polyhedral-gravity 3.2.1rc1__tar.gz → 3.3rc1__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.
Files changed (67) hide show
  1. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/CMakeLists.txt +41 -25
  2. {polyhedral_gravity-3.2.1rc1/polyhedral_gravity.egg-info → polyhedral_gravity-3.3rc1}/PKG-INFO +34 -22
  3. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/README.md +22 -19
  4. polyhedral_gravity-3.3rc1/cmake/clang_format.cmake +27 -0
  5. polyhedral_gravity-3.3rc1/cmake/git.cmake +46 -0
  6. polyhedral_gravity-3.3rc1/cmake/gtest.cmake +23 -0
  7. polyhedral_gravity-3.3rc1/cmake/pybind11.cmake +18 -0
  8. polyhedral_gravity-3.3rc1/cmake/spdlog.cmake +25 -0
  9. polyhedral_gravity-3.3rc1/cmake/tbb.cmake +24 -0
  10. polyhedral_gravity-3.3rc1/cmake/tetgen.cmake +46 -0
  11. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/cmake/thrust.cmake +6 -8
  12. polyhedral_gravity-3.3rc1/cmake/xsimd.cmake +18 -0
  13. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/cmake/yaml.cmake +6 -11
  14. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1/polyhedral_gravity.egg-info}/PKG-INFO +34 -22
  15. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/polyhedral_gravity.egg-info/SOURCES.txt +8 -1
  16. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/setup.py +24 -5
  17. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/CMakeLists.txt +3 -3
  18. polyhedral_gravity-3.3rc1/src/main.cpp +82 -0
  19. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/CMakeLists.txt +1 -1
  20. polyhedral_gravity-3.3rc1/src/polyhedralGravity/Info.h.in +37 -0
  21. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/input/ConfigSource.h +16 -6
  22. polyhedral_gravity-3.3rc1/src/polyhedralGravity/input/MeshReader.cpp +63 -0
  23. polyhedral_gravity-3.3rc1/src/polyhedralGravity/input/MeshReader.h +52 -0
  24. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/input/TetgenAdapter.cpp +22 -22
  25. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/input/TetgenAdapter.h +26 -32
  26. polyhedral_gravity-3.3rc1/src/polyhedralGravity/input/YAMLConfigReader.cpp +64 -0
  27. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/input/YAMLConfigReader.h +16 -4
  28. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityEvaluable.cpp +39 -30
  29. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityEvaluable.h +25 -12
  30. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityModel.h +14 -4
  31. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityModelData.h +5 -44
  32. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityModelDetail.h +0 -1
  33. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/Polyhedron.cpp +76 -33
  34. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/Polyhedron.h +102 -133
  35. polyhedral_gravity-3.3rc1/src/polyhedralGravity/model/PolyhedronDefinitions.cpp +46 -0
  36. polyhedral_gravity-3.3rc1/src/polyhedralGravity/model/PolyhedronDefinitions.h +140 -0
  37. polyhedral_gravity-3.3rc1/src/polyhedralGravity/output/Logging.h +61 -0
  38. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/util/UtilityConstants.h +3 -3
  39. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/util/UtilityContainer.h +35 -37
  40. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/util/UtilityFloatArithmetic.h +1 -1
  41. polyhedral_gravity-3.3rc1/src/polyhedralGravity/util/UtilityString.h +25 -0
  42. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravityPython/PolyhedralGravityPython.cpp +71 -33
  43. polyhedral_gravity-3.2.1rc1/cmake/gtest.cmake +0 -18
  44. polyhedral_gravity-3.2.1rc1/cmake/pybind11.cmake +0 -22
  45. polyhedral_gravity-3.2.1rc1/cmake/spdlog.cmake +0 -33
  46. polyhedral_gravity-3.2.1rc1/cmake/tbb.cmake +0 -15
  47. polyhedral_gravity-3.2.1rc1/cmake/tetgen.cmake +0 -49
  48. polyhedral_gravity-3.2.1rc1/cmake/xsimd.cmake +0 -24
  49. polyhedral_gravity-3.2.1rc1/src/main.cpp +0 -57
  50. polyhedral_gravity-3.2.1rc1/src/polyhedralGravity/input/DataSource.h +0 -28
  51. polyhedral_gravity-3.2.1rc1/src/polyhedralGravity/input/YAMLConfigReader.cpp +0 -58
  52. polyhedral_gravity-3.2.1rc1/src/polyhedralGravity/output/Logging.h +0 -49
  53. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/LICENSE +0 -0
  54. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/MANIFEST.in +0 -0
  55. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/cmake/FindSphinx.cmake +0 -0
  56. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/polyhedral_gravity.egg-info/dependency_links.txt +0 -0
  57. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/polyhedral_gravity.egg-info/not-zip-safe +0 -0
  58. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/polyhedral_gravity.egg-info/top_level.txt +0 -0
  59. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/setup.cfg +0 -0
  60. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityModel.cpp +0 -0
  61. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/model/GravityModelDetail.cpp +0 -0
  62. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/output/CSVWriter.cpp +0 -0
  63. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/output/CSVWriter.h +1 -1
  64. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/output/Logging.cpp +0 -0
  65. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/util/UtilityFloatArithmetic.cpp +0 -0
  66. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravity/util/UtilityThrust.h +0 -0
  67. {polyhedral_gravity-3.2.1rc1 → polyhedral_gravity-3.3rc1}/src/polyhedralGravityPython/CMakeLists.txt +0 -0
@@ -4,6 +4,9 @@ project(polyhedralGravity)
4
4
  set(CMAKE_CXX_STANDARD 17)
5
5
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
6
6
 
7
+ # Appends the the module path to contain additional CMake modules for this project
8
+ # and include everything necessary
9
+ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
7
10
  include(CMakeDependentOption)
8
11
 
9
12
  #####################################
@@ -14,55 +17,65 @@ set(POLYHEDRAL_GRAVITY_PARALLELIZATION "CPP" CACHE STRING "Host parallelization
14
17
  (CPP= Serial, OMP = OpenMP, TBB = Intel Threading Building Blocks")
15
18
  set_property(CACHE POLYHEDRAL_GRAVITY_PARALLELIZATION PROPERTY STRINGS CPP, OMP, TBB)
16
19
 
17
- # Enforce to use an already installed tbb library instead of compiling from source
18
- option(USE_LOCAL_TBB "Uses the local tbb installation rather than on using the automatically fetched version from
19
- GitHub via CMake (Default: OFF)" OFF)
20
-
21
20
  # Set the Logging Level
22
- set(LOGGING_LEVEL "2" CACHE STRING "Set the Logging level, default (INFO=2), available options:
23
- TRACE=0, DEBUG=1, INFO=2, WARN=3, ERROR=4, CRITICAL=5, OFF=6")
24
- set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS 0, 1, 2, 3, 4, 5, 6)
25
- add_compile_definitions(SPDLOG_ACTIVE_LEVEL=${LOGGING_LEVEL})
26
-
27
- ###################################
28
- # What actually to build? - Options
29
- ###################################
21
+ set(POLYHEDRAL_GRAVITY_LOGGING_LEVEL_LIST "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF")
22
+ set(POLYHEDRAL_GRAVITY_LOGGING_LEVEL "INFO" CACHE STRING "Set the Logging level, default (INFO), available options: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF")
23
+ set_property(CACHE POLYHEDRAL_GRAVITY_LOGGING_LEVEL PROPERTY STRINGS ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL_LIST})
24
+ # Convert the logging level string to its corresponding number
25
+ list(FIND POLYHEDRAL_GRAVITY_LOGGING_LEVEL_LIST ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL} LOGGING_LEVEL_INDEX)
26
+ if (${LOGGING_LEVEL_INDEX} EQUAL -1)
27
+ message(FATAL_ERROR "Invalid logging level: ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL}")
28
+ endif ()
29
+ add_compile_definitions(SPDLOG_ACTIVE_LEVEL=${LOGGING_LEVEL_INDEX})
30
30
 
31
+ #########################################################
32
+ # What actually to build? - Options, Versions and Output
33
+ #########################################################
31
34
  # Build docs
32
35
  option(BUILD_POLYHEDRAL_GRAVITY_DOCS "Builds the documentation (Default: OFF)" OFF)
33
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_DOCS = ${BUILD_POLYHEDRAL_GRAVITY_DOCS}")
34
36
  # Build C++ executable
35
37
  option(BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE "Builds the C++ executable (Default: ON)" ON)
36
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE = ${BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE}")
37
38
  # Build library (default ON), if the executable or tests are built this forced to ON
38
39
  cmake_dependent_option(BUILD_POLYHEDRAL_GRAVITY_LIBRARY "Builds the library (Default: ON)" ON
39
40
  "NOT BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE AND NOT BUILD_POLYHEDRAL_GRAVITY_TESTS" ON)
40
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_LIBRARY = ${BUILD_POLYHEDRAL_GRAVITY_LIBRARY}")
41
41
  # Option to build the python interface
42
- option(BUILD_POLYHEDRAL_PYTHON_INTERFACE "Set this to on if the python interface should be built (Default: ON)" ON)
43
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE = ${BUILD_POLYHEDRAL_PYTHON_INTERFACE}")
42
+ option(BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE "Set this to on if the python interface should be built (Default: ON)" ON)
44
43
  # Option to build tests or not
45
44
  option(BUILD_POLYHEDRAL_GRAVITY_TESTS "Set to on if the tests should be built (Default: ON)" ON)
46
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_TESTS = ${BUILD_POLYHEDRAL_GRAVITY_TESTS}")
47
-
48
45
 
49
46
  IF(_LIBCPP_DISABLE_AVAILABILITY)
50
47
  message(STATUS "Disabling availability macros for libc++")
51
48
  add_definitions(-D_LIBCPP_DISABLE_AVAILABILITY)
52
49
  endif ()
53
50
 
51
+ # Resolves missing fmt symbols when working with spdlog (bundled via brew/ conda on Arm architecture)
52
+ # Refer to https://github.com/gabime/spdlog/issues/660
53
+ add_compile_definitions(FMT_HEADER_ONLY)
54
+
55
+ include(git)
56
+ include(version.cmake)
57
+
58
+ message(STATUS "#################################################################")
59
+ message(STATUS "Polyhedral Gravity Version ${POLYHEDRAL_GRAVITY_VERSION}")
60
+ message(STATUS "Polyhedral Gravity Commit Hash ${POLYHEDRAL_GRAVITY_COMMIT_HASH}")
61
+ message(STATUS "Polyhedral Parallelization Backend ${POLYHEDRAL_GRAVITY_PARALLELIZATION}")
62
+ message(STATUS "Polyhedral Gravity Logging Level ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL}")
63
+ message(STATUS "#################################################################")
64
+ message(STATUS "Polyhedral Gravity Documentation ${BUILD_POLYHEDRAL_GRAVITY_DOCS}")
65
+ message(STATUS "Polyhedral Gravity Library ${BUILD_POLYHEDRAL_GRAVITY_LIBRARY}")
66
+ message(STATUS "Polyhedral Gravity C++ Executable ${BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE}")
67
+ message(STATUS "Polyhedral Gravity Python Interface ${BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE}")
68
+ message(STATUS "Polyhedral Gravity Tests ${BUILD_POLYHEDRAL_GRAVITY_TESTS}")
69
+ message(STATUS "#################################################################")
54
70
  #######################################################
55
71
  # Including dependencies needed across multiple targets
56
72
  #######################################################
57
- # Appends the the module path to contain additional CMake modules for this project
58
- # and include everything necessary
59
- list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
60
73
 
61
- # Include dependecies
62
74
  include(thrust)
63
75
  include(spdlog)
64
76
  include(tetgen)
65
77
  include(xsimd)
78
+ include(clang_format)
66
79
 
67
80
  ###############################
68
81
  # Thrust Parallelization Set-Up
@@ -70,9 +83,12 @@ include(xsimd)
70
83
  # Get a version of tbb from the github repository, simplifies compilation for the user since tbb does not need to be
71
84
  # preinstalled but rather gets automatically set up via CMake
72
85
  # Nevertheless, there is still the option to enforce to use a local installation if one exists
73
- if (NOT USE_LOCAL_TBB AND ${POLYHEDRAL_GRAVITY_PARALLELIZATION} STREQUAL "TBB")
86
+ if (${POLYHEDRAL_GRAVITY_PARALLELIZATION} STREQUAL "TBB")
74
87
  include(tbb)
75
- thrust_set_TBB_target(tbb)
88
+ thrust_set_TBB_target(TBB::tbb)
89
+ add_compile_definitions(POLYHEDRAL_GRAVITY_TBB)
90
+ elseif (${POLYHEDRAL_GRAVITY_PARALLELIZATION} STREQUAL "OMP")
91
+ add_compile_definitions(POLYHEDRAL_GRAVITY_OMP)
76
92
  endif ()
77
93
 
78
94
  # Thrust set-up i.e. the parallelization library, create targets according to the users specification
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: polyhedral_gravity
3
- Version: 3.2.1rc1
3
+ Version: 3.3rc1
4
4
  Summary: Package to compute full gravity tensor of a given constant density polyhedron for arbitrary points according to the geodetic convention
5
5
  Author: Jonas Schuhmacher
6
6
  Author-email: jonas.schuhmacher@tum.de
@@ -19,9 +19,18 @@ Classifier: Operating System :: MacOS
19
19
  Classifier: Operating System :: POSIX :: Linux
20
20
  Classifier: Intended Audience :: Science/Research
21
21
  Classifier: Topic :: Scientific/Engineering :: Physics
22
- Requires-Python: >=3.6
22
+ Requires-Python: >=3.8
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: classifier
28
+ Dynamic: description
29
+ Dynamic: description-content-type
30
+ Dynamic: license
31
+ Dynamic: project-url
32
+ Dynamic: requires-python
33
+ Dynamic: summary
25
34
 
26
35
  # polyhedral-gravity-model
27
36
 
@@ -124,7 +133,7 @@ around a cube:
124
133
 
125
134
  ```python
126
135
  import numpy as np
127
- from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation
136
+ from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation, MetricUnit
128
137
 
129
138
  # We define the cube as a polyhedron with 8 vertices and 12 triangular faces
130
139
  # The polyhedron's normals point outwards (see below for checking this)
@@ -190,19 +199,22 @@ You can disable/ enable this setting via the optional `integrity_check` flag and
190
199
  automatically repair the ordering via `HEAL`.
191
200
  If you are confident that your mesh is defined correctly (e.g. checked once with the integrity check)
192
201
  you can disable this check (via `DISABLE`) to avoid the additional runtime overhead of the check.
202
+ Also, you can set the metric unit of the mesh and the density.
203
+ This also influences the output unit. E.g., Density in $kg/m^3$, Mesh in $m$, then the potential is given in $m^2/s^2$.
193
204
 
194
205
  ```python
195
206
  cube_polyhedron = Polyhedron(
196
- polyhedral_source=(cube_vertices, cube_faces),
197
- density=cube_density,
207
+ polyhedral_source=(cube_vertices, cube_faces),# coordinates in m (default), km, or unitless
208
+ density=cube_density, # kg/m^3 (default) or kg/km^3 or unitless
198
209
  normal_orientation=NormalOrientation.INWARDS, # OUTWARDS (default) or INWARDS
199
210
  integrity_check=PolyhedronIntegrity.VERIFY, # VERIFY (default), DISABLE or HEAL
211
+ metric_unit=MetricUnit.METER, # METER (default), KILOMETER, UNITLESS
200
212
  )
201
213
  ```
202
214
 
203
215
  > [!TIP]
204
216
  > More examples and plots are depicted in the
205
- [jupyter notebook](script/polyhedral-gravity.ipynb).
217
+ [jupyter notebook](script/polyhedral-gravity.ipynb) and the [second jupyter notebook](script/Kleopatra.ipynb)
206
218
 
207
219
 
208
220
  ### Minimal C++ Example
@@ -278,7 +290,7 @@ you have a C++17 capable compiler and CMake installed.
278
290
  The project uses the following dependencies,
279
291
  all of them are **automatically** set-up via CMake:
280
292
 
281
- - GoogleTest (1.13.0 or compatible), only required for testing
293
+ - GoogleTest (1.15.2 or compatible), only required for testing
282
294
  - spdlog (1.13.0 or compatible), required for logging
283
295
  - tetgen (1.6 or compatible), required for I/O
284
296
  - yaml-cpp (0.8.0 or compatible), required for I/O
@@ -324,17 +336,16 @@ cmake --build .
324
336
 
325
337
  The following options are available:
326
338
 
327
- | Name (Default) | Options |
328
- |-------------------------------------------:|:-------------------------------------------------------------------------------------------|
329
- | POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
330
- | LOGGING_LEVEL (`2`) | `0` = TRACE/ `1` = DEBUG/ `2` = INFO / `3` = WARN/ `4` = ERROR/ `5` = CRITICAL/ `6` = OFF |
331
- | USE_LOCAL_TBB (`OFF`) | Use a local installation of `TBB` instead of setting it up via `CMake` |
332
- | BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
333
- | BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
334
- | BUILD_POLYHEDRAL_PYTHON_INTERFACE (`ON`) | Build the Python interface |
339
+ | Name (Default) | Options |
340
+ |-------------------------------------------------------------:|:--------------------------------------------------------------------------------------------|
341
+ | POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
342
+ | POLYHEDRAL_GRAVITY_LOGGING_LEVEL (`INFO`) | `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `OFF` |
343
+ | BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
344
+ | BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
345
+ | BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE (`ON`) | Build the Python interface |
335
346
 
336
347
  During testing POLYHEDRAL_GRAVITY_PARALLELIZATION=`TBB` has been the most performant.
337
- It is further not recommend to change the LOGGING_LEVEL to something else than `INFO=2`.
348
+ It is further not recommend to change the POLYHEDRAL_GRAVITY_LOGGING_LEVEL to something else than `INFO=2`.
338
349
 
339
350
  The recommended CMake settings using the `TBB` backend would look like this:
340
351
 
@@ -367,17 +378,18 @@ Further one must specify the name of the .csv output file.
367
378
  ---
368
379
  gravityModel:
369
380
  input:
370
- polyhedron: #polyhedron source-file(s)
381
+ polyhedron: # polyhedron source-file(s)
371
382
  - "../example-config/data/tsoulis.node" # .node contains the vertices
372
383
  - "../example-config/data/tsoulis.face" # .face contains the triangular faces
373
384
  density: 2670.0 # constant density, units must match with the mesh (see section below)
374
- points: # Location of the computation point(s) P
385
+ # Depends on metric_unit: 'km' -> kg/km^3, 'm' -> kg/m^3, 'unitless' -> 'unitless'
386
+ points: # Location of the computation point(s) P
375
387
  - [ 0, 0, 0 ] # Here it is situated at the origin
376
- check_mesh: true # Fully optional, enables mesh autodetect+repair of
388
+ check_mesh: true # Fully optional, enables mesh autodetect+repair of
377
389
  # the polyhedron's vertex ordering (not given: true)
390
+ metric_unit: m # Unit of mesh: One of 'm', 'km' or 'unitless' (not given: 'm')
378
391
  output:
379
- filename: "gravity_result.csv" # The name of the output file
380
-
392
+ filename: "gravity_result.csv" # The name of the output file
381
393
  ````
382
394
 
383
395
  #### Output
@@ -105,7 +105,7 @@ around a cube:
105
105
 
106
106
  ```python
107
107
  import numpy as np
108
- from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation
108
+ from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation, MetricUnit
109
109
 
110
110
  # We define the cube as a polyhedron with 8 vertices and 12 triangular faces
111
111
  # The polyhedron's normals point outwards (see below for checking this)
@@ -171,19 +171,22 @@ You can disable/ enable this setting via the optional `integrity_check` flag and
171
171
  automatically repair the ordering via `HEAL`.
172
172
  If you are confident that your mesh is defined correctly (e.g. checked once with the integrity check)
173
173
  you can disable this check (via `DISABLE`) to avoid the additional runtime overhead of the check.
174
+ Also, you can set the metric unit of the mesh and the density.
175
+ This also influences the output unit. E.g., Density in $kg/m^3$, Mesh in $m$, then the potential is given in $m^2/s^2$.
174
176
 
175
177
  ```python
176
178
  cube_polyhedron = Polyhedron(
177
- polyhedral_source=(cube_vertices, cube_faces),
178
- density=cube_density,
179
+ polyhedral_source=(cube_vertices, cube_faces),# coordinates in m (default), km, or unitless
180
+ density=cube_density, # kg/m^3 (default) or kg/km^3 or unitless
179
181
  normal_orientation=NormalOrientation.INWARDS, # OUTWARDS (default) or INWARDS
180
182
  integrity_check=PolyhedronIntegrity.VERIFY, # VERIFY (default), DISABLE or HEAL
183
+ metric_unit=MetricUnit.METER, # METER (default), KILOMETER, UNITLESS
181
184
  )
182
185
  ```
183
186
 
184
187
  > [!TIP]
185
188
  > More examples and plots are depicted in the
186
- [jupyter notebook](script/polyhedral-gravity.ipynb).
189
+ [jupyter notebook](script/polyhedral-gravity.ipynb) and the [second jupyter notebook](script/Kleopatra.ipynb)
187
190
 
188
191
 
189
192
  ### Minimal C++ Example
@@ -259,7 +262,7 @@ you have a C++17 capable compiler and CMake installed.
259
262
  The project uses the following dependencies,
260
263
  all of them are **automatically** set-up via CMake:
261
264
 
262
- - GoogleTest (1.13.0 or compatible), only required for testing
265
+ - GoogleTest (1.15.2 or compatible), only required for testing
263
266
  - spdlog (1.13.0 or compatible), required for logging
264
267
  - tetgen (1.6 or compatible), required for I/O
265
268
  - yaml-cpp (0.8.0 or compatible), required for I/O
@@ -305,17 +308,16 @@ cmake --build .
305
308
 
306
309
  The following options are available:
307
310
 
308
- | Name (Default) | Options |
309
- |-------------------------------------------:|:-------------------------------------------------------------------------------------------|
310
- | POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
311
- | LOGGING_LEVEL (`2`) | `0` = TRACE/ `1` = DEBUG/ `2` = INFO / `3` = WARN/ `4` = ERROR/ `5` = CRITICAL/ `6` = OFF |
312
- | USE_LOCAL_TBB (`OFF`) | Use a local installation of `TBB` instead of setting it up via `CMake` |
313
- | BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
314
- | BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
315
- | BUILD_POLYHEDRAL_PYTHON_INTERFACE (`ON`) | Build the Python interface |
311
+ | Name (Default) | Options |
312
+ |-------------------------------------------------------------:|:--------------------------------------------------------------------------------------------|
313
+ | POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
314
+ | POLYHEDRAL_GRAVITY_LOGGING_LEVEL (`INFO`) | `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `OFF` |
315
+ | BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
316
+ | BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
317
+ | BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE (`ON`) | Build the Python interface |
316
318
 
317
319
  During testing POLYHEDRAL_GRAVITY_PARALLELIZATION=`TBB` has been the most performant.
318
- It is further not recommend to change the LOGGING_LEVEL to something else than `INFO=2`.
320
+ It is further not recommend to change the POLYHEDRAL_GRAVITY_LOGGING_LEVEL to something else than `INFO=2`.
319
321
 
320
322
  The recommended CMake settings using the `TBB` backend would look like this:
321
323
 
@@ -348,17 +350,18 @@ Further one must specify the name of the .csv output file.
348
350
  ---
349
351
  gravityModel:
350
352
  input:
351
- polyhedron: #polyhedron source-file(s)
353
+ polyhedron: # polyhedron source-file(s)
352
354
  - "../example-config/data/tsoulis.node" # .node contains the vertices
353
355
  - "../example-config/data/tsoulis.face" # .face contains the triangular faces
354
356
  density: 2670.0 # constant density, units must match with the mesh (see section below)
355
- points: # Location of the computation point(s) P
357
+ # Depends on metric_unit: 'km' -> kg/km^3, 'm' -> kg/m^3, 'unitless' -> 'unitless'
358
+ points: # Location of the computation point(s) P
356
359
  - [ 0, 0, 0 ] # Here it is situated at the origin
357
- check_mesh: true # Fully optional, enables mesh autodetect+repair of
360
+ check_mesh: true # Fully optional, enables mesh autodetect+repair of
358
361
  # the polyhedron's vertex ordering (not given: true)
362
+ metric_unit: m # Unit of mesh: One of 'm', 'km' or 'unitless' (not given: 'm')
359
363
  output:
360
- filename: "gravity_result.csv" # The name of the output file
361
-
364
+ filename: "gravity_result.csv" # The name of the output file
362
365
  ````
363
366
 
364
367
  #### Output
@@ -0,0 +1,27 @@
1
+ file(GLOB_RECURSE CLANG_FORMAT_SRC
2
+ "${PROJECT_SOURCE_DIR}/src/*.cpp"
3
+ "${PROJECT_SOURCE_DIR}/src/*.h"
4
+ "${PROJECT_SOURCE_DIR}/test/*.cpp"
5
+ "${PROJECT_SOURCE_DIR}/test/*.h"
6
+ )
7
+
8
+ # Define a variable for clang-format command
9
+ find_program(CLANG_FORMAT clang-format)
10
+
11
+ # Ensure clang-format was found
12
+ if(NOT CLANG_FORMAT)
13
+ message(STATUS "clang-format not found. Please install it to use clang-format via CMake")
14
+ else()
15
+ message(STATUS "clang-format found. You can format all source files via `cmake --build . --target format`")
16
+ add_custom_command(
17
+ OUTPUT format_all_files
18
+ COMMAND ${CLANG_FORMAT} -i ${CLANG_FORMAT_SRC}
19
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
20
+ COMMENT "Formatting all source and test files with clang-format"
21
+ VERBATIM
22
+ )
23
+
24
+ add_custom_target(format
25
+ DEPENDS format_all_files
26
+ )
27
+ endif()
@@ -0,0 +1,46 @@
1
+ find_package(Git QUIET REQUIRED)
2
+
3
+ function(get_git_commit_hash OUTPUT_VAR)
4
+ # Run a Git command to get the first 8 characters of the current commit hash
5
+ execute_process(
6
+ COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD
7
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
8
+ OUTPUT_VARIABLE GIT_COMMIT_HASH
9
+ OUTPUT_STRIP_TRAILING_WHITESPACE
10
+ ERROR_VARIABLE GIT_ERROR
11
+ ERROR_STRIP_TRAILING_WHITESPACE
12
+ )
13
+
14
+ # Check if the Git command was successful
15
+ if (NOT GIT_COMMIT_HASH OR GIT_ERROR)
16
+ message(WARNING "Failed to retrieve Git commit hash: ${GIT_ERROR}")
17
+ set(${OUTPUT_VAR} "UNKNOWN" PARENT_SCOPE)
18
+ else()
19
+ # Pass the short hash back to the calling scope
20
+ set(${OUTPUT_VAR} "${GIT_COMMIT_HASH}" PARENT_SCOPE)
21
+ endif()
22
+ endfunction()
23
+
24
+ function(is_git_working_tree_clean OUTPUT_VAR)
25
+ # Run a Git command to check if the working tree is clean
26
+ execute_process(
27
+ COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD --
28
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
29
+ RESULT_VARIABLE GIT_STATUS_RESULT
30
+ ERROR_VARIABLE GIT_ERROR
31
+ ERROR_STRIP_TRAILING_WHITESPACE
32
+ )
33
+
34
+ # Check the result of the Git command
35
+ if (NOT GIT_ERROR AND GIT_STATUS_RESULT EQUAL 0)
36
+ # Working tree is clean
37
+ set(${OUTPUT_VAR} TRUE PARENT_SCOPE)
38
+ else()
39
+ # Working tree has uncommitted changes or an error occurred
40
+ set(${OUTPUT_VAR} FALSE PARENT_SCOPE)
41
+
42
+ if (GIT_ERROR)
43
+ message(WARNING "Error while checking Git working tree: ${GIT_ERROR}")
44
+ endif()
45
+ endif()
46
+ endfunction()
@@ -0,0 +1,23 @@
1
+ include(FetchContent)
2
+
3
+ message(STATUS "Setting up Google Test")
4
+ set(GOOGLE_TEST_VERSION 1.15.2)
5
+
6
+ find_package(GTest ${GOOGLE_TEST_VERSION} QUIET)
7
+
8
+
9
+ if(${GTest_FOUND})
10
+ message(STATUS "Found existing Google Test: ${GTest_DIR}")
11
+ else()
12
+ message(STATUS "Using Google Test from GitHub Release ${GOOGLE_TEST_VERSION}")
13
+
14
+ FetchContent_Declare(googletest
15
+ GIT_REPOSITORY https://github.com/google/googletest.git
16
+ GIT_TAG v${GOOGLE_TEST_VERSION}
17
+ )
18
+ FetchContent_MakeAvailable(googletest)
19
+
20
+ target_compile_options(gtest_main PRIVATE -w)
21
+ get_target_property(propval gtest_main INTERFACE_INCLUDE_DIRECTORIES)
22
+ target_include_directories(gtest_main SYSTEM PUBLIC "${propval}")
23
+ endif()
@@ -0,0 +1,18 @@
1
+ include(FetchContent)
2
+
3
+ message(STATUS "Setting up Pybind11 Library")
4
+ set(PYBIND11_VERSION 2.12.0)
5
+
6
+ find_package(pybind11 ${PYBIND11_VERSION} QUIET)
7
+
8
+ if(${pybind11_FOUND})
9
+ message(STATUS "Found existing Pybind11 Library: ${pybind11_DIR}")
10
+ else()
11
+ message(STATUS "Using Pybind11 Library from GitHub Release ${PYBIND11_VERSION}")
12
+
13
+ FetchContent_Declare(pybind11
14
+ GIT_REPOSITORY https://github.com/pybind/pybind11
15
+ GIT_TAG v${PYBIND11_VERSION}
16
+ )
17
+ FetchContent_MakeAvailable(pybind11)
18
+ endif()
@@ -0,0 +1,25 @@
1
+ include(FetchContent)
2
+
3
+ message(STATUS "Setting up spdlog")
4
+ set(SPDLOG_VERSION 1.14.1)
5
+
6
+ # Known Issue:
7
+ # If you install spdlog@1.14.1 via homebrew on ARM macOS, CMake will find spdlog
8
+ # However, there is a version mismatch between the `fmt` library installed as dependency, and the one actually
9
+ # being required leading to a linking error (i.e. missing symbols) while compiling!
10
+ # Update 29.11.2024: We fixed this by using spdlog has header library (--> top-level CMake file)
11
+ find_package(spdlog ${SPDLOG_VERSION} QUIET)
12
+
13
+ if(${spdlog_FOUND})
14
+ message(STATUS "Found existing spdlog Library: ${spdlog_DIR}")
15
+ else()
16
+ message(STATUS "Using Spdlog Library from GitHub Release ${SPDLOG_VERSION}")
17
+ FetchContent_Declare(spdlog
18
+ GIT_REPOSITORY https://github.com/gabime/spdlog.git
19
+ GIT_TAG v${SPDLOG_VERSION}
20
+ )
21
+ set(SPDLOG_BUILD_EXAMPLE OFF CACHE BOOL "" FORCE)
22
+ set(SPDLOG_BUILD_TESTS OFF CACHE BOOL "" FORCE)
23
+ set(SPDLOG_INSTALL OFF CACHE BOOL "" FORCE)
24
+ FetchContent_MakeAvailable(spdlog)
25
+ endif()
@@ -0,0 +1,24 @@
1
+ include(FetchContent)
2
+
3
+ message(STATUS "Setting up tbb")
4
+ set(TBB_VERSION 2021.12.0)
5
+
6
+ find_package(TBB QUIET HINTS /opt/homebrew/Cellar/tbb)
7
+
8
+ if(${TBB_FOUND})
9
+ message(STATUS "Found existing TBB library: ${TBB_DIR}")
10
+ else()
11
+ message(STATUS "Using TBB from GitHub Release ${TBB_VERSION}")
12
+
13
+ #Fetches the version v2021.12.0 from the official github of tbb
14
+ FetchContent_Declare(tbb
15
+ GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
16
+ GIT_TAG v${TBB_VERSION}
17
+ )
18
+
19
+ # Disable tests & and do not treat tbb-compile errors as warnings
20
+ set(TBB_TEST OFF CACHE BOOL "" FORCE)
21
+ set(TBB_STRICT OFF CACHE BOOl "" FORCE)
22
+
23
+ FetchContent_MakeAvailable(tbb)
24
+ endif()
@@ -0,0 +1,46 @@
1
+ include(FetchContent)
2
+
3
+ message(STATUS "Setting up tetgen")
4
+
5
+ # IMPORTANT NOTE
6
+ # We do not use find_package here, as we modify the one source file slightly to suppress output via stdout!!!
7
+
8
+ # Fetches the version 1.6 for tetgen
9
+ FetchContent_Declare(tetgen
10
+ GIT_REPOSITORY https://github.com/libigl/tetgen.git
11
+ GIT_TAG 4f3bfba3997f20aa1f96cfaff604313a8c2c85b6 # release 1.6
12
+ )
13
+
14
+ FetchContent_MakeAvailable(tetgen)
15
+
16
+ # Modify the tetgen library to suppress console output from the printf function
17
+ if(NOT EXISTS ${tetgen_SOURCE_DIR}/tetgen_mod.cxx)
18
+ message(STATUS "Creating modified tetgen.cxx in order to prevent console output from library")
19
+ file(READ ${tetgen_SOURCE_DIR}/tetgen.cxx TETGEN_CXX)
20
+
21
+ string(REPLACE
22
+ "#include \"tetgen.h\""
23
+ "#include \"tetgen.h\"\n#define printf(fmt, ...) (0)\n"
24
+ TETGEN_CXX "${TETGEN_CXX}")
25
+
26
+ file(WRITE ${tetgen_SOURCE_DIR}/tetgen_mod.cxx
27
+ "${TETGEN_CXX}"
28
+ )
29
+ else()
30
+ message(STATUS "A modified tetgen.cxx already exists! It is assumed that it is the correct one disabling output")
31
+ endif()
32
+
33
+ # Add the modified version of the tetgen library
34
+ add_library(tetgen_lib STATIC
35
+ ${tetgen_SOURCE_DIR}/tetgen_mod.cxx
36
+ ${tetgen_SOURCE_DIR}/predicates.cxx
37
+ )
38
+
39
+ # Define the TETLIBRARY macro for usage
40
+ target_compile_definitions(tetgen_lib PRIVATE -DTETLIBRARY)
41
+
42
+ # Include the tetgen source directory for the library
43
+ target_include_directories(tetgen_lib INTERFACE "${tetgen_SOURCE_DIR}")
44
+
45
+ # Disable warnings from the library target
46
+ target_compile_options(tetgen_lib PRIVATE -w)
@@ -1,28 +1,26 @@
1
1
  include(FetchContent)
2
2
 
3
3
  message(STATUS "Setting up thrust")
4
+ set(THRUST_VERSION 1.16.0)
4
5
 
5
6
  # Set custom variables, policies, etc.
6
7
  # Disable stuff not needed
7
8
  set(THRUST_ENABLE_HEADER_TESTING "OFF")
8
9
  set(THRUST_ENABLE_TESTING "OFF")
9
10
  set(THRUST_ENABLE_EXAMPLES "OFF")
10
-
11
11
  # Set standard CPP Dialect to 17 (default of thrust would be 14)
12
12
  set(THRUST_CPP_DIALECT 17)
13
13
 
14
- find_package(Thrust 1.16.0 QUIET)
15
-
16
- if (${Thrust_FOUND})
14
+ find_package(Thrust ${THRUST_VERSION} QUIET)
17
15
 
18
- message(STATUS "Using existing thrust installation")
19
16
 
17
+ if (${Thrust_FOUND})
18
+ message(STATUS "Found existing thrust installation: ${Thrust_DIR}")
20
19
  else()
21
- message(STATUS "Using thrust from git repository")
22
- # Fetches the version 1.16.0 of the official NVIDIA Thrust repository
20
+ message(STATUS "Using thrust from GitHub Release ${THRUST_VERSION}")
23
21
  FetchContent_Declare(thrust
24
22
  GIT_REPOSITORY https://github.com/NVIDIA/thrust.git
25
- GIT_TAG 1.16.0
23
+ GIT_TAG ${THRUST_VERSION}
26
24
  )
27
25
  FetchContent_MakeAvailable(thrust)
28
26
  endif()
@@ -0,0 +1,18 @@
1
+ include(FetchContent)
2
+
3
+ message(STATUS "Setting up xsimd Library")
4
+ set(XSIMD_VERSION 11.1.0)
5
+
6
+ find_package(xsimd ${XSIMD_VERSION} QUIET)
7
+
8
+ if (${xsimd_FOUND})
9
+ message(STATUS "Found existing xsimd Library: ${xsimd_DIR}")
10
+ else()
11
+ message(STATUS "Using xsimd Library from GitHub Release ${XSIMD_VERSION}")
12
+ FetchContent_Declare(xsimd
13
+ GIT_REPOSITORY https://github.com/xtensor-stack/xsimd.git
14
+ GIT_TAG ${XSIMD_VERSION}
15
+ )
16
+
17
+ FetchContent_MakeAvailable(xsimd)
18
+ endif()
@@ -1,32 +1,27 @@
1
1
  include(FetchContent)
2
2
 
3
3
  message(STATUS "Setting up yaml-cpp")
4
+ set(YAML_CPP_VERSION 0.8.0)
4
5
 
5
- find_package(yaml-cpp 0.8.0 QUIET)
6
+ find_package(yaml-cpp ${YAML_CPP_VERSION} QUIET)
6
7
 
7
8
  if (${yaml-cpp_FOUND})
8
-
9
- message(STATUS "Using existing yaml-cpp installation")
10
-
9
+ message(STATUS "Found existing yaml-cpp library: ${yaml-cpp_DIR}")
11
10
  else()
12
-
13
- #Fetches the version 0.8.0 for yaml-cpp
11
+ message(STATUS "Using yaml-cpp from GitHub Release ${YAML_CPP_VERSION}")
14
12
  FetchContent_Declare(yaml-cpp
15
13
  GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
16
- GIT_TAG 0.8.0
14
+ GIT_TAG ${YAML_CPP_VERSION}
17
15
  )
18
-
19
16
  # Disable everything we don't need
20
17
  set(YAML_CPP_BUILD_TESTS OFF CACHE INTERNAL "")
21
18
  set(YAML_CPP_BUILD_CONTRIB OFF CACHE INTERNAL "")
22
19
  set(YAML_CPP_BUILD_TOOLS OFF CACHE INTERNAL "")
23
-
20
+ set(YAML_CPP_FORMAT_SOURCE OFF CACHE INTERNAL "")
24
21
  FetchContent_MakeAvailable(yaml-cpp)
25
-
26
22
  # Disable warnings from the library target
27
23
  target_compile_options(yaml-cpp PRIVATE -w)
28
24
  # Disable warnings from included headers
29
25
  get_target_property(propval yaml-cpp INTERFACE_INCLUDE_DIRECTORIES)
30
26
  target_include_directories(yaml-cpp SYSTEM PUBLIC "${propval}")
31
-
32
27
  endif()