volume-remesher 1.0.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.

Potentially problematic release.


This version of volume-remesher might be problematic. Click here for more details.

Files changed (58) hide show
  1. volume_remesher-1.0.0/.DS_Store +0 -0
  2. volume_remesher-1.0.0/.gitignore +21 -0
  3. volume_remesher-1.0.0/CMakeLists.txt +308 -0
  4. volume_remesher-1.0.0/LICENSE +165 -0
  5. volume_remesher-1.0.0/PKG-INFO +405 -0
  6. volume_remesher-1.0.0/README.md +381 -0
  7. volume_remesher-1.0.0/cmake/FindGMP.cmake +79 -0
  8. volume_remesher-1.0.0/cmake/gmp.cmake +18 -0
  9. volume_remesher-1.0.0/cmake/gmp_mpfr.cmake +22 -0
  10. volume_remesher-1.0.0/cmake/test_gmpxx.cpp +3 -0
  11. volume_remesher-1.0.0/cmake/test_simd.cpp +21 -0
  12. volume_remesher-1.0.0/pyproject.toml +84 -0
  13. volume_remesher-1.0.0/python/CMakeLists.txt +39 -0
  14. volume_remesher-1.0.0/python/bindings.cpp +759 -0
  15. volume_remesher-1.0.0/python/volume_remesher/__init__.py +63 -0
  16. volume_remesher-1.0.0/python/volume_remesher/__main__.py +206 -0
  17. volume_remesher-1.0.0/python/volume_remesher/_api.py +635 -0
  18. volume_remesher-1.0.0/python/volume_remesher/_version.py +24 -0
  19. volume_remesher-1.0.0/python/volume_remesher/py.typed +0 -0
  20. volume_remesher-1.0.0/src/VolumeRemesher/2d/arrangement2d.cpp +811 -0
  21. volume_remesher-1.0.0/src/VolumeRemesher/2d/arrangement2d.h +198 -0
  22. volume_remesher-1.0.0/src/VolumeRemesher/2d/delaunay2d.cpp +648 -0
  23. volume_remesher-1.0.0/src/VolumeRemesher/2d/delaunay2d.h +241 -0
  24. volume_remesher-1.0.0/src/VolumeRemesher/2d/embed2d.cpp +102 -0
  25. volume_remesher-1.0.0/src/VolumeRemesher/2d/embed2d.h +50 -0
  26. volume_remesher-1.0.0/src/VolumeRemesher/2d/io2d.cpp +250 -0
  27. volume_remesher-1.0.0/src/VolumeRemesher/2d/io2d.h +58 -0
  28. volume_remesher-1.0.0/src/VolumeRemesher/2d/predicates2d.cpp +108 -0
  29. volume_remesher-1.0.0/src/VolumeRemesher/2d/predicates2d.h +56 -0
  30. volume_remesher-1.0.0/src/VolumeRemesher/BSP.cpp +3926 -0
  31. volume_remesher-1.0.0/src/VolumeRemesher/BSP.h +573 -0
  32. volume_remesher-1.0.0/src/VolumeRemesher/conforming_mesh.cpp +3992 -0
  33. volume_remesher-1.0.0/src/VolumeRemesher/conforming_mesh.h +142 -0
  34. volume_remesher-1.0.0/src/VolumeRemesher/delaunay3d_wrapper.h +21 -0
  35. volume_remesher-1.0.0/src/VolumeRemesher/driver.cpp +131 -0
  36. volume_remesher-1.0.0/src/VolumeRemesher/driver.h +70 -0
  37. volume_remesher-1.0.0/src/VolumeRemesher/embed.cpp +192 -0
  38. volume_remesher-1.0.0/src/VolumeRemesher/embed.h +90 -0
  39. volume_remesher-1.0.0/src/VolumeRemesher/exact_coords.h +150 -0
  40. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/GCO_README.TXT +389 -0
  41. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/GCoptimization.cpp +1874 -0
  42. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/GCoptimization.h +619 -0
  43. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/LinkedBlockList.cpp +67 -0
  44. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/LinkedBlockList.h +50 -0
  45. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/block.h +268 -0
  46. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/energy.h +315 -0
  47. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/example.cpp_ +437 -0
  48. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/graph.cpp +114 -0
  49. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/graph.h +506 -0
  50. volume_remesher-1.0.0/src/VolumeRemesher/graph_cut/maxflow.cpp +733 -0
  51. volume_remesher-1.0.0/src/VolumeRemesher/inOutPartition.cpp +220 -0
  52. volume_remesher-1.0.0/src/VolumeRemesher/io.cpp +234 -0
  53. volume_remesher-1.0.0/src/VolumeRemesher/io.h +64 -0
  54. volume_remesher-1.0.0/src/VolumeRemesher/main.cpp +234 -0
  55. volume_remesher-1.0.0/src/VolumeRemesher/makePolyhedralMesh.cpp +1081 -0
  56. volume_remesher-1.0.0/src/VolumeRemesher/mesh_output.cpp +148 -0
  57. volume_remesher-1.0.0/src/VolumeRemesher/mesh_output.h +91 -0
  58. volume_remesher-1.0.0/src/VolumeRemesher/parallel.h +74 -0
Binary file
@@ -0,0 +1,21 @@
1
+ build
2
+ build-*
3
+ /bin/
4
+ /bin-*/
5
+ .venv
6
+ __pycache__/
7
+
8
+ # 2D benchmark model, too large to commit (see plan: local-only)
9
+ models/2d/italy.obj
10
+
11
+ # Marker for using sibling local checkouts of NFG / Indirect_Predicates (see CMakeLists.txt)
12
+ .local.cmake
13
+
14
+ # Python: build products of the volume_remesher module and packaging
15
+ python/volume_remesher/_core*.so
16
+ python/volume_remesher/_core*.pyd
17
+ python/volume_remesher/_version.py
18
+ *.egg-info/
19
+ dist/
20
+ wheelhouse/
21
+ .pytest_cache/
@@ -0,0 +1,308 @@
1
+ cmake_minimum_required(VERSION 3.25)
2
+
3
+ # Set the target architecture.
4
+ # All modern x86/x64 processors support AVX2.
5
+ # Older x86/x64 processors may support SSE2 but not AVX2.
6
+ # Very old x86/x64 processors, or non x86/x64
7
+ # processors, do not support any of the two.
8
+ option(VOLREM_ENABLE_SSE2 "Enable SSE2 instructions" ON)
9
+ option(VOLREM_ENABLE_AVX2 "Enable AVX2 instructions" ON)
10
+
11
+ #####################
12
+
13
+ set(LGPL ON)
14
+
15
+ # set the project name
16
+ project(mesh_generator)
17
+
18
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
19
+
20
+ set (SOURCES
21
+ src/VolumeRemesher/makePolyhedralMesh.cpp
22
+ src/VolumeRemesher/embed.h
23
+ src/VolumeRemesher/embed.cpp
24
+ src/VolumeRemesher/conforming_mesh.h
25
+ src/VolumeRemesher/conforming_mesh.cpp
26
+ src/VolumeRemesher/BSP.h
27
+ src/VolumeRemesher/BSP.cpp
28
+ src/VolumeRemesher/inOutPartition.cpp
29
+ src/VolumeRemesher/parallel.h
30
+ src/VolumeRemesher/exact_coords.h
31
+ src/VolumeRemesher/io.h
32
+ src/VolumeRemesher/io.cpp
33
+ src/VolumeRemesher/mesh_output.h
34
+ src/VolumeRemesher/mesh_output.cpp
35
+ src/VolumeRemesher/driver.h
36
+ src/VolumeRemesher/driver.cpp
37
+ # 2D pipeline: segment arrangement -> triangles
38
+ src/VolumeRemesher/2d/predicates2d.h
39
+ src/VolumeRemesher/2d/predicates2d.cpp
40
+ src/VolumeRemesher/2d/delaunay2d.h
41
+ src/VolumeRemesher/2d/delaunay2d.cpp
42
+ src/VolumeRemesher/2d/arrangement2d.h
43
+ src/VolumeRemesher/2d/arrangement2d.cpp
44
+ src/VolumeRemesher/2d/io2d.h
45
+ src/VolumeRemesher/2d/io2d.cpp
46
+ src/VolumeRemesher/2d/embed2d.h
47
+ src/VolumeRemesher/2d/embed2d.cpp
48
+ )
49
+
50
+ # Does this target have SIMD (x86 SSE2/AVX2, or ARM NEON on which numerics.h emulates them via
51
+ # SIMDe)? cmake/test_simd.cpp accepts both; it fails only when neither is present.
52
+ try_compile(HAS_SIMD_INSTRUCTIONS ${CMAKE_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_simd.cpp")
53
+
54
+
55
+ # make a static library for use within external programs
56
+ add_library(${PROJECT_NAME}_lib
57
+ ${SOURCES}
58
+ )
59
+
60
+
61
+ if(NOT HAS_SIMD_INSTRUCTIONS)
62
+ message(WARNING "No SIMD (SSE2/NEON) available on this target; using the scalar (slower) "
63
+ "interval arithmetic. Output is unchanged.")
64
+ target_compile_definitions(${PROJECT_NAME}_lib PUBLIC VR_DISABLE_SIMD)
65
+ endif()
66
+
67
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
68
+ # grant IEEE 754 compliance
69
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "/fp:strict")
70
+ # use intrinsic functions
71
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "/Oi")
72
+ # turn off annoying warnings
73
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "/D _CRT_SECURE_NO_WARNINGS")
74
+ target_compile_definitions(${PROJECT_NAME}_lib PRIVATE "_CRT_NONSTDC_NO_WARNINGS")
75
+ # workaround for known bug in C++17 on MSVC
76
+ target_compile_definitions(${PROJECT_NAME}_lib PRIVATE "_HAS_STD_BYTE=0")
77
+ # set target architecture: /arch:AVX2 selects the SIMD interval_number path
78
+ # (as -mavx2 does on Linux and the NEON/SIMDe path on Apple Silicon). Verified
79
+ # to produce byte-identical, deterministic output vs the scalar path and vs
80
+ # Linux/macOS (the integration test suite passes on all three). /fp:strict +
81
+ # fenv_access keep the SIMD interval arithmetic rounding outward under
82
+ # FE_UPWARD. (This was disabled while an unrelated half-edge ordering
83
+ # nondeterminism made Windows diverge; that bug is now fixed in conforming_mesh.cpp.)
84
+ if(VOLREM_ENABLE_AVX2)
85
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "/arch:AVX2")
86
+ endif()
87
+ # reserve enough stack size
88
+ target_link_options(${PROJECT_NAME}_lib PUBLIC "/STACK:8421376")
89
+ if(NOT LGPL)
90
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "/D USE_MAROTS_METHOD")
91
+ endif()
92
+ else()
93
+ # set standard optimization level
94
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC -O2)
95
+ # grant IEEE 754 compliance
96
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC -frounding-math)
97
+ # the exact predicates rely on error-free transformations (e.g. Dekker
98
+ # two-product): forbid the compiler from contracting a*b+c into an FMA, which
99
+ # rounds once instead of twice and silently breaks those identities. This
100
+ # mirrors the /fp:strict used on the MSVC path.
101
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC -ffp-contract=off)
102
+ # set target architecture
103
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64|ARM64)$")
104
+ # ARM (e.g. Apple Silicon): the x86 -mavx2/-mfma/-msse2 flags are
105
+ # invalid here. The code emulates the x86 AVX2/FMA intrinsics on top
106
+ # of NEON via SIMDe, which is fetched below.
107
+ else()
108
+ if(VOLREM_ENABLE_AVX2)
109
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "-mavx2")
110
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "-mfma")
111
+ elseif(VOLREM_ENABLE_SSE2)
112
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "-msse2")
113
+ endif()
114
+ endif()
115
+ # reserve enough stack size (GNU ld only; the macOS linker uses the 8 MB default)
116
+ if(NOT APPLE)
117
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC -Wl,-z,stacksize=8421376)
118
+ endif()
119
+ if(NOT LGPL)
120
+ target_compile_options(${PROJECT_NAME}_lib PUBLIC "-DUSE_MAROTS_METHOD")
121
+ endif()
122
+ endif()
123
+
124
+ # --- Exact-arithmetic dependencies -------------------------------------------
125
+ # The number types (numerics.h) and exact/indirect predicates used to be vendored
126
+ # under include/VolumeRemesher/. They now live upstream as two header-only
127
+ # libraries and are fetched here, pinned to a specific commit for reproducible,
128
+ # byte-identical output:
129
+ # NFG (Numbers For Geometry): intervals, expansions, bignatural, bigfloat,
130
+ # bigrational -- i.e. numerics.h.
131
+ # Indirect_Predicates: indirect_predicates.h, implicit_point.{h,hpp},
132
+ # hand_optimized_predicates.hpp. Its implicit_point.h #includes "numerics.h",
133
+ # so NFG must be on the include path.
134
+ # The thin shims under include/VolumeRemesher/ pull these in and re-export the
135
+ # public types into namespace vol_rem (the API this library and its downstreams
136
+ # depend on, e.g. vol_rem::bigrational).
137
+ include(FetchContent)
138
+
139
+ # Local-checkout override for upstream development. If a file named .local.cmake
140
+ # exists one level above this repository, NFG and Indirect_Predicates are taken
141
+ # from sibling working copies (../NFG and ../Indirect_Predicates) instead of being
142
+ # fetched. This lets a developer who has all three repos checked out side by side
143
+ # (as Marco Attene does) edit the number/predicate libraries and rebuild here
144
+ # immediately, with no re-fetch. The marker file is untracked (see .gitignore), so
145
+ # ordinary builds always take the FetchContent path below and are unaffected.
146
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.local.cmake")
147
+ set(nfg_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../NFG")
148
+ set(indirect_predicates_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../Indirect_Predicates")
149
+ set(delaunay3d_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../Delaunay3D")
150
+ message(STATUS "VolumeRemesher: .local.cmake present -- using local NFG (${nfg_SOURCE_DIR}) "
151
+ "and Indirect_Predicates (${indirect_predicates_SOURCE_DIR}) "
152
+ "and Delaunay3D (${delaunay3d_SOURCE_DIR})")
153
+ else()
154
+ # Pinned to exact commits for reproducible, byte-identical output across platforms
155
+ # (moving branch heads would let different CI runners fetch different sources).
156
+ # NFG: upstream main 2909ad6 -- MarcoAttene/NFG#4 counts _M_X64 as SSE2, so on MSVC x64
157
+ # every translation unit gets the same (SIMD) interval_number layout whether or not it
158
+ # is built with /arch:AVX2 (downstreams that link this library without that flag share
159
+ # NFG:: with it, and a layout mismatch swaps interval bounds across the link), and
160
+ # MarcoAttene/NFG#5 adds bignatural::trimMemoryPool(), which lets a caller return the
161
+ # memory the thread-local bignatural pool grew into during an arrangement -- plus
162
+ # wildmeshing/NFG's danielepanozzo/ip-error-throws: ip_error exits with a failure
163
+ # status instead of 0, so ctest sees a test that trips it as failed (proposed upstream
164
+ # as MarcoAttene/NFG#6), and with NFG_IP_ERROR_THROWS defined it throws a
165
+ # std::runtime_error instead of exiting at all, which the Python module needs so a bad
166
+ # input becomes an exception rather than the end of the interpreter (MarcoAttene/NFG#7).
167
+ # Back to upstream once those are merged there. fast-envelope pins NFG too: see its
168
+ # cmake/recipes/ipred.cmake.
169
+ FetchContent_Declare(nfg
170
+ GIT_REPOSITORY https://github.com/wildmeshing/NFG.git
171
+ GIT_TAG 233026759ead5a2638e951ee7df54b5e484a8e00
172
+ SOURCE_SUBDIR do-not-configure
173
+ )
174
+
175
+ FetchContent_Declare(indirect_predicates
176
+ GIT_REPOSITORY https://github.com/MarcoAttene/Indirect_Predicates.git
177
+ GIT_TAG a5cb2c4e6a2e8ae137f23ffcee91d113e8f3a1c0
178
+ SOURCE_SUBDIR do-not-configure
179
+ )
180
+
181
+ # Delaunay3D: upstream main 8361b9a plus wildmeshing/Delaunay3D's
182
+ # danielepanozzo/orphan-inc-tet-point-search (proposed upstream as
183
+ # MarcoAttene/Delaunay3D#2): insertExistingVertexNonDelaunay marks a vertex it evicts
184
+ # (a coincident copy) as isolated instead of leaving its inc_tet stale, VT() guards
185
+ # against such a vertex, and searchTetrahedron takes a point as well as a vertex id
186
+ # (locate_point relies on it). Back to upstream once that is merged there.
187
+ FetchContent_Declare(Delaunay3D
188
+ GIT_REPOSITORY https://github.com/wildmeshing/Delaunay3D.git
189
+ GIT_TAG c9b3eec9fc794df64597e9652ce162ba819f2937
190
+ SOURCE_SUBDIR do-not-configure
191
+ )
192
+
193
+ FetchContent_MakeAvailable(nfg indirect_predicates delaunay3d)
194
+ message(STATUS "NFG is available in " ${nfg_SOURCE_DIR})
195
+ message(STATUS "Indirect_Predicates is available in " ${indirect_predicates_SOURCE_DIR})
196
+ message(STATUS "Delaunay3D is available in " ${delaunay3d_SOURCE_DIR})
197
+ endif()
198
+
199
+ # On ARM (e.g. Apple Silicon) the exact predicates rely on SIMDe to emulate the
200
+ # x86 AVX2/FMA intrinsics (<x86/avx2.h>, <x86/fma.h>) on top of NEON. NFG's
201
+ # numerics.h includes <x86/avx2.h>/<x86/fma.h> directly under __ARM_NEON.
202
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64|ARM64)$")
203
+ FetchContent_Declare(simde
204
+ GIT_REPOSITORY https://github.com/simd-everywhere/simde.git
205
+ GIT_TAG v0.8.2
206
+ )
207
+ FetchContent_MakeAvailable(simde)
208
+ target_include_directories(${PROJECT_NAME}_lib PUBLIC ${simde_SOURCE_DIR}/simde)
209
+ endif()
210
+
211
+
212
+ # Public include directory. Order: our headers (the shims) first, then NFG and
213
+ # Indirect_Predicates. The shims are addressed as <VolumeRemesher/...> and the
214
+ # upstream headers as bare <numerics.h>/<implicit_point.h>, so the two never clash.
215
+ target_include_directories(${PROJECT_NAME}_lib PUBLIC
216
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
217
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
218
+ ${nfg_SOURCE_DIR}/include
219
+ ${indirect_predicates_SOURCE_DIR}/include
220
+ ${delaunay3d_SOURCE_DIR}/include
221
+ )
222
+ target_compile_features(${PROJECT_NAME}_lib PUBLIC cxx_std_20)
223
+
224
+ # Parallelize the tetrahedralization (makeTetrahedra: the per-cell decomposition and the
225
+ # winding-flip) and the exact output coordinates of embed_tri_in_poly_mesh and
226
+ # embed_seg_in_tri_mesh with std::thread. On by default; turn OFF for a fully serial build.
227
+ # The output is byte-identical either way.
228
+ option(VOLUMEREMESHER_PARALLEL_TETRAHEDRALIZATION
229
+ "Parallelize makeTetrahedra with std::thread" ON)
230
+ if(VOLUMEREMESHER_PARALLEL_TETRAHEDRALIZATION)
231
+ find_package(Threads REQUIRED) # std::thread needs the platform threads library (-pthread)
232
+ target_link_libraries(${PROJECT_NAME}_lib PUBLIC Threads::Threads)
233
+ else()
234
+ target_compile_definitions(${PROJECT_NAME}_lib PUBLIC VOLUMEREMESHER_SERIAL_TET)
235
+ endif()
236
+
237
+ # Exact-arithmetic backend. By default the library uses its built-in arbitrary-
238
+ # precision bignum (the hand-written `bigfloat`): the exact predicates only add,
239
+ # subtract and multiply -- they never divide -- so they never pay for GMP
240
+ # mpq_class's per-operation GCD canonicalization. That makes the built-in type
241
+ # ~2-2.4x faster for mesh generation (measured across the model set, up to a 1.6M
242
+ # triangle mesh) with byte-identical output. GMP is only faster for the rational-
243
+ # heavy verify_tracking test tool. Turn this option ON to use GMP (mpq_class)
244
+ # instead; it pulls in the GMP dependency (downloaded on Windows, plus its runtime
245
+ # DLL) and enables USE_GNU_GMP_CLASSES.
246
+ option(VOLUMEREMESHER_WITH_GMP "Use GMP (mpq_class) for exact arithmetic instead of the built-in bignum" OFF)
247
+
248
+ if(VOLUMEREMESHER_WITH_GMP)
249
+ include(gmp)
250
+ # Enable the GMP classes only if the C++ wrapper (gmpxx.h) actually compiles and
251
+ # links here; otherwise warn and fall back to the built-in bignum rather than break.
252
+ try_compile(HAS_GMPXX ${CMAKE_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_gmpxx.cpp" LINK_LIBRARIES gmp::gmp)
253
+ if(HAS_GMPXX)
254
+ target_link_libraries(${PROJECT_NAME}_lib PUBLIC gmp::gmp)
255
+ target_compile_definitions(${PROJECT_NAME}_lib PUBLIC USE_GNU_GMP_CLASSES)
256
+ else()
257
+ message(WARNING "VOLUMEREMESHER_WITH_GMP is ON but gmpxx is not usable here; using the built-in bignum")
258
+ endif()
259
+ endif()
260
+
261
+
262
+ add_library(VolumeRemesher::VolumeRemesher ALIAS ${PROJECT_NAME}_lib)
263
+
264
+ # --- Python module ------------------------------------------------------------
265
+ # volume_remesher._core (nanobind), see python/. pip builds it through scikit-build-core, which
266
+ # turns this on and the CLI/tests off (pyproject.toml); a plain CMake configure with it ON also
267
+ # builds it, into python/volume_remesher/, so `PYTHONPATH=python pytest` works from the tree.
268
+ option(VOLUMEREMESHER_BUILD_PYTHON "Build the volume_remesher Python module" OFF)
269
+ if(VOLUMEREMESHER_BUILD_PYTHON)
270
+ # The static library is linked into a shared module.
271
+ set_target_properties(${PROJECT_NAME}_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
272
+ # A bad input must become a Python exception, not the end of the interpreter: ip_error
273
+ # throws std::runtime_error instead of exiting. PUBLIC so every translation unit sees the
274
+ # same inline function (mesh_generator, built in the same tree, catches it in main()).
275
+ target_compile_definitions(${PROJECT_NAME}_lib PUBLIC NFG_IP_ERROR_THROWS)
276
+ endif()
277
+
278
+
279
+ # add the executable
280
+ option(VOLUMEREMESHER_BUILD_CLI "Build the mesh_generator executable" ON)
281
+ get_directory_property(HAS_PARENT PARENT_DIRECTORY)
282
+ if(NOT HAS_PARENT AND VOLUMEREMESHER_BUILD_CLI)
283
+ add_executable(${PROJECT_NAME}
284
+ src/VolumeRemesher/main.cpp
285
+ )
286
+ target_link_libraries(${PROJECT_NAME} PUBLIC VolumeRemesher::VolumeRemesher)
287
+ target_compile_definitions(${PROJECT_NAME} PRIVATE VOL_REM_MODELS_PATH=\"${CMAKE_SOURCE_DIR}/models\")
288
+ # When the optional GMP backend is used on Windows it is a downloaded DLL the
289
+ # executable depends on at runtime, so copy it next to the .exe (its own directory
290
+ # is the first place Windows looks). Skipped entirely without GMP.
291
+ if(WIN32 AND VOLUMEREMESHER_WITH_GMP AND HAS_GMPXX)
292
+ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
293
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
294
+ $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}> $<TARGET_FILE_DIR:${PROJECT_NAME}>
295
+ COMMAND_EXPAND_LISTS)
296
+ endif()
297
+ endif()
298
+
299
+ # Integration tests (only when this is the top-level project; they run mesh_generator)
300
+ option(VOLUMEREMESHER_BUILD_TESTS "Build the integration test suite" ON)
301
+ if(NOT HAS_PARENT AND VOLUMEREMESHER_BUILD_TESTS AND VOLUMEREMESHER_BUILD_CLI)
302
+ enable_testing()
303
+ add_subdirectory(tests)
304
+ endif()
305
+
306
+ if(VOLUMEREMESHER_BUILD_PYTHON)
307
+ add_subdirectory(python)
308
+ endif()
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.