BeamMe 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. beamme-0.0.0/LICENSE +21 -0
  2. beamme-0.0.0/MANIFEST.in +1 -0
  3. beamme-0.0.0/PKG-INFO +407 -0
  4. beamme-0.0.0/README.md +353 -0
  5. beamme-0.0.0/pyproject.toml +57 -0
  6. beamme-0.0.0/setup.cfg +4 -0
  7. beamme-0.0.0/setup.py +45 -0
  8. beamme-0.0.0/src/BeamMe.egg-info/PKG-INFO +407 -0
  9. beamme-0.0.0/src/BeamMe.egg-info/SOURCES.txt +93 -0
  10. beamme-0.0.0/src/BeamMe.egg-info/dependency_links.txt +1 -0
  11. beamme-0.0.0/src/BeamMe.egg-info/requires.txt +20 -0
  12. beamme-0.0.0/src/BeamMe.egg-info/top_level.txt +3 -0
  13. beamme-0.0.0/src/build/cython_generated_code/src/meshpy/geometric_search/cython_lib.c +12675 -0
  14. beamme-0.0.0/src/meshpy/__init__.py +22 -0
  15. beamme-0.0.0/src/meshpy/abaqus/__init__.py +23 -0
  16. beamme-0.0.0/src/meshpy/abaqus/beam.py +70 -0
  17. beamme-0.0.0/src/meshpy/abaqus/input_file.py +338 -0
  18. beamme-0.0.0/src/meshpy/abaqus/material.py +45 -0
  19. beamme-0.0.0/src/meshpy/core/__init__.py +23 -0
  20. beamme-0.0.0/src/meshpy/core/base_mesh_item.py +42 -0
  21. beamme-0.0.0/src/meshpy/core/boundary_condition.py +142 -0
  22. beamme-0.0.0/src/meshpy/core/conf.py +182 -0
  23. beamme-0.0.0/src/meshpy/core/container.py +60 -0
  24. beamme-0.0.0/src/meshpy/core/coupling.py +165 -0
  25. beamme-0.0.0/src/meshpy/core/element.py +169 -0
  26. beamme-0.0.0/src/meshpy/core/element_beam.py +343 -0
  27. beamme-0.0.0/src/meshpy/core/element_volume.py +172 -0
  28. beamme-0.0.0/src/meshpy/core/geometry_set.py +366 -0
  29. beamme-0.0.0/src/meshpy/core/material.py +82 -0
  30. beamme-0.0.0/src/meshpy/core/mesh.py +1012 -0
  31. beamme-0.0.0/src/meshpy/core/mesh_utils.py +92 -0
  32. beamme-0.0.0/src/meshpy/core/node.py +178 -0
  33. beamme-0.0.0/src/meshpy/core/nurbs_patch.py +326 -0
  34. beamme-0.0.0/src/meshpy/core/rotation.py +483 -0
  35. beamme-0.0.0/src/meshpy/core/vtk_writer.py +372 -0
  36. beamme-0.0.0/src/meshpy/cosserat_curve/__init__.py +28 -0
  37. beamme-0.0.0/src/meshpy/cosserat_curve/cosserat_curve.py +438 -0
  38. beamme-0.0.0/src/meshpy/cosserat_curve/warping_along_cosserat_curve.py +351 -0
  39. beamme-0.0.0/src/meshpy/four_c/__init__.py +23 -0
  40. beamme-0.0.0/src/meshpy/four_c/beam_interaction_conditions.py +132 -0
  41. beamme-0.0.0/src/meshpy/four_c/beam_potential.py +241 -0
  42. beamme-0.0.0/src/meshpy/four_c/dbc_monitor.py +377 -0
  43. beamme-0.0.0/src/meshpy/four_c/element_beam.py +218 -0
  44. beamme-0.0.0/src/meshpy/four_c/element_volume.py +41 -0
  45. beamme-0.0.0/src/meshpy/four_c/function.py +48 -0
  46. beamme-0.0.0/src/meshpy/four_c/function_utility.py +108 -0
  47. beamme-0.0.0/src/meshpy/four_c/header_functions.py +731 -0
  48. beamme-0.0.0/src/meshpy/four_c/input_file.py +787 -0
  49. beamme-0.0.0/src/meshpy/four_c/locsys_condition.py +90 -0
  50. beamme-0.0.0/src/meshpy/four_c/material.py +223 -0
  51. beamme-0.0.0/src/meshpy/four_c/run_four_c.py +171 -0
  52. beamme-0.0.0/src/meshpy/four_c/solid_shell_thickness_direction.py +296 -0
  53. beamme-0.0.0/src/meshpy/four_c/yaml_dumper.py +72 -0
  54. beamme-0.0.0/src/meshpy/geometric_search/__init__.py +51 -0
  55. beamme-0.0.0/src/meshpy/geometric_search/arborx.py +62 -0
  56. beamme-0.0.0/src/meshpy/geometric_search/cython.py +50 -0
  57. beamme-0.0.0/src/meshpy/geometric_search/cython_lib.pyx +96 -0
  58. beamme-0.0.0/src/meshpy/geometric_search/find_close_points.py +171 -0
  59. beamme-0.0.0/src/meshpy/geometric_search/scipy.py +63 -0
  60. beamme-0.0.0/src/meshpy/geometric_search/utils.py +48 -0
  61. beamme-0.0.0/src/meshpy/mesh_creation_functions/__init__.py +25 -0
  62. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_basic_geometry.py +664 -0
  63. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_curve.py +271 -0
  64. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_fibers_in_rectangle.py +235 -0
  65. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_generic.py +375 -0
  66. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_honeycomb.py +280 -0
  67. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_nurbs.py +161 -0
  68. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_stent.py +361 -0
  69. beamme-0.0.0/src/meshpy/mesh_creation_functions/beam_wire.py +115 -0
  70. beamme-0.0.0/src/meshpy/mesh_creation_functions/nurbs_generic.py +589 -0
  71. beamme-0.0.0/src/meshpy/mesh_creation_functions/nurbs_geometries.py +819 -0
  72. beamme-0.0.0/src/meshpy/space_time/__init__.py +23 -0
  73. beamme-0.0.0/src/meshpy/space_time/beam_to_space_time.py +356 -0
  74. beamme-0.0.0/src/meshpy/utils/__init__.py +22 -0
  75. beamme-0.0.0/src/meshpy/utils/environment.py +78 -0
  76. beamme-0.0.0/src/meshpy/utils/nodes.py +283 -0
  77. beamme-0.0.0/tests/test_abaqus.py +129 -0
  78. beamme-0.0.0/tests/test_cosserat_curve.py +241 -0
  79. beamme-0.0.0/tests/test_create_cubit_input.py +120 -0
  80. beamme-0.0.0/tests/test_examples.py +55 -0
  81. beamme-0.0.0/tests/test_four_c.py +745 -0
  82. beamme-0.0.0/tests/test_four_c_simulation.py +1198 -0
  83. beamme-0.0.0/tests/test_function_utilities.py +82 -0
  84. beamme-0.0.0/tests/test_geometric_search.py +549 -0
  85. beamme-0.0.0/tests/test_geometric_search_utils.py +49 -0
  86. beamme-0.0.0/tests/test_header_functions.py +204 -0
  87. beamme-0.0.0/tests/test_input_file_utils.py +59 -0
  88. beamme-0.0.0/tests/test_mesh_creation_functions.py +1530 -0
  89. beamme-0.0.0/tests/test_meshpy.py +2056 -0
  90. beamme-0.0.0/tests/test_nurbs.py +405 -0
  91. beamme-0.0.0/tests/test_performance.py +333 -0
  92. beamme-0.0.0/tests/test_rotations.py +340 -0
  93. beamme-0.0.0/tests/test_space_time.py +246 -0
  94. beamme-0.0.0/tests/test_utils_environment.py +80 -0
  95. beamme-0.0.0/tests/test_utils_nodes.py +49 -0
beamme-0.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018-2025 MeshPy Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+ include src/meshpy/geometric_search/cython_lib.pyx
beamme-0.0.0/PKG-INFO ADDED
@@ -0,0 +1,407 @@
1
+ Metadata-Version: 2.4
2
+ Name: BeamMe
3
+ Version: 0.0.0
4
+ Summary: BeamMe: A general purpose 3D beam finite element input generator
5
+ Author: MeshPy Authors
6
+ Maintainer-email: Ivo Steinbrecher <ivo.steinbrecher@unibw.de>, David Rudlstorfer <david.rudlstorfer@tum.de>
7
+ License: The MIT License (MIT)
8
+
9
+ Copyright (c) 2018-2025 MeshPy Authors
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+ Project-URL: Homepage, https://imcs-compsim.github.io/meshpy/
29
+ Project-URL: Documentation, https://imcs-compsim.github.io/meshpy/api-documentation/
30
+ Project-URL: Repository, https://github.com/imcs-compsim/meshpy/
31
+ Project-URL: Issues, https://github.com/imcs-compsim/meshpy/issues/
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: autograd
35
+ Requires-Dist: geomdl
36
+ Requires-Dist: ipykernel
37
+ Requires-Dist: notebook
38
+ Requires-Dist: numpy
39
+ Requires-Dist: numpy-quaternion
40
+ Requires-Dist: pyvista
41
+ Requires-Dist: scipy
42
+ Requires-Dist: splinepy
43
+ Requires-Dist: vedo==2024.5.2
44
+ Requires-Dist: vtk
45
+ Provides-Extra: dev
46
+ Requires-Dist: coverage-badge; extra == "dev"
47
+ Requires-Dist: coverage; extra == "dev"
48
+ Requires-Dist: pdoc; extra == "dev"
49
+ Requires-Dist: pre-commit; extra == "dev"
50
+ Requires-Dist: pytest; extra == "dev"
51
+ Requires-Dist: pytest-cov; extra == "dev"
52
+ Requires-Dist: testbook; extra == "dev"
53
+ Dynamic: license-file
54
+
55
+ <div align="center">
56
+
57
+ # MeshPy <!-- omit from toc -->
58
+ </div>
59
+
60
+ <div align="center">
61
+
62
+ [![website](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/website.svg)](https://imcs-compsim.github.io/meshpy/)
63
+ [![documentation](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/documentation.svg)](https://imcs-compsim.github.io/meshpy/api-documentation)
64
+
65
+ </div>
66
+
67
+ <div align="center">
68
+
69
+ [![Code quality](https://github.com/imcs-compsim/meshpy/actions/workflows/check_code.yml/badge.svg)](https://github.com/imcs-compsim/meshpy/actions/workflows/check_code.yml?query=event%3Aschedule)
70
+ [![Test suite](https://github.com/imcs-compsim/meshpy/actions/workflows/testing.yml/badge.svg)](https://github.com/imcs-compsim/meshpy/actions/workflows/testing.yml?query=event%3Aschedule)
71
+ [![Coverage](https://imcs-compsim.github.io/meshpy/coverage-badge/coverage_badge.svg)](https://imcs-compsim.github.io/meshpy/coverage-report/)
72
+
73
+ </div>
74
+
75
+ <div align="center">
76
+
77
+ [![Testing Linux/Ubuntu](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/testing_linux_ubuntu.svg)](https://github.com/imcs-compsim/meshpy/actions/workflows/testing.yml?query=event%3Aschedule)
78
+ [![Testing macOS](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/testing_macos.svg)](https://github.com/imcs-compsim/meshpy/actions/workflows/testing.yml?query=event%3Aschedule)
79
+ [![Testing Windows](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/testing_windows.svg)](https://github.com/imcs-compsim/meshpy/actions/workflows/testing.yml?query=event%3Aschedule)
80
+
81
+ </div>
82
+
83
+ <div align="center">
84
+
85
+ [![pre-commit](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/pre-commit.svg)](https://pre-commit.com/)
86
+ [![ruff-formatter](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/ruff-formatter.svg)](https://docs.astral.sh/ruff/formatter)
87
+ [![ruff-linter](https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/badges/ruff-linter.svg)](https://docs.astral.sh/ruff/linter)
88
+
89
+ </div>
90
+
91
+ MeshPy is a general purpose 3D beam finite element input generator written in Python.
92
+ It contains advanced geometry creation and manipulation functions to create complex beam geometries, including a consistent handling of finite rotations.
93
+ It can be used to create input files for the following finite element solvers (adaption to other solvers is easily possibly):
94
+ - [4C](https://www.4c-multiphysics.org/) (academic finite element solver)
95
+ - [Abaqus](https://en.wikipedia.org/wiki/Abaqus) (commercial software package)
96
+ - [AceFEM](http://symech.fgg.uni-lj.si) (Finite element package for automation of the finite element method in [Mathematica](https://www.wolfram.com/mathematica/))
97
+
98
+ MeshPy is developed at the [Institute for Mathematics and Computer-Based Simulation (IMCS)](https://www.unibw.de/imcs-en) at the Universität der Bundeswehr München.
99
+
100
+ ## Overview <!-- omit from toc -->
101
+ - [Examples](#examples)
102
+ - [How to use MeshPy?](#how-to-use-meshpy)
103
+ - [How to cite MeshPy?](#how-to-cite-meshpy)
104
+ - [Work that uses MeshPy](#work-that-uses-meshpy)
105
+ - [Installation](#installation)
106
+ - [Python environment](#python-environment)
107
+ - [Install MeshPy from source](#install-meshpy-from-source)
108
+ - [Optional dependencies](#optional-dependencies)
109
+ - [4C](#4c)
110
+ - [CubitPy](#cubitpy)
111
+ - [ArborX geometric search](#arborx-geometric-search)
112
+ - [Developing MeshPy](#developing-meshpy)
113
+ - [Coding guidelines](#coding-guidelines)
114
+ - [Testing](#testing)
115
+ - [Cython geometric search](#cython-geometric-search)
116
+ - [Contributing](#contributing)
117
+ - [Authors](#authors)
118
+
119
+ ## Examples
120
+
121
+ <p align="center">
122
+ <img src="https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/assets/honeycomb.png" width="350" title="Honeycomb structure under tension (simulated with 4C)">
123
+ </p>
124
+ <p align="center" style="font-style: italic; color: gray;">Honeycomb structure under tension (simulated with 4C)</p>
125
+
126
+ <p align="center">
127
+ <img src="https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/assets/composite_plate.png" width="400" title="Fiber reinforced composite plate (simulated with 4C)">
128
+ </p>
129
+ <p align="center" style="font-style: italic; color: gray;">Fiber reinforced composite plate (simulated with 4C)</p>
130
+
131
+ <p align="center">
132
+ <img src="https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/assets/pressure_pipe.png" width="350" title="Fiber reinforced pipe under pressure (simulated with 4C)">
133
+ </p>
134
+ <p align="center" style="font-style: italic; color: gray;">Fiber reinforced pipe under pressure (simulated with 4C)</p>
135
+
136
+ <p align="center">
137
+ <img src="https://raw.githubusercontent.com/imcs-compsim/meshpy/refs/heads/main/doc/assets/twisted_plate.png" width="350" title="Fiber reinforcements of a twisted plate (simulated with 4C)">
138
+ </p>
139
+ <p align="center" style="font-style: italic; color: gray;">Fiber reinforcements of a twisted plate (simulated with 4C)</p>
140
+
141
+ ## How to use MeshPy?
142
+
143
+ MeshPy provides example notebooks to showcase its core features and functionality.
144
+ The examples can be found in the `examples/` directory.
145
+ They can be run locally or directly tested from your browser via the following links:
146
+
147
+ - Example 1: **Finite rotation framework** [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/imcs-compsim/meshpy/main?labpath=examples%2Fexample_1_finite_rotations.ipynb)
148
+ - Example 2: **Core mesh generation functions** [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/imcs-compsim/meshpy/main?labpath=examples%2Fexample_2_core_mesh_generation_functions.ipynb)
149
+
150
+ You can also interactively test the entire MeshPy framework directly from your browser here [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/imcs-compsim/meshpy/main)
151
+
152
+
153
+ ## How to cite MeshPy?
154
+
155
+ Whenever you use or mention MeshPy in some sort of scientific document/publication/presentation, please cite MeshPy as
156
+ > Steinbrecher, I., Popp, A.: MeshPy - A general purpose 3D beam finite element input generator, https://imcs-compsim.github.io/meshpy
157
+
158
+ This can be done with the following BiBTeX entry:
159
+ ```TeX
160
+ @Misc{MeshPyWebsite,
161
+ author = {Steinbrecher, I. and Popp, A.},
162
+ howpublished = {\url{https://imcs-compsim.github.io/meshpy}},
163
+ title = {{M}esh{P}y -- {A} general purpose {3D} beam finite element input generator},
164
+ year = {2021},
165
+ key = {MeshPyWebsite},
166
+ url = {https://imcs-compsim.github.io/meshpy},
167
+ }
168
+ ```
169
+
170
+ Feel free to leave a ⭐️ on [GitHub](https://github.com/imcs-compsim/meshpy).
171
+
172
+
173
+ ## Work that uses MeshPy
174
+
175
+ ### Peer-reviewed articles <!-- omit from toc -->
176
+
177
+ 1. </span><span class="csl-right-inline">Datz, J.C., Steinbrecher, I.,
178
+ Meier, C., Engel, L.C., Popp, A., Pfaller, M.R., Schunkert, H., Wall, W.A.:
179
+ Patient-specific coronary angioplasty simulations — A mixed-dimensional
180
+ finite element modeling approach. Computers in Biology and Medicine. 189,
181
+ 109914 (2025).
182
+ <https://doi.org/10.1016/j.compbiomed.2025.109914></span>
183
+ 1. </span><span class="csl-right-inline">Firmbach, M., Steinbrecher, I.,
184
+ Popp, A., Mayr, M.: An approximate block factorization preconditioner
185
+ for mixed-dimensional beam-solid interaction. Computer Methods in
186
+ Applied Mechanics and Engineering. 431, 117256 (2024).
187
+ <https://doi.org/10.1016/j.cma.2024.117256></span>
188
+ 1. </span><span class="csl-right-inline">Hagmeyer, N., Mayr, M., Popp, A.:
189
+ A fully coupled regularized mortar-type finite element approach for
190
+ embedding one-dimensional fibers into three-dimensional fluid flow.
191
+ International Journal for Numerical Methods in Engineering. 125, e7435
192
+ (2024). <https://doi.org/10.1002/nme.7435></span>
193
+ 1. </span><span class="csl-right-inline">Steinbrecher, I., Popp, A., Meier,
194
+ C.: Consistent coupling of positions and rotations for embedding 1D
195
+ Cosserat beams into 3D solid volumes. Computational Mechanics. 69,
196
+ 701–732 (2022). <https://doi.org/10.1007/s00466-021-02111-4></span>
197
+ 1. </span><span class="csl-right-inline">Hagmeyer, N., Mayr, M.,
198
+ Steinbrecher, I., Popp, A.: One-way coupled fluid-beam interaction:
199
+ Capturing the effect of embedded slender bodies on global fluid flow and
200
+ vice versa. Advanced Modeling and Simulation in Engineering Sciences. 9,
201
+ 9 (2022). <https://doi.org/10.1186/s40323-022-00222-y></span>
202
+ 1. </span><span class="csl-right-inline">Steinbrecher, I., Mayr, M., Grill,
203
+ M.J., Kremheller, J., Meier, C., Popp, A.: A mortar-type finite element
204
+ approach for embedding 1D beams into 3D solid volumes. Computational
205
+ Mechanics. 66, 1377–1398 (2020).
206
+ <https://doi.org/10.1007/s00466-020-01907-0></span>
207
+
208
+ ### PhD thesis <!-- omit from toc -->
209
+
210
+ 1. </span><span class="csl-right-inline">Hagmeyer, N.: A computational
211
+ framework for balloon angioplasty and stented arteries based on
212
+ mixed-dimensional modeling,
213
+ <https://athene-forschung.rz.unibw-muenchen.de/146359>, (2023)</span>
214
+ 1. </span><span class="csl-right-inline">Steinbrecher, I.:
215
+ Mixed-dimensional finite element formulations for beam-to-solid
216
+ interaction, <https://athene-forschung.unibw.de/143755>, (2022)</span>
217
+
218
+
219
+ ## Installation
220
+
221
+ ### Python environment
222
+
223
+ MeshPy is tested with, and supports Python versions 3.9-3.12. It is recommended to use a virtual Python environment such as [Conda](https://anaconda.org/anaconda/conda)/[Miniforge](https://conda-forge.org/download/) or [venv](https://docs.python.org/3/library/venv.html).
224
+ - A [Conda](https://anaconda.org/anaconda/conda)/[Miniforge](https://conda-forge.org/download/) environment can be created and loaded with
225
+ ```bash
226
+ # Create the environment (this only has to be done once)
227
+ conda create -n meshpy python=3.12
228
+ # Activate the environment
229
+ conda activate meshpy
230
+ ```
231
+ - A [venv](https://docs.python.org/3/library/venv.html) virtual environment can be created and loaded with (on Debian systems the following packages might have to be installed:
232
+ `sudo apt-get install python3-venv python3-dev`)
233
+ ```bash
234
+ # Create the environment (this only has to be done once)
235
+ python -m venv <path-to-env-folder>/meshpy-env
236
+ # Activate the environment
237
+ source <path-to-env-folder>/meshpy-env/bin/activate
238
+ ```
239
+
240
+ ### Install MeshPy from source
241
+
242
+ You can either install MeshPy directly from the source in a non-editable and editable fashion like:
243
+ - Non-editable:
244
+ This allows you to use MeshPy, but changing the source code will not have any effect on the installed package
245
+ ```bash
246
+ git clone git@github.com:imcs-compsim/meshpy.git
247
+ cd meshpy
248
+ pip install .
249
+ ```
250
+ - Editable:
251
+ This allows you to change the source code without reinstalling the module
252
+ ```bash
253
+ git clone git@github.com:imcs-compsim/meshpy.git
254
+ cd meshpy
255
+ pip install -e .
256
+ ```
257
+ Now you are able to use MeshPy. A good way to get started is by going through the examples
258
+ ```bash
259
+ jupyter notebook examples/
260
+ ```
261
+ If you also want to execute the associated test suite check out our [development](#developing-meshpy) section.
262
+
263
+
264
+ ## Optional dependencies
265
+
266
+ ### [4C](https://www.4c-multiphysics.org)
267
+
268
+ MeshPy can run 4C simulations directly from within a Python script, allowing for full control over arbitrarily complex simulation workflows. Fore more information, please have a look at the `meshpy.four_c.run_four_c` module.
269
+
270
+ ### [CubitPy](https://github.com/imcs-compsim/cubitpy)
271
+
272
+ CubitPy is a Python library that contains utility functions extending the Cubit/Coreform Python interface. Furthermore, it allows for the easy creation of 4C-compatible input files directly from within Python. MeshPy can import meshes created with CubitPy and allows for further modification and manipulation of them.
273
+
274
+ CubitPy can be installed as an optional dependency with:
275
+ ```bash
276
+ pip install -e .[cubitpy]
277
+ ```
278
+
279
+ ### [ArborX](https://github.com/arborx/ArborX) geometric search
280
+
281
+ MeshPy can optionally execute its geometric search functions using the C++ library [ArborX](https://github.com/arborx/ArborX).
282
+ First make sure the [pybind11](https://pybind11.readthedocs.io/en/stable/) submodule is loaded
283
+ ```bash
284
+ cd <path_to_meshpy>
285
+ git submodule update --init
286
+ ```
287
+ To setup MeshPy with ArborX, [CMake](https://cmake.org) and [Kokkos](https://kokkos.org) have to be available on your system (the preferred variant is via [Spack](https://spack.io/)).
288
+ Create a build directory
289
+ ```bash
290
+ mkdir -p <path_to_meshpy>/src/build/geometric_search
291
+ ```
292
+ Configure cmake and build the extension
293
+ ```bash
294
+ cd <path_to_meshpy>/build/geometric_search
295
+ cmake ../../meshpy/geometric_search/src/
296
+ make -j4
297
+ ```
298
+ > Note: Currently ArborX only works if MeshPy is installed in _editable_ mode.
299
+
300
+ ## Developing MeshPy
301
+
302
+ If you want to actively develop MeshPy or run the test suite, you must install MeshPy in _editable_ (`-e`) mode and with our optional developer dependencies (`[dev]`) like
303
+ ```bash
304
+ pip install -e ".[dev]" # Quotation marks are required for some shells
305
+ ```
306
+ You can now run the MeshPy test suite to check that everything worked as expected
307
+ ```bash
308
+ pytest
309
+ ```
310
+
311
+ ### Coding guidelines
312
+
313
+ - When working on MeshPy, use a leading underscore (`_`) to indicate functions, classes, and variables that are intended for internal use only. This is a coding convention rather than an enforced rule, so apply it where it improves code clarity, especially for functions that check consistency or modify internal states.
314
+ - To avoid ambiguous or incorrect imports when using MeshPy as a library, internal imports must follow a strict aliasing convention as illustrated below:
315
+ <details>
316
+
317
+ <summary>Import guidelines</summary>
318
+
319
+ ```python
320
+ # Not OK
321
+ import numpy # No alias
322
+ import numpy as np # Missing leading underscore
323
+
324
+ from numpy import * # Wildcard imports
325
+ from numpy import _core # We don't allow the import of private functionality
326
+ from numpy.linalg import norm # No alias
327
+ from numpy import sin as sin2 # Missing leading underscore
328
+ from meshpy.core.mesh import Mesh as _BeamMesh # MeshPy imports have to be aliased with the same name, i.e., should be `_Mesh` (imports from third party libraries can be renamed)
329
+
330
+ # OK
331
+ import numpy as _np
332
+ import sys as _sys
333
+
334
+ from pathlib import Path as _Path
335
+
336
+ from math import sin as _math_sin
337
+ from numpy import sin as _np_sin
338
+
339
+ import meshpy.core.conf as _conf
340
+ from meshpy.core.mesh import Mesh as _Mesh
341
+ from meshpy.core.node import Node as _Node
342
+ from meshpy.core.node import NodeCosserat as _NodeCosserat
343
+ ```
344
+ </details>
345
+
346
+ ### Testing
347
+
348
+ MeshPy provides a flexible testing system where additional tests can be enabled using specific flags. The following flags can be used with [pytest](https://pytest-cov.readthedocs.io/en/latest/config.html) to enable specific test sets:
349
+ - `--exclude-standard-tests`: Disables the default test suite
350
+ - `--4C`: Runs tests related to 4C integration
351
+ - `--ArborX`: Enables tests for ArborX-related functionality
352
+ - `--CubitPy`: Runs tests for CubitPy integration
353
+ - `--performance-tests`: Includes performance tests
354
+
355
+ These flags can be combined arbitrarily; for example, to run the 4C, CubitPy, and ArborX tests but exclude the default test suite, use:
356
+ ```bash
357
+ # 4C Tests require a path to a 4C executable
358
+ export MESHPY_FOUR_C_EXE=<path_to_4C>
359
+ # CubitPy Tests require a path to a Cubit/Coreform installation
360
+ export CUBIT_ROOT=<path_to_Cubit_or_Coreform>
361
+
362
+ pytest --4C --ArborX --CubitPy --exclude-standard-tests
363
+ ```
364
+
365
+ ### Cython geometric search
366
+
367
+ Some performance critical geometric search algorithms in MeshPy are written in [Cython](https://cython.readthedocs.io/en/stable/index.html). If Cython code is changed, it has to be recompiled. This can be done by running
368
+ ```bash
369
+ python setup.py build_ext --inplace
370
+ ```
371
+
372
+ ## Contributing
373
+
374
+ If you are interested in contributing to MeshPy, we welcome your collaboration.
375
+ For general questions, feature request and bug reports please open an [issue](https://github.com/imcs-compsim/meshpy/issues).
376
+
377
+ If you contribute actual code, fork the repository and make the changes in a feature branch.
378
+ Depending on the topic and amount of changes you also might want to open an [issue](https://github.com/imcs-compsim/meshpy/issues).
379
+ To merge your changes into the MeshPy repository, create a pull request to the `main` branch.
380
+ A few things to keep in mind:
381
+ - Read our [coding guidelines](#coding-guidelines).
382
+ - It is highly encouraged to add tests covering the functionality of your changes, see the test suite in `tests/`.
383
+ - To maintain high code quality, MeshPy uses a number of different pre-commit hooks to check committed code. Make sure to set up the pre-commit hooks before committing your changes
384
+ ```bash
385
+ pre-commit install
386
+ ```
387
+ - Check that you did not break anything by running the MeshPy tests.
388
+ For most changes it should be sufficient to run the standard test suite:
389
+ ```bash
390
+ pytest
391
+ ```
392
+ - Feel free to add yourself to the authors section in the [README.md](https://github.com/imcs-compsim/meshpy/blob/main/README.md) file.
393
+
394
+
395
+ ## Authors
396
+
397
+ ### Maintainers <!-- omit from toc -->
398
+ - Ivo Steinbrecher (@isteinbrecher)
399
+ - David Rudlstorfer (@davidrudlstorfer)
400
+
401
+ ### Contributors (in alphabetical order) <!-- omit from toc -->
402
+ - Dao Viet Anh
403
+ - Max Firmbach (@maxfirmbach)
404
+ - Martin Frank (@knarfnitram)
405
+ - Nora Hagmeyer (@NoraHagmeyer)
406
+ - Matthias Mayr (@mayrmt)
407
+ - Gabriela Loera (@eulovi)