pmmoto 0.1.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.
- pmmoto-0.1.0/LICENSE +21 -0
- pmmoto-0.1.0/MANIFEST.in +1 -0
- pmmoto-0.1.0/PKG-INFO +31 -0
- pmmoto-0.1.0/README.md +124 -0
- pmmoto-0.1.0/pyproject.toml +72 -0
- pmmoto-0.1.0/setup.cfg +4 -0
- pmmoto-0.1.0/setup.py +103 -0
- pmmoto-0.1.0/src/pmmoto/__init__.py +34 -0
- pmmoto-0.1.0/src/pmmoto/analysis/__init__.py +11 -0
- pmmoto-0.1.0/src/pmmoto/analysis/_bins.cpp +13296 -0
- pmmoto-0.1.0/src/pmmoto/analysis/_bins.pyi +21 -0
- pmmoto-0.1.0/src/pmmoto/analysis/_bins.pyx +62 -0
- pmmoto-0.1.0/src/pmmoto/analysis/_minkowski.c +21227 -0
- pmmoto-0.1.0/src/pmmoto/analysis/_minkowski.pyi +13 -0
- pmmoto-0.1.0/src/pmmoto/analysis/_minkowski.pyx +939 -0
- pmmoto-0.1.0/src/pmmoto/analysis/average.py +97 -0
- pmmoto-0.1.0/src/pmmoto/analysis/bins.hpp +50 -0
- pmmoto-0.1.0/src/pmmoto/analysis/bins.pxd +26 -0
- pmmoto-0.1.0/src/pmmoto/analysis/bins.py +375 -0
- pmmoto-0.1.0/src/pmmoto/analysis/minkowski.py +78 -0
- pmmoto-0.1.0/src/pmmoto/analysis/minkowskic.c +737 -0
- pmmoto-0.1.0/src/pmmoto/analysis/minkowskic.h +41 -0
- pmmoto-0.1.0/src/pmmoto/analysis/quantimpyc.c +83 -0
- pmmoto-0.1.0/src/pmmoto/analysis/quantimpyc.h +24 -0
- pmmoto-0.1.0/src/pmmoto/analysis/stats.py +87 -0
- pmmoto-0.1.0/src/pmmoto/core/__init__.py +32 -0
- pmmoto-0.1.0/src/pmmoto/core/_voxels.cpp +83630 -0
- pmmoto-0.1.0/src/pmmoto/core/_voxels.hpp +125 -0
- pmmoto-0.1.0/src/pmmoto/core/_voxels.pxd +54 -0
- pmmoto-0.1.0/src/pmmoto/core/_voxels.pyi +45 -0
- pmmoto-0.1.0/src/pmmoto/core/_voxels.pyx +579 -0
- pmmoto-0.1.0/src/pmmoto/core/boundary_types.py +38 -0
- pmmoto-0.1.0/src/pmmoto/core/communication.py +330 -0
- pmmoto-0.1.0/src/pmmoto/core/domain.py +118 -0
- pmmoto-0.1.0/src/pmmoto/core/domain_decompose.py +142 -0
- pmmoto-0.1.0/src/pmmoto/core/domain_discretization.py +90 -0
- pmmoto-0.1.0/src/pmmoto/core/features.py +354 -0
- pmmoto-0.1.0/src/pmmoto/core/logging.py +89 -0
- pmmoto-0.1.0/src/pmmoto/core/orientation.py +186 -0
- pmmoto-0.1.0/src/pmmoto/core/pmmoto.py +152 -0
- pmmoto-0.1.0/src/pmmoto/core/subdomain.py +376 -0
- pmmoto-0.1.0/src/pmmoto/core/subdomain_features.py +235 -0
- pmmoto-0.1.0/src/pmmoto/core/subdomain_padded.py +311 -0
- pmmoto-0.1.0/src/pmmoto/core/subdomain_verlet.py +104 -0
- pmmoto-0.1.0/src/pmmoto/core/utils.py +246 -0
- pmmoto-0.1.0/src/pmmoto/core/voxels.py +455 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/__init__.py +41 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_domain_generation.cpp +34705 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_domain_generation.pxd +42 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_domain_generation.pyi +29 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_domain_generation.pyx +123 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_rdf.cpp +12667 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_rdf.pxd +0 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_rdf.pyi +16 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/_rdf.pyx +36 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/domain_generation.hpp +173 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/domain_generation.py +270 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/lattice_packings.py +170 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/multiphase.py +126 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/porousmedia.py +101 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/rdf.hpp +35 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/rdf.pxd +17 -0
- pmmoto-0.1.0/src/pmmoto/domain_generation/rdf.py +285 -0
- pmmoto-0.1.0/src/pmmoto/filters/__init__.py +15 -0
- pmmoto-0.1.0/src/pmmoto/filters/connected_components.py +285 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/__init__.py +5 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/_distance.cpp +41547 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/_distance.hpp +359 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/_distance.pxd +48 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/_distance.pyi +69 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/_distance.pyx +702 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/edt.py +528 -0
- pmmoto-0.1.0/src/pmmoto/filters/distance/threadpool.h +144 -0
- pmmoto-0.1.0/src/pmmoto/filters/equilibrium_distribution.py +272 -0
- pmmoto-0.1.0/src/pmmoto/filters/morphological_operators.py +328 -0
- pmmoto-0.1.0/src/pmmoto/filters/porosimetry.py +266 -0
- pmmoto-0.1.0/src/pmmoto/io/__init__.py +41 -0
- pmmoto-0.1.0/src/pmmoto/io/_dataOutput.pyx +8 -0
- pmmoto-0.1.0/src/pmmoto/io/_data_read.cpp +13503 -0
- pmmoto-0.1.0/src/pmmoto/io/_data_read.pxd +19 -0
- pmmoto-0.1.0/src/pmmoto/io/_data_read.pyi +8 -0
- pmmoto-0.1.0/src/pmmoto/io/_data_read.pyx +47 -0
- pmmoto-0.1.0/src/pmmoto/io/data_read.hpp +301 -0
- pmmoto-0.1.0/src/pmmoto/io/data_read.py +296 -0
- pmmoto-0.1.0/src/pmmoto/io/evtk/__init__.py +24 -0
- pmmoto-0.1.0/src/pmmoto/io/evtk/evtk.py +117 -0
- pmmoto-0.1.0/src/pmmoto/io/evtk/hl.py +1083 -0
- pmmoto-0.1.0/src/pmmoto/io/evtk/vtk.py +842 -0
- pmmoto-0.1.0/src/pmmoto/io/evtk/xml.py +95 -0
- pmmoto-0.1.0/src/pmmoto/io/io_utils.py +47 -0
- pmmoto-0.1.0/src/pmmoto/io/output.py +437 -0
- pmmoto-0.1.0/src/pmmoto/particles/KDTreeVectorOfVectorsAdaptor.h +155 -0
- pmmoto-0.1.0/src/pmmoto/particles/__init__.py +19 -0
- pmmoto-0.1.0/src/pmmoto/particles/_particles.cpp +26570 -0
- pmmoto-0.1.0/src/pmmoto/particles/_particles.pxd +14 -0
- pmmoto-0.1.0/src/pmmoto/particles/_particles.pyi +68 -0
- pmmoto-0.1.0/src/pmmoto/particles/_particles.pyx +398 -0
- pmmoto-0.1.0/src/pmmoto/particles/atom_universal_force_field.py +40 -0
- pmmoto-0.1.0/src/pmmoto/particles/atoms.hpp +166 -0
- pmmoto-0.1.0/src/pmmoto/particles/atoms.pxd +65 -0
- pmmoto-0.1.0/src/pmmoto/particles/kd_tree.hpp +127 -0
- pmmoto-0.1.0/src/pmmoto/particles/nanoflann.hpp +2904 -0
- pmmoto-0.1.0/src/pmmoto/particles/new_spheres.cpp +13 -0
- pmmoto-0.1.0/src/pmmoto/particles/new_spheres.hpp +27 -0
- pmmoto-0.1.0/src/pmmoto/particles/new_spheres.pxd +10 -0
- pmmoto-0.1.0/src/pmmoto/particles/particle_list.hpp +262 -0
- pmmoto-0.1.0/src/pmmoto/particles/particle_list.pxd +26 -0
- pmmoto-0.1.0/src/pmmoto/particles/particles.py +230 -0
- pmmoto-0.1.0/src/pmmoto/particles/spheres.hpp +421 -0
- pmmoto-0.1.0/src/pmmoto/particles/spheres.pxd +53 -0
- pmmoto-0.1.0/src/pmmoto.egg-info/PKG-INFO +31 -0
- pmmoto-0.1.0/src/pmmoto.egg-info/SOURCES.txt +113 -0
- pmmoto-0.1.0/src/pmmoto.egg-info/dependency_links.txt +1 -0
- pmmoto-0.1.0/src/pmmoto.egg-info/requires.txt +21 -0
- pmmoto-0.1.0/src/pmmoto.egg-info/top_level.txt +1 -0
pmmoto-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Timothy M. Weigand
|
|
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.
|
pmmoto-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include src/ *.pyx *.pxd *.py *.hpp *.h
|
pmmoto-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pmmoto
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Porous Media Topology and Morphology Toolkit
|
|
5
|
+
Author-email: "Timothy M. Weigand" <timothy.weigand@unc.edu>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: numpy<2.0
|
|
13
|
+
Requires-Dist: cython==3.0
|
|
14
|
+
Requires-Dist: mpi4py>=4.0.0
|
|
15
|
+
Requires-Dist: scipy>=1.11
|
|
16
|
+
Requires-Dist: connected_components_3d>=3.12.4
|
|
17
|
+
Requires-Dist: matplotlib>=3.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
21
|
+
Requires-Dist: mypy>=1.15; extra == "dev"
|
|
22
|
+
Requires-Dist: tox>=3.24; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest_benchmark>=5.1.0; extra == "dev"
|
|
24
|
+
Requires-Dist: ruff>=0.11.5; extra == "dev"
|
|
25
|
+
Requires-Dist: interrogate>=1.5.0; extra == "dev"
|
|
26
|
+
Requires-Dist: typing_extensions>=4.6; extra == "dev"
|
|
27
|
+
Provides-Extra: docs
|
|
28
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
29
|
+
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
30
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
31
|
+
Dynamic: license-file
|
pmmoto-0.1.0/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# PMMoTo
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**PMMoTo** (Parallel Morphological Multiphase Toolkit) is an open-source, MPI-parallelized Python/C++ toolkit for simulating multiphase flow and morphological processes in complex porous media. PMMoTo provides efficient, scalable algorithms for generating, analyzing, and simulating pore-scale phenomena in 2D and 3D domains, with a focus on high-performance computing and extensibility.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Parallel domain decomposition** using MPI for distributed-memory simulations
|
|
16
|
+
- **Morphological drainage and imbibition** algorithms for capillary-dominated flow
|
|
17
|
+
- **Flexible porous media generation**: random fields, sphere packs, atomistic models, and more
|
|
18
|
+
- **Multiphase simulation**: support for multiple fluid phases and wettability
|
|
19
|
+
- **Distance transforms**: exact Euclidean distance transforms with periodic and distributed support
|
|
20
|
+
- **Capillary pressure–saturation curve computation** and other pore-scale analysis tools
|
|
21
|
+
- **Parallel VTK output** for visualization in ParaView and other tools
|
|
22
|
+
- **Modular, extensible design**: Python/C++ hybrid, easy to add new algorithms
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
1. **Clone the repository:**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/tmweigand/PMMoTo.git
|
|
32
|
+
cd PMMoTo
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **Install dependencies:**
|
|
36
|
+
|
|
37
|
+
- Python 3.8+
|
|
38
|
+
- `numpy`
|
|
39
|
+
- `mpi4py`
|
|
40
|
+
- `matplotlib`
|
|
41
|
+
- (Optional) `pytest` for testing
|
|
42
|
+
|
|
43
|
+
Install with pip:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install -r requirements.txt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. **Build C/C++ extensions (required for performance):**
|
|
50
|
+
```bash
|
|
51
|
+
python setup.py build_ext --inplace
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
### Example: Morphological Drainage in an Inkbottle Geometry
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
mpirun -np 8 python examples/drainage_inkbottle.py
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- Output images and data are saved in `examples/` or `data_out/`.
|
|
65
|
+
- Results can be visualized with ParaView or other VTK-compatible tools.
|
|
66
|
+
|
|
67
|
+
### Custom Porous Media
|
|
68
|
+
|
|
69
|
+
You can generate custom porous media using built-in generators (random, spheres, atoms) or your own. See `examples/drainage_inkbottle.py` and the `domain_generation` module for details.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Directory Structure
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
src/pmmoto/
|
|
77
|
+
core/ # Core parallel and utility routines (domain, subdomain, communication, utils)
|
|
78
|
+
domain_generation/ # Porous media and multiphase domain generation
|
|
79
|
+
filters/ # Morphological and distance transform algorithms
|
|
80
|
+
io/ # Input/output, VTK export, data readers
|
|
81
|
+
analysis/ # Analysis tools (Minkowski functionals, etc.)
|
|
82
|
+
particles/ # Particle and atom data structures
|
|
83
|
+
examples/ # Example scripts and workflows
|
|
84
|
+
tests/ # Unit and integration tests
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Testing
|
|
90
|
+
|
|
91
|
+
Run the test suite (requires `pytest` and `mpi4py`):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mpirun -np 8 python -m pytest tests/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Documentation
|
|
100
|
+
|
|
101
|
+
- **API documentation:** See docstrings in source files.
|
|
102
|
+
- **Examples:** See the `examples/` directory for ready-to-run scripts.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Citing
|
|
107
|
+
|
|
108
|
+
If you use PMMoTo in your research, please cite the relevant publication (add citation here if available).
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Contact
|
|
119
|
+
|
|
120
|
+
For questions, issues, or contributions, please open an issue or pull request on [GitHub](https://github.com/tmweigand/PMMoTo).
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
**PMMoTo** — Parallel Morphological Multiphase Toolkit for Porous Media Simulation
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pmmoto"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Porous Media Topology and Morphology Toolkit"
|
|
5
|
+
|
|
6
|
+
authors = [
|
|
7
|
+
{name = "Timothy M. Weigand", email = "timothy.weigand@unc.edu"},
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3.10",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"numpy<2.0",
|
|
19
|
+
"cython==3.0",
|
|
20
|
+
"mpi4py>=4.0.0",
|
|
21
|
+
"scipy>=1.11",
|
|
22
|
+
"connected_components_3d>=3.12.4",
|
|
23
|
+
"matplotlib>=3.0"
|
|
24
|
+
]
|
|
25
|
+
requires-python = ">=3.10"
|
|
26
|
+
|
|
27
|
+
[build-system]
|
|
28
|
+
requires = ["setuptools", "numpy", "cython"]
|
|
29
|
+
build-backend = "setuptools.build_meta"
|
|
30
|
+
|
|
31
|
+
[tools.setuptools.packages.find]
|
|
32
|
+
where = ["src"]
|
|
33
|
+
include = ["pmmoto*"]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=6.0",
|
|
38
|
+
"pytest-cov>=2.0",
|
|
39
|
+
"mypy>=1.15",
|
|
40
|
+
"tox>=3.24",
|
|
41
|
+
"pytest_benchmark>=5.1.0",
|
|
42
|
+
"ruff>=0.11.5",
|
|
43
|
+
"interrogate>=1.5.0",
|
|
44
|
+
# "pytest-mpi @ git+https://github.com/orausch/pytest-mpi.git@master",
|
|
45
|
+
"typing_extensions>=4.6"
|
|
46
|
+
]
|
|
47
|
+
docs = [
|
|
48
|
+
"sphinx>=7.0",
|
|
49
|
+
"sphinx_rtd_theme",
|
|
50
|
+
"myst-parser"
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[tool.black]
|
|
54
|
+
line-length = 88
|
|
55
|
+
|
|
56
|
+
[tool.ruff]
|
|
57
|
+
line-length = 88
|
|
58
|
+
target-version = "py311"
|
|
59
|
+
src = ["src"]
|
|
60
|
+
exclude = [
|
|
61
|
+
"src/pmmoto/io/evtk",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.ruff.lint]
|
|
65
|
+
select = ["E", "F", "D"] # E = pycodestyle, F = pyflakes, D = pydocstyle
|
|
66
|
+
ignore = ["D107", "D203", "D213", "D400", "D415", "D200"]
|
|
67
|
+
|
|
68
|
+
[tool.interrogate]
|
|
69
|
+
fail-under = 90
|
|
70
|
+
ignore-init-method = true
|
|
71
|
+
ignore-module = true
|
|
72
|
+
|
pmmoto-0.1.0/setup.cfg
ADDED
pmmoto-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""Setup script for PMMoTo.
|
|
2
|
+
|
|
3
|
+
Builds Cython/C++ extensions and installs the PMMoTo package.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
from setuptools import Extension, setup
|
|
8
|
+
from Cython.Build import cythonize
|
|
9
|
+
import Cython.Compiler.Options
|
|
10
|
+
import numpy
|
|
11
|
+
|
|
12
|
+
Cython.Compiler.Options.annotate = True
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# try:
|
|
16
|
+
# subprocess.run(["mpirun", "--version"], check=True, stdout=subprocess.PIPE)
|
|
17
|
+
# except FileNotFoundError:
|
|
18
|
+
# sys.stderr.write("Error: MPI is not installed. Install OpenMPI or MPICH.\n")
|
|
19
|
+
# sys.exit(1)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
extra_compile_args = ["-std=c++17"]
|
|
23
|
+
if sys.platform == "win32":
|
|
24
|
+
extra_compile_args += ["/std:c++17", "/O2"]
|
|
25
|
+
else:
|
|
26
|
+
extra_compile_args += ["-std=c++17", "-O3", "-ffast-math", "-pthread"]
|
|
27
|
+
|
|
28
|
+
if sys.platform == "darwin":
|
|
29
|
+
extra_compile_args += ["-stdlib=libc++", "-mmacosx-version-min=10.9"]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
cmdclass = {}
|
|
33
|
+
|
|
34
|
+
ext_modules = [
|
|
35
|
+
Extension(
|
|
36
|
+
"pmmoto.core._voxels",
|
|
37
|
+
["src/pmmoto/core/_voxels.pyx"],
|
|
38
|
+
include_dirs=["src/pmmoto/core"],
|
|
39
|
+
language="c++",
|
|
40
|
+
extra_compile_args=extra_compile_args,
|
|
41
|
+
),
|
|
42
|
+
Extension(
|
|
43
|
+
"pmmoto.filters.distance._distance",
|
|
44
|
+
["src/pmmoto/filters/distance/_distance.pyx"],
|
|
45
|
+
include_dirs=["src/pmmoto/filters/distance", numpy.get_include()],
|
|
46
|
+
language="c++",
|
|
47
|
+
extra_compile_args=extra_compile_args,
|
|
48
|
+
),
|
|
49
|
+
Extension(
|
|
50
|
+
"pmmoto.analysis._minkowski",
|
|
51
|
+
[
|
|
52
|
+
"src/pmmoto/analysis/_minkowski.pyx",
|
|
53
|
+
"src/pmmoto/analysis/quantimpyc.c",
|
|
54
|
+
"src/pmmoto/analysis/minkowskic.c",
|
|
55
|
+
],
|
|
56
|
+
include_dirs=["pmmoto/analysis"],
|
|
57
|
+
),
|
|
58
|
+
Extension(
|
|
59
|
+
"pmmoto.io._data_read",
|
|
60
|
+
["src/pmmoto/io/_data_read.pyx"],
|
|
61
|
+
include_dirs=["src/pmmoto/io"],
|
|
62
|
+
libraries=["z"],
|
|
63
|
+
language="c++",
|
|
64
|
+
extra_compile_args=extra_compile_args,
|
|
65
|
+
),
|
|
66
|
+
Extension(
|
|
67
|
+
"pmmoto.particles._particles",
|
|
68
|
+
["src/pmmoto/particles/_particles.pyx"],
|
|
69
|
+
include_dirs=["src/pmmoto/particles/"],
|
|
70
|
+
language="c++",
|
|
71
|
+
extra_compile_args=extra_compile_args,
|
|
72
|
+
),
|
|
73
|
+
Extension(
|
|
74
|
+
"pmmoto.domain_generation._rdf",
|
|
75
|
+
["src/pmmoto/domain_generation/_rdf.pyx"],
|
|
76
|
+
include_dirs=["src/pmmoto/domain_generation/", "src/pmmoto/particles/"],
|
|
77
|
+
language="c++",
|
|
78
|
+
extra_compile_args=extra_compile_args,
|
|
79
|
+
),
|
|
80
|
+
Extension(
|
|
81
|
+
"pmmoto.analysis._bins",
|
|
82
|
+
["src/pmmoto/analysis/_bins.pyx"],
|
|
83
|
+
include_dirs=["src/pmmoto/analysis/"],
|
|
84
|
+
language="c++",
|
|
85
|
+
extra_compile_args=extra_compile_args,
|
|
86
|
+
),
|
|
87
|
+
Extension(
|
|
88
|
+
"pmmoto.domain_generation._domain_generation",
|
|
89
|
+
["src/pmmoto/domain_generation/_domain_generation.pyx"],
|
|
90
|
+
include_dirs=["src/pmmoto/domain_generation/", "src/pmmoto/particles/"],
|
|
91
|
+
language="c++",
|
|
92
|
+
extra_compile_args=extra_compile_args,
|
|
93
|
+
),
|
|
94
|
+
]
|
|
95
|
+
setup(
|
|
96
|
+
name="pmmoto",
|
|
97
|
+
ext_modules=cythonize(
|
|
98
|
+
ext_modules,
|
|
99
|
+
annotate=True,
|
|
100
|
+
compiler_directives={"language_level": "3"},
|
|
101
|
+
),
|
|
102
|
+
include_dirs=numpy.get_include(),
|
|
103
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""PMMoTo package initialization.
|
|
2
|
+
|
|
3
|
+
This module sets up the logger and imports all major subpackages,
|
|
4
|
+
making core functionality available at the top level.
|
|
5
|
+
|
|
6
|
+
Exports:
|
|
7
|
+
- logger: The package-level logger.
|
|
8
|
+
- initialize: Main initialization function for PMMoTo domains.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .core.logging import get_logger
|
|
12
|
+
from .core.pmmoto import initialize
|
|
13
|
+
from .core.boundary_types import BoundaryType
|
|
14
|
+
from . import core
|
|
15
|
+
from . import analysis
|
|
16
|
+
from . import domain_generation
|
|
17
|
+
from . import filters
|
|
18
|
+
from . import io
|
|
19
|
+
from . import particles
|
|
20
|
+
|
|
21
|
+
# Initialize logger at package level
|
|
22
|
+
logger = get_logger()
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"logger",
|
|
26
|
+
"initialize",
|
|
27
|
+
"BoundaryType",
|
|
28
|
+
"core",
|
|
29
|
+
"analysis",
|
|
30
|
+
"domain_generation",
|
|
31
|
+
"filters",
|
|
32
|
+
"io",
|
|
33
|
+
"particles",
|
|
34
|
+
]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Initialize the analysis subpackage for PMMoTo.
|
|
2
|
+
|
|
3
|
+
Provides statistical, Minkowski, averaging, and binning analysis utilities.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from . import bins
|
|
7
|
+
from . import minkowski
|
|
8
|
+
from . import stats
|
|
9
|
+
from . import average
|
|
10
|
+
|
|
11
|
+
__all__ = ["stats", "minkowski", "average", "bins"]
|