warp.fem.PicQuadrature#

class warp.fem.PicQuadrature(
domain,
positions,
measures=None,
requires_grad=False,
max_dist=0.0,
use_domain_element_indices=False,
temporary_store=None,
)[source]#

Particle-based quadrature formula, using a global set of points unevenly spread out over geometry elements.

Useful for Particle-In-Cell and derived methods (Material Point Method, Generalized Interpolation Material Point Method, etc).

Parameters:
  • domain (GeometryDomain) – Underlying domain for the quadrature

  • positions (wp.array | tuple[wp.array(dtype=ElementIndex), wp.array(dtype=Coords)] | tuple[wp.array2d(dtype=ElementIndex), wp.array2d(dtype=Coords), wp.array2d(dtype=float)]) –

    Defines the location of the quadrature points. Cane be:

    • an array containing the world positions of all particles

    • a tuple of arrays containing the cell indices and coordinates for each particle.

    • for GIMP-style integration where particle can span multiple elements: A tuple of 2d array the element indices for each particle

  • measures (wp.array(dtype=float) | None) – Array containing the measure (area/volume) of each particle, used to defined the integration weights. If None, defaults to the cell measure divided by the number of particles in the cell.

  • max_dist (float) – When providing world positions that fall outside of the domain’s geometry partition, maximum distance to look up for embedding cells

  • requires_grad (bool) – Whether gradients should be allocated for the computed quantities

  • use_domain_element_indices (bool) – Whether to use the domain element indices instead of the full geometry cell indices. This reduces memory usage, but prevents changing the quadrature domain a-posteriori.

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

__init__(
domain,
positions,
measures=None,
requires_grad=False,
max_dist=0.0,
use_domain_element_indices=False,
temporary_store=None,
)[source]#
Parameters:

Methods

__init__(domain, positions[, measures, ...])

active_cell_count()

Number of cells containing at least one particle

arg_value(device)

element_index_arg_value(device)

evaluation_point_count()

Number of locations at which the quadrature rule is evaluated.

fill_arg(args, device)

Fill the quadrature argument structure for device functions.

fill_element_mask(mask)

Fills a mask array such that all non-empty elements are set to 1, all empty elements to zero.

max_points_per_element()

Maximum number of quadrature points per element.

point_coords(elt_arg, qp_arg, ...)

Coordinate values in element of the element's qp_index'th quadrature point.

point_count(elt_arg, qp_arg, ...)

Number of quadrature points for a given element.

point_evaluation_index(elt_arg, qp_arg, ...)

Quadrature point index according to evaluation order.

point_index(elt_arg, qp_arg, ...)

Global index of the element's qp_index'th quadrature point.

point_weight(elt_arg, qp_arg, ...)

Weight of the element's qp_index'th quadrature point.

total_point_count()

Number of unique quadrature points.

Attributes

Arg

ElementIndexArg

Mapping from evaluation point indices to element indices.

cell_particle_indices

Indices of the particles in each cell

cell_particle_offsets

Postfix sum of the number of particles in each cell

domain

Domain over which this quadrature is defined

evaluation_point_element_index

name

Unique name of the quadrature rule.

property name[source]#

Unique name of the quadrature rule.

property domain[source]#

Domain over which this quadrature is defined

Arg = <warp._src.codegen.Struct object>#
fill_arg(args, device)[source]#

Fill the quadrature argument structure for device functions.

Parameters:

args (Arg)

total_point_count()[source]#

Number of unique quadrature points.

evaluation_point_count()[source]#

Number of locations at which the quadrature rule is evaluated. Quadrature points belonging to multiple cells are counted multiple times.

active_cell_count()[source]#

Number of cells containing at least one particle

max_points_per_element()[source]#

Maximum number of quadrature points per element.

property cell_particle_offsets[source]#

Postfix sum of the number of particles in each cell

property cell_particle_indices[source]#

Indices of the particles in each cell

fill_element_mask(mask)[source]#

Fills a mask array such that all non-empty elements are set to 1, all empty elements to zero.

Parameters:

mask (array(ndim=1, dtype=int32)) – Int warp array with size at least equal to self.domain.geometry_element_count()