|
peclet.voro 1.0.0
Device-native moving-particle Voronoi dynamics
|
Namespaces | |
| namespace | detail |
| namespace | mpi |
| namespace | physics |
Classes | |
| struct | AuxMaps |
| struct | CellBuilder |
| struct | ConvexCell |
| struct | HostTessellation |
| Host-side CSR buffers — the conversion target and the round-trip oracle. More... | |
| struct | Invariants |
| Per-step invariant residuals (all should be ~0 / ~machine-precision for a correct tessellation). More... | |
| struct | MovingTessellation |
| struct | NoSdf |
| Sentinel "no geometry" provider — the default; the clip stage is skipped. More... | |
| struct | OracleDiff |
| Result of comparing the current updated state against a fresh cold-build oracle. More... | |
| struct | OtResult |
| struct | Power |
| struct | RepairStats |
| Per-step repair telemetry. More... | |
| struct | SdfBox |
| Axis-aligned solid box of half-extents (hx,hy,hz). eval ported from peclet::core::geom::Box. More... | |
| struct | SdfGrid |
| struct | SdfHollowCylinder |
| struct | SdfSphere |
| Solid ball (negative inside). eval ported from peclet::core::geom::Sphere. More... | |
| struct | SdfSpheres |
| struct | SubsetGatherResult |
| struct | TessellationView |
| struct | TessellatorResult |
| struct | TessGrid |
| struct | TopologyStore |
| struct | VerletSkin |
| struct | Voronoi |
| struct | WorklistCache |
Typedefs | |
| using | gid_t = std::int32_t |
Enumerations | |
| enum class | Precond { Jacobi , ColoredGS , GraphAMG , SteepestDescent } |
| enum | StatusBit { kOk = 0 , kOverflow = 1 , kEmpty = 2 , kIncomplete = 4 , kNegOffset = 8 } |
| Per-cell status bits written by the build pass. More... | |
| enum | SkinTrigger : int { kSkinNone = 0 , kSkinMover = 1 } |
Functions | |
| template<class Real , int MAXP, int MAXT, bool TrackAdj, class Policy = Voronoi> | |
| KOKKOS_INLINE_FUNCTION void | buildConvexCell (ConvexCell< Real, MAXP, MAXT, TrackAdj > &c, const Real L[3], const Real *relx, const Real *rely, const Real *relz, const int *ids, int nNbr, Real wSelf=Real(0), const Real *weights=nullptr) |
| template<class Real > | |
| Invariants | checkInvariants (const TessellationView< Real > &view, const AuxMaps< Real > &aux, double boxVolume) |
| template<class Real > | |
| void | compareVolumes (const Kokkos::View< Real *, peclet::core::MemSpace > &volCurrent, const TessellationView< Real > &oracle, OracleDiff &out) |
| Compare a current per-cell volume array against the oracle view's volumes (cell i == seed i). | |
| template<class Real > | |
| void | compareNeighbours (const Kokkos::View< int *, peclet::core::MemSpace > &storeNp, const Kokkos::View< int *, peclet::core::MemSpace > &storeNt, const Kokkos::View< int *, peclet::core::MemSpace > &storePnbr, const Kokkos::View< unsigned *, peclet::core::MemSpace > &storeTri, int MAXP, int MAXT, const TessellationView< Real > &oracle, OracleDiff &out) |
| template<class Real , bool Weighted = false, class Sdf = NoSdf> | |
| OtResult | meshVolumeOptimize (std::vector< Real > &pos, std::vector< Real > &weight, const std::vector< Real > &vsetIn, const Real L[3], int N, int sw, const Sdf &sdf, int maxNewton, Real tol, int cgIters=300, Precond prec=Precond::Jacobi, bool verbose=false, Real muBarrier=0, Real muDecay=(Real) 0.7, bool freeEnergy=false) |
| template<class Real , class Sdf = NoSdf> | |
| OtResult | interfaceMinimize (std::vector< Real > &pos, const std::vector< int > &type, double sigma, const Real L[3], int N, int sw, const Sdf &sdf, int maxIter, Real tol, bool verbose=false) |
| template<class Real , class Sdf = NoSdf> | |
| OtResult | meshVolumeOptimizeDevice (std::vector< Real > &posHost, const std::vector< Real > &vsetIn, const Real L[3], int N, int sw, const Sdf &sdf, int maxNewton, Real tol, int cgIters=300, bool verbose=false) |
| template<class Real , class Sdf = NoSdf> | |
| OtResult | otVolumeControl (std::vector< Real > &pos, std::vector< Real > &weight, const std::vector< Real > &vsetIn, const Real L[3], int N, int sw, const Sdf &sdf, int maxNewton, Real tol, Real reg=Real(1e-6), Real damp=Real(1), bool verbose=false) |
| template<class Policy , class Cell , class Real > | |
| KOKKOS_INLINE_FUNCTION void | chainToDofs (const Cell &c, const Real seed[3], const Real *pos, Real wSelf, const Real *weight, Real L, const Real *gx, const Real *gy, const Real *gz, Real fSelf[3], Real &fwSelf, Real *fnx, Real *fny, Real *fnz, Real *fwn) |
| template<class Real , int MAXP, int MAXT> | |
| TessellationView< Real > | reevalPublish (const TopologyStore< MAXP, MAXT > &store, const Kokkos::View< Real *, peclet::core::MemSpace > &pos, const Kokkos::View< Real *, peclet::core::MemSpace > &vol, int N, const Real L[3]) |
| template<class Real , class Sdf > | |
| KOKKOS_INLINE_FUNCTION void | sdfGradient (const Sdf &s, Real x, Real y, Real z, Real g[3]) |
| Central-difference gradient of any provider with eval() (matches peclet::core::geom::gradient). | |
| template<class Real , class Sdf > | |
| KOKKOS_INLINE_FUNCTION void | sdfHessian (const Sdf &s, Real x, Real y, Real z, Real H[3][3]) |
| template<class Real , int MAXP, int MAXT, bool TrackAdj, class Sdf > | |
| KOKKOS_INLINE_FUNCTION void | addSdfWallForce (const ConvexCell< Real, MAXP, MAXT, TrackAdj > &c, const Real seed[3], const Sdf &sdf, const Real *gx, const Real *gy, const Real *gz, Real fSelf[3]) |
| template<class Real , int MAXP, int MAXT, bool TrackAdj, class Sdf > | |
| KOKKOS_INLINE_FUNCTION bool | clipCellAgainstSdf (ConvexCell< Real, MAXP, MAXT, TrackAdj > &c, const Real seed[3], const Sdf &sdf) |
| template<class Real , bool Weighted = false, bool TrackAdj = false, class Sdf = NoSdf> | |
| SubsetGatherResult< Real > | subsetGather (const TessGrid< Real > &grid, const Kokkos::View< int *, peclet::core::MemSpace > &indices, int nSubset, const Kokkos::View< int *, peclet::core::MemSpace > &outNp, const Kokkos::View< int *, peclet::core::MemSpace > &outNt, const Kokkos::View< int *, peclet::core::MemSpace > &outPnbr, const Kokkos::View< unsigned *, peclet::core::MemSpace > &outTri, const Kokkos::View< Real *, peclet::core::MemSpace > &cellVol, const Kokkos::View< unsigned char *, peclet::core::MemSpace > &outPoke4={}, Sdf sdf={}, bool withForceGeom=false) |
| KOKKOS_INLINE_FUNCTION int | morton3 (int x, int y, int z) |
| template<class Real , bool Weighted> | |
| TessGrid< Real > | buildTessGrid (const Kokkos::View< Real *, peclet::core::MemSpace > &posFlat, const Kokkos::View< Real *, peclet::core::MemSpace > &weight, int N, const Real L[3], int sw=4, int densityCount=-1, Kokkos::View< long *, peclet::core::MemSpace > gid={}, WorklistCache< Real > *wlc=nullptr) |
| gid_t | toGid (std::uint32_t id) |
| template<class Real > | |
| std::vector< int > | buildReciprocalMap (const HostTessellation< Real > &t) |
| template<class Real > | |
| TessellationView< Real > | upload (const HostTessellation< Real > &h) |
| Upload a HostTessellation to device Views. | |
| template<class Real , bool Weighted, class Sdf = NoSdf> | |
| TessellatorResult< Real > | buildTessellation (const Kokkos::View< Real *, peclet::core::MemSpace > &posFlat, const Kokkos::View< Real *, peclet::core::MemSpace > &weight, int N, const Real L[3], int sw=4, int densityCount=-1, Kokkos::View< long *, peclet::core::MemSpace > gid={}, Sdf sdf={}, bool withForceGeom=true, int nBuild=-1, Kokkos::View< int *, peclet::core::MemSpace > outNp={}, Kokkos::View< int *, peclet::core::MemSpace > outNt={}, Kokkos::View< int *, peclet::core::MemSpace > outPnbr={}, Kokkos::View< unsigned *, peclet::core::MemSpace > outTri={}, Kokkos::View< int *, peclet::core::MemSpace > outCand={}, Kokkos::View< int *, peclet::core::MemSpace > outCandCnt={}, int candCap=0, WorklistCache< Real > *wlc=nullptr) |
| template<class Real > | |
| AuxMaps< Real > | buildAuxMaps (const TessellationView< Real > &view) |
| Build {recip, cellOfFacet} on device from a published view (dense single-domain). | |
| template<class Real > | |
| int | flagSkinMovers (const Kokkos::View< Real *, peclet::core::MemSpace > &pos, const Kokkos::View< Real *, peclet::core::MemSpace > &xRef, Real skin, const Real L[3], const Kokkos::View< int *, peclet::core::MemSpace > &outFlags) |
| template<class Real > | |
| Real | maxDisplacement (const Kokkos::View< Real *, peclet::core::MemSpace > &pos, const Kokkos::View< Real *, peclet::core::MemSpace > &xRef, const Real L[3]) |
Variables | |
| constexpr int | kBoundaryFacet = -2 |
| constexpr int | kWlOffBias = 128 |
| using peclet::voro::gid_t = typedef std::int32_t |
Seed/neighbour identifier in the published view. Signed so the unsigned sentinels map cleanly to negatives: 0xFFFFFFFF -> -1 (no neighbour), 0xFFFFFFFE -> -2 (boundary). Consumers treat facetNbr(f) < 0 as a boundary facet.
|
strong |
| enum peclet::voro::SkinTrigger : int |
Per-particle rebuild-trigger bits. Extensible: Phase 1 only ever sets kSkinMover; the deferred boundary trigger (Risk 1d) will add kSkinBoundary so a status-change near an SDF wall feeds the same Pass-1 set. Stored as int so the flag array doubles as a stream-compaction mask.
| Enumerator | |
|---|---|
| kSkinNone | |
| kSkinMover | |
| KOKKOS_INLINE_FUNCTION void peclet::voro::addSdfWallForce | ( | const ConvexCell< Real, MAXP, MAXT, TrackAdj > & | c, |
| const Real | seed[3], | ||
| const Sdf & | sdf, | ||
| const Real * | gx, | ||
| const Real * | gy, | ||
| const Real * | gz, | ||
| Real | fSelf[3] | ||
| ) |
Differentiable SDF wall force (Effort 2, Option A — the seed-foot model). A wall facet (pnbr == kBoundaryFacet) is modelled as the tangent plane at the seed's foot point on sdf=0, so its seed-relative foot-point normal is n_wall(s) = −φ(s) û(s), û = ∇φ/|∇φ|. Its Jacobian is J_wall = ∂n_wall/∂s = −|∇φ| û ûᵀ − (φ/|∇φ|)(I − û ûᵀ) H, H = ∇²φ, so the wall's contribution to dGeom/dseed is J_wallᵀ g summed over the cell's wall facets (g = dGeom/dn_k from geomVolumeGrad). EXACT for a flat wall (φ linear ⇒ H=0, one facet); first-order for a curved wall (the clip approximates the curve by several vertex-anchored tangent facets, modelled here as one effective seed-foot plane). Call AFTER chainToDofs<Policy> (which zeroes pnbr<0 planes); this adds the wall self-force into fSelf. No-op for NoSdf.
| AuxMaps< Real > peclet::voro::buildAuxMaps | ( | const TessellationView< Real > & | view | ) |
Build {recip, cellOfFacet} on device from a published view (dense single-domain).
| KOKKOS_INLINE_FUNCTION void peclet::voro::buildConvexCell | ( | ConvexCell< Real, MAXP, MAXT, TrackAdj > & | c, |
| const Real | L[3], | ||
| const Real * | relx, | ||
| const Real * | rely, | ||
| const Real * | relz, | ||
| const int * | ids, | ||
| int | nNbr, | ||
| Real | wSelf = Real(0), |
||
| const Real * | weights = nullptr |
||
| ) |
Build a cell from neighbour relative positions sorted by ascending distance (rSqHalf). Policy = Voronoi (default) clips closest-first with the security-radius early-out: once the next candidate's plane offset exceeds 2·max-vertex-rsq, no farther seed can cut. Policy = Power uses the radical-plane offset ½(|r|²+w_self−w_nbr) and — in this reference builder — applies EVERY candidate (no early-out; the bisector security certificate is invalid once the offset can go negative, so P1 keeps the trivially-correct apply-all path). weights is indexed like ids (neighbour weights); it may be null for Voronoi. Mirrors the half-edge buildVoronoiCell.
| std::vector< int > peclet::voro::buildReciprocalMap | ( | const HostTessellation< Real > & | t | ) |
Reciprocal-facet transpose (NbrsToFacets, plan §2.5). For each packed facet g (cell i -> seed j) returns the packed index of the facet in cell j that points back to seed i, or -1 for a boundary facet or if no reciprocal exists. This is the map the atomic-free gather force reads through: a cell fetches its neighbour's reciprocal-facet quantities without scattering (no atomics).
Periodic multi-image facets (several g in i -> same j) are disambiguated by area-vector negation (the reciprocal has the most opposite area vector).
| TessellatorResult< Real > peclet::voro::buildTessellation | ( | const Kokkos::View< Real *, peclet::core::MemSpace > & | posFlat, |
| const Kokkos::View< Real *, peclet::core::MemSpace > & | weight, | ||
| int | N, | ||
| const Real | L[3], | ||
| int | sw = 4, |
||
| int | densityCount = -1, |
||
| Kokkos::View< long *, peclet::core::MemSpace > | gid = {}, |
||
| Sdf | sdf = {}, |
||
| bool | withForceGeom = true, |
||
| int | nBuild = -1, |
||
| Kokkos::View< int *, peclet::core::MemSpace > | outNp = {}, |
||
| Kokkos::View< int *, peclet::core::MemSpace > | outNt = {}, |
||
| Kokkos::View< int *, peclet::core::MemSpace > | outPnbr = {}, |
||
| Kokkos::View< unsigned *, peclet::core::MemSpace > | outTri = {}, |
||
| Kokkos::View< int *, peclet::core::MemSpace > | outCand = {}, |
||
| Kokkos::View< int *, peclet::core::MemSpace > | outCandCnt = {}, |
||
| int | candCap = 0, |
||
| WorklistCache< Real > * | wlc = nullptr |
||
| ) |
Build the full tessellation on device.
| posFlat | device positions, x-fastest per seed (3*i + k), in [0,L). |
| weight | device per-seed weights (size N) for the Power policy; ignored (may be empty) when Weighted == false. |
| N | number of seeds. |
| L | periodic box extent. |
| sw | grid-block half-width (default 4; coverage = sw·cellSize). |
| densityCount | seed count to derive the grid spacing from (cellSize ~ mean spacing). Defaults to N. In the distributed case the seeds are a clustered owned+ghost subset, so pass the GLOBAL count to keep the grid at the true local density. |
| nBuild | build a cell only for seeds whose ORIGINAL index is < nBuild; the rest are still used as cut candidates (neighbours) but their own cell is skipped. Defaults to N (build all). In the distributed case the ghosts are appended after the nOwned owned seeds, so passing nOwned tessellates only the kept (owned) cells — the ghost cells are needed only as cutting seeds, so building them is wasted work (~the ghost fraction of the cold build). |
| TessGrid< Real > peclet::voro::buildTessGrid | ( | const Kokkos::View< Real *, peclet::core::MemSpace > & | posFlat, |
| const Kokkos::View< Real *, peclet::core::MemSpace > & | weight, | ||
| int | N, | ||
| const Real | L[3], | ||
| int | sw = 4, |
||
| int | densityCount = -1, |
||
| Kokkos::View< long *, peclet::core::MemSpace > | gid = {}, |
||
| WorklistCache< Real > * | wlc = nullptr |
||
| ) |
Build the counting-sort grid + worklist for the Voronoi gather (the first half of the old buildTessellation, unchanged). Weighted only affects the grid density (Power keeps 1 seed/cell; unweighted host uses 2/cell for cache locality). See buildTessellation for the argument semantics. wlc (optional) reuses/fills the step-invariant worklist table across calls (E3); nullptr rebuilds it every call (the original behaviour, byte-for-byte).
| KOKKOS_INLINE_FUNCTION void peclet::voro::chainToDofs | ( | const Cell & | c, |
| const Real | seed[3], | ||
| const Real * | pos, | ||
| Real | wSelf, | ||
| const Real * | weight, | ||
| Real | L, | ||
| const Real * | gx, | ||
| const Real * | gy, | ||
| const Real * | gz, | ||
| Real | fSelf[3], | ||
| Real & | fwSelf, | ||
| Real * | fnx, | ||
| Real * | fny, | ||
| Real * | fnz, | ||
| Real * | fwn | ||
| ) |
Chain a cell's per-plane geometry gradient (SoA gx/gy/gz, e.g. from geomVolumeGrad) to the physics DOFs under Policy. Accumulates the derivative w.r.t. the cell's OWN seed into fSelf (position) and fwSelf (weight), and writes the derivative w.r.t. each neighbour seed into (fnx,fny,fnz)[k] (position) and fwn[k] (weight) — the caller scatters those into the global per-seed arrays at index pnbr[k]. Box/SDF planes (pnbr < 0) contribute nothing here (zeroed); SDF-wall self-DOF forces are added by the SDF chain in sdf.hpp.
seed/pos/wSelf/weight/L recompute each plane's (r, ρ, c) for weighted policies; they are untouched for Voronoi (kHasWeightDof == false), so a caller with no weights may pass nullptr for pos/weight and 0 for wSelf on the Voronoi path.
| Invariants peclet::voro::checkInvariants | ( | const TessellationView< Real > & | view, |
| const AuxMaps< Real > & | aux, | ||
| double | boxVolume | ||
| ) |
Compute the per-step invariants of a published TessellationView. aux is its reciprocal map (buildAuxMaps(view)); pass the box volume Lx*Ly*Lz.
| KOKKOS_INLINE_FUNCTION bool peclet::voro::clipCellAgainstSdf | ( | ConvexCell< Real, MAXP, MAXT, TrackAdj > & | c, |
| const Real | seed[3], | ||
| const Sdf & | sdf | ||
| ) |
Clip a built scratch cell against the SDF solid. Faithful port of clipCellAgainstBoundary (m_boundaryMaxCuts=24, m_boundaryTol=1e-8): empties the cell if its seed is in the solid; otherwise iteratively projects the most violating vertex onto sdf=0 and clips by the tangent plane there, so a curved surface is approximated by a few planar wall facets.
| seed | seed world position (the cell's vpos are relative to it). |
| void peclet::voro::compareNeighbours | ( | const Kokkos::View< int *, peclet::core::MemSpace > & | storeNp, |
| const Kokkos::View< int *, peclet::core::MemSpace > & | storeNt, | ||
| const Kokkos::View< int *, peclet::core::MemSpace > & | storePnbr, | ||
| const Kokkos::View< unsigned *, peclet::core::MemSpace > & | storeTri, | ||
| int | MAXP, | ||
| int | MAXT, | ||
| const TessellationView< Real > & | oracle, | ||
| OracleDiff & | out | ||
| ) |
Compare the stored topology against the oracle's neighbour sets, on FACE neighbours (a stored plane k counts only if ≥3 live triangles are incident — the raw pnbr also keeps non-face cutting planes, which are not neighbours). changedNbrFrac = cells whose face-neighbour SET differs (either direction); missedNbr = cells missing a TRUE neighbour (genuine staleness — what the repair must drive to zero). Needs the packed triangles (tri at stride MAXT) + nt to identify the faces.
| void peclet::voro::compareVolumes | ( | const Kokkos::View< Real *, peclet::core::MemSpace > & | volCurrent, |
| const TessellationView< Real > & | oracle, | ||
| OracleDiff & | out | ||
| ) |
Compare a current per-cell volume array against the oracle view's volumes (cell i == seed i).
| int peclet::voro::flagSkinMovers | ( | const Kokkos::View< Real *, peclet::core::MemSpace > & | pos, |
| const Kokkos::View< Real *, peclet::core::MemSpace > & | xRef, | ||
| Real | skin, | ||
| const Real | L[3], | ||
| const Kokkos::View< int *, peclet::core::MemSpace > & | outFlags | ||
| ) |
Flag every particle that has moved more than skin/2 from xRef (minimal image in box L), writing kSkinMover/kSkinNone into outFlags, and return the number flagged. outFlags must be sized N. The flag value is OR-combinable with future trigger bits; here it is overwritten each call (the only Phase-1 trigger). One reduce + write pass; no host round-trip beyond the final count.
| OtResult peclet::voro::interfaceMinimize | ( | std::vector< Real > & | pos, |
| const std::vector< int > & | type, | ||
| double | sigma, | ||
| const Real | L[3], | ||
| int | N, | ||
| int | sw, | ||
| const Sdf & | sdf, | ||
| int | maxIter, | ||
| Real | tol, | ||
| bool | verbose = false |
||
| ) |
| Real peclet::voro::maxDisplacement | ( | const Kokkos::View< Real *, peclet::core::MemSpace > & | pos, |
| const Kokkos::View< Real *, peclet::core::MemSpace > & | xRef, | ||
| const Real | L[3] | ||
| ) |
Largest per-seed displacement from xRef (minimal image), in absolute units. Diagnostics / the Verlet rebuild decision (max-disp > skin/2 -> a global rebuild is the simplest safe response).
| OtResult peclet::voro::meshVolumeOptimize | ( | std::vector< Real > & | pos, |
| std::vector< Real > & | weight, | ||
| const std::vector< Real > & | vsetIn, | ||
| const Real | L[3], | ||
| int | N, | ||
| int | sw, | ||
| const Sdf & | sdf, | ||
| int | maxNewton, | ||
| Real | tol, | ||
| int | cgIters = 300, |
||
| Precond | prec = Precond::Jacobi, |
||
| bool | verbose = false, |
||
| Real | muBarrier = 0, |
||
| Real | muDecay = (Real)0.7, |
||
| bool | freeEnergy = false |
||
| ) |
Minimise the DIMENSIONLESS relative volume energy E = Σ (V_i/V_ref,i − 1)² by damped Gauss-Newton over positions (and weights when Weighted). vsetIn is the per-cell reference volume V_ref (may be non-uniform — spatially-graded refinement); it is renormalised to the actual total cell volume so the residual has zero mean and E → 0 is achievable. pos (3N) and weight (N; used only when Weighted) are updated in place.
NOTE: with an SDF the per-cell volume gradient still uses only the published seed-seed facetConnect (it omits the SDF wall-facet term), so pore-space meshing does not yet fully equalise — the wall gradient needs to be produced inside the tessellator (see the study in tests/kokkos/bench_mesh_optimizer).
| prec | Jacobi / ColoredGS / GraphAMG CG preconditioner. |
| cgIters | inner CG iterations per Newton step; |
| tol | on the gradient ∞-norm. |
| OtResult peclet::voro::meshVolumeOptimizeDevice | ( | std::vector< Real > & | posHost, |
| const std::vector< Real > & | vsetIn, | ||
| const Real | L[3], | ||
| int | N, | ||
| int | sw, | ||
| const Sdf & | sdf, | ||
| int | maxNewton, | ||
| Real | tol, | ||
| int | cgIters = 300, |
||
| bool | verbose = false |
||
| ) |
| KOKKOS_INLINE_FUNCTION int peclet::voro::morton3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) |
3D Morton (Z-order) code of a grid cell, via the suite's morton library (Morton<3,21>, software bit path on device — no BMI2; bit-identical to the former hand-rolled magic-bits spread). Used to order the cell grid so a cell's spatial neighbourhood is near it in memory — the gather then reads near-contiguous cellStart/posSorted instead of chasing z-neighbours dimx*dimy entries apart. Good to 21 bits/axis (grid indices are far below that).
| OtResult peclet::voro::otVolumeControl | ( | std::vector< Real > & | pos, |
| std::vector< Real > & | weight, | ||
| const std::vector< Real > & | vsetIn, | ||
| const Real | L[3], | ||
| int | N, | ||
| int | sw, | ||
| const Sdf & | sdf, | ||
| int | maxNewton, | ||
| Real | tol, | ||
| Real | reg = Real(1e-6), |
||
| Real | damp = Real(1), |
||
| bool | verbose = false |
||
| ) |
Drive the power weights weight (size N, updated in place) so the power-cell volumes match vsetIn (size N). pos (size 3N) are the fixed seeds. Returns convergence diagnostics.
| sw | grid coverage half-width for the tessellation (default 4). |
| maxNewton | max Newton iterations. |
| tol | convergence on max_i |V_i − V_set_i| (absolute volume). |
| reg | tiny Laplacian regularisation ε (lifts the constant nullspace so L+εI is SPD). |
| damp | Newton step scale α (1 = full Newton; <1 damps). |
| verbose | print per-iteration residual. |
vsetIn is normalised internally so Σ V_set = Σ V (the total tessellated volume) — the constant nullspace of L requires a compatible right-hand side (Σ residual = 0).
| TessellationView< Real > peclet::voro::reevalPublish | ( | const TopologyStore< MAXP, MAXT > & | store, |
| const Kokkos::View< Real *, peclet::core::MemSpace > & | pos, | ||
| const Kokkos::View< Real *, peclet::core::MemSpace > & | vol, | ||
| int | N, | ||
| const Real | L[3] | ||
| ) |
Re-evaluate the geometry of every cell in store on positions pos and publish a force-geometry TessellationView (facet neighbour / area / dV / connector CSR), reusing vol for the per-cell volume. MAXP/MAXT are the store's ConvexCell capacities; N cells; L the (cubic) box.
| KOKKOS_INLINE_FUNCTION void peclet::voro::sdfGradient | ( | const Sdf & | s, |
| Real | x, | ||
| Real | y, | ||
| Real | z, | ||
| Real | g[3] | ||
| ) |
Central-difference gradient of any provider with eval() (matches peclet::core::geom::gradient).
| KOKKOS_INLINE_FUNCTION void peclet::voro::sdfHessian | ( | const Sdf & | s, |
| Real | x, | ||
| Real | y, | ||
| Real | z, | ||
| Real | H[3][3] | ||
| ) |
Central-difference Hessian H_ab = ∂²φ/∂x_a∂x_b (symmetrised), via differences of the gradient (same stencil as sdfGradient, so host/device agree). Used by the differentiable SDF wall force.
| SubsetGatherResult< Real > peclet::voro::subsetGather | ( | const TessGrid< Real > & | grid, |
| const Kokkos::View< int *, peclet::core::MemSpace > & | indices, | ||
| int | nSubset, | ||
| const Kokkos::View< int *, peclet::core::MemSpace > & | outNp, | ||
| const Kokkos::View< int *, peclet::core::MemSpace > & | outNt, | ||
| const Kokkos::View< int *, peclet::core::MemSpace > & | outPnbr, | ||
| const Kokkos::View< unsigned *, peclet::core::MemSpace > & | outTri, | ||
| const Kokkos::View< Real *, peclet::core::MemSpace > & | cellVol, | ||
| const Kokkos::View< unsigned char *, peclet::core::MemSpace > & | outPoke4 = {}, |
||
| Sdf | sdf = {}, |
||
| bool | withForceGeom = false |
||
| ) |
Gather + clip the nSubset cells named by indices (original seed indices) off grid, writing their topology into the caller's store views and their volume into the result.
| grid | a TessGrid built for the CURRENT positions (buildTessGrid). Reused, not rebuilt. |
| indices | device view of nSubset ORIGINAL seed indices to (re)build (values in [0,N)). |
| nSubset | number of indices to process. |
| outNp,outNt,outPnbr,outTri | topology store views, each sized as in TopologyStore::alloc(N) (N, N, N*MAXP, N*MAXT) with MAXP=CellBuilder::kMaxP, MAXT=CellBuilder::kMaxT. |
| cellVol | N-sized view; the volume of each rebuilt cell is written at its original index. |
| withForceGeom | if true also compute the per-facet area/dV/connector (kept for parity with the cold build); the facet CSR itself is not published here (the store is). Default false: the store + volume are what Phase-1 needs (geometry is re-derived on reload). |
|
inline |
| TessellationView< Real > peclet::voro::upload | ( | const HostTessellation< Real > & | h | ) |
Upload a HostTessellation to device Views.
|
constexpr |
Neighbour id stamped on a facet produced by an SDF cut (a wall). Distinct from the initial-cuboid boundary (-1); published as facetNbr < 0 either way.
|
constexpr |
Bias added to each signed block offset (dx,dy,dz) so it packs into one int (8 bits per axis) in the worklist table — a single load + bit-unpack in the hot gather loop instead of three scattered loads. Block offsets stay within [-sw,sw], sw << 128.