peclet-dem 1.1.0
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
Loading...
Searching...
No Matches
particles.hpp
Go to the documentation of this file.
1
10#ifndef DEM_PARTICLES_HPP
11#define DEM_PARTICLES_HPP
12
13#include <cstdint>
14#include <Kokkos_Core.hpp>
15#include <vector>
16
17#include "contact_preprocessing.hpp" // ContactC, ManifoldC
18#include "integration.hpp" // Domain, V3/V4/Vf/Vi
19#include "narrowphase.hpp" // ShapeDesc, PlaneP
20
21namespace peclet::dem {
22
27 // per owned contact: global ids of bodyA / bodyB (-1 for a wall), the periodic image of each
28 // body's slot (integer box lengths per axis; 0 for an owned row and on a closed axis) and dist
29 std::vector<int> gidA, gidB, imageA, imageB; // image*: 3 per contact
30 std::vector<float> dist;
31 // per owned body: global id, predicted position (3), world radius
32 std::vector<int> gid;
33 std::vector<float> posPred, rad;
34};
35
45 int nHubs = 0, nCopies = 0, nGroups = 0, slotBase = 0;
46 int maxHubDegree = 0; // diagnostics: the largest hub degree
47 Kokkos::View<int*, CpMem> slotA, slotB; // per edge: override slot of the A / B end, -1
48 Kokkos::View<int*, CpMem> copyBase; // per copy slot (slot - slotBase): its hub's vertex
49 Kokkos::View<int*, CpMem> hubVertex, hubS; // per hub: base vertex, copy count s (incl. base)
50 Kokkos::View<int*, CpMem> groupStart, groupSlot, groupK;
51 Kokkos::View<float* [3], CpMem> groupShift; // per member
52 Kokkos::View<unsigned char*, CpMem> groupActive; // per member: >= 1 active edge (counts in k)
53 Kokkos::View<float* [3], CpMem> seedX, seedW; // per group: sigma (velPred / posPred; angVelPred)
54};
55
72
73struct Particles {
74 // --- per-particle state (size = capacity) ---
94 // Global particle id (stable across halo rebuilds and MPI ownership migration; identity == local
95 // index on the single-GPU path). The distributed step builds the persistent-contact pair keys
96 // from it — local slots are not stable identities there. Ghost slots carry the owner's gid.
98 Kokkos::View<float* [2], CpMem> planeFriction;
99 Vf rad; // effective broadphase radius scratch (scale * globalScale)
100 V3 extForce; // per-particle external FORCE (e.g. fluid drag); F=ma => dv = extForce*invMass*dt
101 // Per-particle external TORQUE in the WORLD frame (resolved CFD-DEM hydrodynamic torque, a
102 // magnetic couple, ...). Rotated into the body frame in the predictor, where the gyroscopic
103 // Euler term already lives: dw_body = invI * (tau_body - w x I w) * dt. World frame is the
104 // caller-facing convention because that is what every force/torque source produces; the body
105 // frame is an internal detail of the principal-axis inertia representation.
107
110 }
129
130 // --- collision/contact/manifold buffers ---
131 Kokkos::View<int* [2], CpMem> pairs; // broadphase candidates (maxPairs)
132 Kokkos::View<ContactC*, CpMem> contacts; // narrowphase output (maxContacts)
133 Kokkos::View<ManifoldC*, CpMem> manifolds; // reduction output (maxContacts)
134 // Graph-colouring scratch for the single-GPU colored Gauss–Seidel velocity solve: per-manifold
135 // colour (maxContacts; -2 inactive, -1 uncoloured, >=0 colour), plus per-body arbitration winner
136 // and committed-colour bitmask (both indexed by REAL body index, sized capacity).
137 Kokkos::View<int*, CpMem> manifoldColor; // per-manifold colour (velocity solve)
138 // Incremental (warm-started) colouring (single-GPU PGS path): the previous substep's per-manifold
139 // colour, sorted alongside prevPairKeys (committed by pair key exactly like prevLambda). A
140 // surviving pair keeps its colour so the Jones-Plassmann arbitration only re-runs over the NEW
141 // manifolds; velLastFullColors is the colour count at the last FULL recolour (creep-recompaction
142 // reference). See colorManifoldsIncremental.
143 Kokkos::View<int*, CpMem> prevManifoldColor;
145 // Persistent-contact restitution (gravity-gated): pair keys of this/last substep's manifolds +
146 // the per-manifold "existed last substep" flag. A persistent contact is LOADED, not a fresh
147 // impact — it gets e = 0 (the impulse still cancels the approach: pure inelastic support), which
148 // is how the velocity solve carries a pile's static weight through impulse chains. Restitution
149 // stays reserved for newly formed contacts (genuine impacts). |g| = 0 leaves all of this idle.
150 Kokkos::View<unsigned long long*, CpMem> pairKeys;
151 Kokkos::View<unsigned long long*, CpMem> prevPairKeys;
152 Kokkos::View<unsigned char*, CpMem> manifoldPersistent;
154 // Grounded level per REAL body (Guendelman support levels, warm-started + decayed): 255 at a
155 // wall/plane contact, propagated lower -> upper through the contact graph a few sweeps per
156 // substep. One-sided (shock-propagation) impulses require the LOWER body grounded > 0, so a
157 // gas-borne emulsion or lifted slug (no path to the floor) keeps momentum-conserving impulses
158 // and its weight stays on the gas -- only genuinely supported chains drain into the ground.
159 Kokkos::View<unsigned char*, CpMem> groundedLevel;
160 // Warm-started PGS (projected Gauss-Seidel) velocity solve: per-manifold accumulated push
161 // impulse (this substep), the previous substep's converged impulses (sorted alongside
162 // prevPairKeys for the warm-start gather), and the pre-solve approach velocity (restitution
163 // bias). At convergence lambdaAcc IS the contact force network (x dt).
164 Kokkos::View<float*, CpMem> lambdaAcc;
165 Kokkos::View<float*, CpMem> prevLambda;
166 Kokkos::View<float*, CpMem> vn0;
167 Kokkos::View<float* [3], CpMem> vt0; // pre-solve tangential surface velocity (beta reference)
168 // Friction-cone PGS: per-manifold accumulated tangential impulse (world frame, kept in the
169 // contact tangent plane by projection) and the previous substep's converged values (sorted
170 // alongside prevPairKeys for the warm-start gather). |lambdaT| <= mu * lambdaAcc at all times.
171 Kokkos::View<float* [3], CpMem> lambdaT;
172 Kokkos::View<float* [3], CpMem> prevLambdaT;
173 // Position-channel normal load (see solvePositionColoredGS): per-contact positional
174 // lambda this substep, its per-manifold impulse-equivalent, the previous substep's value
175 // (warm-gathered) that tops up the friction cone's Coulomb bound, and the sorted store.
176 Kokkos::View<float*, CpMem> hertzSnPair; // per cached pair: last step's patch stiffness sum
177 Kokkos::View<float*, CpMem> hertzSnWall; // per (particle, wall): same, for wall patches
178 Kokkos::View<float*, CpMem> posLambdaContact;
179 Kokkos::View<float*, CpMem> posImpulse; // gathered: LAST substep's position-channel load
180 Kokkos::View<float*, CpMem> prevPosImpulse; // sorted alongside prevPairKeys
181 // Event-level (Poisson) restitution (restitutionModel == 1): per-pair OWED separation impulse
182 // (physical units) — e x the event's banked kinetic-compression impulse, minus what has already
183 // been returned. Carried by pair key like lambdaT (gathered into restBank, committed to
184 // prevRestBank); restRel is the per-substep release accumulator (clamped 0..owed inside the PGS
185 // sweep — the friction-cone-shaped budget cap). See updateRestitutionBank.
186 Kokkos::View<float*, CpMem> restBank;
187 Kokkos::View<float*, CpMem> prevRestBank; // sorted alongside prevPairKeys
188 Kokkos::View<float*, CpMem> restRel; // this substep's released impulse (lambda units)
189 // Event state: peak physical approach speed of the pair's current impact event (> 0 = event
190 // active). Set/refreshed by kinetic approaches, decays 1/256 per substep, cleared once it ages
191 // below the resting threshold — so a buried/absorbed event's bank evaporates instead of popping.
192 // While active the contact banks its applied normal-impulse flux EVERY substep (the co-moving
193 // compression plateau has vn0 ~ 0, which a per-substep kinetic gate would miss), and the release
194 // separation velocity is capped at e x vPeak (sustained unloading push, never an impulsive dump).
195 Kokkos::View<float*, CpMem> restVPeak;
196 Kokkos::View<float*, CpMem> prevRestVPeak; // sorted alongside prevPairKeys
197 // Orphan transfer (pair-churn fix): a pair that DIES with owed budget credits it to its
198 // endpoint bodies mass-weighted (per-body balance + the event peak speed it carried, both
199 // decayed 1/256 per substep so stranded credit evaporates). Live releasing pairs draw the
200 // balance back on demand inside the PGS sweep — a penetrating impactor's event budget then
201 // survives the ~20-substep turnover of its contact partners instead of dying with each pair.
202 // Indexed by REAL body slot (owned range authoritative; MPI ghosts mirrored owner->ghost).
203 Kokkos::View<float*, CpMem> bodyOrphan;
204 Kokkos::View<float*, CpMem> bodyOrphanVPeak;
205 Kokkos::View<unsigned char*, CpMem> prevMatched; // scratch: prev-ledger entry seen this substep
206 // Side flags for the STABILIZATION pass (0 = symmetric): zeroed for the main momentum-
207 // conserving sweeps, filled from persistence+grounding only if statics fail to converge.
208 Kokkos::View<unsigned char*, CpMem> sideFlags;
209 // Level-ordered ("ordered") stabilization: per-REAL-body height-from-floor BFS level
210 // (recomputed fresh each time the pass triggers) + the per-manifold (level, colour) bucket
211 // key and permutation the ordered sweeps iterate through.
212 Kokkos::View<int*, CpMem> heightLevel;
213 Kokkos::View<int*, CpMem> levelKey;
214 Kokkos::View<int*, CpMem> levelPerm;
215 // Multilevel (GraphMG) stabilization scratch (solver_multilevel.hpp): packed per-manifold
216 // 6-bit colour per level, pooled parent maps / group mass / group velocity arrays (levels
217 // shrink >= 10% each, so the pools hold every level), the composed body -> group map, and
218 // the matching scratch.
219 Kokkos::View<long long*, CpMem> mlColorPacked;
220 Kokkos::View<int*, CpMem> mlParent;
221 Kokkos::View<float*, CpMem> mlInvMassG;
222 Kokkos::View<float* [3], CpMem> mlVelG;
223 Kokkos::View<float* [3], CpMem> mlVelG0;
224 Kokkos::View<float*, CpMem> mlMassG;
225 Kokkos::View<int*, CpMem> mlGrp;
226 Kokkos::View<int*, CpMem> mlMate;
227 // Rigid 6-DOF aggregates (docs/contact_physics_followups.md §2.3; MlScratch documents each):
228 // allocated LAZILY on the first multilevel pass with the group pools' extent (mlAccD: one
229 // level's groups, <= the body count), so the default path allocates nothing.
230 Kokkos::View<float* [3], CpMem> mlOriginG;
231 Kokkos::View<float* [3], CpMem> mlComOffG;
232 Kokkos::View<float* [3], CpMem> mlAngG;
233 Kokkos::View<float* [3], CpMem> mlAngG0;
234 Kokkos::View<float* [6], CpMem> mlInvIG;
235 Kokkos::View<double* [7], CpMem> mlAccD;
236 // --- Hertz-Mindlin soft-sphere engine (solver_hertz.hpp): cached Verlet pair list state ---
237 Kokkos::View<float* [3], CpMem> hertzXi; // per cached pair: Mindlin shear history
238 Kokkos::View<unsigned long long*, CpMem> hertzKeys; // keys of the cached pairs
239 Kokkos::View<unsigned long long*, CpMem> hertzPrevKeys; // sorted keys of the PREVIOUS list
240 Kokkos::View<float* [3], CpMem> hertzPrevXi; // xi aligned with hertzPrevKeys
241 Kokkos::View<float* [3], CpMem> hertzXiWall; // per (particle, wall) shear history
242 Kokkos::View<int*, CpMem> hertzWallCand; // near-wall candidate slots (i * 8 + wallIdx)
243 Kokkos::View<int, CpMem> hertzWallCandCount;
245 // Effective Hertz contact-curvature radius for non-spherical shapes, as a fraction of the
246 // bounding radius (true curvature is undefined at faces/edges; spheres use their real radius).
248 Kokkos::View<float* [3], CpMem> hertzRefPos; // positions at the last pair build
249 Kokkos::View<float, CpMem> hertzDispMax; // max |pos-ref|^2 since the build
250 Kokkos::View<float*, CpMem> hertzE, hertzNu; // per-material Young / Poisson
251 int hertzNumPairs = -1; // -1: no valid cached list
253 static constexpr int kHertzMaxWalls = 4;
254 // Stabilization mode of the staged velocity solve (Phase B; see sim.hpp): 0 = off (pure
255 // symmetric PGS), 1 = one-sided grounded pass (default), 2 = multilevel (level-ordered
256 // symmetric sweeps -- momentum is transported, never deleted), 3 = escalate (extra symmetric
257 // sweeps; diagnostic/fallback).
259 // Restitution model of the PGS velocity solve: 0 = newton (default; per-substep restitution on
260 // the pre-solve approach — unchanged behaviour), 1 = poisson (event-level: kinetic compression
261 // impulse banked per pair, released as a budget-capped separation-velocity target during
262 // unloading — restores the multi-substep-impact rebound per-substep Newton cannot return).
264 // Per-particle material id + flat pair-material table [kMaxMaterials^2 * 2] of (restitution,
265 // friction) rows; zero-length pairMaterials = feature off (global material everywhere).
266 Kokkos::View<unsigned char*, CpMem> materialId;
267 Kokkos::View<float*, CpMem> pairMaterials;
268 Kokkos::View<int*, CpMem> contactSlot; // contact -> manifold slot (PGS friction bound)
269 Kokkos::View<int*, CpMem> contactColor; // per-contact colour (position solve; = its unit's)
270 // Position units (docs/contact_solve_framework.md §4.3): the contacts of one body pair, or of one
271 // body and one wall, swept sequentially in one work item. CSR over the solved contacts
272 // [0, nc): unitStart (numPosUnits + 1), unitContacts (nc; ascending inside a unit), and the
273 // per-unit colour. Rebuilt every substep on the Gauss-Seidel path; numPosUnits = 0 otherwise.
274 Kokkos::View<int*, CpMem> unitStart;
275 Kokkos::View<int*, CpMem> unitContacts;
276 Kokkos::View<int*, CpMem> unitColor;
277 int numPosUnits = 0;
278 // Incremental (warm-started) position colouring (single-GPU PGS path): this substep's per-contact
279 // pair keys + the previous substep's (sorted keys, colour) ledger, so a surviving contact keeps
280 // its colour and only NEW contacts re-arbitrate. Unlike the manifold graph a pair CAN own several
281 // contacts (non-spherical multi-point patches), so carried colours are conflict-CHECKED (a shared
282 // colour on a shared body -> full recolour that substep). posLastFullColors = colours at the last
283 // full recolour (creep-recompaction reference). See colorContactsIncremental.
284 Kokkos::View<unsigned long long*, CpMem> contactKeys;
285 Kokkos::View<unsigned long long*, CpMem> prevContactKeys;
286 Kokkos::View<int*, CpMem> prevContactColor;
287 Kokkos::View<int*, CpMem> posCommitPerm;
290 // Per-body round-winner key for the colouring arbitration. 64-bit: hashed-random priority in the
291 // high word (splitmix32 of the edge index), the unique edge index in the low word. Random
292 // priorities give O(log n) arbitration rounds w.h.p.; RAW indices are adversarial for poured
293 // lattice beds (monotone index chains -> O(chain) rounds -> minutes per step at 1M grains).
294 // Dense colour-bucket scratch (buildColorBuckets): per-manifold permutation for the PGS
295 // velocity sweeps, the pooled commit permutation, a 64-int cursor, and the lazily-grown
296 // per-level coarse-cycle permutation (numLevels x numManifolds segments).
297 Kokkos::View<int*, CpMem> velPerm;
298 Kokkos::View<int*, CpMem> commitPerm;
299 Kokkos::View<int*, CpMem> bucketCursor;
300 Kokkos::View<int*, CpMem> mlBucketPerm;
301 // Fused colour sweeps (solver_fused.hpp): position-colour bucket permutation, pooled device
302 // copies of the host colour offsets (velocity / position / flat multilevel), and the software
303 // grid-barrier arrival counter (memset per fused launch, shared by all fused kernels — they
304 // are stream-ordered).
305 Kokkos::View<int*, CpMem> posPerm;
306 Kokkos::View<int*, CpMem> velOffsDev;
307 Kokkos::View<int*, CpMem> posOffsDev;
308 Kokkos::View<int*, CpMem> mlOffsDev;
309 Kokkos::View<unsigned*, CpMem> fusedBar;
310 // Cross-step CUDA-graph executable cache (opaque cudaGraphExec_t per iteration loop:
311 // velocity / onesided / multilevel / position). Owned here; leaked at teardown by design
312 // (freeing needs the CUDA context, which Kokkos may already have torn down).
313 void* graphCache[4] = {nullptr, nullptr, nullptr, nullptr};
314 Kokkos::View<long long*, CpMem> bodyWinner;
315 Kokkos::View<std::uint64_t*, CpMem> bodyColorMask; // per-body committed-colour bitmask
316 // --- island sleeping / freezing (single-GPU statics path; see sleeping.hpp) ---
317 // Per-REAL-body asleep flag + low-motion counter; effective inverse mass for the solve (asleep
318 // bodies + their ghosts -> 0, swapped in for the solve so a sleeper is immovable); the
319 // moving-wall "never sleep" flag + this-substep live contact count (contact-set-change wake); the
320 // stored count. Per-manifold / per-contact "both endpoints asleep" masks exclude a frozen island
321 // from the colouring / sweeps / multilevel hierarchy (the ledger still carries their force
322 // network).
323 Kokkos::View<unsigned char*, CpMem> asleep;
324 Kokkos::View<unsigned char*, CpMem> sleepCounter;
325 Kokkos::View<unsigned char*, CpMem> sleepMovingWall;
326 Kokkos::View<int*, CpMem> sleepCurCount;
327 Kokkos::View<int*, CpMem> sleepPrevCount;
328 Kokkos::View<float*, CpMem> invMassEff;
329 Kokkos::View<unsigned char*, CpMem> manifoldSleep;
330 Kokkos::View<unsigned char*, CpMem> contactSleep;
331 bool sleepingEnabled = true; // set_sleeping(enabled=False) disables; default ON
332 float sleepScale = 2.0f; // cSleep: sleep threshold = sleepScale * vRest
333 float wakeScale = 40.0f; // cWake: wake if an awake neighbour exceeds wakeScale * vRest
334 // (hysteresis: >> the residual settling jitter so a frozen bed
335 // stays frozen; only a genuine impact/disturbance wakes it)
336 int sleepK = 64; // substeps below threshold before sleeping (high enough that an
337 // impact's unloading/rebound completes before the network re-sleeps)
338 // rule (b): wake on a LOST contact (support removed); set_sleeping(wake_on_lost_contact=)
340 // Effective inverse-mass fraction of a sleeper for the solve (0 = exactly immovable). A small
341 // POSITIVE value keeps the sleeper very heavy but not infinitely rigid, so an awake body wedged
342 // at a frozen-pocket boundary can relieve against it instead of the PGS normal impulse diverging
343 // (trapped-between-two-rigid-constraints blow-up that a settling column reliably hit, ejected via
344 // the friction cone to NaN); the sleeper's velocity is re-zeroed each substep so no momentum
345 // accumulates and both-asleep interior manifolds are still fully excluded (the speed win). 0.01 =
346 // sleeper 100x a grain's mass: stable through the 96k column + violent pour, case3 penetration
347 // and the settled-bed freeze both preserved. set_sleeping(immovable_frac=) overrides.
348 float sleepImmovableFrac = 0.01f;
349 bool extForceActive = false; // CFD-DEM drag present -> sleeping disabled this step
350 bool extTorqueActive = false; // external couple present -> sleeping disabled this step
351 // --- Verlet-cached broadphase for the impulse step (single-GPU, non-periodic; see demStep) ---
352 // The impulse broadphase rebuilds the ArborX pair list every step; between rebuilds no new pair
353 // can appear if no particle has moved more than skin/2 (with the list built at margin + skin).
354 // impRefPos = posPred at the last build; impNumPairs = the cached candidate count (-1 = invalid,
355 // forces a build). Periodic ghosts are regenerated per step (unstable slot ids), so this is used
356 // only when the domain is non-periodic. Off by default (rebuild every step).
357 Kokkos::View<float* [3], CpMem> impRefPos;
358 Kokkos::View<float, CpMem> impDispMax;
359 int impNumPairs = -1;
360 float impRefMaxRad = 0.0f; // max effective radius at the last build (growth bound)
361 float verletSkinFrac = 0.0f; // set_verlet_skin; 0 = off (rebuild every step)
362
363 // --- solver execution policy (Simulation setters; see solve_driver.hpp / solver_fused.hpp) ---
364 // cudaGraphs and fusedSweeps only choose HOW the same arithmetic is submitted to the GPU (both
365 // paths are bit-identical, and both are inert on a non-CUDA backend). incrementalColoring does
366 // change results: the colouring fixes the Gauss-Seidel sweep order.
367 bool cudaGraphs = true; // set_cuda_graphs: capture+replay the sweep loops (CUDA)
368 int fusedSweeps = -1; // set_fused_sweeps: -1 auto, 0 off, 1 on (CUDA)
369 bool incrementalColoring = true; // set_incremental_coloring: warm-started recolouring
370
371 // --- atomic counters / scalars (rank-0 Views) ---
372 Kokkos::View<int, CpMem> pairCount, contactCount, manifoldCount, topGhost;
373 Kokkos::View<float, CpMem> maxOverlap;
374 // The accumulated position projection's stop residual max |d| w per iteration (WO-12), and its
375 // over-relaxation (internal; kPositionOmega by default, a test hook for the omega scan).
376 Kokkos::View<float, CpMem> posResidual;
377 float positionOmega = 1.5f;
378 // Max physical approach speed among approaching manifolds in the last velocity sweep — drives the
379 // colored-GS velocity loop's adaptive stop (converged once no pair approaches above the resting
380 // threshold). maxOverlap plays the same role for the position loop.
381 Kokkos::View<float, CpMem> maxApproach;
382 // Quasi-static share of maxApproach (corrections on contacts with |vn0| <= 4 vRest): the
383 // multilevel stabilization loop's stop criterion -- flowing scenes keep ballistic churn out
384 // of it, so the pass ends after ~one cycle instead of burning its full budget as an
385 // over-convergence brake on discharge.
386 Kokkos::View<float, CpMem> maxApproachQS;
387 // The largest consensus correction since the last stop vote (docs/contact_solve_framework.md
388 // §12 S14): |mean - copy| of any active copy at a local fold (velocity: velPred; position:
389 // posPred) or a rank-level M reconciliation, absolute like the phase's residual. A phase with
390 // copies folds it into its stop vote (the same Allreduce-MAX) and zeroes it after the read; a
391 // phase without copies never writes or reads it.
392 Kokkos::View<float, CpMem> maxConsensus;
393
394 // --- static geometry ---
395 Kokkos::View<ShapeDesc*, CpMem> shapes;
396 Kokkos::View<float* [3], CpMem> shell;
397 Kokkos::View<PlaneP*, CpMem> planes;
398 Kokkos::View<float*, CpMem> sdfGrid; // concatenated grid-SDF samples (imported shapes)
399 // static world-space SDF walls (drum barrel, hopper, vibrating tray) + their concatenated
400 // samples.
401 Kokkos::View<WallSdf*, CpMem> walls;
402 Kokkos::View<float*, CpMem> wallGrid;
403 // shape nodes backing ANALYTIC walls (Layer 1); WallSdf::nodes points into this
404 Kokkos::View<peclet::core::geom::ShapeNode<float>*, CpMem> wallNodes;
405 // SHAPE_SCENE particle trees: the pooled node table (base pointer + absolute indices)
406 Kokkos::View<peclet::core::geom::ShapeNode<float>*, CpMem> shapeNodes;
407
408 // --- sizes & params (host) ---
409 int capacity = 0, numReal = 0, numParticles = 0;
410 int maxPairs = 0, maxContacts = 0, numPlanes = 0, numWalls = 0;
411 // LARGEST surface-shell size across the registered shapes, mirrored from Simulation so the
412 // free-function contact-buffer growth (growContactBuffers) can size itself without reading the
413 // device shape descriptors back to the host every step.
414 int shellPoints = 0;
415 // Narrow-phase shell detection (Simulation::setShellDetection; detectContacts): 0 =
416 // one-way (default; the lower-index body's probes against the other's SDF), 1 = two-way (shell
417 // pairs probe both ways, sphere-shell pairs take the sphere probe). XPBD engine only.
419 // max wall friction (host) — gates the friction path so a frictional wall works even with a
420 // frictionless body-body material (global frictionDynamic == 0).
421 float wallFrictionMax = 0.0f;
423 F3 gravity{0, 0, 0};
424 float dt = 1e-3f, globalScale = 1.0f, growthRate = 0.0f, growthFactor = -1.0f;
426 1.0f; // shape canonical radius; effective radius = scale * globalScale * baseRadius
427 float thermostatTau = 0.0f, thermostatTemp = 0.0f,
428 thermostatKB = 1.0f; // Berendsen (tau>0 enables)
429 float frictionDynamic = 0.0f, restitutionNormal = 0.0f, skin = 0.1f;
430 // Walton tangential restitution beta (0 = tangentially dead stick, the pre-beta behaviour;
431 // > 0 reverses the pre-collision tangential surface velocity of COLLIDING contacts).
432 float restitutionTangent = 0.0f;
434 // Single-GPU collision solves: true = colored Gauss–Seidel for BOTH the restitution (velocity)
435 // and the overlap (position) solve — correct coupled multi-contact impulses + non-penetration,
436 // default; false = count-averaged Jacobi (the legacy robust path, still used by step_mpi).
437 bool velocityUseGS = true;
438
439 // --- contact-solve copies (docs/contact_solve_framework.md §4.4, §4.5) ---
441 // Solve views (§4.5): per slot k x invMass / k x invInertia of its body while the phase has
442 // copies (else the sweeps take invMass / invInertia themselves), and splitSlot = (k > 1).
443 // Grow-only, sized to the slots the phase touches.
444 Kokkos::View<float*, CpMem> invMassSolve;
445 Kokkos::View<float* [3], CpMem> invInertiaSolve;
446 Kokkos::View<unsigned char*, CpMem> splitSlot;
447 Kokkos::View<int*, CpMem> vertexDegree; // scratch: per colouring vertex, active edges
448 // Rank-level M (docs/contact_solve_framework.md §13.3; the distributed step only, recomputed
449 // every substep): per slot the local active copy counts aVel / aPos (the activity pass: 0 or 1
450 // at a vertex outside any group, the group's count at a hub base) and the global active copy
451 // counts kVel / kPos (owner: max(1, a(own) + sum of the ghosts' a), forwarded to the ghosts);
452 // activityHit the pass's per-slot scratch; invMassCoarse the multilevel coarse vertex's inverse
453 // mass invMass k / max(1, a) (§13.2). Grow-only.
454 Kokkos::View<int*, CpMem> aVel, aPos, kVel, kPos;
455 Kokkos::View<unsigned char*, CpMem> activityHit;
456 // Rank-level X (docs/contact_solve_framework.md §1.4, §13.5 WO-6; the g = 0 one-shot on an
457 // exchanging rank): per slot the velocity activity mask (bit col(r) of every rank on which the
458 // body is active, made global by the g = 0 opening), the per-manifold fire gate of the current
459 // sync interval, and the solve counter that starts each substep's holder cycle one step later.
460 // solveEpoch is incremented by every demSolveContacts, so it is identical on all ranks.
461 Kokkos::View<unsigned long long*, CpMem> velMask;
462 Kokkos::View<unsigned char*, CpMem> xGate;
463 long long solveEpoch = 0;
464 Kokkos::View<float*, CpMem> invMassCoarse;
465 // ... and its inverse inertia invInertia k / max(1, a) (docs/contact_physics_followups.md §2.5),
466 // built with invMassCoarse under rank-level M. Grow-only, lazy.
467 Kokkos::View<float* [3], CpMem> invInertiaCoarse;
468 // split_stats.orphanClamps, accumulated on the device by the owner apply (read by
469 // Simulation::debugSplitStats, reset by the step entry points; no fence in the step).
470 Kokkos::View<int, CpMem> orphanClampCount;
471 Kokkos::View<float* [3], CpMem>
472 imageShift; // demStep: posPred(image) - posPred(real) at generation
473 // The velocity incremental colouring carries colours by pair key; after a substep coloured
474 // through hub copies those colours are per COPY and may repeat at the body, so the next substep
475 // recolours in full (§4.2 item 4).
478 // The last multilevel hierarchy's shape (host), for the coarse-colouring validity check
479 // (Simulation::debugMultilevelColoringConflicts). numLevels = 0: none built last substep.
480 struct MlLast {
482 std::vector<int> parentOff, numGroups;
484
485 // Diagnostics (Simulation::debugIterationCounters; docs/contact_solve_framework.md §12 S12):
486 // with iterCounters on, a single-rank device-side (fused) main velocity / position loop writes
487 // its iteration count to iterCountDev(0) / (1), read back into splitStats.velItersUsed /
488 // posItersUsed. Off (the default): nothing is written or read back, the counters read -1.
489 bool iterCounters = false;
490 // TEST-ONLY (Simulation::debugNoAdaptiveStop; §12 S13): every adaptive stop of the contact solve
491 // is disabled, so each loop runs exactly its iteration cap (the votes still run: they are
492 // collective and carry the colouring invariant). Off (the default) changes nothing.
493 bool noAdaptiveStop = false;
494 Kokkos::View<int*, CpMem> iterCountDev;
495
496 // TEST-ONLY contact capture (Simulation::debugCaptureContacts; see DebugContactCapture).
497 bool debugCapture = false;
499
500 // nPlanes is the plane-array CAPACITY; numPlanes (the live count) stays 0 until planes are added.
501 void allocate(int cap, int maxPairs_, int maxContacts_, int nShapes, int nShell, int nPlanes) {
502 capacity = cap;
503 maxPairs = maxPairs_;
504 maxContacts = maxContacts_;
505 numPlanes = 0;
506 pos = V3("pos", cap);
507 invMass = Vf("invMass", cap);
508 quat = V4("quat", cap);
509 vel = V3("vel", cap);
510 angVel = V3("angVel", cap);
511 invInertia = V3("invInertia", cap);
512 scale = Vf("scale", cap);
513 targetScale = Vf("targetScale", cap);
514 shapeId = Vi("shapeId", cap);
515 posPred = V3("posPred", cap);
516 quatPred = V4("quatPred", cap);
517 velPred = V3("velPred", cap);
518 angVelPred = V3("angVelPred", cap);
519 deltaPos = V3("deltaPos", cap);
520 deltaQuat = V4("deltaQuat", cap);
521 deltaVel = V3("deltaVel", cap);
522 deltaAngVel = V3("deltaAngVel", cap);
523 constraintCounts = Vi("constraintCounts", cap);
524 realIndices = Vi("realIndices", cap);
525 gid = Vi("gid", cap);
526 planeFriction = Kokkos::View<float* [2], CpMem>("planeFriction", cap);
527 rad = Vf("rad", cap);
528 extForce = V3("extForce", cap); // zero-initialised => no external force by default
529 extTorque = V3("extTorque", cap);
530 pairs = Kokkos::View<int* [2], CpMem>("pairs", maxPairs);
531 contacts = Kokkos::View<ContactC*, CpMem>("contacts", maxContacts);
532 manifolds = Kokkos::View<ManifoldC*, CpMem>("manifolds", maxContacts);
533 manifoldColor = Kokkos::View<int*, CpMem>("manifoldColor", maxContacts);
534 prevManifoldColor = Kokkos::View<int*, CpMem>("prevManifoldColor", maxContacts);
535 pairKeys = Kokkos::View<unsigned long long*, CpMem>("pairKeys", maxContacts);
536 prevPairKeys = Kokkos::View<unsigned long long*, CpMem>("prevPairKeys", maxContacts);
537 manifoldPersistent = Kokkos::View<unsigned char*, CpMem>("manifoldPersistent", maxContacts);
538 prevPairCount = 0;
539 contactColor = Kokkos::View<int*, CpMem>("contactColor", maxContacts);
540 unitStart = Kokkos::View<int*, CpMem>("unitStart", maxContacts + 1);
541 unitContacts = Kokkos::View<int*, CpMem>("unitContacts", maxContacts);
542 unitColor = Kokkos::View<int*, CpMem>("unitColor", maxContacts);
543 contactKeys = Kokkos::View<unsigned long long*, CpMem>("contactKeys", maxContacts);
544 prevContactKeys = Kokkos::View<unsigned long long*, CpMem>("prevContactKeys", maxContacts);
545 prevContactColor = Kokkos::View<int*, CpMem>("prevContactColor", maxContacts);
546 posCommitPerm = Kokkos::View<int*, CpMem>("posCommitPerm", maxContacts);
547 velPerm = Kokkos::View<int*, CpMem>("velPerm", maxContacts);
548 commitPerm = Kokkos::View<int*, CpMem>("commitPerm", maxContacts);
549 bucketCursor = Kokkos::View<int*, CpMem>("bucketCursor", 64);
550 mlBucketPerm = Kokkos::View<int*, CpMem>("mlBucketPerm", 0);
551 posPerm = Kokkos::View<int*, CpMem>("posPerm", maxContacts);
552 velOffsDev = Kokkos::View<int*, CpMem>("velOffsDev", 65);
553 posOffsDev = Kokkos::View<int*, CpMem>("posOffsDev", 65);
554 mlOffsDev = Kokkos::View<int*, CpMem>("mlOffsDev", 65 * 10); // 10 = kMlMaxLevels
555 fusedBar = Kokkos::View<unsigned*, CpMem>("fusedBar", 32769); // 4096 blocks x 8 + 1
556 bodyWinner = Kokkos::View<long long*, CpMem>("bodyWinner", cap);
557 bodyColorMask = Kokkos::View<std::uint64_t*, CpMem>("bodyColorMask", cap);
558 asleep = Kokkos::View<unsigned char*, CpMem>("asleep", cap);
559 sleepCounter = Kokkos::View<unsigned char*, CpMem>("sleepCounter", cap);
560 sleepMovingWall = Kokkos::View<unsigned char*, CpMem>("sleepMovingWall", cap);
561 sleepCurCount = Kokkos::View<int*, CpMem>("sleepCurCount", cap);
562 sleepPrevCount = Kokkos::View<int*, CpMem>("sleepPrevCount", cap);
563 invMassEff = Kokkos::View<float*, CpMem>("invMassEff", cap);
564 manifoldSleep = Kokkos::View<unsigned char*, CpMem>("manifoldSleep", maxContacts);
565 contactSleep = Kokkos::View<unsigned char*, CpMem>("contactSleep", maxContacts);
566 impRefPos = Kokkos::View<float* [3], CpMem>("impRefPos", cap);
567 impDispMax = Kokkos::View<float, CpMem>("impDispMax");
568 groundedLevel = Kokkos::View<unsigned char*, CpMem>("groundedLevel", cap);
569 materialId = Kokkos::View<unsigned char*, CpMem>("materialId", cap);
570 lambdaAcc = Kokkos::View<float*, CpMem>("lambdaAcc", maxContacts);
571 lambdaT = Kokkos::View<float* [3], CpMem>("lambdaT", maxContacts);
572 posLambdaContact = Kokkos::View<float*, CpMem>("posLambdaContact", maxContacts);
573 posImpulse = Kokkos::View<float*, CpMem>("posImpulse", maxContacts);
574 prevPosImpulse = Kokkos::View<float*, CpMem>("prevPosImpulse", maxContacts);
575 restBank = Kokkos::View<float*, CpMem>("restBank", maxContacts);
576 prevRestBank = Kokkos::View<float*, CpMem>("prevRestBank", maxContacts);
577 restRel = Kokkos::View<float*, CpMem>("restRel", maxContacts);
578 restVPeak = Kokkos::View<float*, CpMem>("restVPeak", maxContacts);
579 prevRestVPeak = Kokkos::View<float*, CpMem>("prevRestVPeak", maxContacts);
580 bodyOrphan = Kokkos::View<float*, CpMem>("bodyOrphan", cap);
581 bodyOrphanVPeak = Kokkos::View<float*, CpMem>("bodyOrphanVPeak", cap);
582 prevMatched = Kokkos::View<unsigned char*, CpMem>("prevMatched", maxContacts);
583 sideFlags = Kokkos::View<unsigned char*, CpMem>("sideFlags", maxContacts);
584 heightLevel = Kokkos::View<int*, CpMem>("heightLevel", cap);
585 levelKey = Kokkos::View<int*, CpMem>("levelKey", maxContacts);
586 levelPerm = Kokkos::View<int*, CpMem>("levelPerm", maxContacts);
587 mlColorPacked = Kokkos::View<long long*, CpMem>("mlColorPacked", maxContacts);
588 mlParent = Kokkos::View<int*, CpMem>("mlParent", 5 * cap);
589 mlInvMassG = Kokkos::View<float*, CpMem>("mlInvMassG", 4 * cap);
590 mlVelG = Kokkos::View<float* [3], CpMem>("mlVelG", 4 * cap);
591 mlVelG0 = Kokkos::View<float* [3], CpMem>("mlVelG0", 4 * cap);
592 mlMassG = Kokkos::View<float*, CpMem>("mlMassG", 4 * cap);
593 mlGrp = Kokkos::View<int*, CpMem>("mlGrp", cap);
594 mlMate = Kokkos::View<int*, CpMem>("mlMate", cap);
595 hertzXiWall = Kokkos::View<float* [3], CpMem>("hertzXiWall", cap * kHertzMaxWalls);
596 hertzWallCand = Kokkos::View<int*, CpMem>("hertzWallCand", cap * 2);
597 hertzSnWall = Kokkos::View<float*, CpMem>("hertzSnWall", cap * kHertzMaxWalls);
598 hertzWallCandCount = Kokkos::View<int, CpMem>("hertzWallCandCount");
599 hertzRefPos = Kokkos::View<float* [3], CpMem>("hertzRefPos", cap);
600 hertzDispMax = Kokkos::View<float, CpMem>("hertzDispMax");
601 hertzE = Kokkos::View<float*, CpMem>("hertzE", 8);
602 hertzNu = Kokkos::View<float*, CpMem>("hertzNu", 8);
603 {
604 auto he = Kokkos::create_mirror_view(hertzE);
605 auto hn = Kokkos::create_mirror_view(hertzNu);
606 for (int i = 0; i < 8; ++i) {
607 he(i) = 1.0e9f;
608 hn(i) = 0.25f;
609 }
610 Kokkos::deep_copy(hertzE, he);
611 Kokkos::deep_copy(hertzNu, hn);
612 }
613 prevLambdaT = Kokkos::View<float* [3], CpMem>("prevLambdaT", maxContacts);
614 contactSlot = Kokkos::View<int*, CpMem>("contactSlot", maxContacts);
615 prevLambda = Kokkos::View<float*, CpMem>("prevLambda", maxContacts);
616 vn0 = Kokkos::View<float*, CpMem>("vn0", maxContacts);
617 vt0 = Kokkos::View<float* [3], CpMem>("vt0", maxContacts);
618 pairCount = Kokkos::View<int, CpMem>("pairCount");
619 contactCount = Kokkos::View<int, CpMem>("contactCount");
620 manifoldCount = Kokkos::View<int, CpMem>("manifoldCount");
621 topGhost = Kokkos::View<int, CpMem>("topGhost");
622 maxOverlap = Kokkos::View<float, CpMem>("maxOverlap");
623 posResidual = Kokkos::View<float, CpMem>("posResidual");
624 maxApproach = Kokkos::View<float, CpMem>("maxApproach");
625 maxApproachQS = Kokkos::View<float, CpMem>("maxApproachQS");
626 maxConsensus = Kokkos::View<float, CpMem>("maxConsensus");
627 shapes = Kokkos::View<ShapeDesc*, CpMem>("shapes", nShapes > 0 ? nShapes : 1);
628 shell = Kokkos::View<float* [3], CpMem>("shell", nShell > 0 ? nShell : 1);
629 planes = Kokkos::View<PlaneP*, CpMem>("planes", nPlanes > 0 ? nPlanes : 1);
630 sdfGrid = Kokkos::View<float*, CpMem>("sdfGrid", 1); // resized by setSdfShape
631 walls = Kokkos::View<WallSdf*, CpMem>("walls", 1); // resized by addSdfWall
632 wallGrid = Kokkos::View<float*, CpMem>("wallGrid", 1); // concatenated wall samples
633 wallNodes = Kokkos::View<peclet::core::geom::ShapeNode<float>*, CpMem>("wallNodes", 1);
634 shapeNodes = Kokkos::View<peclet::core::geom::ShapeNode<float>*, CpMem>("shapeNodes", 1);
635 numWalls = 0;
636 }
637
638 // Grow the per-particle SoA to hold at least `newCap` particles (real + periodic-ghost headroom),
639 // preserving the existing [0,numReal) state (Kokkos::resize copies the overlapping subextent).
640 // The single-GPU step sizes this from the domain before generating ghosts; without the headroom
641 // every ghost slot overflows `capacity` and cross-boundary contacts silently vanish. A no-op when
642 // the SoA is already large enough (e.g. the MPI path, whose caller pre-sizes capacity for the
643 // worst-case ghost band). The collision buffers (pairs/contacts/manifolds) keep their
644 // construction-time sizing — each real particle still issues one broad-phase query.
645 void ensureCapacity(int newCap) {
646 if (newCap <= capacity)
647 return;
648 Kokkos::resize(pos, newCap);
649 Kokkos::resize(invMass, newCap);
650 Kokkos::resize(quat, newCap);
651 Kokkos::resize(vel, newCap);
652 Kokkos::resize(angVel, newCap);
653 Kokkos::resize(invInertia, newCap);
654 Kokkos::resize(scale, newCap);
655 Kokkos::resize(targetScale, newCap);
656 Kokkos::resize(shapeId, newCap);
657 Kokkos::resize(posPred, newCap);
658 Kokkos::resize(quatPred, newCap);
659 Kokkos::resize(velPred, newCap);
660 Kokkos::resize(angVelPred, newCap);
661 Kokkos::resize(deltaPos, newCap);
662 Kokkos::resize(deltaQuat, newCap);
663 Kokkos::resize(deltaVel, newCap);
664 Kokkos::resize(deltaAngVel, newCap);
665 Kokkos::resize(constraintCounts, newCap);
666 Kokkos::resize(realIndices, newCap);
667 Kokkos::resize(gid, newCap);
668 Kokkos::resize(bodyWinner, newCap);
669 Kokkos::resize(bodyColorMask, newCap);
670 Kokkos::resize(groundedLevel, newCap);
671 Kokkos::resize(heightLevel, newCap);
672 Kokkos::resize(planeFriction, newCap);
673 Kokkos::resize(rad, newCap);
674 Kokkos::resize(extForce, newCap);
675 Kokkos::resize(extTorque, newCap);
676 // materialId is written per GHOST slot by generateGhosts (guarded by `capacity`),
677 // so it MUST track the padded capacity like every other per-slot array. Its absence here
678 // was a silent out-of-bounds write into the neighbouring allocation — harmless or
679 // catastrophic depending on the device allocator's layout (the 2026-08 H100 packing
680 // corruption: contacts silently unresolved, phi_voxel 0.40 instead of 0.50).
681 Kokkos::resize(materialId, newCap);
682 // Not ghost-indexed today, but per-particle and cap-sized at construction — keep them in
683 // lockstep so a future ghost-slot consumer cannot reintroduce the same class of bug.
684 Kokkos::resize(asleep, newCap);
685 Kokkos::resize(sleepCounter, newCap);
686 Kokkos::resize(sleepMovingWall, newCap);
687 // The rest of the capacity-sized per-body arrays. These were the LAST twelve left behind, and
688 // the same class of bug as materialId above: every one of them is written up to numParticles
689 // (or numReal) by some kernel, so any that keeps the pre-growth extent is an out-of-bounds
690 // write. Found via peclet-examples/pall-ring-packing, where a 48-ring pour reported
691 // "corrupted double-linked list" from inside step() -- mlGrp/mlMate (the multilevel
692 // stabiliser's per-body group and mate arrays) and invMassEff (written for numParticles by
693 // buildInvMassEff) are the ones that bit. A cap-sized array that ensureCapacity does not
694 // resize is a latent heap corruption, full stop; there is no reason to keep any of them out.
695 Kokkos::resize(invMassEff, newCap);
696 Kokkos::resize(sleepCurCount, newCap);
697 Kokkos::resize(sleepPrevCount, newCap);
698 Kokkos::resize(bodyOrphan, newCap);
699 Kokkos::resize(bodyOrphanVPeak, newCap);
700 Kokkos::resize(mlGrp, newCap);
701 Kokkos::resize(mlMate, newCap);
702 Kokkos::resize(impRefPos, newCap);
703 Kokkos::resize(hertzRefPos, newCap);
704 Kokkos::resize(hertzWallCand, newCap);
705 Kokkos::resize(hertzSnWall, newCap);
706 Kokkos::resize(hertzXiWall, newCap);
707 capacity = newCap;
708 }
709
710 // Const views for the read-only kernel inputs.
711 Kokkos::View<const float* [3], CpMem> cpos() const { return pos; }
712 Kokkos::View<const float*, CpMem> crad() const { return rad; }
713};
714
715} // namespace peclet::dem
716
717#endif // DEM_PARTICLES_HPP
dem — portable (Kokkos) contact->manifold reduction, replacing the thrust-based reduce_contacts_to_ma...
dem — portable (Kokkos) time integration kernels (integration.cu).
Kokkos::View< float *, CpMem > Vf
Kokkos::View< int *, CpMem > Vi
CpExec::memory_space CpMem
Kokkos::View< float *[3], CpMem > V3
Kokkos::View< float *[4], CpMem > V4
dem — portable (Kokkos) narrow-phase: SDF point-shell collision + boundary planes.
The solve's per-body accumulators: position/orientation and velocity corrections and the per-body con...
The substep's predicted body state (Particles::bodyPred()).
A body's state, one row per particle slot (Particles::bodyState()).
The previous substep's colour ledger for an incremental colouring: the key-sorted pair keys,...
Per-vertex scratch of the Jones-Plassmann colourings: the round's winning edge key and the committed-...
TEST-ONLY host capture of one distributed substep's contact ownership (C++ only; filled by demStepMpi...
Definition particles.hpp:26
std::vector< float > dist
Definition particles.hpp:30
std::vector< float > posPred
Definition particles.hpp:33
The pair-keyed warm-start ledger: pair key, converged normal and tangential impulses,...
std::vector< int > parentOff
std::vector< int > numGroups
Kokkos::View< WallSdf *, CpMem > walls
Kokkos::View< float, CpMem > posResidual
Kokkos::View< const float *[3], CpMem > cpos() const
Kokkos::View< float *, CpMem > hertzE
Kokkos::View< int *, CpMem > commitPerm
Kokkos::View< float *[3], CpMem > hertzXi
Kokkos::View< unsigned *, CpMem > fusedBar
Kokkos::View< unsigned char *, CpMem > asleep
Kokkos::View< int *, CpMem > bucketCursor
Kokkos::View< unsigned char *, CpMem > materialId
Kokkos::View< unsigned char *, CpMem > sideFlags
Kokkos::View< unsigned long long *, CpMem > prevContactKeys
Kokkos::View< int *, CpMem > mlGrp
Kokkos::View< unsigned char *, CpMem > xGate
Kokkos::View< unsigned char *, CpMem > manifoldPersistent
Kokkos::View< int *, CpMem > aPos
Kokkos::View< int, CpMem > hertzWallCandCount
Kokkos::View< float *[3], CpMem > impRefPos
Kokkos::View< int, CpMem > manifoldCount
Kokkos::View< int *, CpMem > posOffsDev
Kokkos::View< float *, CpMem > bodyOrphanVPeak
Kokkos::View< int *, CpMem > velPerm
PairLedger pairLedger() const
Kokkos::View< unsigned char *, CpMem > contactSleep
Kokkos::View< float *, CpMem > prevLambda
void ensureCapacity(int newCap)
Kokkos::View< int *, CpMem > unitStart
Kokkos::View< ManifoldC *, CpMem > manifolds
Kokkos::View< float *[3], CpMem > mlOriginG
Kokkos::View< float *, CpMem > vn0
Kokkos::View< float *, CpMem > mlMassG
Kokkos::View< int *, CpMem > levelKey
Kokkos::View< int *, CpMem > sleepCurCount
Kokkos::View< int *[2], CpMem > pairs
Kokkos::View< float *[3], CpMem > invInertiaSolve
Kokkos::View< float *[3], CpMem > imageShift
Kokkos::View< int, CpMem > contactCount
DebugContactCapture debugCaptured
Kokkos::View< int *, CpMem > hertzWallCand
BodyPred bodyPred() const
Kokkos::View< unsigned char *, CpMem > sleepMovingWall
Kokkos::View< float, CpMem > hertzDispMax
Kokkos::View< float *[3], CpMem > mlAngG0
Kokkos::View< float *[3], CpMem > vt0
Kokkos::View< int *, CpMem > vertexDegree
Kokkos::View< float *, CpMem > restRel
Kokkos::View< int *, CpMem > levelPerm
Kokkos::View< int *, CpMem > prevManifoldColor
Kokkos::View< float *[3], CpMem > mlAngG
static constexpr int kHertzMaxWalls
Kokkos::View< unsigned char *, CpMem > splitSlot
Kokkos::View< int *, CpMem > kVel
Kokkos::View< float *[3], CpMem > mlComOffG
Kokkos::View< float, CpMem > impDispMax
Kokkos::View< unsigned long long *, CpMem > contactKeys
Kokkos::View< float *, CpMem > pairMaterials
Kokkos::View< ShapeDesc *, CpMem > shapes
Kokkos::View< unsigned long long *, CpMem > hertzPrevKeys
Kokkos::View< int *, CpMem > prevContactColor
Kokkos::View< unsigned char *, CpMem > prevMatched
Kokkos::View< unsigned char *, CpMem > activityHit
Kokkos::View< float, CpMem > maxApproach
Kokkos::View< float *, CpMem > prevRestBank
Kokkos::View< float *, CpMem > restVPeak
Kokkos::View< peclet::core::geom::ShapeNode< float > *, CpMem > wallNodes
Kokkos::View< float *, CpMem > restBank
CarriedColors prevManifoldColors() const
Kokkos::View< std::uint64_t *, CpMem > bodyColorMask
Kokkos::View< int *, CpMem > posCommitPerm
Kokkos::View< int *, CpMem > velOffsDev
Kokkos::View< int *, CpMem > mlOffsDev
Kokkos::View< unsigned long long *, CpMem > pairKeys
Kokkos::View< float *, CpMem > hertzNu
Kokkos::View< unsigned long long *, CpMem > hertzKeys
BodyState bodyState() const
struct peclet::dem::Particles::MlLast mlLast
Kokkos::View< int, CpMem > topGhost
Kokkos::View< int *, CpMem > aVel
Kokkos::View< float, CpMem > maxConsensus
Kokkos::View< float *, CpMem > bodyOrphan
Kokkos::View< unsigned long long *, CpMem > prevPairKeys
Kokkos::View< float *, CpMem > hertzSnWall
Kokkos::View< int *, CpMem > posPerm
Kokkos::View< float *, CpMem > invMassEff
Kokkos::View< float *, CpMem > prevPosImpulse
ColorScratch colorScratch() const
Kokkos::View< int *, CpMem > contactColor
Kokkos::View< float *[3], CpMem > mlVelG
Kokkos::View< float *, CpMem > invMassSolve
Kokkos::View< peclet::core::geom::ShapeNode< float > *, CpMem > shapeNodes
Kokkos::View< float *[3], CpMem > mlVelG0
Kokkos::View< int *, CpMem > sleepPrevCount
Kokkos::View< int *, CpMem > mlBucketPerm
Kokkos::View< float *[3], CpMem > hertzRefPos
Kokkos::View< float *[3], CpMem > invInertiaCoarse
Kokkos::View< int *, CpMem > mlParent
Kokkos::View< float *, CpMem > sdfGrid
Kokkos::View< float *[3], CpMem > lambdaT
Kokkos::View< float *, CpMem > hertzSnPair
CarriedColors prevContactColors() const
Kokkos::View< float *[3], CpMem > prevLambdaT
Kokkos::View< int *, CpMem > unitColor
Kokkos::View< int *, CpMem > kPos
Kokkos::View< float, CpMem > maxOverlap
Kokkos::View< float *, CpMem > posLambdaContact
Kokkos::View< unsigned long long *, CpMem > velMask
Kokkos::View< float *, CpMem > posImpulse
SleepState sleepState() const
Kokkos::View< int *, CpMem > contactSlot
PairLedger prevPairLedger() const
Kokkos::View< unsigned char *, CpMem > sleepCounter
Kokkos::View< float *, CpMem > mlInvMassG
Kokkos::View< int *, CpMem > heightLevel
Kokkos::View< long long *, CpMem > bodyWinner
BodyDelta bodyDelta() const
Kokkos::View< float *, CpMem > lambdaAcc
Kokkos::View< double *[7], CpMem > mlAccD
Kokkos::View< long long *, CpMem > mlColorPacked
Kokkos::View< float *, CpMem > invMassCoarse
Kokkos::View< float *, CpMem > wallGrid
Kokkos::View< int *, CpMem > iterCountDev
Kokkos::View< float, CpMem > maxApproachQS
Kokkos::View< unsigned char *, CpMem > manifoldSleep
Kokkos::View< const float *, CpMem > crad() const
Kokkos::View< int, CpMem > orphanClampCount
void allocate(int cap, int maxPairs_, int maxContacts_, int nShapes, int nShell, int nPlanes)
Kokkos::View< float *[2], CpMem > planeFriction
Definition particles.hpp:98
Kokkos::View< float *[3], CpMem > shell
Kokkos::View< float *, CpMem > prevRestVPeak
Kokkos::View< int *, CpMem > mlMate
Kokkos::View< ContactC *, CpMem > contacts
Kokkos::View< int, CpMem > pairCount
Kokkos::View< unsigned char *, CpMem > groundedLevel
Kokkos::View< float *[3], CpMem > hertzXiWall
Kokkos::View< int *, CpMem > unitContacts
Kokkos::View< PlaneP *, CpMem > planes
Kokkos::View< float *[3], CpMem > hertzPrevXi
Kokkos::View< int *, CpMem > manifoldColor
Kokkos::View< float *[6], CpMem > mlInvIG
One solve phase's body copies (docs/contact_solve_framework.md §4.4, §4.5, §WO-4 item 2): the hub cop...
Definition particles.hpp:44
Kokkos::View< float *[3], CpMem > seedX
Definition particles.hpp:53
Kokkos::View< int *, CpMem > hubS
Definition particles.hpp:49
Kokkos::View< float *[3], CpMem > seedW
Definition particles.hpp:53
Kokkos::View< int *, CpMem > slotB
Definition particles.hpp:47
Kokkos::View< float *[3], CpMem > groupShift
Definition particles.hpp:51
Kokkos::View< int *, CpMem > hubVertex
Definition particles.hpp:49
Kokkos::View< int *, CpMem > copyBase
Definition particles.hpp:48
Kokkos::View< int *, CpMem > slotA
Definition particles.hpp:47
Kokkos::View< int *, CpMem > groupK
Definition particles.hpp:50
Kokkos::View< int *, CpMem > groupStart
Definition particles.hpp:50
Kokkos::View< unsigned char *, CpMem > groupActive
Definition particles.hpp:52
Kokkos::View< int *, CpMem > groupSlot
Definition particles.hpp:50
Island-sleeping state per real body: asleep flag, low-motion counter, moving-wall flag,...
diagnostics.split_stats() (docs/contact_solve_framework.md §WO-4 item 4, §13.5 WO-4b): the last subst...
Definition particles.hpp:66
long long unfiredSplitContacts
Definition particles.hpp:68