warp.fem.Tetmesh#

class warp.fem.Tetmesh(
tet_vertex_indices,
positions,
build_bvh=False,
temporary_store=None,
cell_env=None,
env_count=None,
)[source]#

Tetrahedral mesh geometry.

Parameters:
__init__(
tet_vertex_indices,
positions,
build_bvh=False,
temporary_store=None,
cell_env=None,
env_count=None,
)[source]#

Construct a tetrahedral mesh.

Parameters:
  • tet_vertex_indices (array) – warp array of shape (num_tets, 4) containing vertex indices for each tet

  • positions (array) – warp array of shape (num_vertices, 3) containing 3d position for each vertex

  • build_bvh (bool) – Whether to also build the tet BVH, which is necessary for the global fem.lookup operator to function without initial guess

  • temporary_store (TemporaryStore | None) – shared pool from which to allocate temporary arrays

  • cell_env (array | None) – Optional per-cell environment indices. If provided, env_count must also be provided.

  • env_count (int | None) – Number of environments represented by cell_env.

Methods

__init__(tet_vertex_indices, positions[, ...])

Construct a tetrahedral mesh.

boundary_side_count()

Number of boundary sides in the mesh.

build_bvh([device])

Rebuild the geometry's Bounding Volume Hierarchy (BVH) for device from scratch.

bvh_id(device)

Return the BVH identifier for the given device, or 0 if unavailable.

cell_arg_value(device)

cell_bvh_groups(device)

Return optional per-cell BVH group indices on device.

cell_count()

Number of cells in the mesh.

cell_env_arg_value(device)

Return per-cell environment indices for geometry argument structs.

cell_measure(args, s)

Device function returning the measure determinant (e.g. volume, area) at a given point.

cell_normal(args, s)

Device function returning the element normal at a sample point.

edge_count()

Number of edges in the mesh.

environment_count()

Number of topologically independent environments represented by this geometry.

fill_cell_arg(args, device)

Fill the arguments to be passed to cell-related device functions.

fill_side_arg(args, device)

Fill the arguments to be passed to side-related device functions.

fill_side_index_arg(args, device)

Fill the arguments to be passed to side-index device functions.

make_filtered_cell_lookup([filter_func])

Create a filtered cell lookup function.

reference_cell()

Reference element for mesh cells.

reference_side()

Reference element for mesh sides.

side_arg_value(device)

side_count()

Number of sides in the mesh.

side_index_arg_value(device)

side_inner_inverse_deformation_gradient(...)

Device function returning the matrix right-transforming a gradient w.r.t.

side_measure(args, s)

Device function returning the measure determinant (e.g. volume, area) at a given point.

side_measure_ratio(args, s)

Device function returning the ratio of the measure of a side to that of its neighbour cells

side_normal(args, s)

Device function returning the element normal at a sample point

side_outer_inverse_deformation_gradient(...)

Device function returning the matrix right-transforming a gradient w.r.t.

supports_cell_lookup(device)

Return whether cell lookups are supported on the given device.

update_bvh([device])

Refit the geometry's BVH if it exists on device, or build it from scratch otherwise.

vertex_count()

Number of vertices in the mesh.

Attributes

SideIndexArg

Structure containing arguments to be passed to device functions for indexing sides.

base

Return the base geometry from which this geometry derives its topology.

boundary_side_index

cell_bounds

cell_bvh_id

cell_closest_point

cell_deformation_gradient

cell_dimension

Manifold dimension of the geometry cells

cell_env

Optional per-cell environment indices.

cell_environment_index

cell_inverse_deformation_gradient

cell_lookup

Device function for looking up the closest cell to a position.

cell_measure_ratio

cell_position

compute_cell_bvh_groups

coords_type

Warp vector type for element coordinates matching this geometry's scalar precision.

dimension

Dimension of the embedding space.

face_tet_indices

Tet indices for each face.

face_to_tet_coords

face_vertex_indices

Vertex indices for each face.

name

Name of the geometry, including environment and scalar type suffixes.

sample_type

Warp struct type for samples matching this geometry's scalar precision.

scalar_type

side_closest_point

side_deformation_gradient

side_environment_index

side_from_cell_coords

side_inner_cell_coords

side_inner_cell_index

side_outer_cell_coords

side_outer_cell_index

side_position

side_to_cell_arg

tet_edge_indices

Edge indices for each tet element.

CellArg

Structure containing arguments to be passed to device functions evaluating cell-related quantities.

SideArg

Structure containing arguments to be passed to device functions evaluating side-related quantities.

dimension: int = 3#

Dimension of the embedding space.

property scalar_type[source]#
cell_count()[source]#

Number of cells in the mesh.

vertex_count()[source]#

Number of vertices in the mesh.

side_count()[source]#

Number of sides in the mesh.

edge_count()[source]#

Number of edges in the mesh.

boundary_side_count()[source]#

Number of boundary sides in the mesh.

reference_cell()[source]#

Reference element for mesh cells.

Return type:

Element

reference_side()[source]#

Reference element for mesh sides.

Return type:

Element

property tet_edge_indices: array[source]#

Edge indices for each tet element.

property face_tet_indices: array[source]#

Tet indices for each face.

property face_vertex_indices: array[source]#

Vertex indices for each face.

SideIndexArg: Struct = <warp._src.codegen.Struct object>#

Structure containing arguments to be passed to device functions for indexing sides.

fill_cell_arg(args, device)[source]#

Fill the arguments to be passed to cell-related device functions.

cell_position = <Function Tetmesh__cell_position(args: Any, s: Any)>#
Parameters:
cell_deformation_gradient = <Function Tetmesh__cell_deformation_gradient(args: Any, s: Any)>#
Parameters:
cell_inverse_deformation_gradient = <Function Tetmesh__cell_inverse_deformation_gradient(args: Any, s: Any)>#
Parameters:
cell_closest_point = <Function Tetmesh__cell_closest_point(args: Any, tet_index: int, pos: Any)>#
Parameters:
cell_environment_index = <Function Tetmesh__cell_environment_index(args: Any, cell_index: int)>#
Parameters:
boundary_side_index = <Function Tetmesh__boundary_side_index(args: warp._src.fem.geometry.tetmesh.Tetmesh.SideIndexArg, boundary_side_index: int)>#
Parameters:
  • args (SideIndexArg)

  • boundary_side_index (int)

fill_side_index_arg(args, device)[source]#

Fill the arguments to be passed to side-index device functions.

Parameters:

args (SideIndexArg)

fill_side_arg(args, device)[source]#

Fill the arguments to be passed to side-related device functions.

side_position = <Function Tetmesh__side_position(args: Any, s: Any)>#
Parameters:
side_closest_point = <Function Tetmesh__side_closest_point(args: Any, tri_index: int, pos: Any)>#
Parameters:
side_deformation_gradient = <Function Tetmesh__side_deformation_gradient(args: Any, s: Any)>#
Parameters:
side_inner_cell_index = <Function Tetmesh__side_inner_cell_index(arg: Any, side_index: int)>#
Parameters:
side_outer_cell_index = <Function Tetmesh__side_outer_cell_index(arg: Any, side_index: int)>#
Parameters:
side_environment_index = <Function Tetmesh__side_environment_index(args: Any, side_index: int)>#
Parameters:
face_to_tet_coords = <Function Tetmesh__face_to_tet_coords(args: Any, side_index: int, tet_index: int, side_coords: Any)>#
Parameters:
  • args (Any)

  • side_index (int)

  • tet_index (int)

  • side_coords (Any)

side_inner_cell_coords = <Function Tetmesh__side_inner_cell_coords(args: Any, side_index: int, side_coords: Any)>#
Parameters:
  • args (Any)

  • side_index (int)

  • side_coords (Any)

side_outer_cell_coords = <Function Tetmesh__side_outer_cell_coords(args: Any, side_index: int, side_coords: Any)>#
Parameters:
  • args (Any)

  • side_index (int)

  • side_coords (Any)

side_from_cell_coords = <Function Tetmesh__side_from_cell_coords(args: Any, side_index: int, tet_index: int, tet_coords: Any)>#
Parameters:
  • args (Any)

  • side_index (int)

  • tet_index (int)

  • tet_coords (Any)

side_to_cell_arg = <Function Tetmesh__side_to_cell_arg(side_arg: Any)>#
Parameters:

side_arg (Any)

cell_bvh_id = <Function Tetmesh__cell_bvh_id(cell_arg: Any)>#
Parameters:

cell_arg (Any)

cell_bounds = <Function Tetmesh__cell_bounds(cell_arg: Any, cell_index: int)>#
Parameters:
  • cell_arg (Any)

  • cell_index (int)