-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create wrapper #2
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
At the moment, works (barely). I can't seem to get the development install working, so you'll have to build the wheel and then install it for local testing. Here's the install command (run from pytetwild repo root directory) pip install pipx
pipx run build --wheel
pip install dist/* Right now it's just a raw wrapper. Work with it with: import pyvista as pv
import numpy as np
from pytetwild import PyfTetWildWrapper
mesh = pv.Icosphere(nsub=0)
print(mesh)
# Extract vertices and faces from the bunny mesh
vertices = np.array(mesh.points, dtype=np.float64) # Ensure correct data type
faces = np.array(mesh.faces.reshape((-1, 4))[:, 1:4], dtype=np.int32)
# Tetrahedralize the mesh using PyfTetWildWrapper
tetrahedral_mesh_vertices, tetrahedral_mesh_tetrahedra = PyfTetWildWrapper.tetrahedralize_mesh(vertices, faces)
# Convert tetrahedral mesh data back to PyVista mesh for visualization
# Note: PyVista's UnstructuredGrid expects cells to be defined by the number of points in the cell followed by the indices of the points in the cell
cells = np.hstack([np.full((tetrahedral_mesh_tetrahedra.shape[0], 1), 4, dtype=np.int32), tetrahedral_mesh_tetrahedra])
# Define cell types for the UnstructuredGrid, 10 represents tetrahedra
cell_types = np.full(tetrahedral_mesh_tetrahedra.shape[0], 10, dtype=np.uint8)
# Create a PyVista unstructured grid
tetrahedral_mesh = pv.UnstructuredGrid(cells, cell_types, tetrahedral_mesh_vertices)
# Visualize the tetrahedral mesh
tetrahedral_mesh.explode(1).plot(show_edges=True) |
for more information, see https://pre-commit.ci
output reproduces default settings in fTetWild - preparing for switches
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Create a basic wrapper of ftetwild.
Resolves #1.
main.cpp
cibuildwheel