cutcells 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cutcells-0.5.0/LICENSE +21 -0
- cutcells-0.5.0/PKG-INFO +95 -0
- cutcells-0.5.0/cpp/CMakeLists.txt +122 -0
- cutcells-0.5.0/cpp/CutCellsConfig.cmake.in +7 -0
- cutcells-0.5.0/cpp/src/CMakeLists.txt +54 -0
- cutcells-0.5.0/cpp/src/bernstein.cpp +1206 -0
- cutcells-0.5.0/cpp/src/bernstein.h +120 -0
- cutcells-0.5.0/cpp/src/cell_flags.h +197 -0
- cutcells-0.5.0/cpp/src/cell_topology.h +383 -0
- cutcells-0.5.0/cpp/src/cell_types.h +269 -0
- cutcells-0.5.0/cpp/src/compression/CMakeLists.txt +32 -0
- cutcells-0.5.0/cpp/src/compression/compress.cpp +1164 -0
- cutcells-0.5.0/cpp/src/compression/compress.h +84 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_hexahedron.h +764 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_interval.h +124 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_prism.h +764 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_pyramid.h +1314 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_quadrilateral.h +209 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_tetrahedron.h +372 -0
- cutcells-0.5.0/cpp/src/generated/quadrature_tables_triangle.h +183 -0
- cutcells-0.5.0/cpp/src/level_set.cpp +1480 -0
- cutcells-0.5.0/cpp/src/level_set.h +363 -0
- cutcells-0.5.0/cpp/src/level_set_cell.cpp +774 -0
- cutcells-0.5.0/cpp/src/level_set_cell.h +72 -0
- cutcells-0.5.0/cpp/src/lut/CMakeLists.txt +50 -0
- cutcells-0.5.0/cpp/src/lut/cell_pieces.cpp +429 -0
- cutcells-0.5.0/cpp/src/lut/cell_pieces.h +78 -0
- cutcells-0.5.0/cpp/src/lut/cell_subdivision.h +70 -0
- cutcells-0.5.0/cpp/src/lut/cut_cell.cpp +724 -0
- cutcells-0.5.0/cpp/src/lut/cut_cell.h +203 -0
- cutcells-0.5.0/cpp/src/lut/cut_hexahedron.cpp +371 -0
- cutcells-0.5.0/cpp/src/lut/cut_hexahedron.h +27 -0
- cutcells-0.5.0/cpp/src/lut/cut_interval.cpp +192 -0
- cutcells-0.5.0/cpp/src/lut/cut_interval.h +34 -0
- cutcells-0.5.0/cpp/src/lut/cut_mesh.cpp +736 -0
- cutcells-0.5.0/cpp/src/lut/cut_mesh.h +112 -0
- cutcells-0.5.0/cpp/src/lut/cut_prism.cpp +365 -0
- cutcells-0.5.0/cpp/src/lut/cut_prism.h +27 -0
- cutcells-0.5.0/cpp/src/lut/cut_pyramid.cpp +367 -0
- cutcells-0.5.0/cpp/src/lut/cut_pyramid.h +27 -0
- cutcells-0.5.0/cpp/src/lut/cut_quadrilateral.cpp +408 -0
- cutcells-0.5.0/cpp/src/lut/cut_quadrilateral.h +30 -0
- cutcells-0.5.0/cpp/src/lut/cut_tetrahedron.cpp +732 -0
- cutcells-0.5.0/cpp/src/lut/cut_tetrahedron.h +42 -0
- cutcells-0.5.0/cpp/src/lut/cut_triangle.cpp +539 -0
- cutcells-0.5.0/cpp/src/lut/cut_triangle.h +49 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_hexahedron_inside_tables.h +1864 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_hexahedron_interface_tables.h +1044 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_hexahedron_outside_tables.h +1591 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_prism_inside_tables.h +353 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_prism_interface_tables.h +194 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_prism_outside_tables.h +285 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_pyramid_inside_tables.h +145 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_pyramid_interface_tables.h +79 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_pyramid_outside_tables.h +109 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_quadrilateral_inside_tables.h +80 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_quadrilateral_interface_tables.h +43 -0
- cutcells-0.5.0/cpp/src/lut/generated/cut_quadrilateral_outside_tables.h +52 -0
- cutcells-0.5.0/cpp/src/lut/iso_refine.cpp +762 -0
- cutcells-0.5.0/cpp/src/lut/iso_refine.h +57 -0
- cutcells-0.5.0/cpp/src/lut/piece_rules.cpp +263 -0
- cutcells-0.5.0/cpp/src/lut/piece_rules.h +61 -0
- cutcells-0.5.0/cpp/src/lut/prism_midpoint_split.cpp +115 -0
- cutcells-0.5.0/cpp/src/lut/prism_midpoint_split.h +471 -0
- cutcells-0.5.0/cpp/src/lut/quad_midpoint_split.cpp +100 -0
- cutcells-0.5.0/cpp/src/lut/quad_midpoint_split.h +161 -0
- cutcells-0.5.0/cpp/src/lut/triangulation.h +153 -0
- cutcells-0.5.0/cpp/src/mapping.cpp +410 -0
- cutcells-0.5.0/cpp/src/mapping.h +157 -0
- cutcells-0.5.0/cpp/src/mesh_view.h +203 -0
- cutcells-0.5.0/cpp/src/part/CMakeLists.txt +30 -0
- cutcells-0.5.0/cpp/src/part/cell_source.cpp +84 -0
- cutcells-0.5.0/cpp/src/part/cell_source.h +109 -0
- cutcells-0.5.0/cpp/src/part/classify.cpp +364 -0
- cutcells-0.5.0/cpp/src/part/classify.h +53 -0
- cutcells-0.5.0/cpp/src/part/cut_result.cpp +644 -0
- cutcells-0.5.0/cpp/src/part/cut_result.h +155 -0
- cutcells-0.5.0/cpp/src/part/entities.cpp +248 -0
- cutcells-0.5.0/cpp/src/part/entities.h +154 -0
- cutcells-0.5.0/cpp/src/part/entity_rules.cpp +200 -0
- cutcells-0.5.0/cpp/src/part/entity_rules.h +98 -0
- cutcells-0.5.0/cpp/src/part/mesh_part.cpp +293 -0
- cutcells-0.5.0/cpp/src/part/mesh_part.h +158 -0
- cutcells-0.5.0/cpp/src/part/output.cpp +1616 -0
- cutcells-0.5.0/cpp/src/part/output.h +107 -0
- cutcells-0.5.0/cpp/src/quadrature.cpp +689 -0
- cutcells-0.5.0/cpp/src/quadrature.h +146 -0
- cutcells-0.5.0/cpp/src/quadrature_tables.h +142 -0
- cutcells-0.5.0/cpp/src/quadrays/CMakeLists.txt +35 -0
- cutcells-0.5.0/cpp/src/quadrays/adapters/shapeforest_tape.h +350 -0
- cutcells-0.5.0/cpp/src/quadrays/analytic.cpp +205 -0
- cutcells-0.5.0/cpp/src/quadrays/analytic.h +270 -0
- cutcells-0.5.0/cpp/src/quadrays/box_bernstein.cpp +1349 -0
- cutcells-0.5.0/cpp/src/quadrays/box_bernstein.h +227 -0
- cutcells-0.5.0/cpp/src/quadrays/clipped_box.cpp +786 -0
- cutcells-0.5.0/cpp/src/quadrays/clipped_box.h +200 -0
- cutcells-0.5.0/cpp/src/quadrays/curves.cpp +1398 -0
- cutcells-0.5.0/cpp/src/quadrays/curves.h +51 -0
- cutcells-0.5.0/cpp/src/quadrays/debug.cpp +213 -0
- cutcells-0.5.0/cpp/src/quadrays/debug.h +56 -0
- cutcells-0.5.0/cpp/src/quadrays/engine.cpp +6434 -0
- cutcells-0.5.0/cpp/src/quadrays/engine.h +377 -0
- cutcells-0.5.0/cpp/src/quadrays/gauss.h +58 -0
- cutcells-0.5.0/cpp/src/quadrays/leaves.cpp +354 -0
- cutcells-0.5.0/cpp/src/quadrays/leaves.h +100 -0
- cutcells-0.5.0/cpp/src/quadrays/rules.cpp +139 -0
- cutcells-0.5.0/cpp/src/quadrays/rules.h +91 -0
- cutcells-0.5.0/cpp/src/quadrays/source.cpp +523 -0
- cutcells-0.5.0/cpp/src/quadrays/source.h +150 -0
- cutcells-0.5.0/cpp/src/quadrays/taylor.h +714 -0
- cutcells-0.5.0/cpp/src/reference_cell.h +320 -0
- cutcells-0.5.0/cpp/src/row_view.h +225 -0
- cutcells-0.5.0/cpp/src/selection_expr.cpp +690 -0
- cutcells-0.5.0/cpp/src/selection_expr.h +156 -0
- cutcells-0.5.0/cpp/src/span_math.h +140 -0
- cutcells-0.5.0/cpp/src/tolerances.h +22 -0
- cutcells-0.5.0/cpp/src/utils.h +124 -0
- cutcells-0.5.0/cpp/src/version.h.in +11 -0
- cutcells-0.5.0/cpp/src/write_tikz.h +213 -0
- cutcells-0.5.0/cpp/src/write_vtk.cpp +741 -0
- cutcells-0.5.0/cpp/src/write_vtk.h +194 -0
- cutcells-0.5.0/pyproject.toml +104 -0
- cutcells-0.5.0/python/CMakeLists.txt +89 -0
- cutcells-0.5.0/python/README.md +50 -0
- cutcells-0.5.0/python/cutcells/__init__.py +325 -0
- cutcells-0.5.0/python/cutcells/conditions.py +179 -0
- cutcells-0.5.0/python/cutcells/mesh_utils.py +432 -0
- cutcells-0.5.0/python/cutcells/part.py +78 -0
- cutcells-0.5.0/python/cutcells/quadrays_debug.py +279 -0
- cutcells-0.5.0/python/cutcells/shapeforest.py +106 -0
- cutcells-0.5.0/python/cutcells/wrapper.cpp +3214 -0
- cutcells-0.5.0/python/tests/test_basix_internal_ordering.py +81 -0
- cutcells-0.5.0/python/tests/test_compression.py +79 -0
- cutcells-0.5.0/python/tests/test_conditions.py +391 -0
- cutcells-0.5.0/python/tests/test_cut_mesh_parent_map_layout.py +61 -0
- cutcells-0.5.0/python/tests/test_cut_vtk_mesh_hexahedron_smoke.py +63 -0
- cutcells-0.5.0/python/tests/test_cut_vtk_mesh_prism_smoke.py +51 -0
- cutcells-0.5.0/python/tests/test_cut_vtk_mesh_pyramid_smoke.py +50 -0
- cutcells-0.5.0/python/tests/test_cut_vtk_mesh_termination.py +63 -0
- cutcells-0.5.0/python/tests/test_cut_vtk_mesh_triangulate_flag.py +63 -0
- cutcells-0.5.0/python/tests/test_cutcell_original_info.py +30 -0
- cutcells-0.5.0/python/tests/test_cutcontext_edge_reuse.py +42 -0
- cutcells-0.5.0/python/tests/test_entity_rules.py +433 -0
- cutcells-0.5.0/python/tests/test_hex_classify.py +94 -0
- cutcells-0.5.0/python/tests/test_hex_emit.py +140 -0
- cutcells-0.5.0/python/tests/test_hex_polyhedron_export.py +26 -0
- cutcells-0.5.0/python/tests/test_hex_variant.py +56 -0
- cutcells-0.5.0/python/tests/test_hexahedron_special_point.py +47 -0
- cutcells-0.5.0/python/tests/test_ho_part_straight_output.py +546 -0
- cutcells-0.5.0/python/tests/test_iso_p1_templates.py +92 -0
- cutcells-0.5.0/python/tests/test_level_set_interpolate.py +123 -0
- cutcells-0.5.0/python/tests/test_level_set_mesh_data.py +157 -0
- cutcells-0.5.0/python/tests/test_level_set_vtu.py +231 -0
- cutcells-0.5.0/python/tests/test_level_sets_made_of.py +387 -0
- cutcells-0.5.0/python/tests/test_mapping.py +223 -0
- cutcells-0.5.0/python/tests/test_mesh_cut.py +155 -0
- cutcells-0.5.0/python/tests/test_mesh_utils.py +100 -0
- cutcells-0.5.0/python/tests/test_multi_level_set_interface_measure.py +268 -0
- cutcells-0.5.0/python/tests/test_part.py +546 -0
- cutcells-0.5.0/python/tests/test_part_lut.py +337 -0
- cutcells-0.5.0/python/tests/test_part_order.py +153 -0
- cutcells-0.5.0/python/tests/test_partial_entities.py +83 -0
- cutcells-0.5.0/python/tests/test_prism_special_point.py +61 -0
- cutcells-0.5.0/python/tests/test_pyramid_special_point.py +65 -0
- cutcells-0.5.0/python/tests/test_quad_table_sanity.py +42 -0
- cutcells-0.5.0/python/tests/test_quadrature.py +309 -0
- cutcells-0.5.0/python/tests/test_quadrays.py +134 -0
- cutcells-0.5.0/python/tests/test_quadrays_analytic.py +449 -0
- cutcells-0.5.0/python/tests/test_quadrays_curve_arcs.py +294 -0
- cutcells-0.5.0/python/tests/test_quadrays_facets.py +391 -0
- cutcells-0.5.0/python/tests/test_quadrays_leaves.py +107 -0
- cutcells-0.5.0/python/tests/test_quadrays_limits.py +179 -0
- cutcells-0.5.0/python/tests/test_quadrays_moment_check.py +112 -0
- cutcells-0.5.0/python/tests/test_quadrays_silhouette.py +476 -0
- cutcells-0.5.0/python/tests/test_quadrays_two_level_sets.py +129 -0
- cutcells-0.5.0/python/tests/test_quadrilateral.py +50 -0
- cutcells-0.5.0/python/tests/test_quadrilateral_ambiguity.py +138 -0
- cutcells-0.5.0/python/tests/test_runtime_quadrature.py +182 -0
- cutcells-0.5.0/python/tests/test_single_corner.py +18 -0
- cutcells-0.5.0/python/tests/test_single_corner_basic.py +18 -0
- cutcells-0.5.0/python/tests/test_tables_cli.py +50 -0
- cutcells-0.5.0/python/tests/test_tetra_triangulated_cut_edges.py +193 -0
- cutcells-0.5.0/python/tests/test_tetra_triangulation_analysis.py +59 -0
- cutcells-0.5.0/python/tests/test_tetrahedron.py +66 -0
- cutcells-0.5.0/python/tests/test_triangle.py +100 -0
- cutcells-0.5.0/python/tests/test_vertex_aligned_zero_sets.py +96 -0
- cutcells-0.5.0/python/tests/test_vertex_parent_entity_tokens.py +123 -0
- cutcells-0.5.0/third_party/Basix-LICENSE.txt +21 -0
- cutcells-0.5.0/third_party/THIRD_PARTY_NOTICES.md +37 -0
- cutcells-0.5.0/third_party/VTK-Copyright.txt +34 -0
cutcells-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 ONERA (Authors: Susanne Claus)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
cutcells-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cutcells
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Cut-cell geometry and quadrature for level set meshes (CutFEM, unfitted FEM)
|
|
5
|
+
Keywords: cut cells,level set,CutFEM,unfitted finite elements,quadrature
|
|
6
|
+
Author-Email: Susanne Claus <susanne.claus@onera.fr>
|
|
7
|
+
License-Expression: MIT AND BSD-3-Clause
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: third_party/Basix-LICENSE.txt
|
|
10
|
+
License-File: third_party/THIRD_PARTY_NOTICES.md
|
|
11
|
+
License-File: third_party/VTK-Copyright.txt
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: C++
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
25
|
+
Project-URL: Homepage, https://github.com/sclaus2/CutCells
|
|
26
|
+
Project-URL: Documentation, https://sclaus2.github.io/CutCells/
|
|
27
|
+
Project-URL: Source, https://github.com/sclaus2/CutCells
|
|
28
|
+
Project-URL: Issues, https://github.com/sclaus2/CutCells/issues
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: numpy>=1.21
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Requires-Dist: markdown; extra == "docs"
|
|
33
|
+
Provides-Extra: lint
|
|
34
|
+
Requires-Dist: ruff; extra == "lint"
|
|
35
|
+
Provides-Extra: optional
|
|
36
|
+
Requires-Dist: pyvista; extra == "optional"
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: pytest; extra == "test"
|
|
39
|
+
Requires-Dist: numpy; extra == "test"
|
|
40
|
+
Provides-Extra: ci
|
|
41
|
+
Requires-Dist: mypy; extra == "ci"
|
|
42
|
+
Requires-Dist: pytest-xdist; extra == "ci"
|
|
43
|
+
Requires-Dist: cutcells[test]; extra == "ci"
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# CutCells
|
|
47
|
+
|
|
48
|
+
CutCells cuts the cells of a mesh by one or more level sets `phi(x)` and
|
|
49
|
+
returns the inside, outside and interface pieces with explicit connectivity and
|
|
50
|
+
quadrature rules. It is a geometry kernel for unfitted finite element methods
|
|
51
|
+
(CutFEM): the C++20 core has no dependencies beyond a compiler, and the Python
|
|
52
|
+
interface passes arrays to and from NumPy without copying where the layout
|
|
53
|
+
allows.
|
|
54
|
+
|
|
55
|
+
```console
|
|
56
|
+
pip install cutcells
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Wheels are published for Linux and macOS. Other platforms build from the source
|
|
60
|
+
distribution, which needs a C++20 compiler and CMake.
|
|
61
|
+
|
|
62
|
+
## Example
|
|
63
|
+
|
|
64
|
+
Cut a triangle mesh by a circle and integrate the inside and the interface:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import numpy as np
|
|
68
|
+
import cutcells
|
|
69
|
+
|
|
70
|
+
mesh = cutcells.rectangle_mesh(-1.0, -1.0, 1.0, 1.0, 41, 41, cell_type="triangle")
|
|
71
|
+
|
|
72
|
+
def phi(X):
|
|
73
|
+
# X has shape (gdim, num_points)
|
|
74
|
+
return np.sqrt(X[0] ** 2 + X[1] ** 2) - 0.55
|
|
75
|
+
|
|
76
|
+
level_set = cutcells.create_level_set(mesh, phi, degree=2, name="phi")
|
|
77
|
+
result = cutcells.cut(mesh, level_set)
|
|
78
|
+
|
|
79
|
+
inside = result[level_set < 0]
|
|
80
|
+
interface = result[level_set == 0]
|
|
81
|
+
|
|
82
|
+
print("area ", inside.quadrature(order=4, mode="full").weights.sum())
|
|
83
|
+
print("perimeter", interface.quadrature(order=4, mode="cut_only").weights.sum())
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Parent cells can be intervals, triangles, quadrilaterals, tetrahedra,
|
|
87
|
+
hexahedra, prisms and pyramids, with any number of level sets per cell. Level
|
|
88
|
+
sets are interpolated (any degree) or analytic.
|
|
89
|
+
|
|
90
|
+
## Links
|
|
91
|
+
|
|
92
|
+
- Documentation and tutorials: <https://sclaus2.github.io/CutCells/>
|
|
93
|
+
- Source, issues and the C++ library: <https://github.com/sclaus2/CutCells>
|
|
94
|
+
- Licence: MIT. Third-party notices for generated VTK-derived tables and
|
|
95
|
+
Basix-generated quadrature tables ship with the package.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.21)
|
|
2
|
+
|
|
3
|
+
project(CutCells VERSION "0.5.0" LANGUAGES CXX C)
|
|
4
|
+
|
|
5
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
6
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
7
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
8
|
+
|
|
9
|
+
option(BUILD_SHARED_LIBS "Build CutCells with shared libraries." ON)
|
|
10
|
+
option(CUTCELLS_ENABLE_IPO
|
|
11
|
+
"Enable interprocedural optimization in release builds when supported."
|
|
12
|
+
OFF)
|
|
13
|
+
option(CUTCELLS_NATIVE_COMPRESSION
|
|
14
|
+
"Compile the compression kernels for the build machine's CPU (-march=native)."
|
|
15
|
+
OFF)
|
|
16
|
+
option(BUILD_TESTING "Build the C++ tests in cpp/tests (run with ctest)." OFF)
|
|
17
|
+
|
|
18
|
+
include(GNUInstallDirs)
|
|
19
|
+
include(CheckIPOSupported)
|
|
20
|
+
|
|
21
|
+
add_subdirectory(src)
|
|
22
|
+
|
|
23
|
+
set(CUTCELLS_BUILD_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
|
|
24
|
+
# Rewritten on every configure, so headers that moved or went leave nothing behind
|
|
25
|
+
file(REMOVE_RECURSE "${CUTCELLS_BUILD_INCLUDE_DIR}/cutcells")
|
|
26
|
+
file(MAKE_DIRECTORY "${CUTCELLS_BUILD_INCLUDE_DIR}/cutcells")
|
|
27
|
+
# A header keeps its path below src/, in the build tree and when installed:
|
|
28
|
+
# src/quadrays/rules.h becomes <cutcells/quadrays/rules.h>.
|
|
29
|
+
foreach(_cutcells_header IN LISTS HEADERS)
|
|
30
|
+
file(RELATIVE_PATH _cutcells_header_path
|
|
31
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${_cutcells_header}")
|
|
32
|
+
get_filename_component(_cutcells_header_dir "${_cutcells_header_path}"
|
|
33
|
+
DIRECTORY)
|
|
34
|
+
file(WRITE "${CUTCELLS_BUILD_INCLUDE_DIR}/cutcells/${_cutcells_header_path}"
|
|
35
|
+
"#pragma once\n#include \"${_cutcells_header}\"\n")
|
|
36
|
+
install(FILES "${_cutcells_header}"
|
|
37
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cutcells/${_cutcells_header_dir}"
|
|
38
|
+
COMPONENT Development)
|
|
39
|
+
endforeach()
|
|
40
|
+
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/src/generated"
|
|
41
|
+
DESTINATION "${CUTCELLS_BUILD_INCLUDE_DIR}/cutcells"
|
|
42
|
+
FILES_MATCHING PATTERN "*.h")
|
|
43
|
+
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/src/lut/generated"
|
|
44
|
+
DESTINATION "${CUTCELLS_BUILD_INCLUDE_DIR}/cutcells/lut"
|
|
45
|
+
FILES_MATCHING PATTERN "*.h")
|
|
46
|
+
|
|
47
|
+
# No fused multiply-adds unless written: compilers for ARM (and x86 with FMA)
|
|
48
|
+
# fuse a * b + c by default, which changes the last bits, and quadrays' cuts
|
|
49
|
+
# decide on signs and comparisons that a last bit can flip. Without fusion
|
|
50
|
+
# every platform computes what x86-64 does.
|
|
51
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
52
|
+
target_compile_options(cutcells PRIVATE -ffp-contract=off)
|
|
53
|
+
endif()
|
|
54
|
+
|
|
55
|
+
find_package(OpenMP QUIET COMPONENTS CXX)
|
|
56
|
+
if(OpenMP_CXX_FOUND AND TARGET OpenMP::OpenMP_CXX)
|
|
57
|
+
target_link_libraries(cutcells PUBLIC OpenMP::OpenMP_CXX)
|
|
58
|
+
endif()
|
|
59
|
+
|
|
60
|
+
if(CUTCELLS_ENABLE_IPO)
|
|
61
|
+
check_ipo_supported(RESULT CUTCELLS_IPO_SUPPORTED OUTPUT CUTCELLS_IPO_ERROR)
|
|
62
|
+
if(CUTCELLS_IPO_SUPPORTED)
|
|
63
|
+
set_property(TARGET cutcells PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
|
64
|
+
else()
|
|
65
|
+
message(STATUS "IPO requested but not supported: ${CUTCELLS_IPO_ERROR}")
|
|
66
|
+
endif()
|
|
67
|
+
endif()
|
|
68
|
+
|
|
69
|
+
target_include_directories(cutcells PUBLIC
|
|
70
|
+
$<BUILD_INTERFACE:${CUTCELLS_BUILD_INCLUDE_DIR}>
|
|
71
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
72
|
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
73
|
+
|
|
74
|
+
if(BUILD_TESTING)
|
|
75
|
+
enable_testing()
|
|
76
|
+
add_subdirectory(tests)
|
|
77
|
+
endif()
|
|
78
|
+
|
|
79
|
+
# Install the generated tables: quadrature rules, and the lookup tables
|
|
80
|
+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/generated
|
|
81
|
+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cutcells
|
|
82
|
+
COMPONENT Development
|
|
83
|
+
FILES_MATCHING PATTERN "*.h")
|
|
84
|
+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/lut/generated
|
|
85
|
+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cutcells/lut
|
|
86
|
+
COMPONENT Development
|
|
87
|
+
FILES_MATCHING PATTERN "*.h")
|
|
88
|
+
|
|
89
|
+
# Install the cutcells library
|
|
90
|
+
install(TARGETS cutcells
|
|
91
|
+
EXPORT CutCellsTargets
|
|
92
|
+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT RuntimeExecutables
|
|
93
|
+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
|
|
94
|
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
|
|
95
|
+
|
|
96
|
+
set(_cutcells_license_install_dir
|
|
97
|
+
"${CMAKE_INSTALL_DATADIR}/licenses/cutcells")
|
|
98
|
+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE"
|
|
99
|
+
DESTINATION ${_cutcells_license_install_dir}
|
|
100
|
+
RENAME CutCells-LICENSE.txt)
|
|
101
|
+
install(FILES
|
|
102
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/../third_party/THIRD_PARTY_NOTICES.md"
|
|
103
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/../third_party/VTK-Copyright.txt"
|
|
104
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/../third_party/Basix-LICENSE.txt"
|
|
105
|
+
DESTINATION ${_cutcells_license_install_dir})
|
|
106
|
+
|
|
107
|
+
include(CMakePackageConfigHelpers)
|
|
108
|
+
write_basic_package_version_file(CutCellsConfigVersion.cmake
|
|
109
|
+
VERSION ${PROJECT_VERSION}
|
|
110
|
+
COMPATIBILITY AnyNewerVersion)
|
|
111
|
+
configure_package_config_file(CutCellsConfig.cmake.in
|
|
112
|
+
${CMAKE_CURRENT_BINARY_DIR}/CutCellsConfig.cmake
|
|
113
|
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cutcells)
|
|
114
|
+
|
|
115
|
+
install(FILES
|
|
116
|
+
${CMAKE_CURRENT_BINARY_DIR}/CutCellsConfig.cmake
|
|
117
|
+
${CMAKE_CURRENT_BINARY_DIR}/CutCellsConfigVersion.cmake
|
|
118
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cutcells COMPONENT Development)
|
|
119
|
+
install(EXPORT CutCellsTargets
|
|
120
|
+
FILE CutCellsTargets.cmake
|
|
121
|
+
NAMESPACE CUTCELLS::
|
|
122
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cutcells)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
include(GNUInstallDirs)
|
|
2
|
+
|
|
3
|
+
add_library(cutcells)
|
|
4
|
+
|
|
5
|
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in version.h)
|
|
6
|
+
|
|
7
|
+
target_include_directories(cutcells PUBLIC
|
|
8
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
9
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
|
|
10
|
+
|
|
11
|
+
# Sub-folders add their sources to the cutcells target and return their
|
|
12
|
+
# headers (installed under include/cutcells/<folder>/).
|
|
13
|
+
add_subdirectory(quadrays)
|
|
14
|
+
add_subdirectory(lut)
|
|
15
|
+
add_subdirectory(part)
|
|
16
|
+
add_subdirectory(compression)
|
|
17
|
+
|
|
18
|
+
set(HEADERS
|
|
19
|
+
${CMAKE_CURRENT_SOURCE_DIR}/cell_types.h
|
|
20
|
+
${CMAKE_CURRENT_SOURCE_DIR}/cell_flags.h
|
|
21
|
+
${CMAKE_CURRENT_SOURCE_DIR}/cell_topology.h
|
|
22
|
+
${CMAKE_CURRENT_SOURCE_DIR}/reference_cell.h
|
|
23
|
+
${CMAKE_CURRENT_SOURCE_DIR}/mapping.h
|
|
24
|
+
${CMAKE_CURRENT_SOURCE_DIR}/bernstein.h
|
|
25
|
+
${CMAKE_CURRENT_SOURCE_DIR}/level_set.h
|
|
26
|
+
${CMAKE_CURRENT_SOURCE_DIR}/level_set_cell.h
|
|
27
|
+
${CMAKE_CURRENT_SOURCE_DIR}/mesh_view.h
|
|
28
|
+
${CMAKE_CURRENT_SOURCE_DIR}/selection_expr.h
|
|
29
|
+
${CMAKE_CURRENT_SOURCE_DIR}/quadrature.h
|
|
30
|
+
${CMAKE_CURRENT_SOURCE_DIR}/quadrature_tables.h
|
|
31
|
+
${CMAKE_CURRENT_SOURCE_DIR}/row_view.h
|
|
32
|
+
${CMAKE_CURRENT_SOURCE_DIR}/span_math.h
|
|
33
|
+
${CMAKE_CURRENT_SOURCE_DIR}/tolerances.h
|
|
34
|
+
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
|
|
35
|
+
${CMAKE_CURRENT_SOURCE_DIR}/write_tikz.h
|
|
36
|
+
${CMAKE_CURRENT_SOURCE_DIR}/write_vtk.h
|
|
37
|
+
${QUADRAYS_HEADERS}
|
|
38
|
+
${LUT_HEADERS}
|
|
39
|
+
${PART_HEADERS}
|
|
40
|
+
${COMPRESSION_HEADERS}
|
|
41
|
+
PARENT_SCOPE)
|
|
42
|
+
|
|
43
|
+
target_sources(cutcells PRIVATE
|
|
44
|
+
${CMAKE_CURRENT_SOURCE_DIR}/mapping.cpp
|
|
45
|
+
${CMAKE_CURRENT_SOURCE_DIR}/bernstein.cpp
|
|
46
|
+
${CMAKE_CURRENT_SOURCE_DIR}/level_set.cpp
|
|
47
|
+
${CMAKE_CURRENT_SOURCE_DIR}/level_set_cell.cpp
|
|
48
|
+
${CMAKE_CURRENT_SOURCE_DIR}/selection_expr.cpp
|
|
49
|
+
${CMAKE_CURRENT_SOURCE_DIR}/quadrature.cpp
|
|
50
|
+
${CMAKE_CURRENT_SOURCE_DIR}/write_vtk.cpp
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
target_compile_options(cutcells PRIVATE
|
|
54
|
+
$<$<CONFIG:Release>:-O3>)
|