jax_sbgeom.jax_utils.mesh module¶
- mesh_to_pyvista_mesh(pts, conn=None)[source]¶
Convert a mesh defined by pts and conn to a pyvista mesh
Either pass a tuple (pts, conn) or pts and conn separately.
- Parameters:
pts (jnp.ndarray [N_points, 3]) – Points of the mesh
conn (jnp.ndarray [N_elements, M] optional) – Connectivity of the mesh (triangles or tetrahedra)
- Return type:
pyvista mesh
- vertices_to_pyvista_polyline(pts: Array)[source]¶
Convert a set of points to a pyvista polyline
- Parameters:
pts (
Array) – Points of the polyline- Return type:
pyvista PolyData line
- surface_normals_from_mesh(mesh)[source]¶
Compute surface normals from triangular mesh
- Parameters:
mesh (tuple (pts, conn)) –
- ptsjnp.ndarray [N_points, 3]
Points of the mesh
- connjnp.ndarray [N_triangles, 3]
Connectivity of the mesh (triangles)
- Returns:
Normals at each face of the mesh
- Return type:
jnp.ndarray [N_faces, 3]
- boundary_normal_vectors_from_tetrahedron(tetrahedron: Array)[source]¶
Create a boundary vector from tetrahedron
- Parameters:
tetrahedron (
Array) – Tetrahedron vertex locations- Returns:
boundary – Normal
- Return type:
jnp.ndarray […, 4,3]
- boundary_centroids_from_tetrahedron(tetrahedron: Array)[source]¶
Create the centroids of all boundaries from tetrahedron
- Parameters:
tetrahedra (jnp.ndarray [..., 4,3]) – Tetrahedron vertex locations
- Returns:
centroids – Centroids
- Return type:
jnp.ndarray […, 4,3]
- area_of_mesh(positions: Array, connectivity: Array)[source]¶
Total area of a triangle mesh (sum of the triangle areas).
- Parameters:
positions (
Array) – Vertex positions, shape (n_vertices, 3)connectivity (
Array) – Triangle vertex indices, shape (n_triangles, 3)
- Returns:
Sum of the triangle areas
- Return type:
float