polyhedral-gravity 2.0.3__tar.gz → 3.0rc3__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.
- polyhedral_gravity-3.0rc3/PKG-INFO +406 -0
- polyhedral_gravity-3.0rc3/README.md +387 -0
- polyhedral_gravity-3.0rc3/polyhedral_gravity.egg-info/PKG-INFO +406 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/polyhedral_gravity.egg-info/SOURCES.txt +7 -9
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/setup.py +58 -14
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/main.cpp +5 -21
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/input/ConfigSource.h +2 -1
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/input/DataSource.h +2 -1
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/input/TetgenAdapter.cpp +2 -2
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/input/TetgenAdapter.h +5 -5
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/input/YAMLConfigReader.cpp +1 -1
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/input/YAMLConfigReader.h +4 -4
- {polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation → polyhedral_gravity-3.0rc3/src/polyhedralGravity/model}/GravityEvaluable.cpp +23 -16
- {polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation → polyhedral_gravity-3.0rc3/src/polyhedralGravity/model}/GravityEvaluable.h +47 -39
- polyhedral_gravity-3.0rc3/src/polyhedralGravity/model/GravityModel.cpp +15 -0
- {polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation → polyhedral_gravity-3.0rc3/src/polyhedralGravity/model}/GravityModel.h +10 -15
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/model/GravityModelData.h +11 -10
- {polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation → polyhedral_gravity-3.0rc3/src/polyhedralGravity/model}/GravityModelDetail.h +52 -53
- polyhedral_gravity-3.0rc3/src/polyhedralGravity/model/Polyhedron.cpp +252 -0
- polyhedral_gravity-3.0rc3/src/polyhedralGravity/model/Polyhedron.h +378 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/output/CSVWriter.h +3 -3
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/util/UtilityConstants.h +1 -1
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/util/UtilityContainer.h +131 -85
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/util/UtilityThrust.h +8 -8
- polyhedral_gravity-3.0rc3/src/polyhedralGravityPython/PolyhedralGravityPython.cpp +306 -0
- polyhedral_gravity-2.0.3/PKG-INFO +0 -15
- polyhedral_gravity-2.0.3/README.md +0 -210
- polyhedral_gravity-2.0.3/polyhedral_gravity.egg-info/PKG-INFO +0 -15
- polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation/GravityModel.cpp +0 -24
- polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation/MeshChecking.cpp +0 -86
- polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation/MeshChecking.h +0 -62
- polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation/PolyhedronTransform.h +0 -29
- polyhedral_gravity-2.0.3/src/polyhedralGravity/model/Polyhedron.h +0 -151
- polyhedral_gravity-2.0.3/src/polyhedralGravityPython/PolyhedralGravityPython.cpp +0 -139
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/CMakeLists.txt +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/LICENSE +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/MANIFEST.in +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/FindSphinx.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/gtest.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/pybind11.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/spdlog.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/tbb.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/tetgen.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/thrust.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/xsimd.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/cmake/yaml.cmake +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/polyhedral_gravity.egg-info/dependency_links.txt +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/polyhedral_gravity.egg-info/not-zip-safe +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/polyhedral_gravity.egg-info/top_level.txt +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/setup.cfg +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/CMakeLists.txt +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/CMakeLists.txt +0 -0
- {polyhedral_gravity-2.0.3/src/polyhedralGravity/calculation → polyhedral_gravity-3.0rc3/src/polyhedralGravity/model}/GravityModelDetail.cpp +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/output/CSVWriter.cpp +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/output/Logging.cpp +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravity/output/Logging.h +0 -0
- {polyhedral_gravity-2.0.3 → polyhedral_gravity-3.0rc3}/src/polyhedralGravityPython/CMakeLists.txt +0 -0
@@ -0,0 +1,406 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: polyhedral_gravity
|
3
|
+
Version: 3.0rc3
|
4
|
+
Summary: Package to compute full gravity tensor of a given constant density polyhedron for arbitrary points according to the geodetic convention
|
5
|
+
Author: Jonas Schuhmacher
|
6
|
+
Author-email: jonas.schuhmacher@tum.de
|
7
|
+
License: GPLv3
|
8
|
+
Project-URL: Homepage, https://github.com/esa/polyhedral-gravity-model
|
9
|
+
Project-URL: Source, https://github.com/esa/polyhedral-gravity-model
|
10
|
+
Project-URL: Documentation, https://esa.github.io/polyhedral-gravity-model/
|
11
|
+
Project-URL: Issues, https://github.com/esa/polyhedral-gravity-model/issues
|
12
|
+
Project-URL: Changelog, https://github.com/esa/polyhedral-gravity-model/releases
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
14
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
15
|
+
Classifier: Programming Language :: C++
|
16
|
+
Classifier: Programming Language :: Python
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
18
|
+
Classifier: Operating System :: MacOS
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
20
|
+
Classifier: Intended Audience :: Science/Research
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
22
|
+
Requires-Python: >=3.6
|
23
|
+
Description-Content-Type: text/markdown
|
24
|
+
License-File: LICENSE
|
25
|
+
|
26
|
+
# polyhedral-gravity-model
|
27
|
+
|
28
|
+

|
29
|
+

|
30
|
+

|
31
|
+
|
32
|
+

|
33
|
+

|
34
|
+

|
35
|
+
|
36
|
+

|
37
|
+

|
38
|
+

|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
## Table of Contents
|
43
|
+
|
44
|
+
- [References](#references)
|
45
|
+
- [Documentation & Examples](#documentation--examples)
|
46
|
+
- [Input & Output (C++ and Python)](#input--output-c-and-python)
|
47
|
+
- [Minimal Python Example](#minimal-python-example)
|
48
|
+
- [Minimal C++ Example](#minimal-c-example)
|
49
|
+
- [Installation](#installation)
|
50
|
+
- [With conda](#with-conda)
|
51
|
+
- [With pip](#with-pip)
|
52
|
+
- [From source](#from-source)
|
53
|
+
- [C++ Library & Executable](#c-library--executable)
|
54
|
+
- [Building the C++ Library & Executable](#building-the-c-library--executable)
|
55
|
+
- [Running the C++ Executable](#running-the-c-executable)
|
56
|
+
- [Testing](#testing)
|
57
|
+
- [Contributing](#contributing)
|
58
|
+
|
59
|
+
## References
|
60
|
+
|
61
|
+
This code is a validated implementation in C++17 of the Polyhedral Gravity Model
|
62
|
+
by Tsoulis et al.. It was created in a collaborative project between
|
63
|
+
TU Munich and ESA's Advanced Concepts Team. Please refer to the
|
64
|
+
[project report](https://mediatum.ub.tum.de/doc/1695208/1695208.pdf)
|
65
|
+
for extensive information about the theoretical background, related work,
|
66
|
+
implementation & design decisions, application, verification,
|
67
|
+
and runtime measurements of the presented code.
|
68
|
+
|
69
|
+
The implementation is based on the
|
70
|
+
paper [Tsoulis, D., 2012. Analytical computation of the full gravity tensor of a homogeneous arbitrarily shaped polyhedral source using line integrals. Geophysics, 77(2), pp.F1-F11.](http://dx.doi.org/10.1190/geo2010-0334.1)
|
71
|
+
and its corresponding implementation in FORTRAN.
|
72
|
+
|
73
|
+
Supplementary details can be found in the more recent
|
74
|
+
paper [TSOULIS, Dimitrios; GAVRIILIDOU, Georgia. A computational review of the line integral analytical formulation of the polyhedral gravity signal. Geophysical Prospecting, 2021, 69. Jg., Nr. 8-9, S. 1745-1760.](https://doi.org/10.1111/1365-2478.13134)
|
75
|
+
and its corresponding [implementation in MATLAB](https://github.com/Gavriilidou/GPolyhedron),
|
76
|
+
which is strongly based on the former implementation in FORTRAN.
|
77
|
+
|
78
|
+
## Documentation & Examples
|
79
|
+
|
80
|
+
> [!NOTE]
|
81
|
+
> The [GitHub Pages](https://esa.github.io/polyhedral-gravity-model) of this project
|
82
|
+
contain the full extensive documentation of C++ Library and the Python Interface
|
83
|
+
as well as background on the gravity model and advanced settings not detailed here!
|
84
|
+
|
85
|
+
## Input & Output (C++ and Python)
|
86
|
+
|
87
|
+
### Input
|
88
|
+
|
89
|
+
The evaluation of the polyhedral gravity model requires the following parameters:
|
90
|
+
|
91
|
+
| Name |
|
92
|
+
|----------------------------------------------------------------------------|
|
93
|
+
| Polyhedral Mesh (either as vertices & faces or as polyhedral source files) |
|
94
|
+
| Constant Density $\rho$ |
|
95
|
+
|
96
|
+
The mesh and the constants density's unit must match.
|
97
|
+
Have a look the documentation to view the [supported mesh files](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html).
|
98
|
+
|
99
|
+
### Output
|
100
|
+
|
101
|
+
The calculation outputs the following parameters for every Computation Point *P*.
|
102
|
+
The units of the respective output depend on the units of the input parameters (mesh and density)!
|
103
|
+
Hence, if e.g. your mesh is in $km$, the density must match. Further, output units will be different accordingly.
|
104
|
+
|
105
|
+
| Name | Unit (if mesh in $[m]$ and $\rho$ in $[kg/m^3]$) | Comment |
|
106
|
+
|:----------------------------------------------------------:|:------------------------------------------------:|:-----------------------------------------------------------------:|
|
107
|
+
| $V$ | $\frac{m^2}{s^2}$ or $\frac{J}{kg}$ | The potential or also called specific energy |
|
108
|
+
| $V_x$, $V_y$, $V_z$ | $\frac{m}{s^2}$ | The gravitational accerleration in the three cartesian directions |
|
109
|
+
| $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 |
|
110
|
+
|
111
|
+
|
112
|
+
>[!NOTE]
|
113
|
+
>This gravity model's output obeys to the geodesy and geophysics sign conventions.
|
114
|
+
Hence, the potential $V$ for a polyhedron with a mass $m > 0$ is defined as **positive**.
|
115
|
+
Accordingly, the accelerations are defined as $\textbf{g} = + \nabla V$.
|
116
|
+
|
117
|
+
|
118
|
+
### Minimal Python Example
|
119
|
+
|
120
|
+
The following example shows how to use the python interface to compute the gravity
|
121
|
+
around a cube:
|
122
|
+
|
123
|
+
```python
|
124
|
+
import numpy as np
|
125
|
+
from polyhedral_gravity import Polyhedron, GravityEvaluable, evaluate, PolyhedronIntegrity, NormalOrientation
|
126
|
+
|
127
|
+
# We define the cube as a polyhedron with 8 vertices and 12 triangular faces
|
128
|
+
# The polyhedron's normals point outwards (see below for checking this)
|
129
|
+
# The density is set to 1.0
|
130
|
+
cube_vertices = np.array(
|
131
|
+
[[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1],
|
132
|
+
[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]]
|
133
|
+
)
|
134
|
+
cube_faces = np.array(
|
135
|
+
[[1, 3, 2], [0, 3, 1], [0, 1, 5], [0, 5, 4], [0, 7, 3], [0, 4, 7],
|
136
|
+
[1, 2, 6], [1, 6, 5], [2, 3, 6], [3, 7, 6], [4, 5, 6], [4, 6, 7]]
|
137
|
+
)
|
138
|
+
cube_density = 1.0
|
139
|
+
computation_point = np.array([0, 0, 0])
|
140
|
+
```
|
141
|
+
|
142
|
+
We first, define a constant density Polyhedron from `vertices` and `faces`
|
143
|
+
|
144
|
+
```python
|
145
|
+
cube_polyhedron = Polyhedron(
|
146
|
+
polyhedral_source=(cube_vertices, cube_faces),
|
147
|
+
density=cube_density,
|
148
|
+
)
|
149
|
+
```
|
150
|
+
|
151
|
+
In case you want to hand over the polyhedron via a supported file format,
|
152
|
+
just replace the `polyhedral_source` argument with *a list of strings*,
|
153
|
+
where each string is the path to a supported file format.
|
154
|
+
|
155
|
+
Continuing, the simplest way to compute the gravity is to use the `evaluate` function:
|
156
|
+
|
157
|
+
```python
|
158
|
+
potential, acceleration, tensor = evaluate(
|
159
|
+
polyhedron=cube_polyhedron,
|
160
|
+
computation_points=computation_point,
|
161
|
+
parallel=True,
|
162
|
+
)
|
163
|
+
```
|
164
|
+
|
165
|
+
The more advanced way is to use the `GravityEvaluable` class. It caches the
|
166
|
+
internal data structure and properties which can be reused for multiple
|
167
|
+
evaluations. This is especially useful if you want to compute the gravity
|
168
|
+
for multiple computation points, but don't know the "future points" in advance.
|
169
|
+
|
170
|
+
```python
|
171
|
+
evaluable = GravityEvaluable(polyhedron=cube_polyhedron)
|
172
|
+
potential, acceleration, tensor = evaluable(
|
173
|
+
computation_points=computation_point,
|
174
|
+
parallel=True,
|
175
|
+
)
|
176
|
+
```
|
177
|
+
|
178
|
+
Note that the `computation_point` could also be (N, 3)-shaped array.
|
179
|
+
In this case, the return value of `evaluate(..)` or an `GravityEvaluable` will
|
180
|
+
be a list of triplets comprising potential, acceleration, and tensor.
|
181
|
+
|
182
|
+
The gravity model requires that all the polyhedron's plane unit normals consistently
|
183
|
+
point outwards or inwards the polyhedron. You can specify this via the `normal_orientation`.
|
184
|
+
This property is - by default - checked when constructing the `Polyhedron`! So, don't worry, it
|
185
|
+
is impossible if not **explicitly** disabled to create an invalid `Polyhedron`.
|
186
|
+
You can disable/ enable this setting via the optional `integrity_check` flag and can even
|
187
|
+
automatically repair the ordering via `HEAL`.
|
188
|
+
As advanced user/ when you "know the mesh",
|
189
|
+
you want to disable this check (via `DISABLE`) due to the additional runtime overhead!
|
190
|
+
|
191
|
+
```python
|
192
|
+
cube_polyhedron = Polyhedron(
|
193
|
+
polyhedral_source=(cube_vertices, cube_faces),
|
194
|
+
density=cube_density,
|
195
|
+
normal_orientation=NormalOrientation.INWARDS, # OUTWARDS (default) or INWARDS
|
196
|
+
integrity_check=PolyhedronIntegrity.VERIFY, # AUTOMATIC (default) == VERIFY, DISABLE or HEAL
|
197
|
+
)
|
198
|
+
```
|
199
|
+
|
200
|
+
> [!TIP]
|
201
|
+
> More examples and plots are depicted in the
|
202
|
+
[jupyter notebook](script/polyhedral-gravity.ipynb).
|
203
|
+
|
204
|
+
|
205
|
+
### Minimal C++ Example
|
206
|
+
|
207
|
+
The following example shows how to use the C++ library to compute the gravity.
|
208
|
+
It works analogously to the Python example above.
|
209
|
+
|
210
|
+
```cpp
|
211
|
+
// Defining the input like above in the Python example
|
212
|
+
std::vector<std::array<double, 3>> vertices = ...
|
213
|
+
std::vector<std::array<size_t, 3>> faces = ...
|
214
|
+
double density = 1.0;
|
215
|
+
// The constant density polyhedron is defined by its vertices & faces
|
216
|
+
// It also supports the hand-over of NormalOrientation and PolyhedronIntegrity as optional arguments
|
217
|
+
// as above described for the Python Interface
|
218
|
+
Polyhedron polyhedron{vertices, faces, density};
|
219
|
+
std::vector<std::array<double, 3>> points = ...
|
220
|
+
std::array<double, 3> point = points[0];
|
221
|
+
bool parallel = true;
|
222
|
+
```
|
223
|
+
|
224
|
+
The C++ library provides also two ways to compute the gravity. Via
|
225
|
+
the free function `evaluate`...
|
226
|
+
|
227
|
+
```cpp
|
228
|
+
const auto[pot, acc, tensor] = GravityModel::evaluate(polyhedron, point, parallel);
|
229
|
+
```
|
230
|
+
|
231
|
+
... or via the `GravityEvaluable` class.
|
232
|
+
|
233
|
+
```cpp
|
234
|
+
// Instantiation of the GravityEvaluable object
|
235
|
+
GravityEvaluable evaluable{polyhedron};
|
236
|
+
|
237
|
+
// From now, we can evaluate the gravity model for any point with
|
238
|
+
const auto[potential, acceleration, tensor] = evaluable(point, parallel);
|
239
|
+
// or for multiple points with
|
240
|
+
const auto results = evaluable(points, parallel);
|
241
|
+
```
|
242
|
+
|
243
|
+
Similarly to Python, the C++ implementation also provides mesh checking capabilities.
|
244
|
+
|
245
|
+
> [!TIP]
|
246
|
+
> For reference, have a look at [the main method](./src/main.cpp) of the C++ executable.
|
247
|
+
|
248
|
+
## Installation
|
249
|
+
|
250
|
+
### With conda
|
251
|
+
|
252
|
+
The python interface can be easily installed with
|
253
|
+
[conda](https://anaconda.org/conda-forge/polyhedral-gravity-model):
|
254
|
+
|
255
|
+
```bash
|
256
|
+
conda install -c conda-forge polyhedral-gravity-model
|
257
|
+
```
|
258
|
+
|
259
|
+
### With pip
|
260
|
+
|
261
|
+
As a second option, you can also install the python interface with pip from [PyPi](https://pypi.org/project/polyhedral-gravity/).
|
262
|
+
|
263
|
+
```bash
|
264
|
+
pip install polyhedral-gravity
|
265
|
+
```
|
266
|
+
|
267
|
+
Binaries for the most common platforms are available on PyPI including
|
268
|
+
Windows, Linux and macOS. For macOS and Linux, binaries for
|
269
|
+
`x86_64` and `aarch64` are provided.
|
270
|
+
In case `pip` uses the source distribution, please make sure that
|
271
|
+
you have a C++17 capable compiler and CMake installed.
|
272
|
+
|
273
|
+
### From source
|
274
|
+
|
275
|
+
The project uses the following dependencies,
|
276
|
+
all of them are **automatically** set-up via CMake:
|
277
|
+
|
278
|
+
- GoogleTest (1.13.0 or compatible), only required for testing
|
279
|
+
- spdlog (1.11.0 or compatible), required for logging
|
280
|
+
- tetgen (1.6 or compatible), required for I/O
|
281
|
+
- yaml-cpp (0.7.0 or compatible), required for I/O
|
282
|
+
- thrust (2.1.0 or compatible), required for parallelization and utility
|
283
|
+
- xsimd (11.1.0 or compatible), required for vectorization of the `atan(..)`
|
284
|
+
- pybind11 (2.10.4 or compatible), required for the Python interface, but not the C++ standalone
|
285
|
+
|
286
|
+
The module will be build using a C++17 capable compiler,
|
287
|
+
CMake. Just execute the following command in
|
288
|
+
the repository root folder:
|
289
|
+
|
290
|
+
```bash
|
291
|
+
pip install .
|
292
|
+
```
|
293
|
+
|
294
|
+
To modify the build options (like parallelization) have a look
|
295
|
+
at the [next paragraph](#building-the-c-library--executable). The options
|
296
|
+
are modified by setting the environment variables before executing
|
297
|
+
the `pip install .` command, e.g.:
|
298
|
+
|
299
|
+
```bash
|
300
|
+
export POLYHEDRAL_GRAVITY_PARALLELIZATION="TBB"
|
301
|
+
pip install .
|
302
|
+
```
|
303
|
+
|
304
|
+
(Optional: For a faster build you can install all dependencies available
|
305
|
+
for your system in your local python environment. That way, they
|
306
|
+
won't be fetched from GitHub.)
|
307
|
+
|
308
|
+
## C++ Library & Executable
|
309
|
+
|
310
|
+
### Building the C++ Library & Executable
|
311
|
+
|
312
|
+
The program is build by using CMake. So first make sure that you installed
|
313
|
+
CMake and then follow these steps:
|
314
|
+
|
315
|
+
```bash
|
316
|
+
mkdir build
|
317
|
+
cd build
|
318
|
+
cmake .. <options>
|
319
|
+
cmake --build .
|
320
|
+
```
|
321
|
+
|
322
|
+
The following options are available:
|
323
|
+
|
324
|
+
| Name (Default) | Options |
|
325
|
+
|-------------------------------------------:|:-------------------------------------------------------------------------------------------|
|
326
|
+
| POLYHEDRAL_GRAVITY_PARALLELIZATION (`CPP`) | `CPP` = Serial Execution / `OMP` or `TBB` = Parallel Execution with OpenMP or Intel\'s TBB |
|
327
|
+
| LOGGING_LEVEL (`2`) | `0` = TRACE/ `1` = DEBUG/ `2` = INFO / `3` = WARN/ `4` = ERROR/ `5` = CRITICAL/ `6` = OFF |
|
328
|
+
| USE_LOCAL_TBB (`OFF`) | Use a local installation of `TBB` instead of setting it up via `CMake` |
|
329
|
+
| BUILD_POLYHEDRAL_GRAVITY_DOCS (`OFF`) | Build this documentation |
|
330
|
+
| BUILD_POLYHEDRAL_GRAVITY_TESTS (`ON`) | Build the Tests |
|
331
|
+
| BUILD_POLYHEDRAL_PYTHON_INTERFACE (`ON`) | Build the Python interface |
|
332
|
+
|
333
|
+
During testing POLYHEDRAL_GRAVITY_PARALLELIZATION=`TBB` has been the most performant.
|
334
|
+
It is further not recommend to change the LOGGING_LEVEL to something else than `INFO=2`.
|
335
|
+
|
336
|
+
The recommended CMake command would look like this (we only need to change `PARALLELIZATION_DEVICE`, since
|
337
|
+
the defaults of the others are already correctly set):
|
338
|
+
|
339
|
+
```bash
|
340
|
+
cmake .. -POLYHEDRAL_GRAVITY_PARALLELIZATION="TBB"
|
341
|
+
```
|
342
|
+
|
343
|
+
### Running the C++ Executable
|
344
|
+
|
345
|
+
After the build, the gravity model can be run by executing:
|
346
|
+
|
347
|
+
```bash
|
348
|
+
./polyhedralGravity <YAML-Configuration-File>
|
349
|
+
```
|
350
|
+
|
351
|
+
where the YAML-Configuration-File contains the required parameters.
|
352
|
+
Examples for Configuration Files and Polyhedral Source Files can be
|
353
|
+
found in this repository in the folder `/example-config/`.
|
354
|
+
|
355
|
+
#### Input Configuration File
|
356
|
+
|
357
|
+
The configuration should look similar to the given example below.
|
358
|
+
It is required to specify the source-files of the polyhedron's mesh (more info
|
359
|
+
about the supported file in the [documentation](https://esa.github.io/polyhedral-gravity-model/quickstart/supported_input.html)), the density
|
360
|
+
of the polyhedron, and the wished computation points where the
|
361
|
+
gravity tensor shall be computed.
|
362
|
+
Further one must specify the name of the .csv output file.
|
363
|
+
|
364
|
+
````yaml
|
365
|
+
---
|
366
|
+
gravityModel:
|
367
|
+
input:
|
368
|
+
polyhedron: #polyhedron source-file(s)
|
369
|
+
- "../example-config/data/tsoulis.node" # .node contains the vertices
|
370
|
+
- "../example-config/data/tsoulis.face" # .face contains the triangular faces
|
371
|
+
density: 2670.0 # constant density, units must match with the mesh (see section below)
|
372
|
+
points: # Location of the computation point(s) P
|
373
|
+
- [ 0, 0, 0 ] # Here it is situated at the origin
|
374
|
+
check_mesh: true # Fully optional, enables mesh autodetect+repair of
|
375
|
+
# the polyhedron's vertex ordering (not given: true)
|
376
|
+
output:
|
377
|
+
filename: "gravity_result.csv" # The name of the output file
|
378
|
+
|
379
|
+
````
|
380
|
+
|
381
|
+
#### Output
|
382
|
+
|
383
|
+
The executable produces a CSV file containing $V$, $V_x$, $V_y$, $V_z$,
|
384
|
+
$V_{xx}$, $V_{yy}$, $V_{zz}$, $V_{xy}$, $V_{xz}$, $V_{yz}$ for every
|
385
|
+
computation point *P*.
|
386
|
+
|
387
|
+
## Testing
|
388
|
+
|
389
|
+
The project uses GoogleTest for testing. In oder to execute those
|
390
|
+
tests just execute the following command in the build directory:
|
391
|
+
|
392
|
+
```bash
|
393
|
+
ctest
|
394
|
+
```
|
395
|
+
|
396
|
+
For the Python test suite, please execute the following command in the repository root folder:
|
397
|
+
|
398
|
+
```bash
|
399
|
+
pytest
|
400
|
+
```
|
401
|
+
|
402
|
+
## Contributing
|
403
|
+
|
404
|
+
We are happy to accept contributions to the project in the form of
|
405
|
+
suggestions, bug reports and pull requests. Please have a look at
|
406
|
+
the [contributing guidelines](CONTRIBUTING.md) for more information.
|