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,
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,
- Parameters:
domain (GeometryDomain)
positions (array | tuple[array(ndim=1, dtype=int32), array(ndim=1, dtype=vec3f)] | tuple[array(ndim=2, dtype=int32), array(ndim=2, dtype=vec3f), array(ndim=2, dtype=float32)])
measures (array(ndim=1, dtype=float32) | None)
requires_grad (bool)
max_dist (float)
use_domain_element_indices (bool)
temporary_store (TemporaryStore)
Methods
__init__(domain, positions[, measures, ...])Number of cells containing at least one particle
arg_value(device)element_index_arg_value(device)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.
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.
Number of unique quadrature points.
Attributes
ElementIndexArgMapping from evaluation point indices to element indices.
Indices of the particles in each cell
Postfix sum of the number of particles in each cell
Domain over which this quadrature is defined
evaluation_point_element_indexUnique name of the quadrature rule.
- Arg = <warp._src.codegen.Struct object>#
- fill_arg(args, device)[source]#
Fill the quadrature argument structure for device functions.
- Parameters:
args (Arg)