10#ifndef DEM_PARTICLES_HPP
11#define DEM_PARTICLES_HPP
14#include <Kokkos_Core.hpp>
131 Kokkos::View<int* [2], CpMem>
pairs;
166 Kokkos::View<float*, CpMem>
vn0;
167 Kokkos::View<float* [3], CpMem>
vt0;
323 Kokkos::View<unsigned char*, CpMem>
asleep;
396 Kokkos::View<float* [3], CpMem>
shell;
401 Kokkos::View<WallSdf*, CpMem>
walls;
461 Kokkos::View<unsigned long long*, CpMem>
velMask;
462 Kokkos::View<unsigned char*, CpMem>
xGate;
471 Kokkos::View<float* [3], CpMem>
501 void allocate(
int cap,
int maxPairs_,
int maxContacts_,
int nShapes,
int nShell,
int nPlanes) {
506 pos =
V3(
"pos", cap);
509 vel =
V3(
"vel", cap);
525 gid =
Vi(
"gid", cap);
526 planeFriction = Kokkos::View<float* [2], CpMem>(
"planeFriction", cap);
527 rad =
Vf(
"rad", cap);
549 bucketCursor = Kokkos::View<int*, CpMem>(
"bucketCursor", 64);
550 mlBucketPerm = Kokkos::View<int*, CpMem>(
"mlBucketPerm", 0);
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);
555 fusedBar = Kokkos::View<unsigned*, CpMem>(
"fusedBar", 32769);
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);
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);
580 bodyOrphan = Kokkos::View<float*, CpMem>(
"bodyOrphan", cap);
584 heightLevel = Kokkos::View<int*, CpMem>(
"heightLevel", cap);
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);
596 hertzWallCand = Kokkos::View<int*, CpMem>(
"hertzWallCand", cap * 2);
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);
604 auto he = Kokkos::create_mirror_view(
hertzE);
605 auto hn = Kokkos::create_mirror_view(
hertzNu);
606 for (
int i = 0; i < 8; ++i) {
610 Kokkos::deep_copy(
hertzE, he);
611 Kokkos::deep_copy(
hertzNu, hn);
618 pairCount = Kokkos::View<int, CpMem>(
"pairCount");
619 contactCount = Kokkos::View<int, CpMem>(
"contactCount");
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");
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);
631 walls = Kokkos::View<WallSdf*, CpMem>(
"walls", 1);
632 wallGrid = Kokkos::View<float*, CpMem>(
"wallGrid", 1);
633 wallNodes = Kokkos::View<peclet::core::geom::ShapeNode<float>*,
CpMem>(
"wallNodes", 1);
634 shapeNodes = Kokkos::View<peclet::core::geom::ShapeNode<float>*,
CpMem>(
"shapeNodes", 1);
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);
654 Kokkos::resize(
scale, newCap);
656 Kokkos::resize(
shapeId, newCap);
657 Kokkos::resize(
posPred, newCap);
659 Kokkos::resize(
velPred, newCap);
667 Kokkos::resize(
gid, newCap);
673 Kokkos::resize(
rad, newCap);
684 Kokkos::resize(
asleep, newCap);
700 Kokkos::resize(
mlGrp, newCap);
701 Kokkos::resize(
mlMate, newCap);
711 Kokkos::View<const float* [3], CpMem>
cpos()
const {
return pos; }
712 Kokkos::View<const float*, CpMem>
crad()
const {
return rad; }
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-...
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
bool velCopiesLastSubstep
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
float hertzContactRadiusFrac
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
bool sleepWakeLostContact
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
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...
Kokkos::View< float *[3], CpMem > seedX
Kokkos::View< int *, CpMem > hubS
Kokkos::View< float *[3], CpMem > seedW
Kokkos::View< int *, CpMem > slotB
Kokkos::View< float *[3], CpMem > groupShift
Kokkos::View< int *, CpMem > hubVertex
Kokkos::View< int *, CpMem > copyBase
Kokkos::View< int *, CpMem > slotA
Kokkos::View< int *, CpMem > groupK
Kokkos::View< int *, CpMem > groupStart
Kokkos::View< unsigned char *, CpMem > groupActive
Kokkos::View< int *, CpMem > groupSlot
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...
long long driftMigrations
long long unfiredSplitContacts