peclet-dem
Performance-portable XPBD Discrete Element Method (Kokkos + ArborX)
Loading...
Searching...
No Matches
narrowphase.hpp File Reference

dem — portable (Kokkos) narrow-phase: SDF point-shell collision + boundary planes. More...

#include <Kokkos_Core.hpp>
#include "contact_preprocessing.hpp"
#include "dem_portable.hpp"

Go to the source code of this file.

Classes

struct  peclet::dem::ShapeDesc
 Portable mirror of ShapeDescriptor (analytic fields + a flat-array point shell). More...
 
struct  peclet::dem::PlaneP
 
struct  peclet::dem::WallSdf
 Static, world-space SDF container/geometry the particles collide against (a drum barrel, a hopper, a vibrating tray, ...). More...
 

Namespaces

namespace  peclet
 
namespace  peclet::dem
 

Typedefs

using peclet::dem::PosView = Kokkos::View< const float *[3], CpMem >
 
using peclet::dem::QuatView = Kokkos::View< const float *[4], CpMem >
 
using peclet::dem::ScalarF = Kokkos::View< const float *, CpMem >
 
using peclet::dem::ScalarI = Kokkos::View< const int *, CpMem >
 
using peclet::dem::ShellView = Kokkos::View< const float *[3], CpMem >
 
using peclet::dem::GridView = Kokkos::View< const float *, CpMem >
 

Functions

F3 peclet::dem::loadF3 (PosView v, int i)
 
F4 peclet::dem::loadF4 (QuatView v, int i)
 
float peclet::dem::sampleGridSdf (F3 p, const ShapeDesc &d, GridView grid)
 Trilinearly sample an imported grid SDF at canonical point p.
 
float peclet::dem::sampleWallSdf (F3 p, const WallSdf &w, GridView grid)
 Trilinearly sample a static world-space wall SDF at world point p (same "clamp + residual" extension as sampleGridSdf, so a probe outside the stored box gets a well-signed growing distance and a sane central-difference normal at the boundary).
 
float peclet::dem::sdfEvalShape (F3 p, const ShapeDesc &d, GridView grid)
 Canonical-space SDF of a shape: analytic dispatch, or a trilinear grid sample for an imported grid SDF.
 
void peclet::dem::detectContactsKokkos (Kokkos::View< const int *[2], CpMem > pairs, int numPairs, PosView pos, QuatView quat, ScalarF scale, ScalarI shapeId, Kokkos::View< const ShapeDesc *, CpMem > shapes, ShellView shell, float globalScale, float margin, Kokkos::View< ContactC *, CpMem > outContacts, Kokkos::View< int, CpMem > outCount, Kokkos::View< float, CpMem > maxOverlap, GridView sdfGrid=GridView{})
 Pair point-shell vs SDF contacts.
 
void peclet::dem::detectWallSdfKokkos (int numReal, int numWalls, PosView pos, QuatView quat, ScalarF scale, ScalarI shapeId, Kokkos::View< const ShapeDesc *, CpMem > shapes, ShellView shell, Kokkos::View< const WallSdf *, CpMem > walls, GridView wallGrid, float globalScale, float margin, Kokkos::View< ContactC *, CpMem > outContacts, Kokkos::View< int, CpMem > outCount, Kokkos::View< float, CpMem > maxOverlap)
 Per-real-particle contacts against a static world-space wall SDF set (a drum barrel, hopper, vibrating tray, ...).
 
void peclet::dem::detectBoundaryKokkos (int numReal, int numPlanes, PosView pos, QuatView quat, ScalarF scale, ScalarI shapeId, Kokkos::View< const ShapeDesc *, CpMem > shapes, ShellView shell, Kokkos::View< const PlaneP *, CpMem > planes, float globalScale, float margin, Kokkos::View< ContactC *, CpMem > outContacts, Kokkos::View< int, CpMem > outCount, Kokkos::View< float, CpMem > maxOverlap)
 Per-real-particle contacts against explicit planes (point-shell shapes test each surface point; analytic spheres use centre-minus-radius).
 

Detailed Description

dem — portable (Kokkos) narrow-phase: SDF point-shell collision + boundary planes.

Kokkos port of detect_contacts_kernel / detect_boundary_kernel (narrowphase.cu) over the particle SoA expressed as Kokkos Views (positions/quaternions as View<float*[3]>/[4], scales/shape-ids as View<float*>/<int*> — backend-default layout, so coalesced on GPU and cache-friendly on CPU). The per-point math is a faithful copy of the CUDA kernels (same scale/global_scale handling, same central-difference normal, same contact geometry) so results match. Analytic shapes only for now; grid-SDF (texture) returns +inf (peclet::dem::sdfEval), as in the CUDA placeholder.

Definition in file narrowphase.hpp.