|
peclet-dem 1.1.0
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
|
nanobind module dem — the Kokkos + ArborX XPBD granular-dynamics simulation. More...
#include <nanobind/nanobind.h>#include <nanobind/ndarray.h>#include <nanobind/stl/array.h>#include <nanobind/stl/optional.h>#include <nanobind/stl/pair.h>#include <nanobind/stl/string.h>#include <nanobind/stl/tuple.h>#include <nanobind/stl/vector.h>#include <array>#include <cmath>#include <cstdint>#include <cstdio>#include <Kokkos_Core.hpp>#include <optional>#include <stdexcept>#include <string>#include <tuple>#include <vector>#include "dem_bindings_checks.hpp"#include "peclet/core/python/kokkos_teardown.hpp"#include "peclet/core/python/ndarray_interop.hpp"#include "sim.hpp"Go to the source code of this file.
Classes | |
| class | Simulation |
| Host-facing facade with std::vector setters/getters (binding-agnostic). More... | |
Functions | |
| NB_MODULE (_dem, m) | |
nanobind module dem — the Kokkos + ArborX XPBD granular-dynamics simulation.
Exposes peclet::dem::Simulation (the portable Kokkos+ArborX pipeline) in two tiers (suite/docs/QUALITY_PLAN.md D2): the PUBLIC surface on Simulation is what a user needs to set up, run and read out a simulation; everything a developer uses to inspect, ablate or profile lives on Simulation.diagnostics (a Diagnostics view holding a reference to the simulation, no copies of state). Names follow suite/docs/NAMING.md: set_<thing> setters, stored scalars as properties, computed scalars as bare methods, array copies as get_*, set_dt + step(n), string modes, 3-tuples for every triple, one 3-D (nx, ny, nz) Fortran-order array for every grid.
Particle arrays cross the boundary through the shared peclet::core::python bridge (core): inputs read as flat C-order buffers, getters move the result into the NumPy array's backing store (no extra copy), and under a GPU backend the bridge's device path lets CuPy arrays flow in/out zero-copy.
Kokkos teardown follows the suite-wide pattern of peclet/core/python/kokkos_teardown.hpp: Kokkos is initialized at import; Simulation keeps its own live registry (sim.hpp, Simulation::releaseAll drops every live Simulation's Views) which is plugged in as a release hook, and every zero-copy array (get_*_view) is a Releasable capsule; the module's single atexit hook (also dem.finalize()) releases all of them and THEN calls Kokkos::finalize, so a Simulation or array still referenced at interpreter exit (script globals, a Jupyter/Quarto kernel) can no longer be destroyed after finalize – which is a Kokkos::abort (SIGABRT / exit 134, on OpenMP as on CUDA).
Definition in file dem_bindings.cpp.
| NB_MODULE | ( | _dem | , |
| m | ) |
Definition at line 138 of file dem_bindings.cpp.
References peclet::dem::Simulation::addAnalyticWall(), peclet::dem::Simulation::addPlane(), peclet::dem::ShapeRegistry::addSceneShape(), peclet::dem::ShapeRegistry::addSdfShape(), peclet::dem::Simulation::addSdfWall(), peclet::dem::ShapeRegistry::addShape(), peclet::dem::Simulation::capacity(), Simulation::capacity(), Simulation::clearExternalForces(), Simulation::clearExternalTorques(), Simulation::computeOverlaps(), peclet::dem::binding_checks::count(), peclet::dem::Simulation::cudaGraphs(), peclet::dem::Simulation::debugColoringConflicts(), peclet::dem::Simulation::debugColoringLeftovers(), peclet::dem::Simulation::debugMultilevelColoringConflicts(), peclet::dem::Simulation::debugSplitStats(), peclet::dem::binding_checks::domainCorners(), Simulation::domainExtent(), Simulation::domainOrigin(), Simulation::domainPeriodic(), Simulation::dt(), Simulation::enablePeriodicity(), Simulation::exportLammps(), peclet::dem::Simulation::exportSdf(), peclet::dem::Simulation::externalForcesView(), peclet::dem::binding_checks::finite(), peclet::dem::binding_checks::finiteEach(), peclet::dem::Simulation::fusedSweeps(), peclet::dem::Simulation::getAngularVelocities(), 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(), Simulation::globalScale(), Simulation::gravity(), Simulation::growthFactor(), Simulation::incrementalColoring(), peclet::dem::ShapeRegistry::initializeShape(), peclet::dem::Simulation::invMassView(), peclet::dem::binding_checks::kMaxMaterialId, peclet::dem::binding_checks::materialIds(), peclet::dem::Simulation::maxOverlap(), MPI_Init(), peclet::dem::binding_checks::mpiBox(), peclet::dem::binding_checks::nonneg(), peclet::dem::binding_checks::nonnegEach(), peclet::dem::Simulation::numAsleep(), peclet::dem::Simulation::numContacts(), peclet::dem::Simulation::numManifolds(), peclet::dem::Simulation::numParticles(), Simulation::numParticles(), peclet::dem::ShapeRegistry::numShapes(), peclet::dem::binding_checks::plane(), peclet::dem::binding_checks::poissonRatio(), peclet::dem::Simulation::positionsView(), peclet::dem::binding_checks::positive(), peclet::dem::binding_checks::positiveEach(), Simulation::relax(), Simulation::releaseAll(), peclet::dem::binding_checks::require(), peclet::dem::Simulation::restBankStats(), peclet::dem::binding_checks::restitutionCoef(), Simulation::restitutionModel(), peclet::dem::Simulation::restOrphanStats(), peclet::dem::binding_checks::sampleCounts(), peclet::dem::binding_checks::sdfShapeArgs(), peclet::dem::Simulation::setAngularVelocities(), peclet::dem::Simulation::setCudaGraphs(), 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(), 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(), Simulation::setRestitutionModel(), peclet::dem::Simulation::setScales(), peclet::dem::Simulation::setScalesUniform(), peclet::dem::ShapeRegistry::setSdfShape(), peclet::dem::ShapeRegistry::setShapeIds(), 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::setWallVelocity(), Simulation::shellDetection(), Simulation::sleeping(), Simulation::stabilizationMode(), Simulation::step(), Simulation::stepHertz(), peclet::dem::SplitStats::velHubCopies, peclet::dem::Simulation::velocitiesView(), peclet::dem::Simulation::velocityUseGS(), Simulation::verletSkin(), peclet::dem::Simulation::wallSdfAt(), peclet::dem::writeLammpsDump(), and Simulation::writeVtp().