polyhedral-gravity 3.2.1__tar.gz → 3.3__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 (68) hide show
  1. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/CMakeLists.txt +46 -28
  2. {polyhedral_gravity-3.2.1/polyhedral_gravity.egg-info → polyhedral_gravity-3.3}/PKG-INFO +56 -43
  3. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/README.md +43 -40
  4. polyhedral_gravity-3.3/cmake/clang_format.cmake +26 -0
  5. polyhedral_gravity-3.3/cmake/cmake_format.cmake +25 -0
  6. polyhedral_gravity-3.3/cmake/git.cmake +46 -0
  7. polyhedral_gravity-3.3/cmake/gtest.cmake +23 -0
  8. polyhedral_gravity-3.3/cmake/pybind11.cmake +18 -0
  9. polyhedral_gravity-3.3/cmake/spdlog.cmake +25 -0
  10. polyhedral_gravity-3.3/cmake/tbb.cmake +24 -0
  11. polyhedral_gravity-3.3/cmake/tetgen.cmake +46 -0
  12. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/cmake/thrust.cmake +6 -8
  13. polyhedral_gravity-3.3/cmake/xsimd.cmake +18 -0
  14. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/cmake/yaml.cmake +6 -11
  15. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3/polyhedral_gravity.egg-info}/PKG-INFO +56 -43
  16. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/polyhedral_gravity.egg-info/SOURCES.txt +9 -1
  17. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/setup.py +27 -6
  18. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/CMakeLists.txt +3 -3
  19. polyhedral_gravity-3.3/src/main.cpp +82 -0
  20. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/CMakeLists.txt +1 -1
  21. polyhedral_gravity-3.3/src/polyhedralGravity/Info.h.in +37 -0
  22. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/input/ConfigSource.h +16 -6
  23. polyhedral_gravity-3.3/src/polyhedralGravity/input/MeshReader.cpp +63 -0
  24. polyhedral_gravity-3.3/src/polyhedralGravity/input/MeshReader.h +52 -0
  25. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/input/TetgenAdapter.cpp +22 -22
  26. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/input/TetgenAdapter.h +26 -32
  27. polyhedral_gravity-3.3/src/polyhedralGravity/input/YAMLConfigReader.cpp +64 -0
  28. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/input/YAMLConfigReader.h +16 -4
  29. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityEvaluable.cpp +39 -30
  30. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityEvaluable.h +25 -12
  31. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityModel.h +14 -4
  32. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityModelData.h +5 -44
  33. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityModelDetail.h +0 -1
  34. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/Polyhedron.cpp +76 -33
  35. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/Polyhedron.h +102 -133
  36. polyhedral_gravity-3.3/src/polyhedralGravity/model/PolyhedronDefinitions.cpp +46 -0
  37. polyhedral_gravity-3.3/src/polyhedralGravity/model/PolyhedronDefinitions.h +140 -0
  38. polyhedral_gravity-3.3/src/polyhedralGravity/output/Logging.h +61 -0
  39. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/util/UtilityConstants.h +3 -3
  40. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/util/UtilityContainer.h +35 -37
  41. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/util/UtilityFloatArithmetic.h +1 -1
  42. polyhedral_gravity-3.3/src/polyhedralGravity/util/UtilityString.h +25 -0
  43. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravityPython/PolyhedralGravityPython.cpp +75 -35
  44. polyhedral_gravity-3.2.1/cmake/gtest.cmake +0 -18
  45. polyhedral_gravity-3.2.1/cmake/pybind11.cmake +0 -22
  46. polyhedral_gravity-3.2.1/cmake/spdlog.cmake +0 -33
  47. polyhedral_gravity-3.2.1/cmake/tbb.cmake +0 -15
  48. polyhedral_gravity-3.2.1/cmake/tetgen.cmake +0 -49
  49. polyhedral_gravity-3.2.1/cmake/xsimd.cmake +0 -24
  50. polyhedral_gravity-3.2.1/src/main.cpp +0 -57
  51. polyhedral_gravity-3.2.1/src/polyhedralGravity/input/DataSource.h +0 -28
  52. polyhedral_gravity-3.2.1/src/polyhedralGravity/input/YAMLConfigReader.cpp +0 -58
  53. polyhedral_gravity-3.2.1/src/polyhedralGravity/output/Logging.h +0 -49
  54. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/LICENSE +0 -0
  55. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/MANIFEST.in +0 -0
  56. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/cmake/FindSphinx.cmake +0 -0
  57. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/polyhedral_gravity.egg-info/dependency_links.txt +0 -0
  58. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/polyhedral_gravity.egg-info/not-zip-safe +0 -0
  59. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/polyhedral_gravity.egg-info/top_level.txt +0 -0
  60. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/setup.cfg +0 -0
  61. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityModel.cpp +0 -0
  62. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/model/GravityModelDetail.cpp +0 -0
  63. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/output/CSVWriter.cpp +0 -0
  64. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/output/CSVWriter.h +1 -1
  65. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/output/Logging.cpp +0 -0
  66. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/util/UtilityFloatArithmetic.cpp +0 -0
  67. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/src/polyhedralGravity/util/UtilityThrust.h +0 -0
  68. {polyhedral_gravity-3.2.1 → polyhedral_gravity-3.3}/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,61 +17,73 @@ 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_LIST "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF")
23
- set(LOGGING_LEVEL "INFO" CACHE STRING "Set the Logging level, default (INFO), available options: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF")
24
- set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS ${LOGGING_LEVEL_LIST})
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})
25
24
  # Convert the logging level string to its corresponding number
26
- list(FIND LOGGING_LEVEL_LIST ${LOGGING_LEVEL} LOGGING_LEVEL_INDEX)
25
+ list(FIND POLYHEDRAL_GRAVITY_LOGGING_LEVEL_LIST ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL} LOGGING_LEVEL_INDEX)
27
26
  if (${LOGGING_LEVEL_INDEX} EQUAL -1)
28
- message(FATAL_ERROR "Invalid logging level: ${LOGGING_LEVEL}")
27
+ message(FATAL_ERROR "Invalid logging level: ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL}")
29
28
  endif ()
30
29
  add_compile_definitions(SPDLOG_ACTIVE_LEVEL=${LOGGING_LEVEL_INDEX})
31
- message(STATUS "Logging level set to ${LOGGING_LEVEL} (=${LOGGING_LEVEL_INDEX})")
32
-
33
- ###################################
34
- # What actually to build? - Options
35
- ###################################
36
30
 
31
+ #########################################################
32
+ # What actually to build? - Options, Versions and Output
33
+ #########################################################
37
34
  # Build docs
38
35
  option(BUILD_POLYHEDRAL_GRAVITY_DOCS "Builds the documentation (Default: OFF)" OFF)
39
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_DOCS = ${BUILD_POLYHEDRAL_GRAVITY_DOCS}")
40
36
  # Build C++ executable
41
37
  option(BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE "Builds the C++ executable (Default: ON)" ON)
42
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE = ${BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE}")
43
38
  # Build library (default ON), if the executable or tests are built this forced to ON
44
39
  cmake_dependent_option(BUILD_POLYHEDRAL_GRAVITY_LIBRARY "Builds the library (Default: ON)" ON
45
40
  "NOT BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE AND NOT BUILD_POLYHEDRAL_GRAVITY_TESTS" ON)
46
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_LIBRARY = ${BUILD_POLYHEDRAL_GRAVITY_LIBRARY}")
47
41
  # Option to build the python interface
48
- option(BUILD_POLYHEDRAL_PYTHON_INTERFACE "Set this to on if the python interface should be built (Default: ON)" ON)
49
- 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)
50
43
  # Option to build tests or not
51
44
  option(BUILD_POLYHEDRAL_GRAVITY_TESTS "Set to on if the tests should be built (Default: ON)" ON)
52
- message(STATUS "BUILD_POLYHEDRAL_GRAVITY_TESTS = ${BUILD_POLYHEDRAL_GRAVITY_TESTS}")
53
45
 
54
-
55
- IF(_LIBCPP_DISABLE_AVAILABILITY)
46
+ if (_LIBCPP_DISABLE_AVAILABILITY)
56
47
  message(STATUS "Disabling availability macros for libc++")
57
48
  add_definitions(-D_LIBCPP_DISABLE_AVAILABILITY)
58
49
  endif ()
59
50
 
51
+ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
52
+ # Fixes undefined _VSTD when using Apple Clang 17
53
+ message(STATUS "Using Apple Clang compiler. Defining _VSTD=std.")
54
+ add_definitions(-D_VSTD=std)
55
+ endif()
56
+
57
+
58
+ # Resolves missing fmt symbols when working with spdlog (bundled via brew/ conda on Arm architecture)
59
+ # Refer to https://github.com/gabime/spdlog/issues/660
60
+ add_compile_definitions(FMT_HEADER_ONLY)
61
+
62
+ include(git)
63
+ include(version.cmake)
64
+
65
+ message(STATUS "#################################################################")
66
+ message(STATUS "Polyhedral Gravity Version ${POLYHEDRAL_GRAVITY_VERSION}")
67
+ message(STATUS "Polyhedral Gravity Commit Hash ${POLYHEDRAL_GRAVITY_COMMIT_HASH}")
68
+ message(STATUS "Polyhedral Parallelization Backend ${POLYHEDRAL_GRAVITY_PARALLELIZATION}")
69
+ message(STATUS "Polyhedral Gravity Logging Level ${POLYHEDRAL_GRAVITY_LOGGING_LEVEL}")
70
+ message(STATUS "#################################################################")
71
+ message(STATUS "Polyhedral Gravity Documentation ${BUILD_POLYHEDRAL_GRAVITY_DOCS}")
72
+ message(STATUS "Polyhedral Gravity Library ${BUILD_POLYHEDRAL_GRAVITY_LIBRARY}")
73
+ message(STATUS "Polyhedral Gravity C++ Executable ${BUILD_POLYHEDRAL_GRAVITY_EXECUTABLE}")
74
+ message(STATUS "Polyhedral Gravity Python Interface ${BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE}")
75
+ message(STATUS "Polyhedral Gravity Tests ${BUILD_POLYHEDRAL_GRAVITY_TESTS}")
76
+ message(STATUS "#################################################################")
60
77
  #######################################################
61
78
  # Including dependencies needed across multiple targets
62
79
  #######################################################
63
- # Appends the the module path to contain additional CMake modules for this project
64
- # and include everything necessary
65
- list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
66
80
 
67
- # Include dependecies
68
81
  include(thrust)
69
82
  include(spdlog)
70
83
  include(tetgen)
71
84
  include(xsimd)
85
+ include(clang_format)
86
+ include(cmake_format)
72
87
 
73
88
  ###############################
74
89
  # Thrust Parallelization Set-Up
@@ -76,9 +91,12 @@ include(xsimd)
76
91
  # Get a version of tbb from the github repository, simplifies compilation for the user since tbb does not need to be
77
92
  # preinstalled but rather gets automatically set up via CMake
78
93
  # Nevertheless, there is still the option to enforce to use a local installation if one exists
79
- if (NOT USE_LOCAL_TBB AND ${POLYHEDRAL_GRAVITY_PARALLELIZATION} STREQUAL "TBB")
94
+ if (${POLYHEDRAL_GRAVITY_PARALLELIZATION} STREQUAL "TBB")
80
95
  include(tbb)
81
- thrust_set_TBB_target(tbb)
96
+ thrust_set_TBB_target(TBB::tbb)
97
+ add_compile_definitions(POLYHEDRAL_GRAVITY_TBB)
98
+ elseif (${POLYHEDRAL_GRAVITY_PARALLELIZATION} STREQUAL "OMP")
99
+ add_compile_definitions(POLYHEDRAL_GRAVITY_OMP)
82
100
  endif ()
83
101
 
84
102
  # 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.4
2
2
  Name: polyhedral_gravity
3
- Version: 3.2.1
3
+ Version: 3.3
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,19 @@ 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: license-file
32
+ Dynamic: project-url
33
+ Dynamic: requires-python
34
+ Dynamic: summary
25
35
 
26
36
  # polyhedral-gravity-model
27
37
 
@@ -95,20 +105,20 @@ The evaluation of the polyhedral gravity model requires the following parameters
95
105
  | Polyhedral Mesh (either as vertices & faces or as polyhedral source files) |
96
106
  | Constant Density $\rho$ |
97
107
 
98
- The mesh and the constants density's unit must match.
99
- Have a look the documentation to view the [supported mesh files](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html).
108
+ The mesh and the constant density's unit must match.
109
+ Have a look at the documentation to view the [supported mesh files](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html).
100
110
 
101
111
  ### Output
102
112
 
103
113
  The calculation outputs the following parameters for every Computation Point *P*.
104
114
  The units of the respective output depend on the units of the input parameters (mesh and density)!
105
- Hence, if e.g. your mesh is in $km$, the density must match. Further, output units will be different accordingly.
115
+ Hence, if e.g., your mesh is in $km$, the density must match. Further, output units will be different accordingly.
106
116
 
107
- | Name | Unit (if mesh in $[m]$ and $\rho$ in $[kg/m^3]$) | Comment |
108
- |:----------------------------------------------------------:|:------------------------------------------------:|:-----------------------------------------------------------------:|
109
- | $V$ | $\frac{m^2}{s^2}$ or $\frac{J}{kg}$ | The potential or also called specific energy |
110
- | $V_x$, $V_y$, $V_z$ | $\frac{m}{s^2}$ | The gravitational accerleration in the three cartesian directions |
111
- | $V_{xx}$, $V_{yy}$, $V_{zz}$, $V_{xy}$, $V_{xz}$, $V_{yz}$ | $\frac{1}{s^2}$ | The spatial rate of change of the gravitational accleration |
117
+ | Name | Unit (if mesh in $[m]$ and $\rho$ in $[kg/m^3]$) | Comment |
118
+ |:----------------------------------------------------------:|:------------------------------------------------:|:----------------------------------------------------------------:|
119
+ | $V$ | $\frac{m^2}{s^2}$ or $\frac{J}{kg}$ | The potential or also called specific energy |
120
+ | $V_x$, $V_y$, $V_z$ | $\frac{m}{s^2}$ | The gravitational acceleration in the three cartesian directions |
121
+ | $V_{xx}$, $V_{yy}$, $V_{zz}$, $V_{xy}$, $V_{xz}$, $V_{yz}$ | $\frac{1}{s^2}$ | The spatial rate of change of the gravitational acceleration |
112
122
 
113
123
 
114
124
  >[!NOTE]
@@ -124,7 +134,7 @@ around a cube:
124
134
 
125
135
  ```python
126
136
  import numpy as np
127
- from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation
137
+ from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation, MetricUnit
128
138
 
129
139
  # We define the cube as a polyhedron with 8 vertices and 12 triangular faces
130
140
  # The polyhedron's normals point outwards (see below for checking this)
@@ -167,7 +177,7 @@ potential, acceleration, tensor = evaluate(
167
177
  The more advanced way is to use the `GravityEvaluable` class. It caches the
168
178
  internal data structure and properties which can be reused for multiple
169
179
  evaluations. This is especially useful if you want to compute the gravity
170
- for multiple computation points, but don't know the "future points" in advance.
180
+ for multiple computation points but don't know the "future points" in advance.
171
181
 
172
182
  ```python
173
183
  evaluable = GravityEvaluable(polyhedron=cube_polyhedron) # stores intermediate computation steps
@@ -188,21 +198,24 @@ This property is - by default - checked when constructing the `Polyhedron`! So,
188
198
  is impossible if not **explicitly** disabled to create an invalid `Polyhedron`.
189
199
  You can disable/ enable this setting via the optional `integrity_check` flag and can even
190
200
  automatically repair the ordering via `HEAL`.
191
- If you are confident that your mesh is defined correctly (e.g. checked once with the integrity check)
201
+ If you are confident that your mesh is defined correctly (e.g., checked once with the integrity check)
192
202
  you can disable this check (via `DISABLE`) to avoid the additional runtime overhead of the check.
203
+ Also, you can set the metric unit of the mesh and the density.
204
+ 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
205
 
194
206
  ```python
195
207
  cube_polyhedron = Polyhedron(
196
- polyhedral_source=(cube_vertices, cube_faces),
197
- density=cube_density,
208
+ polyhedral_source=(cube_vertices, cube_faces),# coordinates in m (default), km, or unitless
209
+ density=cube_density, # kg/m^3 (default) or kg/km^3 or unitless
198
210
  normal_orientation=NormalOrientation.INWARDS, # OUTWARDS (default) or INWARDS
199
211
  integrity_check=PolyhedronIntegrity.VERIFY, # VERIFY (default), DISABLE or HEAL
212
+ metric_unit=MetricUnit.METER, # METER (default), KILOMETER, UNITLESS
200
213
  )
201
214
  ```
202
215
 
203
216
  > [!TIP]
204
217
  > More examples and plots are depicted in the
205
- [jupyter notebook](script/polyhedral-gravity.ipynb).
218
+ [jupyter notebook](script/polyhedral-gravity.ipynb) and the [second jupyter notebook](script/Kleopatra.ipynb)
206
219
 
207
220
 
208
221
  ### Minimal C++ Example
@@ -267,8 +280,8 @@ As a second option, you can also install the python interface with pip from [PyP
267
280
  pip install polyhedral-gravity
268
281
  ```
269
282
 
270
- Binaries for the most common platforms are available on PyPI including
271
- Windows, Linux and macOS. For macOS and Linux, binaries for
283
+ Binaries for the most common platforms are available on PyPI, including
284
+ Windows, Linux, and macOS. For macOS and Linux, binaries for
272
285
  `x86_64` and `aarch64` are provided.
273
286
  In case `pip` uses the source distribution, please make sure that
274
287
  you have a C++17 capable compiler and CMake installed.
@@ -276,9 +289,9 @@ you have a C++17 capable compiler and CMake installed.
276
289
  ### From source
277
290
 
278
291
  The project uses the following dependencies,
279
- all of them are **automatically** set-up via CMake:
292
+ all of them are **automatically** set up via CMake:
280
293
 
281
- - GoogleTest (1.13.0 or compatible), only required for testing
294
+ - GoogleTest (1.15.2 or compatible), only required for testing
282
295
  - spdlog (1.13.0 or compatible), required for logging
283
296
  - tetgen (1.6 or compatible), required for I/O
284
297
  - yaml-cpp (0.8.0 or compatible), required for I/O
@@ -286,7 +299,7 @@ all of them are **automatically** set-up via CMake:
286
299
  - xsimd (11.1.0 or compatible), required for vectorization of the `atan(..)`
287
300
  - pybind11 (2.12.0 or compatible), required for the Python interface, but not the C++ standalone
288
301
 
289
- The module will be build using a C++17 capable compiler,
302
+ The module will be built using a C++17 capable compiler,
290
303
  CMake. Just execute the following command in
291
304
  the repository root folder:
292
305
 
@@ -304,7 +317,7 @@ export POLYHEDRAL_GRAVITY_PARALLELIZATION="TBB"
304
317
  pip install .
305
318
  ```
306
319
 
307
- (Optional: For a faster build you can install all dependencies available
320
+ (Optional: For a faster build, you can install all dependencies available
308
321
  for your system in your local python environment. That way, they
309
322
  won't be fetched from GitHub.)
310
323
 
@@ -312,7 +325,7 @@ won't be fetched from GitHub.)
312
325
 
313
326
  ### Building the C++ Library & Executable
314
327
 
315
- The program is build by using CMake. So first make sure that you installed
328
+ The program is built by using CMake. So first make sure that you installed
316
329
  CMake and then follow these steps:
317
330
 
318
331
  ```bash
@@ -324,17 +337,16 @@ cmake --build .
324
337
 
325
338
  The following options are available:
326
339
 
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 (`INFO`) | `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `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 |
340
+ | Name (Default) | Options |
341
+ |-------------------------------------------------------------:|:--------------------------------------------------------------------------------------------|
342
+ | POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
343
+ | POLYHEDRAL_GRAVITY_LOGGING_LEVEL (`INFO`) | `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `OFF` |
344
+ | BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
345
+ | BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
346
+ | BUILD_POLYHEDRAL_GRAVITY_PYTHON_INTERFACE (`ON`) | Build the Python interface |
335
347
 
336
348
  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`.
349
+ It is further not recommended to change the POLYHEDRAL_GRAVITY_LOGGING_LEVEL to something else than `INFO=2`.
338
350
 
339
351
  The recommended CMake settings using the `TBB` backend would look like this:
340
352
 
@@ -361,23 +373,24 @@ It is required to specify the source-files of the polyhedron's mesh (more info
361
373
  about the supported file in the [documentation](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html)), the density
362
374
  of the polyhedron, and the wished computation points where the
363
375
  gravity tensor shall be computed.
364
- Further one must specify the name of the .csv output file.
376
+ Further, one must specify the name of the .csv output file.
365
377
 
366
378
  ````yaml
367
379
  ---
368
380
  gravityModel:
369
381
  input:
370
- polyhedron: #polyhedron source-file(s)
382
+ polyhedron: # polyhedron source-file(s)
371
383
  - "../example-config/data/tsoulis.node" # .node contains the vertices
372
384
  - "../example-config/data/tsoulis.face" # .face contains the triangular faces
373
- density: 2670.0 # constant density, units must match with the mesh (see section below)
374
- points: # Location of the computation point(s) P
385
+ density: 2670.0 # constant density, units must match with the mesh (see a section below)
386
+ # Depends on metric_unit: 'km' -> kg/km^3, 'm' -> kg/m^3, 'unitless' -> 'unitless'
387
+ points: # Location of the computation point(s) P
375
388
  - [ 0, 0, 0 ] # Here it is situated at the origin
376
- check_mesh: true # Fully optional, enables mesh autodetect+repair of
389
+ check_mesh: true # Fully optional, enables mesh autodetect+repair of
377
390
  # the polyhedron's vertex ordering (not given: true)
391
+ metric_unit: m # Unit of mesh: One of 'm', 'km' or 'unitless' (not given: 'm')
378
392
  output:
379
- filename: "gravity_result.csv" # The name of the output file
380
-
393
+ filename: "gravity_result.csv" # The name of the output file
381
394
  ````
382
395
 
383
396
  #### Output
@@ -388,8 +401,8 @@ computation point *P*.
388
401
 
389
402
  ## Testing
390
403
 
391
- The project uses GoogleTest for testing. In oder to execute those
392
- tests just execute the following command in the build directory:
404
+ The project uses GoogleTest for testing.
405
+ In order to execute those tests, just execute the following command in the build directory:
393
406
 
394
407
  ```bash
395
408
  ctest
@@ -404,5 +417,5 @@ pytest
404
417
  ## Contributing
405
418
 
406
419
  We are happy to accept contributions to the project in the form of
407
- suggestions, bug reports and pull requests. Please have a look at
420
+ suggestions, bug reports, and pull requests. Please have a look at
408
421
  the [contributing guidelines](CONTRIBUTING.md) for more information.
@@ -76,20 +76,20 @@ The evaluation of the polyhedral gravity model requires the following parameters
76
76
  | Polyhedral Mesh (either as vertices & faces or as polyhedral source files) |
77
77
  | Constant Density $\rho$ |
78
78
 
79
- The mesh and the constants density's unit must match.
80
- Have a look the documentation to view the [supported mesh files](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html).
79
+ The mesh and the constant density's unit must match.
80
+ Have a look at the documentation to view the [supported mesh files](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html).
81
81
 
82
82
  ### Output
83
83
 
84
84
  The calculation outputs the following parameters for every Computation Point *P*.
85
85
  The units of the respective output depend on the units of the input parameters (mesh and density)!
86
- Hence, if e.g. your mesh is in $km$, the density must match. Further, output units will be different accordingly.
86
+ Hence, if e.g., your mesh is in $km$, the density must match. Further, output units will be different accordingly.
87
87
 
88
- | Name | Unit (if mesh in $[m]$ and $\rho$ in $[kg/m^3]$) | Comment |
89
- |:----------------------------------------------------------:|:------------------------------------------------:|:-----------------------------------------------------------------:|
90
- | $V$ | $\frac{m^2}{s^2}$ or $\frac{J}{kg}$ | The potential or also called specific energy |
91
- | $V_x$, $V_y$, $V_z$ | $\frac{m}{s^2}$ | The gravitational accerleration in the three cartesian directions |
92
- | $V_{xx}$, $V_{yy}$, $V_{zz}$, $V_{xy}$, $V_{xz}$, $V_{yz}$ | $\frac{1}{s^2}$ | The spatial rate of change of the gravitational accleration |
88
+ | Name | Unit (if mesh in $[m]$ and $\rho$ in $[kg/m^3]$) | Comment |
89
+ |:----------------------------------------------------------:|:------------------------------------------------:|:----------------------------------------------------------------:|
90
+ | $V$ | $\frac{m^2}{s^2}$ or $\frac{J}{kg}$ | The potential or also called specific energy |
91
+ | $V_x$, $V_y$, $V_z$ | $\frac{m}{s^2}$ | The gravitational acceleration in the three cartesian directions |
92
+ | $V_{xx}$, $V_{yy}$, $V_{zz}$, $V_{xy}$, $V_{xz}$, $V_{yz}$ | $\frac{1}{s^2}$ | The spatial rate of change of the gravitational acceleration |
93
93
 
94
94
 
95
95
  >[!NOTE]
@@ -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)
@@ -148,7 +148,7 @@ potential, acceleration, tensor = evaluate(
148
148
  The more advanced way is to use the `GravityEvaluable` class. It caches the
149
149
  internal data structure and properties which can be reused for multiple
150
150
  evaluations. This is especially useful if you want to compute the gravity
151
- for multiple computation points, but don't know the "future points" in advance.
151
+ for multiple computation points but don't know the "future points" in advance.
152
152
 
153
153
  ```python
154
154
  evaluable = GravityEvaluable(polyhedron=cube_polyhedron) # stores intermediate computation steps
@@ -169,21 +169,24 @@ This property is - by default - checked when constructing the `Polyhedron`! So,
169
169
  is impossible if not **explicitly** disabled to create an invalid `Polyhedron`.
170
170
  You can disable/ enable this setting via the optional `integrity_check` flag and can even
171
171
  automatically repair the ordering via `HEAL`.
172
- If you are confident that your mesh is defined correctly (e.g. checked once with the integrity check)
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
@@ -248,8 +251,8 @@ As a second option, you can also install the python interface with pip from [PyP
248
251
  pip install polyhedral-gravity
249
252
  ```
250
253
 
251
- Binaries for the most common platforms are available on PyPI including
252
- Windows, Linux and macOS. For macOS and Linux, binaries for
254
+ Binaries for the most common platforms are available on PyPI, including
255
+ Windows, Linux, and macOS. For macOS and Linux, binaries for
253
256
  `x86_64` and `aarch64` are provided.
254
257
  In case `pip` uses the source distribution, please make sure that
255
258
  you have a C++17 capable compiler and CMake installed.
@@ -257,9 +260,9 @@ you have a C++17 capable compiler and CMake installed.
257
260
  ### From source
258
261
 
259
262
  The project uses the following dependencies,
260
- all of them are **automatically** set-up via CMake:
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
@@ -267,7 +270,7 @@ all of them are **automatically** set-up via CMake:
267
270
  - xsimd (11.1.0 or compatible), required for vectorization of the `atan(..)`
268
271
  - pybind11 (2.12.0 or compatible), required for the Python interface, but not the C++ standalone
269
272
 
270
- The module will be build using a C++17 capable compiler,
273
+ The module will be built using a C++17 capable compiler,
271
274
  CMake. Just execute the following command in
272
275
  the repository root folder:
273
276
 
@@ -285,7 +288,7 @@ export POLYHEDRAL_GRAVITY_PARALLELIZATION="TBB"
285
288
  pip install .
286
289
  ```
287
290
 
288
- (Optional: For a faster build you can install all dependencies available
291
+ (Optional: For a faster build, you can install all dependencies available
289
292
  for your system in your local python environment. That way, they
290
293
  won't be fetched from GitHub.)
291
294
 
@@ -293,7 +296,7 @@ won't be fetched from GitHub.)
293
296
 
294
297
  ### Building the C++ Library & Executable
295
298
 
296
- The program is build by using CMake. So first make sure that you installed
299
+ The program is built by using CMake. So first make sure that you installed
297
300
  CMake and then follow these steps:
298
301
 
299
302
  ```bash
@@ -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 (`INFO`) | `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `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 recommended 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
 
@@ -342,23 +344,24 @@ It is required to specify the source-files of the polyhedron's mesh (more info
342
344
  about the supported file in the [documentation](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html)), the density
343
345
  of the polyhedron, and the wished computation points where the
344
346
  gravity tensor shall be computed.
345
- Further one must specify the name of the .csv output file.
347
+ Further, one must specify the name of the .csv output file.
346
348
 
347
349
  ````yaml
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
- density: 2670.0 # constant density, units must match with the mesh (see section below)
355
- points: # Location of the computation point(s) P
356
+ density: 2670.0 # constant density, units must match with the mesh (see a section below)
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
@@ -369,8 +372,8 @@ computation point *P*.
369
372
 
370
373
  ## Testing
371
374
 
372
- The project uses GoogleTest for testing. In oder to execute those
373
- tests just execute the following command in the build directory:
375
+ The project uses GoogleTest for testing.
376
+ In order to execute those tests, just execute the following command in the build directory:
374
377
 
375
378
  ```bash
376
379
  ctest
@@ -385,5 +388,5 @@ pytest
385
388
  ## Contributing
386
389
 
387
390
  We are happy to accept contributions to the project in the form of
388
- suggestions, bug reports and pull requests. Please have a look at
391
+ suggestions, bug reports, and pull requests. Please have a look at
389
392
  the [contributing guidelines](CONTRIBUTING.md) for more information.
@@ -0,0 +1,26 @@
1
+ # Find clang format
2
+ find_program(CLANG_FORMAT clang-format)
3
+
4
+ # Ensure clang-format was found
5
+ if(NOT CLANG_FORMAT)
6
+ message(STATUS "clang-format not found. Please install it to use clang-format via CMake")
7
+ else()
8
+ message(STATUS "clang-format found. You can format all source files via `cmake --build . --target format`")
9
+ file(GLOB_RECURSE CLANG_FORMAT_SRC
10
+ "${PROJECT_SOURCE_DIR}/src/*.cpp"
11
+ "${PROJECT_SOURCE_DIR}/src/*.h"
12
+ "${PROJECT_SOURCE_DIR}/test/*.cpp"
13
+ "${PROJECT_SOURCE_DIR}/test/*.h"
14
+ )
15
+ add_custom_command(
16
+ OUTPUT format_all_files
17
+ COMMAND ${CLANG_FORMAT} -i ${CLANG_FORMAT_SRC}
18
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
19
+ COMMENT "Formatting all source and test files with clang-format"
20
+ VERBATIM
21
+ )
22
+
23
+ add_custom_target(format
24
+ DEPENDS format_all_files
25
+ )
26
+ endif()
@@ -0,0 +1,25 @@
1
+ find_program(CMAKE_FORMAT_EXECUTABLE NAMES cmake-format)
2
+
3
+ if (NOT CMAKE_FORMAT_EXECUTABLE)
4
+ message(STATUS "cmake-format not found. Please install it to use cmake-format via CMake")
5
+ else ()
6
+ message(STATUS "cmake-format found. You can format all source files via `cmake --build . --target format_cmake`")
7
+
8
+ # Create a list of all .cmake files in the project
9
+ file(GLOB_RECURSE CMAKE_FORMAT_FILES
10
+ "${PROJECT_SOURCE_DIR}/*.cmake"
11
+ "${PROJECT_SOURCE_DIR}/CMakeLists.txt"
12
+ )
13
+
14
+ # Add a custom target to format all .cmake files
15
+ add_custom_command(
16
+ OUTPUT format_cmake_files
17
+ COMMAND ${CMAKE_FORMAT_EXECUTABLE} --in-place ${CMAKE_FORMAT_FILES}
18
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
19
+ COMMENT "Formatting all cmake files in the project with cmake-format"
20
+ VERBATIM
21
+ )
22
+ add_custom_target(format_cmake
23
+ DEPENDS format_cmake_files
24
+ )
25
+ endif ()