warp.fem.Geometry#

class warp.fem.Geometry[source]#

Interface class for discrete geometries

A geometry is composed of cells and sides. Sides may be boundary or interior (between cells).

__init__()#

Methods

__init__()

boundary_side_count()

Number of boundary sides (sides with a single neighbour cell) in the geometry

boundary_side_index(args, boundary_side_index)

Device function returning the side index corresponding to a boundary side

build_bvh([device])

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

bvh_id(device)

cell_arg_value(device)

cell_count()

Number of cells in the geometry

cell_deformation_gradient(args, s)

Device function returning the transpose of the gradient of world position with respect to reference cell

cell_inverse_deformation_gradient(args, s)

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

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.

cell_position(args, s)

Device function returning the world position of a cell sample point

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-related device functions

make_filtered_cell_lookup([filter_func])

reference_cell()

Prototypical element for a cell

reference_side()

Prototypical element for a side

side_arg_value(device)

side_count()

Number of sides in the geometry

side_deformation_gradient(args, s)

Device function returning the gradient of world position with respect to reference side

side_from_cell_coords(args, side_index, ...)

Device function converting coordinates on a cell to coordinates on a side, or OUTSIDE

side_index_arg_value(device)

side_inner_cell_coords(args, side_index, ...)

Device function returning the coordinates of a point on a side in the inner cell

side_inner_cell_index(args, side_index)

Device function returning the inner cell index for a given side

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_cell_coords(args, side_index, ...)

Device function returning the coordinates of a point on a side in the outer cell

side_outer_cell_index(args, side_index)

Device function returning the outer cell index for a given side

side_outer_inverse_deformation_gradient(...)

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

side_position(args, s)

Device function returning the side position at a sample point

side_to_cell_arg(side_arg)

Device function converting a side-related argument value to a cell-related argument value, for promoting trace samples to the full space

supports_cell_lookup(device)

update_bvh([device])

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

Attributes

base

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

cell_dimension

Manifold dimension of the geometry cells

cell_lookup

cell_measure_ratio

dimension

name

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

SideIndexArg

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

dimension: int = 0#
cell_count()[source]#

Number of cells in the geometry

side_count()[source]#

Number of sides in the geometry

boundary_side_count()[source]#

Number of boundary sides (sides with a single neighbour cell) in the geometry

reference_cell()[source]#

Prototypical element for a cell

Return type:

Element

reference_side()[source]#

Prototypical element for a side

Return type:

Element

property cell_dimension: int[source]#

Manifold dimension of the geometry cells

property base: Geometry[source]#

Returns the base geometry from which this geometry derives its topology. Usually self

property name: str[source]#
CellArg: Struct#

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

SideArg: Struct#

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

SideIndexArg: Struct#

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

cell_arg_value(device)[source]#
fill_cell_arg(args, device)[source]#

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

Parameters:

args (Geometry.CellArg)

static cell_position(args, s)[source]#

Device function returning the world position of a cell sample point

Parameters:
  • args (Geometry.CellArg)

  • s (Sample)

static cell_deformation_gradient(args, s)[source]#

Device function returning the transpose of the gradient of world position with respect to reference cell

Parameters:
  • args (Geometry.CellArg)

  • s (Sample)

static cell_inverse_deformation_gradient(args, s)[source]#

Device function returning the matrix right-transforming a gradient w.r.t. cell space to a gradient w.r.t. world space (i.e. the inverse deformation gradient)

Parameters:
  • args (Geometry.CellArg)

  • s (Sample)

static cell_measure(args, s)[source]#

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

Parameters:
  • args (Geometry.CellArg)

  • s (Sample)

cell_measure_ratio = <Function Geometry__cell_measure_ratio(args: typing.Any, s: warp._src.fem.types.Sample)>#
Parameters:
  • args (Any)

  • s (Sample)

static cell_normal(args, s)[source]#

Device function returning the element normal at a sample point.

For elements with the same dimension as the embedding space, this will be zero.

Parameters:
  • args (Geometry.CellArg)

  • s (Sample)

side_arg_value(device)[source]#
fill_side_arg(args, device)[source]#

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

Parameters:

args (Geometry.SideArg)

side_index_arg_value(device)[source]#
fill_side_index_arg(args, device)[source]#

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

Parameters:

args (Geometry.SideIndexArg)

static boundary_side_index(args, boundary_side_index)[source]#

Device function returning the side index corresponding to a boundary side

Parameters:
  • args (Geometry.SideIndexArg)

  • boundary_side_index (int)

static side_position(args, s)[source]#

Device function returning the side position at a sample point

Parameters:
  • args (Geometry.SideArg)

  • s (Sample)

static side_deformation_gradient(args, s)[source]#

Device function returning the gradient of world position with respect to reference side

Parameters:
  • args (Geometry.SideArg)

  • s (Sample)

static side_inner_inverse_deformation_gradient(
args,
side_index,
coords,
)[source]#

Device function returning the matrix right-transforming a gradient w.r.t. inner cell space to a gradient w.r.t. world space (i.e. the inverse deformation gradient)

Parameters:
  • args (Geometry.Siderg)

  • side_index (int)

  • coords (vec3f)

static side_outer_inverse_deformation_gradient(
args,
side_index,
coords,
)[source]#

Device function returning the matrix right-transforming a gradient w.r.t. outer cell space to a gradient w.r.t. world space (i.e. the inverse deformation gradient)

Parameters:
  • args (Geometry.CellArg)

  • side_index (int)

  • coords (vec3f)

static side_measure(args, s)[source]#

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

Parameters:
  • args (Geometry.SideArg)

  • s (Sample)

static side_measure_ratio(args, s)[source]#

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

Parameters:
  • args (Geometry.SideArg)

  • s (Sample)

static side_normal(args, s)[source]#

Device function returning the element normal at a sample point

Parameters:
  • args (Geometry.SideArg)

  • s (Sample)

static side_inner_cell_index(args, side_index)[source]#

Device function returning the inner cell index for a given side

Parameters:
  • args (Geometry.SideArg)

  • side_index (int)

static side_outer_cell_index(args, side_index)[source]#

Device function returning the outer cell index for a given side

Parameters:
  • args (Geometry.SideArg)

  • side_index (int)

static side_inner_cell_coords(args, side_index, side_coords)[source]#

Device function returning the coordinates of a point on a side in the inner cell

Parameters:
  • args (Geometry.SideArg)

  • side_index (int)

  • side_coords (vec3f)

static side_outer_cell_coords(args, side_index, side_coords)[source]#

Device function returning the coordinates of a point on a side in the outer cell

Parameters:
  • args (Geometry.SideArg)

  • side_index (int)

  • side_coords (vec3f)

static side_from_cell_coords(
args,
side_index,
element_index,
element_coords,
)[source]#

Device function converting coordinates on a cell to coordinates on a side, or OUTSIDE

Parameters:
  • args (Geometry.SideArg)

  • side_index (int)

  • element_index (int)

  • element_coords (vec3f)

static side_to_cell_arg(side_arg)[source]#

Device function converting a side-related argument value to a cell-related argument value, for promoting trace samples to the full space

Parameters:

side_arg (Geometry.SideArg)

make_filtered_cell_lookup(filter_func=None)[source]#
Parameters:

filter_func (Function)

property cell_lookup: Function#
supports_cell_lookup(device)[source]#
Return type:

bool

update_bvh(device=None)[source]#

Refits the geometry’s BVH if it exists on device, or builds it from scratch otherwise.

Refitting the BVH is cheaper than rebuilding it from scratch, and is generally preferred when the geometry positions are modified without significant changes to the topology.

See also: Geometry.build_bvh().

build_bvh(device=None)[source]#

Rebuilds the geometry’s Bounding Volume Hierarchy (BVH) for device from scratch.

Many geometries rely on a BVH for the lookup() and partition_lookup() operators to be functional.

If building a BVH is not supported for this geometry, a TypeError is raised.

See also: Geometry.update_bvh().

bvh_id(device)[source]#