|
peclet-dem 1.1.0
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
|
Host-side shape registry (Layer 1). More...
#include <shape_registry.hpp>
Public Member Functions | |
| void | setSphereShape (float radius) |
| void | initializeShape (int shape_type, float radius, float height, float thickness) |
| int | addShape (int shape_type, float radius, float height, float thickness) |
| Append an analytic shape and return its index, for simulations with a MIXTURE of shapes. | |
| void | setShapeIds (const std::vector< int > &ids) |
| Per-particle shape assignment. | |
| int | addSdfShape (const std::vector< float > &grid, int nx, int ny, int nz, F3 origin, F3 spacing, const std::vector< float > &shellFlat, F3 invInertia, float boundingRadius) |
| Append a grid-SDF shape (the general non-spherical particle) to the mixture and return its index. | |
| int | numShapes () const |
| void | setSdfShape (const std::vector< float > &grid, int nx, int ny, int nz, F3 origin, F3 spacing, const std::vector< float > &shellFlat, F3 invInertia, float boundingRadius) |
| int | addSceneShape (const std::vector< int > &nodeInts, const std::vector< float > &nodeReals, int root, const std::vector< float > &shellFlat, F3 invInertia, float boundingRadius) |
| std::vector< float > | autoShell (const std::vector< float > &grid, int nx, int ny, int nz, F3 origin, F3 spacing, float boundingRadius) const |
| Generate a collision shell for a grid SDF by sampling its own zero level set, so a caller does not have to supply one. | |
Protected Member Functions | |
| void | ensureContactCapacity () |
| void | clearShapes () |
| void | appendShape (ShapeDesc sd, const std::vector< F3 > &shell, F3 invI, float baseRadius) |
| Append one shape, taking ownership of its shell. | |
| void | uploadShapes () |
| Rebuild the device Views from the host registry. | |
Protected Attributes | |
| Particles | P_ |
| float | baseRadius_ = 1.0f |
| std::vector< ShapeDesc > | shapesHost_ |
| std::vector< F3 > | shellHost_ |
| std::vector< F3 > | invIHost_ |
| std::vector< float > | baseRadiusHost_ |
| std::vector< float > | sdfSamplesHost_ |
| int | shellPoints_ = 0 |
| std::vector< peclet::core::geom::ShapeNode< float > > | shapeNodesHost_ |
| F3 | defaultInvI_ {2.5f, 2.5f, 2.5f} |
Host-side shape registry (Layer 1).
The device Views (P_.shapes / P_.shell / P_.sdfGrid) are rebuilt from the host vectors by uploadShapes(), which is what assigns each shape its shellOffset and grid offset into the shared pools. Keeping the authoritative copy on the host is what makes a MIXTURE of shapes possible at all: the old code wrote descriptor slot 0 directly and had nowhere to put a second shell.
Definition at line 32 of file shape_registry.hpp.
|
inline |
Definition at line 34 of file shape_registry.hpp.
References initializeShape(), and peclet::dem::SPHERE.
Referenced by peclet::dem::Simulation::Simulation().
|
inline |
Definition at line 47 of file shape_registry.hpp.
References appendShape(), peclet::dem::BOX, clearShapes(), ensureContactCapacity(), peclet::dem::genBoxShell(), peclet::dem::genCylinderShell(), peclet::dem::HOLLOW_CYLINDER, peclet::dem::SPHERE, and uploadShapes().
Referenced by addShape(), NB_MODULE(), and setSphereShape().
|
inline |
Append an analytic shape and return its index, for simulations with a MIXTURE of shapes.
Same arguments as initializeShape, which stays the "single shape" entry point (it resets the registry). Assign the returned index to particles with setShapeIds().
Definition at line 115 of file shape_registry.hpp.
References appendShape(), baseRadiusHost_, ensureContactCapacity(), initializeShape(), invIHost_, sdfSamplesHost_, shapesHost_, shellHost_, and uploadShapes().
Referenced by NB_MODULE().
|
inline |
Per-particle shape assignment.
Also refreshes each particle's inverse inertia from its new shape, so the order of setPositions/setShapeIds does not matter.
Definition at line 144 of file shape_registry.hpp.
References invIHost_, peclet::dem::Particles::invInertia, peclet::dem::Particles::numReal, P_, peclet::dem::Particles::shapeId, and shapesHost_.
Referenced by NB_MODULE().
|
inline |
Append a grid-SDF shape (the general non-spherical particle) to the mixture and return its index.
Same arguments as set_sdf_shape, which stays the single-shape entry point. The samples are appended to the shared pool and the descriptor's offset set accordingly.
Definition at line 168 of file shape_registry.hpp.
References appendShape(), autoShell(), ensureContactCapacity(), sdfSamplesHost_, peclet::dem::SHAPE_GRID_SDF, shapesHost_, peclet::dem::toCoreVec(), peclet::dem::ShapeDesc::type, uploadShapes(), peclet::dem::F3::x, peclet::dem::F3::y, and peclet::dem::F3::z.
Referenced by NB_MODULE().
|
inline |
Definition at line 206 of file shape_registry.hpp.
References shapesHost_.
Referenced by NB_MODULE().
|
inline |
Definition at line 219 of file shape_registry.hpp.
References appendShape(), autoShell(), clearShapes(), ensureContactCapacity(), P_, peclet::dem::Particles::sdfGrid, sdfSamplesHost_, peclet::dem::SHAPE_GRID_SDF, peclet::dem::Particles::shell, peclet::dem::toCoreVec(), peclet::dem::ShapeDesc::type, uploadShapes(), peclet::dem::F3::x, peclet::dem::F3::y, and peclet::dem::F3::z.
Referenced by NB_MODULE().
|
inline |
Definition at line 285 of file shape_registry.hpp.
References appendShape(), ensureContactCapacity(), peclet::dem::SHAPE_SCENE, shapeNodesHost_, shapesHost_, peclet::dem::ShapeDesc::type, and uploadShapes().
Referenced by NB_MODULE().
|
inline |
Generate a collision shell for a grid SDF by sampling its own zero level set, so a caller does not have to supply one.
Layer 1: previously every shape needed a hand-written generator (there were only two, for the cylinder and the box) or a marching-cubes shell computed in Python; core's surfacePoints() is driven by the SDF itself and works for any geometry.
Definition at line 334 of file shape_registry.hpp.
References peclet::dem::F3::x, peclet::dem::F3::y, and peclet::dem::F3::z.
Referenced by addSdfShape(), and setSdfShape().
|
inlineprotected |
Definition at line 365 of file shape_registry.hpp.
References peclet::dem::Particles::capacity, peclet::dem::growContactBuffers(), P_, peclet::dem::Particles::shellPoints, and shellPoints_.
Referenced by peclet::dem::Simulation::addAnalyticWall(), addSceneShape(), addSdfShape(), peclet::dem::Simulation::addSdfWall(), addShape(), initializeShape(), setSdfShape(), and peclet::dem::Simulation::setShellDetection().
|
inlineprotected |
Definition at line 383 of file shape_registry.hpp.
References baseRadiusHost_, invIHost_, sdfSamplesHost_, shapesHost_, and shellHost_.
Referenced by initializeShape(), and setSdfShape().
|
inlineprotected |
Append one shape, taking ownership of its shell.
Fills in shellOffset from the running concatenation; the caller has already set the grid fields (if any).
Definition at line 393 of file shape_registry.hpp.
References baseRadiusHost_, invIHost_, peclet::dem::ShapeDesc::numPoints, shapesHost_, shellHost_, and peclet::dem::ShapeDesc::shellOffset.
Referenced by addSceneShape(), addSdfShape(), addShape(), initializeShape(), and setSdfShape().
|
inlineprotected |
Rebuild the device Views from the host registry.
Definition at line 403 of file shape_registry.hpp.
References peclet::dem::Particles::baseRadius, baseRadius_, baseRadiusHost_, defaultInvI_, invIHost_, P_, peclet::dem::Particles::sdfGrid, sdfSamplesHost_, peclet::dem::SHAPE_SCENE, peclet::dem::Particles::shapeNodes, shapeNodesHost_, peclet::dem::Particles::shapes, shapesHost_, peclet::dem::Particles::shell, shellHost_, and shellPoints_.
Referenced by addSceneShape(), addSdfShape(), addShape(), initializeShape(), and setSdfShape().
|
protected |
Definition at line 370 of file shape_registry.hpp.
Referenced by peclet::dem::Simulation::addAnalyticWall(), peclet::dem::Simulation::addPlane(), peclet::dem::Simulation::addSdfWall(), peclet::dem::Simulation::capacity(), peclet::dem::Simulation::clearExternalForces(), peclet::dem::Simulation::clearExternalTorques(), peclet::dem::Simulation::computeOverlaps(), peclet::dem::Simulation::cudaGraphs(), peclet::dem::Simulation::debugColoringConflicts(), peclet::dem::Simulation::debugColoringLeftovers(), peclet::dem::Simulation::debugMultilevelColoringConflicts(), peclet::dem::Simulation::debugSplitStats(), peclet::dem::Simulation::domainExtent(), peclet::dem::Simulation::domainOrigin(), peclet::dem::Simulation::domainPeriodic(), peclet::dem::Simulation::dt(), peclet::dem::Simulation::enablePeriodicity(), ensureContactCapacity(), peclet::dem::Simulation::exportLammps(), peclet::dem::Simulation::exportSdf(), peclet::dem::Simulation::externalForcesView(), peclet::dem::Simulation::externalTorquesView(), peclet::dem::Simulation::fusedSweeps(), peclet::dem::Simulation::getAngularVelocities(), peclet::dem::Simulation::getGrowthRate(), peclet::dem::Simulation::getInvInertia(), peclet::dem::Simulation::getMasses(), peclet::dem::Simulation::getPositions(), peclet::dem::Simulation::getQuaternions(), peclet::dem::Simulation::getScales(), peclet::dem::Simulation::getSdfGrid(), peclet::dem::Simulation::getVelocities(), peclet::dem::Simulation::globalScale(), peclet::dem::Simulation::gravity(), peclet::dem::Simulation::growthFactor(), peclet::dem::Simulation::incrementalColoring(), peclet::dem::Simulation::invMassView(), peclet::dem::Simulation::maxOverlap(), peclet::dem::Simulation::numAsleep(), peclet::dem::Simulation::numContacts(), peclet::dem::Simulation::numManifolds(), peclet::dem::Simulation::numParticles(), peclet::dem::Simulation::positionsView(), peclet::dem::Simulation::relax(), peclet::dem::Simulation::releaseViews(), peclet::dem::Simulation::restBankStats(), peclet::dem::Simulation::restitutionModel(), peclet::dem::Simulation::restOrphanStats(), peclet::dem::Simulation::setAngularVelocities(), peclet::dem::Simulation::setCudaGraphs(), peclet::dem::Simulation::setDomain(), peclet::dem::Simulation::setDomainCanonical(), peclet::dem::Simulation::setDomainMinMax(), peclet::dem::Simulation::setDt(), peclet::dem::Simulation::setExternalForces(), peclet::dem::Simulation::setExternalTorques(), peclet::dem::Simulation::setFusedSweeps(), peclet::dem::Simulation::setGlobalScale(), peclet::dem::Simulation::setGravity(), peclet::dem::Simulation::setGrowthParams(), peclet::dem::Simulation::setHertzMaterial(), peclet::dem::Simulation::setIncrementalColoring(), peclet::dem::Simulation::setInvInertia(), peclet::dem::Simulation::setInvMass(), peclet::dem::Simulation::setMaterialIds(), peclet::dem::Simulation::setMaterialParams(), peclet::dem::Simulation::setPairMaterial(), peclet::dem::Simulation::setPositions(), peclet::dem::Simulation::setQuaternions(), peclet::dem::Simulation::setRestitutionModel(), peclet::dem::Simulation::setScales(), peclet::dem::Simulation::setScalesUniform(), setSdfShape(), setShapeIds(), peclet::dem::Simulation::setShellDetection(), peclet::dem::Simulation::setSleeping(), peclet::dem::Simulation::setSolverIterations(), peclet::dem::Simulation::setStabilizationMode(), peclet::dem::Simulation::setThermostat(), peclet::dem::Simulation::setVelocities(), peclet::dem::Simulation::setVelocityUseGS(), peclet::dem::Simulation::setVerletSkin(), peclet::dem::Simulation::setWallMaterialId(), peclet::dem::Simulation::setWallTransform(), peclet::dem::Simulation::shellDetection(), peclet::dem::Simulation::Simulation(), peclet::dem::Simulation::sleeping(), peclet::dem::Simulation::stabilizationMode(), peclet::dem::Simulation::step(), peclet::dem::Simulation::stepHertz(), uploadShapes(), peclet::dem::Simulation::velocitiesView(), peclet::dem::Simulation::velocityUseGS(), peclet::dem::Simulation::verletSkin(), peclet::dem::Simulation::wallSdfAt(), and peclet::dem::Simulation::writeVtp().
|
protected |
Definition at line 371 of file shape_registry.hpp.
Referenced by peclet::dem::Simulation::exportLammps(), uploadShapes(), and peclet::dem::Simulation::writeVtp().
|
protected |
Definition at line 377 of file shape_registry.hpp.
Referenced by addSceneShape(), addSdfShape(), addShape(), appendShape(), clearShapes(), numShapes(), setShapeIds(), and uploadShapes().
|
protected |
Definition at line 378 of file shape_registry.hpp.
Referenced by addShape(), appendShape(), clearShapes(), and uploadShapes().
|
protected |
Definition at line 379 of file shape_registry.hpp.
Referenced by addShape(), appendShape(), clearShapes(), setShapeIds(), and uploadShapes().
|
protected |
Definition at line 380 of file shape_registry.hpp.
Referenced by addShape(), appendShape(), clearShapes(), and uploadShapes().
|
protected |
Definition at line 381 of file shape_registry.hpp.
Referenced by addSdfShape(), addShape(), clearShapes(), setSdfShape(), and uploadShapes().
|
protected |
Definition at line 464 of file shape_registry.hpp.
Referenced by ensureContactCapacity(), and uploadShapes().
|
protected |
Definition at line 465 of file shape_registry.hpp.
Referenced by addSceneShape(), and uploadShapes().
|
protected |
Definition at line 466 of file shape_registry.hpp.
Referenced by peclet::dem::Simulation::setPositions(), and uploadShapes().