core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::geom::GridSdf Struct Reference

A signed-distance field sampled on a regular axis-aligned grid (negative inside solid). More...

#include <grid_sdf.hpp>

Public Member Functions

double at (Index i, Index j, Index k) const
 Raw sample lookup at integer grid index (i,j,k); no bounds checking.
 
GridDesc< double > desc () const
 Descriptor form of this field, for the shared sampler.
 
double eval (const Vec< 3 > &p) const
 Trilinearly-interpolated signed distance at world point p.
 

Public Attributes

std::vector< float > values
 Sample values, x-fastest: idx = i + j*nx + k*nx*ny.
 
IVec< 3 > dims {}
 Sample count per axis (nx, ny, nz).
 
Vec< 3 > origin {}
 World position of sample (0,0,0).
 
Vec< 3 > spacing {1, 1, 1}
 World-space distance between samples per axis.
 

Detailed Description

A signed-distance field sampled on a regular axis-aligned grid (negative inside solid).

Models the peclet::core::geom::Sdf concept via eval(). Storage is x-fastest, matching the suite indexing convention and the VTI fields produced by flow/dem.

Definition at line 24 of file grid_sdf.hpp.

Member Function Documentation

◆ at()

double peclet::core::geom::GridSdf::at ( Index  i,
Index  j,
Index  k 
) const
inline

Raw sample lookup at integer grid index (i,j,k); no bounds checking.

Definition at line 31 of file grid_sdf.hpp.

References dims, and values.

◆ desc()

GridDesc< double > peclet::core::geom::GridSdf::desc ( ) const
inline

Descriptor form of this field, for the shared sampler.

Built from spacing once per call here (this is host setup-side code, not a device inner loop); a hot path should hold the descriptor instead – see the rung-3 note in docs/ANALYTIC_SDF_GEOMETRY.md.

Definition at line 38 of file grid_sdf.hpp.

References dims, peclet::core::geom::kClamp, origin, and spacing.

Referenced by eval().

◆ eval()

double peclet::core::geom::GridSdf::eval ( const Vec< 3 > &  p) const
inline

Trilinearly-interpolated signed distance at world point p.

Queries outside the sampled box clamp to the nearest in-domain sample (GridExtension::kClamp).

DELEGATES to peclet::core::geom::sampleGrid, which is now the suite's single trilinear grid-SDF routine (it also serves dem's object/container policies). NOTE this changed the last bit of the result: the old body divided by spacing, the shared routine multiplies by its inverse, and a/s != a*(1/s) in floating point. Deliberate – multiplying is what dem's bit-exactness contract is written against and is cheaper on device.

Definition at line 60 of file grid_sdf.hpp.

References desc(), peclet::core::geom::sampleGrid(), and values.

Member Data Documentation

◆ values

std::vector<float> peclet::core::geom::GridSdf::values

Sample values, x-fastest: idx = i + j*nx + k*nx*ny.

Definition at line 25 of file grid_sdf.hpp.

Referenced by at(), eval(), peclet::core::geom::readVti(), peclet::core::geom::sample(), and peclet::core::geom::writeVti().

◆ dims

IVec<3> peclet::core::geom::GridSdf::dims {}

Sample count per axis (nx, ny, nz).

Definition at line 26 of file grid_sdf.hpp.

Referenced by at(), desc(), peclet::core::geom::readVti(), peclet::core::geom::sample(), and peclet::core::geom::writeVti().

◆ origin

Vec<3> peclet::core::geom::GridSdf::origin {}

World position of sample (0,0,0).

Definition at line 27 of file grid_sdf.hpp.

Referenced by desc(), peclet::core::geom::readVti(), peclet::core::geom::sample(), and peclet::core::geom::writeVti().

◆ spacing

Vec<3> peclet::core::geom::GridSdf::spacing {1, 1, 1}

World-space distance between samples per axis.

Definition at line 28 of file grid_sdf.hpp.

Referenced by desc(), peclet::core::geom::readVti(), peclet::core::geom::sample(), and peclet::core::geom::writeVti().


The documentation for this struct was generated from the following file: