meshers 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.
- meshers-0.1.0/LICENSE +21 -0
- meshers-0.1.0/PKG-INFO +116 -0
- meshers-0.1.0/README.md +95 -0
- meshers-0.1.0/THIRDPARTY.json +1257 -0
- meshers-0.1.0/meshers-core/Cargo.toml +17 -0
- meshers-0.1.0/meshers-core/LICENSE +21 -0
- meshers-0.1.0/meshers-core/README.md +50 -0
- meshers-0.1.0/meshers-core/examples/curved_intersection.rs +102 -0
- meshers-0.1.0/meshers-core/examples/gyroid.rs +13 -0
- meshers-0.1.0/meshers-core/examples/implicit.rs +51 -0
- meshers-0.1.0/meshers-core/examples/implicit_sphere.rs +11 -0
- meshers-0.1.0/meshers-core/src/accelerator.rs +37 -0
- meshers-0.1.0/meshers-core/src/adaptive.rs +324 -0
- meshers-0.1.0/meshers-core/src/error.rs +14 -0
- meshers-0.1.0/meshers-core/src/geometry.rs +57 -0
- meshers-0.1.0/meshers-core/src/implicit/intersection/repair.rs +722 -0
- meshers-0.1.0/meshers-core/src/implicit/intersection.rs +803 -0
- meshers-0.1.0/meshers-core/src/implicit.rs +904 -0
- meshers-0.1.0/meshers-core/src/lib.rs +853 -0
- meshers-0.1.0/meshers-core/src/optimize.rs +526 -0
- meshers-0.1.0/meshers-core/src/optimize_batch.rs +323 -0
- meshers-0.1.0/meshers-core/src/profile.rs +42 -0
- meshers-0.1.0/meshers-core/tests/batching.rs +93 -0
- meshers-0.1.0/meshers-core/tests/implicit.rs +499 -0
- meshers-0.1.0/meshers-core/tests/intersection.rs +334 -0
- meshers-0.1.0/meshers-core/tests/public_api.rs +98 -0
- meshers-0.1.0/meshers-python/COMPILED.md +58 -0
- meshers-0.1.0/meshers-python/Cargo.lock +800 -0
- meshers-0.1.0/meshers-python/Cargo.toml +23 -0
- meshers-0.1.0/meshers-python/LICENSE +21 -0
- meshers-0.1.0/meshers-python/README.md +95 -0
- meshers-0.1.0/meshers-python/THIRDPARTY.json +1257 -0
- meshers-0.1.0/meshers-python/THIRDPARTY.md +21 -0
- meshers-0.1.0/meshers-python/examples/basic.py +21 -0
- meshers-0.1.0/meshers-python/examples/cancellation.py +21 -0
- meshers-0.1.0/meshers-python/examples/curved_tpms.py +56 -0
- meshers-0.1.0/meshers-python/examples/evaluators.py +32 -0
- meshers-0.1.0/meshers-python/examples/graded.py +22 -0
- meshers-0.1.0/meshers-python/examples/intersection.py +33 -0
- meshers-0.1.0/meshers-python/examples/periodic.py +25 -0
- meshers-0.1.0/meshers-python/src/compiled.rs +252 -0
- meshers-0.1.0/meshers-python/src/intersection.rs +151 -0
- meshers-0.1.0/meshers-python/src/lib.rs +469 -0
- meshers-0.1.0/meshers-python/tests/test_angular.py +51 -0
- meshers-0.1.0/meshers-python/tests/test_api.py +253 -0
- meshers-0.1.0/meshers-python/tests/test_automatic.py +102 -0
- meshers-0.1.0/meshers-python/tests/test_compiled.py +122 -0
- meshers-0.1.0/meshers-python/tests/test_examples.py +40 -0
- meshers-0.1.0/meshers-python/tests/test_intersection.py +323 -0
- meshers-0.1.0/meshers-python/tests/test_quality.py +59 -0
- meshers-0.1.0/meshers-python/tests/test_rust_compile.py +75 -0
- meshers-0.1.0/meshers-python/tests/test_tpms_release.py +36 -0
- meshers-0.1.0/pyproject.toml +29 -0
- meshers-0.1.0/python/meshers/__init__.py +279 -0
- meshers-0.1.0/python/meshers/_meshers.pyi +67 -0
- meshers-0.1.0/python/meshers/compiler.py +5 -0
- meshers-0.1.0/python/meshers/expression.py +347 -0
- meshers-0.1.0/python/meshers/intersection.py +424 -0
- meshers-0.1.0/python/meshers/py.typed +0 -0
meshers-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Meshers contributors
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
meshers-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: meshers
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Requires-Dist: numpy>=1.23
|
|
5
|
+
Requires-Dist: h5py>=3.8 ; extra == 'io'
|
|
6
|
+
Requires-Dist: pytest>=8 ; extra == 'test'
|
|
7
|
+
Requires-Dist: h5py>=3.8 ; extra == 'test'
|
|
8
|
+
Requires-Dist: pyvista>=0.46 ; extra == 'test'
|
|
9
|
+
Provides-Extra: io
|
|
10
|
+
Provides-Extra: test
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: THIRDPARTY.json
|
|
13
|
+
Summary: Direct CPU tetrahedral meshing of implicit geometries and constrained intersections
|
|
14
|
+
License-Expression: MIT
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
|
+
Project-URL: Documentation, https://github.com/kmarchais/meshers/tree/main/docs/site
|
|
18
|
+
Project-URL: Issues, https://github.com/kmarchais/meshers/issues
|
|
19
|
+
Project-URL: Repository, https://github.com/kmarchais/meshers
|
|
20
|
+
|
|
21
|
+
# Meshers Python 0.1.0
|
|
22
|
+
|
|
23
|
+
In-process CPU float64 meshing of bounded implicit solids. No subprocess or intermediate mesh file is needed.
|
|
24
|
+
|
|
25
|
+
## Install and use
|
|
26
|
+
|
|
27
|
+
Use Python 3.10+. Wheels are available for Linux x86-64, Windows x86-64,
|
|
28
|
+
macOS Apple Silicon and macOS Intel. Users installing a wheel do not need Rust,
|
|
29
|
+
Numba or SymPy.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
python -m pip install "meshers[io]"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The base installation, `pip install meshers`, requires NumPy. The optional
|
|
36
|
+
`io` extra adds h5py for VTKHDF export; it does not install a viewer.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import meshers
|
|
40
|
+
|
|
41
|
+
mesh = meshers.generate("gyroid", cells=24, band=(-0.5, 0.5), periodic=(True, True, True))
|
|
42
|
+
points, tetrahedra = mesh.points, mesh.tetrahedra
|
|
43
|
+
mesh.write_vtkhdf("gyroid.vtkhdf") # requires h5py
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Native fields: `gyroid`, `schwarz_p`, `schwarz_d`; their period is one physical
|
|
47
|
+
coordinate unit. Bounds default to the unit cube and use
|
|
48
|
+
`(xmin, xmax, ymin, ymax, zmin, zmax)`. `cells` accepts an integer or three integers.
|
|
49
|
+
Without `band`, the solid is `field <= 0`. Periodicity defaults to disabled.
|
|
50
|
+
|
|
51
|
+
## Custom and graded functions
|
|
52
|
+
|
|
53
|
+
Pass a pointwise NumPy-style callable `field(x, y, z)`. Supported expressions
|
|
54
|
+
compile automatically inside the wheel, with automatic gradients and cached
|
|
55
|
+
machine code. CPU workers evaluate float64 directly, with the GIL released.
|
|
56
|
+
This supports callable grading, thickness and blends without an explicit
|
|
57
|
+
compilation step. See [supported operations and limits](https://github.com/kmarchais/meshers/blob/main/crates/meshers-python/COMPILED.md).
|
|
58
|
+
|
|
59
|
+
Unsupported expressions fall back to batched NumPy callbacks with a warning.
|
|
60
|
+
Select that path explicitly with `compile=False`; callbacks must return `(N,)`
|
|
61
|
+
float64 arrays, and optional gradients `(N,3)`. Functions must be deterministic
|
|
62
|
+
and independent of batch contents. Callback evaluation runs on the calling
|
|
63
|
+
Python thread.
|
|
64
|
+
|
|
65
|
+
See the [graded example](https://github.com/kmarchais/meshers/blob/main/crates/meshers-python/examples/graded.py).
|
|
66
|
+
|
|
67
|
+
## Results and failures
|
|
68
|
+
|
|
69
|
+
- Owned NumPy arrays: float64 points, int64 tetrahedra and boundary triangles.
|
|
70
|
+
- Boundary tags: 0 implicit, 1/2 x-/x+, 3/4 y-/y+, 5/6 z-/z+.
|
|
71
|
+
- Per-axis periodic node pairs plus geometry and quality diagnostics.
|
|
72
|
+
- VTKHDF volume or `surface=True`, periodic master IDs and physical shift vectors.
|
|
73
|
+
Volume files include `Volume` and `MMGQuality`, computed using the MMG formula
|
|
74
|
+
in NumPy, not by calling mmgpy.
|
|
75
|
+
- Invalid options raise `ValueError`; failed meshing raises `MeshingError`.
|
|
76
|
+
Callback exceptions are preserved. `KeyboardInterrupt` is propagated.
|
|
77
|
+
- Pass `cancel=CancellationToken()` and call `token.cancel()` from another thread
|
|
78
|
+
for cooperative cancellation. A callback must return before it can be interrupted
|
|
79
|
+
by that token. Tokens remain cancelled after use.
|
|
80
|
+
|
|
81
|
+
Output arrays own their storage and are mutable. Mutating them can invalidate
|
|
82
|
+
connectivity, metadata or diagnostics. Surface output is the closed solid boundary,
|
|
83
|
+
not an independent zero-level surface mesher. Small features may be missed at
|
|
84
|
+
insufficient resolution; successful sampling is not geometry certification.
|
|
85
|
+
|
|
86
|
+
## Validation and limits
|
|
87
|
+
|
|
88
|
+
The test suite covers automatic derivatives, cache invalidation, cancellation,
|
|
89
|
+
periodicity, bounded callbacks, named intersections, physical coordinate scales
|
|
90
|
+
and VTKHDF round trips. CI tests Python 3.10, 3.12 and 3.14 on Linux, Windows
|
|
91
|
+
and macOS, plus installed platform wheels and an isolated source build.
|
|
92
|
+
See the [release checks](https://github.com/kmarchais/meshers/blob/main/docs/site/release.md)
|
|
93
|
+
and [CI results](https://github.com/kmarchais/meshers/actions). Thin, nonsmooth or
|
|
94
|
+
poorly resolved geometry still needs application-specific convergence checks.
|
|
95
|
+
|
|
96
|
+
See the [runnable examples](https://github.com/kmarchais/meshers/blob/main/docs/site/examples.md) and [performance regression checks](https://github.com/kmarchais/meshers/blob/main/docs/site/performance.md).
|
|
97
|
+
|
|
98
|
+
## Maintainer build
|
|
99
|
+
|
|
100
|
+
Maintainers need a compatible Rust toolchain and Python to build wheels:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
python -m pip install maturin
|
|
104
|
+
maturin build --release --interpreter python --out dist
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
End users install the resulting wheels. Source installations require Rust.
|
|
108
|
+
|
|
109
|
+
## Retained intersections and mapped periodic ends
|
|
110
|
+
|
|
111
|
+
`meshers.generate_intersection` accepts named negative sublevel constraints,
|
|
112
|
+
an optional coordinate map and explicit rigid periodic transforms. It returns
|
|
113
|
+
the same Mesh type, with named surface access, feature edges and parameter
|
|
114
|
+
coordinates. See the [intersection guide](https://github.com/kmarchais/meshers/blob/main/docs/site/intersections.md)
|
|
115
|
+
and `examples/curved_tpms.py`. Source builds require Rust 1.95 or newer.
|
|
116
|
+
|
meshers-0.1.0/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Meshers Python 0.1.0
|
|
2
|
+
|
|
3
|
+
In-process CPU float64 meshing of bounded implicit solids. No subprocess or intermediate mesh file is needed.
|
|
4
|
+
|
|
5
|
+
## Install and use
|
|
6
|
+
|
|
7
|
+
Use Python 3.10+. Wheels are available for Linux x86-64, Windows x86-64,
|
|
8
|
+
macOS Apple Silicon and macOS Intel. Users installing a wheel do not need Rust,
|
|
9
|
+
Numba or SymPy.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
python -m pip install "meshers[io]"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The base installation, `pip install meshers`, requires NumPy. The optional
|
|
16
|
+
`io` extra adds h5py for VTKHDF export; it does not install a viewer.
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import meshers
|
|
20
|
+
|
|
21
|
+
mesh = meshers.generate("gyroid", cells=24, band=(-0.5, 0.5), periodic=(True, True, True))
|
|
22
|
+
points, tetrahedra = mesh.points, mesh.tetrahedra
|
|
23
|
+
mesh.write_vtkhdf("gyroid.vtkhdf") # requires h5py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Native fields: `gyroid`, `schwarz_p`, `schwarz_d`; their period is one physical
|
|
27
|
+
coordinate unit. Bounds default to the unit cube and use
|
|
28
|
+
`(xmin, xmax, ymin, ymax, zmin, zmax)`. `cells` accepts an integer or three integers.
|
|
29
|
+
Without `band`, the solid is `field <= 0`. Periodicity defaults to disabled.
|
|
30
|
+
|
|
31
|
+
## Custom and graded functions
|
|
32
|
+
|
|
33
|
+
Pass a pointwise NumPy-style callable `field(x, y, z)`. Supported expressions
|
|
34
|
+
compile automatically inside the wheel, with automatic gradients and cached
|
|
35
|
+
machine code. CPU workers evaluate float64 directly, with the GIL released.
|
|
36
|
+
This supports callable grading, thickness and blends without an explicit
|
|
37
|
+
compilation step. See [supported operations and limits](https://github.com/kmarchais/meshers/blob/main/crates/meshers-python/COMPILED.md).
|
|
38
|
+
|
|
39
|
+
Unsupported expressions fall back to batched NumPy callbacks with a warning.
|
|
40
|
+
Select that path explicitly with `compile=False`; callbacks must return `(N,)`
|
|
41
|
+
float64 arrays, and optional gradients `(N,3)`. Functions must be deterministic
|
|
42
|
+
and independent of batch contents. Callback evaluation runs on the calling
|
|
43
|
+
Python thread.
|
|
44
|
+
|
|
45
|
+
See the [graded example](https://github.com/kmarchais/meshers/blob/main/crates/meshers-python/examples/graded.py).
|
|
46
|
+
|
|
47
|
+
## Results and failures
|
|
48
|
+
|
|
49
|
+
- Owned NumPy arrays: float64 points, int64 tetrahedra and boundary triangles.
|
|
50
|
+
- Boundary tags: 0 implicit, 1/2 x-/x+, 3/4 y-/y+, 5/6 z-/z+.
|
|
51
|
+
- Per-axis periodic node pairs plus geometry and quality diagnostics.
|
|
52
|
+
- VTKHDF volume or `surface=True`, periodic master IDs and physical shift vectors.
|
|
53
|
+
Volume files include `Volume` and `MMGQuality`, computed using the MMG formula
|
|
54
|
+
in NumPy, not by calling mmgpy.
|
|
55
|
+
- Invalid options raise `ValueError`; failed meshing raises `MeshingError`.
|
|
56
|
+
Callback exceptions are preserved. `KeyboardInterrupt` is propagated.
|
|
57
|
+
- Pass `cancel=CancellationToken()` and call `token.cancel()` from another thread
|
|
58
|
+
for cooperative cancellation. A callback must return before it can be interrupted
|
|
59
|
+
by that token. Tokens remain cancelled after use.
|
|
60
|
+
|
|
61
|
+
Output arrays own their storage and are mutable. Mutating them can invalidate
|
|
62
|
+
connectivity, metadata or diagnostics. Surface output is the closed solid boundary,
|
|
63
|
+
not an independent zero-level surface mesher. Small features may be missed at
|
|
64
|
+
insufficient resolution; successful sampling is not geometry certification.
|
|
65
|
+
|
|
66
|
+
## Validation and limits
|
|
67
|
+
|
|
68
|
+
The test suite covers automatic derivatives, cache invalidation, cancellation,
|
|
69
|
+
periodicity, bounded callbacks, named intersections, physical coordinate scales
|
|
70
|
+
and VTKHDF round trips. CI tests Python 3.10, 3.12 and 3.14 on Linux, Windows
|
|
71
|
+
and macOS, plus installed platform wheels and an isolated source build.
|
|
72
|
+
See the [release checks](https://github.com/kmarchais/meshers/blob/main/docs/site/release.md)
|
|
73
|
+
and [CI results](https://github.com/kmarchais/meshers/actions). Thin, nonsmooth or
|
|
74
|
+
poorly resolved geometry still needs application-specific convergence checks.
|
|
75
|
+
|
|
76
|
+
See the [runnable examples](https://github.com/kmarchais/meshers/blob/main/docs/site/examples.md) and [performance regression checks](https://github.com/kmarchais/meshers/blob/main/docs/site/performance.md).
|
|
77
|
+
|
|
78
|
+
## Maintainer build
|
|
79
|
+
|
|
80
|
+
Maintainers need a compatible Rust toolchain and Python to build wheels:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
python -m pip install maturin
|
|
84
|
+
maturin build --release --interpreter python --out dist
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
End users install the resulting wheels. Source installations require Rust.
|
|
88
|
+
|
|
89
|
+
## Retained intersections and mapped periodic ends
|
|
90
|
+
|
|
91
|
+
`meshers.generate_intersection` accepts named negative sublevel constraints,
|
|
92
|
+
an optional coordinate map and explicit rigid periodic transforms. It returns
|
|
93
|
+
the same Mesh type, with named surface access, feature edges and parameter
|
|
94
|
+
coordinates. See the [intersection guide](https://github.com/kmarchais/meshers/blob/main/docs/site/intersections.md)
|
|
95
|
+
and `examples/curved_tpms.py`. Source builds require Rust 1.95 or newer.
|