warp.fem.Grid2D#

class warp.fem.Grid2D(res, bounds_lo=None, bounds_hi=None, scalar_type=warp.float32)[source]#

Two-dimensional regular grid geometry.

Parameters:
__init__(
res,
bounds_lo=None,
bounds_hi=None,
scalar_type=warp.float32,
)[source]#

Construct a dense 2D grid.

Parameters:
  • res (vec2i) – Resolution of the grid along each dimension

  • bounds_lo (vec2f | None) – Position of the lower bound of the axis-aligned grid

  • bounds_hi (vec2f | None) – Position of the upper bound of the axis-aligned grid

  • scalar_type (type) – Scalar type for grid coordinates (warp.float32 or warp.float64)

Methods

__init__(res[, bounds_lo, bounds_hi, ...])

Construct a dense 2D grid.

boundary_side_count()

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_count()

fill_cell_arg(args, device)

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])

Create a filtered cell lookup function.

reference_cell()

reference_side()

side_arg_value(device)

side_count()

side_index_arg_value(device)

supports_cell_lookup(device)

update_bvh([device])

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

vertex_count()

Attributes

ALT_AXIS

LONG_AXIS

Side

base

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

boundary_side_index

cell_closest_point

cell_coordinates

cell_deformation_gradient

cell_dimension

Manifold dimension of the geometry cells

cell_index

cell_inverse_deformation_gradient

cell_lookup

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

cell_measure

cell_measure_ratio

cell_normal

cell_position

cell_size

Size of a cell along each axis.

coords_type

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

dimension

Dimension of the embedding space.

extents

Extent of the grid along each axis.

get_cell

is_flipped

name

Name of the geometry, including scalar type suffix for non-default precision.

orient

origin

res

sample_type

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

scalar_type

side_closest_point

side_coordinates

side_deformation_gradient

side_from_cell_coords

side_inner_cell_coords

side_inner_cell_index

side_inner_inverse_deformation_gradient

side_measure

side_measure_ratio

side_normal

side_outer_cell_coords

side_outer_cell_index

side_outer_inverse_deformation_gradient

side_position

side_to_cell_arg

strides

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 = 2#

Dimension of the embedding space.

ALT_AXIS = 0#
LONG_AXIS = 1#
property scalar_type[source]#
property extents#

Extent of the grid along each axis.

property cell_size#

Size of a cell along each axis.

cell_count()[source]#
vertex_count()[source]#
side_count()[source]#
boundary_side_count()[source]#
reference_cell()[source]#
Return type:

Element

reference_side()[source]#
Return type:

Element

property res[source]#
property origin[source]#
property strides#
Cell[source]#

alias of vec2i

cell_index = <Function Grid2D__cell_index(res: vec2i, cell: vec2i)>#
Parameters:
get_cell = <Function Grid2D__get_cell(res: vec2i, cell_index: int)>#
Parameters:
Side = <warp._src.codegen.Struct object>#
orient = <Function Grid2D__orient(axis: int, vec: Any)>#
Parameters:
is_flipped = <Function Grid2D__is_flipped(side: warp._src.fem.geometry.grid_2d.Grid2D.Side)>#
Parameters:

side (Side)

fill_cell_arg(args, device)[source]#
side_arg_value(device)[source]#
side_index_arg_value(device)[source]#
supports_cell_lookup(device)[source]#
boundary_side_index = <Function Grid2D__boundary_side_index(args: Any, boundary_side_index: int)>#
Parameters:
  • args (Any)

  • boundary_side_index (int)

cell_position = <Function Grid2D__cell_position(args: Any, s: Any)>#
Parameters:
cell_deformation_gradient = <Function Grid2D__cell_deformation_gradient(args: Any, s: Any)>#
Parameters:
cell_inverse_deformation_gradient = <Function Grid2D__cell_inverse_deformation_gradient(args: Any, s: Any)>#
Parameters:
cell_coordinates = <Function Grid2D__cell_coordinates(args: Any, cell_index: int, pos: Any)>#
Parameters:
cell_closest_point = <Function Grid2D__cell_closest_point(args: Any, cell_index: int, pos: Any)>#
Parameters:
cell_measure = <Function Grid2D__cell_measure(args: Any, s: Any)>#
Parameters:
cell_normal = <Function Grid2D__cell_normal(args: Any, s: Any)>#
Parameters:
side_position = <Function Grid2D__side_position(args: Any, s: Any)>#
Parameters:
side_deformation_gradient = <Function Grid2D__side_deformation_gradient(args: Any, s: Any)>#
Parameters:
side_inner_inverse_deformation_gradient = <Function Grid2D__side_inner_inverse_deformation_gradient(args: Any, s: Any)>#
Parameters:
side_outer_inverse_deformation_gradient = <Function Grid2D__side_outer_inverse_deformation_gradient(args: Any, s: Any)>#
Parameters:
side_measure = <Function Grid2D__side_measure(args: Any, s: Any)>#
Parameters:
side_measure_ratio = <Function Grid2D__side_measure_ratio(args: Any, s: Any)>#
Parameters:
side_normal = <Function Grid2D__side_normal(args: Any, s: Any)>#
Parameters:
side_inner_cell_index = <Function Grid2D__side_inner_cell_index(arg: Any, side_index: int)>#
Parameters:
side_outer_cell_index = <Function Grid2D__side_outer_cell_index(arg: Any, side_index: int)>#
Parameters:
side_inner_cell_coords = <Function Grid2D__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 Grid2D__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 Grid2D__side_from_cell_coords(args: Any, side_index: int, element_index: int, element_coords: Any)>#
Parameters:
  • args (Any)

  • side_index (int)

  • element_index (int)

  • element_coords (Any)

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

side_arg (Any)

side_coordinates = <Function Grid2D__side_coordinates(args: Any, side_index: int, pos: Any)>#
Parameters:
side_closest_point = <Function Grid2D__side_closest_point(args: Any, side_index: int, pos: Any)>#
Parameters:
make_filtered_cell_lookup(filter_func=None)[source]#

Create a filtered cell lookup function.

Parameters:

filter_func (Function) – Optional device predicate to filter candidate cells.