warp.fem.AdaptiveNanogrid#
- class warp.fem.AdaptiveNanogrid(
- cell_grid,
- cell_level,
- level_count,
- temporary_store,
- scalar_type=warp.float32,
- cell_env=None,
- env_offsets=None,
Adaptive sparse grid.
Construct an adaptive sparse grid geometry from an in-memory NanoVDB volume and a list of levels.
It is not recommended to use this constructor directly; see the helper functions
warp.fem.adaptive_nanogrid_from_field()andwarp.fem.adaptive_nanogrid_from_hierarchy().- Parameters:
cell_grid (Volume) – A warp volume (ideally backed by an index grid) whose voxels coordinates correspond to the lowest fine-resolution voxel of each cell. The cell’s extent is then given by the
cell_levelarray. For instance, a voxel at coordinatesijkand level0corresponds to a fine cell at the same coordinates, a voxel at coordinates2*ijkand level1corresponds to a cell spanning2^3voxels from2*ijkto2*ijk + (1,1,1), etc.cell_level (array) – Refinement level for each voxel of the volume. Level 0 is the finest, level
level_count-1is the coarsest.level_count (int) – Number of levels in the grid
scalar_type (type) – Scalar type for coordinate and weight computations (
warp.float32orwarp.float64)temporary_store (TemporaryStore)
cell_env (array | None)
env_offsets (array | None)
Methods
boundary_side_count()build_bvh([device])Rebuild the geometry's Bounding Volume Hierarchy (BVH) for
devicefrom scratch.bvh_id(device)Return the BVH identifier for the given device, or
0if unavailable.cell_arg_value(device)cell_bvh_groups(device)Return optional per-cell BVH group indices on
device.cell_count()cell_env_arg_value(device)Return per-cell environment indices for geometry argument structs.
environment_count()fill_cell_arg(arg, device)fill_side_arg(arg, device)fill_side_index_arg(arg, device)from_environment_voxels([points, ...])Construct an adaptive sparse grid from environment-tagged active cells and levels.
make_filtered_cell_lookup([filter_func])reference_cell()reference_side()side_arg_value(device)side_count()side_deformation_gradient(args, s)Device function returning the gradient of world position with respect to reference side
side_index_arg_value(device)side_normal(args, s)Device function returning the element normal at a sample point
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
FACE_AXIS_MASKFACE_INNER_OFFSET_BITFACE_OUTER_OFFSET_BITGRID_AXIS_FLAGSideIndexArgStructure containing arguments to be passed to device functions for indexing sides.
baseReturn the base geometry from which this geometry derives its topology.
boundary_side_indexcell_dimensionManifold dimension of the geometry cells
cell_envcell_environment_indexcell_gridcell_lookupDevice function for looking up the closest cell to a position.
cell_measure_ratiocompute_cell_bvh_groupscoords_typeWarp vector type for element coordinates matching this geometry's scalar precision.
Dimension of the embedding space.
env_offsetsface_gridnameName of the geometry, including environment and scalar type suffixes.
sample_typeWarp struct type for samples matching this geometry's scalar precision.
scalar_typeside_environment_indextransformTransform matrix mapping index to world space.
vertex_gridCellArgStructure containing arguments to be passed to device functions evaluating cell-related quantities.
SideArgStructure containing arguments to be passed to device functions evaluating side-related quantities.
- classmethod from_environment_voxels(
- points=None,
- cell_levels=None,
- point_envs=None,
- env_count=None,
- level_count=None,
- env_offsets=None,
- *,
- point_mask=None,
- voxel_size=1.0,
- translation=(0.0, 0.0, 0.0),
- transform=None,
- temporary_store=None,
- scalar_type=warp.float32,
- device=None,
- cell_ijks=None,
Construct an adaptive sparse grid from environment-tagged active cells and levels.
Coordinates and levels are interpreted in environment-local fine-grid index space. The helper packs all environments into one NanoVDB index grid and returns a geometry whose FEM world coordinates remain local to each environment.
- Parameters:
points (array | Sequence[array] | None) – Flat
warp.vec3iorwarp.vec3farray of active cell points. Deprecated: a sequence of per-environmentwarp.vec3iarrays is also accepted for compatibility.cell_levels (array | Sequence[array] | None) – Flat
warp.uint8array with one refinement level per point. Deprecated: a sequence of per-environmentwarp.uint8arrays matchingpointsis also accepted for compatibility.point_envs (array | int | None) – Flat
int32array with one environment index per point. Entries for unmasked points must satisfy0 <= env < env_count.env_count (int | array | Sequence[Sequence[int]] | None) – Number of environments represented by
point_envs.level_count (int | None) – Number of refinement levels in the grid.
env_offsets (array | Sequence[Sequence[int]] | None) – Optional packed-grid offsets, one
warp.vec3iper environment. Offsets must be aligned to the coarsest cell size. If omitted, aligned offsets are generated along the x axis. Custom offsets are an advanced override for callers that need deterministic packed NanoVDB coordinates, for example to match an externally built volume. They must still keep active cells from different environments from sharing packed-grid faces.point_mask (array | None) – Optional
int32array with one entry per point. Points with a zero mask value are ignored.voxel_size (int | float | Sequence[float] | None) – Fine-grid voxel size for the packed NanoVDB volume. Ignored if
transformis provided.translation – Translation between packed index and world spaces.
transform – Linear transform between packed index and world spaces.
temporary_store (TemporaryStore | None) – Shared pool from which to allocate temporary arrays.
scalar_type (type) – Scalar type for grid coordinates (
warp.float32orwarp.float64).device – CUDA device on which to build the packed volume.
cell_ijks (Sequence[array] | None) – Deprecated keyword alias for the old per-environment
pointssequence form.
- cell_position = <Function AdaptiveNanogrid__cell_position(args: Any, s: Any)>#
- cell_deformation_gradient = <Function AdaptiveNanogrid__cell_deformation_gradient(args: Any, s: Any)>#
- cell_inverse_deformation_gradient = <Function AdaptiveNanogrid__cell_inverse_deformation_gradient(args: Any, s: Any)>#
- cell_measure = <Function AdaptiveNanogrid__cell_measure(args: Any, s: Any)>#
- cell_normal = <Function AdaptiveNanogrid__cell_normal(args: Any, s: Any)>#
- cell_coordinates = <Function AdaptiveNanogrid__cell_coordinates(args: Any, cell_index: int, pos: Any)>#
- cell_closest_point = <Function AdaptiveNanogrid__cell_closest_point(args: Any, cell_index: int, pos: Any)>#
- side_position = <Function AdaptiveNanogrid__side_position(args: Any, s: Any)>#
- side_inner_inverse_deformation_gradient = <Function AdaptiveNanogrid__side_inner_inverse_deformation_gradient(args: Any, s: Any)>#
- side_outer_inverse_deformation_gradient = <Function AdaptiveNanogrid__side_outer_inverse_deformation_gradient(args: Any, s: Any)>#
- side_measure = <Function AdaptiveNanogrid__side_measure(args: Any, s: Any)>#
- side_measure_ratio = <Function AdaptiveNanogrid__side_measure_ratio(args: Any, s: Any)>#
- side_inner_cell_index = <Function AdaptiveNanogrid__side_inner_cell_index(args: Any, side_index: int)>#
- side_outer_cell_index = <Function AdaptiveNanogrid__side_outer_cell_index(args: Any, side_index: int)>#
- side_inner_cell_coords = <Function AdaptiveNanogrid__side_inner_cell_coords(args: Any, side_index: int, side_coords: Any)>#
- side_outer_cell_coords = <Function AdaptiveNanogrid__side_outer_cell_coords(args: Any, side_index: int, side_coords: Any)>#
- side_from_cell_coords = <Function AdaptiveNanogrid__side_from_cell_coords(args: Any, side_index: int, element_index: int, element_coords: Any)>#
- side_to_cell_arg = <Function AdaptiveNanogrid__side_to_cell_arg(side_arg: Any)>#
- Parameters:
side_arg (Any)
- side_coordinates = <Function AdaptiveNanogrid__side_coordinates(args: Any, side_index: int, pos: Any)>#
- side_closest_point = <Function AdaptiveNanogrid__side_closest_point(args: Any, side_index: int, pos: Any)>#
- coarse_ijk = <Function AdaptiveNanogrid__coarse_ijk(ijk: vec3i, level: int)>#
- fine_ijk = <Function AdaptiveNanogrid__fine_ijk(ijk: vec3i, level: int)>#
- encode_axis_and_level = <Function AdaptiveNanogrid__encode_axis_and_level(ijk: vec3i, axis: int, level: int)>#