pytetwild 0.1.dev0__cp310-cp310-win_amd64.whl → 0.1.dev1__cp310-cp310-win_amd64.whl
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.
- pytetwild/PyfTetWildWrapper.pyd +0 -0
- pytetwild/__init__.py +3 -3
- pytetwild/py.typed +1 -0
- pytetwild/pytetwild.py +70 -8
- pytetwild-0.1.dev1.dist-info/DELVEWHEEL +2 -0
- {pytetwild-0.1.dev0.dist-info → pytetwild-0.1.dev1.dist-info}/METADATA +61 -17
- pytetwild-0.1.dev1.dist-info/RECORD +14 -0
- pytetwild-0.1.dev0.dist-info/DELVEWHEEL +0 -2
- pytetwild-0.1.dev0.dist-info/RECORD +0 -13
- {pytetwild-0.1.dev0.dist-info → pytetwild-0.1.dev1.dist-info}/WHEEL +0 -0
- {pytetwild-0.1.dev0.dist-info → pytetwild-0.1.dev1.dist-info}/entry_points.txt +0 -0
- {pytetwild-0.1.dev0.dist-info → pytetwild-0.1.dev1.dist-info}/licenses/LICENSE +0 -0
pytetwild/PyfTetWildWrapper.pyd
CHANGED
|
Binary file
|
pytetwild/__init__.py
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
# start delvewheel patch
|
|
5
|
-
def
|
|
5
|
+
def _delvewheel_patch_1_5_4():
|
|
6
6
|
import os
|
|
7
7
|
libs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'pytetwild.libs'))
|
|
8
8
|
if os.path.isdir(libs_dir):
|
|
9
9
|
os.add_dll_directory(libs_dir)
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
del
|
|
12
|
+
_delvewheel_patch_1_5_4()
|
|
13
|
+
del _delvewheel_patch_1_5_4
|
|
14
14
|
# end delvewheel patch
|
|
15
15
|
|
|
16
16
|
from ._version import __version__ # noqa: F401
|
pytetwild/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
partial
|
pytetwild/pytetwild.py
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
"""Wrapper for fTetWild."""
|
|
2
2
|
import warnings
|
|
3
3
|
import numpy as np
|
|
4
|
-
from pytetwild import PyfTetWildWrapper
|
|
4
|
+
from pytetwild import PyfTetWildWrapper # type: ignore
|
|
5
5
|
from typing import Tuple, TYPE_CHECKING
|
|
6
|
+
import numpy.typing as npt
|
|
6
7
|
|
|
7
8
|
if TYPE_CHECKING:
|
|
8
9
|
import pyvista as pv
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
def
|
|
12
|
+
def _check_edge_length(edge_length_fac: float) -> None:
|
|
13
|
+
"""Check edge length.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
edge_length_fac : float, default: 0.05
|
|
18
|
+
Tetrahedral edge length as a function of bounding box diagional. The
|
|
19
|
+
default ideal edge length is bb/20 (bounding box divided by 20).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
if edge_length_fac > 1.0 or edge_length_fac < 0.0 + 1e-16:
|
|
24
|
+
raise ValueError("Edge length factor must be between 1e-16 and 1.0")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def tetrahedralize_pv(
|
|
28
|
+
mesh: "pv.PolyData", edge_length_fac: float = 0.05, optimize: bool = True
|
|
29
|
+
) -> "pv.UnstructuredGrid":
|
|
12
30
|
"""
|
|
13
31
|
Convert a PyVista surface mesh to a PyVista unstructured grid.
|
|
14
32
|
|
|
@@ -16,11 +34,33 @@ def tetrahedralize_pv(mesh: "pv.PolyData") -> "pv.UnstructuredGrid":
|
|
|
16
34
|
----------
|
|
17
35
|
mesh : pv.PolyData
|
|
18
36
|
The input surface mesh.
|
|
37
|
+
edge_length_fac : float, default: 0.05
|
|
38
|
+
Tetrahedral edge length as a function of bounding box diagional. The
|
|
39
|
+
default ideal edge length is bb/20 (bounding box divided by 20).
|
|
40
|
+
optimize : bool
|
|
41
|
+
Improve the minimum scaled Jacobean for each cell. This leads to higher
|
|
42
|
+
cell quality at the expense of computation time.
|
|
19
43
|
|
|
20
44
|
Returns
|
|
21
45
|
-------
|
|
22
46
|
pv.UnstructuredGrid
|
|
23
|
-
The converted unstructured grid.
|
|
47
|
+
The converted unstructured grid containing only tetrahedra.
|
|
48
|
+
|
|
49
|
+
Examples
|
|
50
|
+
--------
|
|
51
|
+
>>> import pyvista as pv
|
|
52
|
+
>>> import pytetwild
|
|
53
|
+
>>> surface_mesh = pv.Sphere()
|
|
54
|
+
>>> tetrahedral_mesh = pytetwild.tetrahedralize_pv(surface_mesh)
|
|
55
|
+
>>> tetrahedral_mesh
|
|
56
|
+
UnstructuredGrid (0x7ff568593d00)
|
|
57
|
+
N Cells: 7247
|
|
58
|
+
N Points: 1658
|
|
59
|
+
X Bounds: -4.993e-01, 4.993e-01
|
|
60
|
+
Y Bounds: -4.965e-01, 4.965e-01
|
|
61
|
+
Z Bounds: -5.000e-01, 4.999e-01
|
|
62
|
+
N Arrays: 0
|
|
63
|
+
|
|
24
64
|
"""
|
|
25
65
|
try:
|
|
26
66
|
import pyvista as pv
|
|
@@ -29,6 +69,9 @@ def tetrahedralize_pv(mesh: "pv.PolyData") -> "pv.UnstructuredGrid":
|
|
|
29
69
|
"Install PyVista to use this feature with:\n\n" "pip install pytetwild[all]"
|
|
30
70
|
)
|
|
31
71
|
|
|
72
|
+
if not isinstance(mesh, pv.PolyData):
|
|
73
|
+
raise TypeError(f"`mesh` must be a pyvista.PolyData, got {type(mesh)}")
|
|
74
|
+
|
|
32
75
|
if not mesh.is_all_triangles:
|
|
33
76
|
warnings.warn(
|
|
34
77
|
"Input mesh is not all triangles. Either call `.triangulate()`"
|
|
@@ -36,13 +79,14 @@ def tetrahedralize_pv(mesh: "pv.PolyData") -> "pv.UnstructuredGrid":
|
|
|
36
79
|
)
|
|
37
80
|
mesh = mesh.triangulate()
|
|
38
81
|
|
|
39
|
-
|
|
40
|
-
|
|
82
|
+
_check_edge_length(edge_length_fac)
|
|
83
|
+
vertices = mesh.points.astype(np.float64, copy=False)
|
|
84
|
+
faces = mesh.faces.reshape((-1, 4))[:, 1:4].astype(np.float32, copy=False)
|
|
41
85
|
|
|
42
86
|
(
|
|
43
87
|
tetrahedral_mesh_vertices,
|
|
44
88
|
tetrahedral_mesh_tetrahedra,
|
|
45
|
-
) = PyfTetWildWrapper.tetrahedralize_mesh(vertices, faces)
|
|
89
|
+
) = PyfTetWildWrapper.tetrahedralize_mesh(vertices, faces, optimize, edge_length_fac)
|
|
46
90
|
|
|
47
91
|
cells = np.hstack(
|
|
48
92
|
[
|
|
@@ -55,7 +99,12 @@ def tetrahedralize_pv(mesh: "pv.PolyData") -> "pv.UnstructuredGrid":
|
|
|
55
99
|
return pv.UnstructuredGrid(cells, cell_types, tetrahedral_mesh_vertices)
|
|
56
100
|
|
|
57
101
|
|
|
58
|
-
def tetrahedralize(
|
|
102
|
+
def tetrahedralize(
|
|
103
|
+
vertices: npt.NDArray[np.float64],
|
|
104
|
+
faces: npt.NDArray[np.int32],
|
|
105
|
+
optimize: bool = True,
|
|
106
|
+
edge_length_fac: float = 0.05,
|
|
107
|
+
) -> Tuple[npt.NDArray[np.float64], npt.NDArray[np.int32]]:
|
|
59
108
|
"""
|
|
60
109
|
Convert mesh vertices and faces to a tetrahedral mesh.
|
|
61
110
|
|
|
@@ -65,10 +114,23 @@ def tetrahedralize(vertices: np.ndarray, faces: np.ndarray) -> Tuple[np.ndarray,
|
|
|
65
114
|
The vertices of the mesh.
|
|
66
115
|
faces : np.ndarray
|
|
67
116
|
The faces of the mesh.
|
|
117
|
+
optimize : bool
|
|
118
|
+
Improve the minimum scaled Jacobean for each cell. This leads to higher
|
|
119
|
+
cell quality at the expense of computation time.
|
|
120
|
+
edge_length_fac : float, default: 0.05
|
|
121
|
+
Tetrahedral edge length as a function of bounding box diagional. The
|
|
122
|
+
default ideal edge length is bb/20 (bounding box divided by 20).
|
|
68
123
|
|
|
69
124
|
Returns
|
|
70
125
|
-------
|
|
71
126
|
Tuple[np.ndarray, np.ndarray]
|
|
72
127
|
A tuple containing the vertices and tetrahedra of the tetrahedral mesh.
|
|
73
128
|
"""
|
|
74
|
-
|
|
129
|
+
_check_edge_length(edge_length_fac)
|
|
130
|
+
if not isinstance(vertices, np.ndarray):
|
|
131
|
+
raise TypeError("`vertices` must be a numpy array")
|
|
132
|
+
if not isinstance(faces, np.ndarray):
|
|
133
|
+
raise TypeError("`faces` must be a numpy array")
|
|
134
|
+
vertices = vertices.astype(np.float64, copy=False)
|
|
135
|
+
faces = faces.astype(np.int32, copy=False)
|
|
136
|
+
return PyfTetWildWrapper.tetrahedralize_mesh(vertices, faces, optimize, edge_length_fac)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Version: 1.5.4
|
|
2
|
+
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-rdukv1yg\\cp310-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-rdukv1yg\\cp310-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-rdukv1yg\\cp310-win_amd64\\built_wheel\\pytetwild-0.1.dev1-cp310-cp310-win_amd64.whl', '--add-path', '.']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytetwild
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.dev1
|
|
4
4
|
Summary: Python wrapper of fTetWild
|
|
5
5
|
Author-Email: Alex Kaszynski <akascap@gmail.com>
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -62,28 +62,72 @@ more details.
|
|
|
62
62
|
Usage
|
|
63
63
|
*****
|
|
64
64
|
|
|
65
|
-
To tetrahedralize a surface mesh:
|
|
65
|
+
To tetrahedralize a surface mesh from `PyVista <https://docs.pyvista.org>`_:
|
|
66
66
|
|
|
67
|
-
.. code::
|
|
67
|
+
.. code:: py
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
>>> mesh.vertices
|
|
72
|
-
array([[x1, y1, z1],
|
|
73
|
-
[x2, y2, z2],
|
|
74
|
-
...], dtype=float32)
|
|
75
|
-
>>> mesh.tetrahedra
|
|
76
|
-
array([[i1, j1, k1, l1],
|
|
77
|
-
[i2, j2, k2, l2],
|
|
78
|
-
...], dtype=int32)
|
|
69
|
+
import pyvista as pv
|
|
70
|
+
import pytetwild
|
|
79
71
|
|
|
80
|
-
|
|
72
|
+
# Load or create a PyVista PolyData surface mesh
|
|
73
|
+
# Here, we'll create a simple sphere mesh as an example
|
|
74
|
+
surface_mesh = pv.Icosphere(nsub=2)
|
|
81
75
|
|
|
82
|
-
|
|
76
|
+
# Convert the surface mesh to a tetrahedral mesh. For this example let's
|
|
77
|
+
# use a coarse mesh
|
|
78
|
+
tetrahedral_mesh = pytetwild.tetrahedralize_pv(surface_mesh, edge_length_fac=1))
|
|
79
|
+
|
|
80
|
+
# Visualize the tetrahedral mesh in an "exploded" view
|
|
81
|
+
tetrahedral_mesh.explode(1).plot(show_edges=True)
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
.. image:: https://github.com/pyvista/pytetwild/raw/main/exploded-sphere.png
|
|
84
|
+
|
|
85
|
+
You can also work with raw arrays. Here's a simple cube that we turn into tetrahedra.
|
|
86
|
+
|
|
87
|
+
.. code:: pycon
|
|
86
88
|
|
|
89
|
+
import numpy as np
|
|
90
|
+
|
|
91
|
+
# Define vertices of the cube
|
|
92
|
+
vertices = np.array([
|
|
93
|
+
[0, 0, 0], # Vertex 0
|
|
94
|
+
[1, 0, 0], # Vertex 1
|
|
95
|
+
[1, 1, 0], # Vertex 2
|
|
96
|
+
[0, 1, 0], # Vertex 3
|
|
97
|
+
[0, 0, 1], # Vertex 4
|
|
98
|
+
[1, 0, 1], # Vertex 5
|
|
99
|
+
[1, 1, 1], # Vertex 6
|
|
100
|
+
[0, 1, 1] # Vertex 7
|
|
101
|
+
])
|
|
102
|
+
|
|
103
|
+
# Define faces using vertex indices
|
|
104
|
+
# Each face is a rectangle (also accepts triangles)
|
|
105
|
+
faces = np.array([
|
|
106
|
+
[0, 1, 2, 3], # Front face
|
|
107
|
+
[1, 5, 6, 2], # Right face
|
|
108
|
+
[5, 4, 7, 6], # Back face
|
|
109
|
+
[4, 0, 3, 7], # Left face
|
|
110
|
+
[4, 5, 1, 0], # Bottom face
|
|
111
|
+
[3, 2, 6, 7] # Top face
|
|
112
|
+
])
|
|
113
|
+
v_out, tetra = pytetwild.tetrahedralize(vertices, faces, optimize=False)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
Usage - Options
|
|
117
|
+
---------------
|
|
118
|
+
We've surfaced a handful of parameters to each of our interfaces
|
|
119
|
+
``tetrahedralize`` and ``tetrahedralize_pv``. Here are the optional parameters.
|
|
120
|
+
|
|
121
|
+
.. code::
|
|
122
|
+
|
|
123
|
+
Additional Parameters
|
|
124
|
+
---------------------
|
|
125
|
+
edge_length_fac : float, default: 0.05
|
|
126
|
+
Tetrahedral edge length as a function of bounding box diagional. The
|
|
127
|
+
default ideal edge length is bb/20 (bounding box divided by 20).
|
|
128
|
+
optimize : bool
|
|
129
|
+
Improve the minimum scaled Jacobean for each cell. This leads to higher
|
|
130
|
+
cell quality at the expense of computation time.
|
|
87
131
|
|
|
88
132
|
|
|
89
133
|
License and Acknowledgments
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
pytetwild/py.typed,sha256=mDShSrm8qg9qjacQc2F-rI8ATllqP6EdgHuEYxuCXZ0,7
|
|
2
|
+
pytetwild/PyfTetWildWrapper.pyd,sha256=drheVC_9LDlGgYPyjAdcxmEKW0Rcsu2wNx2xOBrZFVs,4988416
|
|
3
|
+
pytetwild/pytetwild.py,sha256=PSLlG5czLo2Z2aZtcgxmZAy97E9eAtbo7EdvY0WONIs,4646
|
|
4
|
+
pytetwild/_version.py,sha256=hbg9UkagWDGV6Zg23kEpex_otuUYHUzMCHXYTnFnHmE,118
|
|
5
|
+
pytetwild/__init__.py,sha256=QdK3GINbrnK1cwEauX0cPgzkVCa1VPait8aGT2AJN4Q,486
|
|
6
|
+
pytetwild-0.1.dev1.dist-info/DELVEWHEEL,sha256=9gdhJR4vb_YdBPE6ej5YzI4lvi6480X3Wh0PPcfM5TM,423
|
|
7
|
+
pytetwild-0.1.dev1.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
pytetwild-0.1.dev1.dist-info/METADATA,sha256=6I1FzXoY9ezDC8EWamtUR2MVxWtBvgjD5frhxz4gw6Y,4587
|
|
9
|
+
pytetwild-0.1.dev1.dist-info/RECORD,,
|
|
10
|
+
pytetwild-0.1.dev1.dist-info/WHEEL,sha256=8XuJkyxPIT13OzegTGarRVhmDP5NkOix_zaC7jtZJJE,105
|
|
11
|
+
pytetwild-0.1.dev1.dist-info/licenses/LICENSE,sha256=k0P1sbYupRWlxoESvbYq2UzoMW6MXA84LltqR-4mEo4,17096
|
|
12
|
+
pytetwild.libs/concrt140-ddbfd8b75976783430ced289c6b989c3.dll,sha256=BZPGv1uz0YBgBOgTWBBL0elt7C3clmR348_2Zlqh47Q,302080
|
|
13
|
+
pytetwild.libs/mpir-0f58ffaa159ebf7efb9359a55c2d7f23.dll,sha256=qd6vEIL0JPtRZ39EzelGE9rApfJ6duoMgV8jT8UHGns,612352
|
|
14
|
+
pytetwild.libs/msvcp140-3499a3a8427eec4915749ee9a8991ddd.dll,sha256=oDDcLf0uyiipN1ySmJrfTa8WH5iNteFrnhBnjrDf9Mc,573008
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Version: 1.5.2
|
|
2
|
-
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-a87uf2fd\\cp310-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-a87uf2fd\\cp310-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-a87uf2fd\\cp310-win_amd64\\built_wheel\\pytetwild-0.1.dev0-cp310-cp310-win_amd64.whl', '--add-path', '.']
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
pytetwild/PyfTetWildWrapper.pyd,sha256=UuNiz6sAfdNOMcAi9EPWcmMs4OvCTiHLA6tQar9U6Cs,4988416
|
|
2
|
-
pytetwild/pytetwild.py,sha256=fA0lXIqIf97TONhpX2vME7_3vS_9kVh8ianOVIC44EU,2169
|
|
3
|
-
pytetwild/_version.py,sha256=hbg9UkagWDGV6Zg23kEpex_otuUYHUzMCHXYTnFnHmE,118
|
|
4
|
-
pytetwild/__init__.py,sha256=01OqAVF8WQmKyJjKPOTwgJCDAqYmP-KwbCF9VhN--xo,486
|
|
5
|
-
pytetwild-0.1.dev0.dist-info/DELVEWHEEL,sha256=SHYn2-hpJw46uLwvXBovphCM_cH6y5DadxgiGIXrv_A,423
|
|
6
|
-
pytetwild-0.1.dev0.dist-info/entry_points.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
pytetwild-0.1.dev0.dist-info/METADATA,sha256=tAozjdbNnB40sjP1A_7R-maND-a9aNqKpNibMwI0k3c,3038
|
|
8
|
-
pytetwild-0.1.dev0.dist-info/RECORD,,
|
|
9
|
-
pytetwild-0.1.dev0.dist-info/WHEEL,sha256=8XuJkyxPIT13OzegTGarRVhmDP5NkOix_zaC7jtZJJE,105
|
|
10
|
-
pytetwild-0.1.dev0.dist-info/licenses/LICENSE,sha256=k0P1sbYupRWlxoESvbYq2UzoMW6MXA84LltqR-4mEo4,17096
|
|
11
|
-
pytetwild.libs/concrt140-ddbfd8b75976783430ced289c6b989c3.dll,sha256=BZPGv1uz0YBgBOgTWBBL0elt7C3clmR348_2Zlqh47Q,302080
|
|
12
|
-
pytetwild.libs/mpir-0f58ffaa159ebf7efb9359a55c2d7f23.dll,sha256=qd6vEIL0JPtRZ39EzelGE9rApfJ6duoMgV8jT8UHGns,612352
|
|
13
|
-
pytetwild.libs/msvcp140-3499a3a8427eec4915749ee9a8991ddd.dll,sha256=oDDcLf0uyiipN1ySmJrfTa8WH5iNteFrnhBnjrDf9Mc,573008
|
|
File without changes
|
|
File without changes
|
|
File without changes
|