PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
|
Public Types | |
using | EInitializationStrategy |
Enum type for initialization strategy. | |
using | Data = pbat::sim::vbd::Data |
Data type for VBD. | |
Public Member Functions | |
Integrator (Data const &data) | |
Construct Integrator from data. | |
void | Step (GpuScalar dt, GpuIndex iterations, GpuIndex substeps=GpuIndex{1}) |
Execute one simulation step. | |
void | TracedStep (GpuScalar dt, GpuIndex iterations, GpuIndex substeps, GpuIndex t, std::string_view dir=".") |
Execute one simulation step with tracing to disk. | |
void | SetSceneBoundingBox (Eigen::Vector< GpuScalar, 3 > const &min, Eigen::Vector< GpuScalar, 3 > const &max) |
Set the bounding box over the scene used for spatial partitioning. | |
void | SetBlockSize (GpuIndex blockSize) |
Set the number of threads per GPU block for per-vertex elastic energy computation. | |
void | InitializeActiveSet (GpuScalar dt) |
Detect candidate contact pairs for the current time step. | |
void | ComputeInertialTargets (GpuScalar sdt, GpuScalar sdt2) |
Compute the inertial target positions of the BDF1 objective. | |
void | InitializeBcdSolution (GpuScalar sdt, GpuScalar sdt2) |
Compute starting point of BCD minimization. | |
void | UpdateActiveSet () |
Computes active contact pairs in the current configuration. | |
virtual void | Solve (kernels::BackwardEulerMinimization &bdf, GpuIndex iterations) |
VBD to iterate on the BDF minimization problem. | |
void | TracedSolve (kernels::BackwardEulerMinimization &bdf, GpuIndex iterations, GpuIndex t, GpuIndex s, std::string_view dir) |
VBD to iterate on the BDF minimization problem. | |
void | RunVbdIteration (kernels::BackwardEulerMinimization &bdf) |
Run a single iteration of the VBD's BDF minimization. | |
void | UpdateBdfState (GpuScalar sdt) |
Update the BDF state (i.e. positions and velocities) after solving the BDF minimization. | |
kernels::BackwardEulerMinimization | BdfDeviceParameters (GpuScalar dt, GpuScalar dt2) |
Obtain Backward Euler time stepping minimization problem for device code. | |
Public Attributes | |
common::Buffer< GpuScalar, 3 > | x |
Vertex positions. | |
common::Buffer< GpuIndex, 4 > | T |
Tetrahedral mesh elements. | |
Eigen::Vector< GpuScalar, 3 > | mWorldMin |
World AABB min. | |
Eigen::Vector< GpuScalar, 3 > | mWorldMax |
World AABB max. | |
GpuIndex | mActiveSetUpdateFrequency |
Active set update frequency. | |
contact::VertexTriangleMixedCcdDcd | cd |
Collision detector. | |
common::Buffer< GpuIndex > | fc |
common::Buffer< GpuScalar > | XVA |
|x.Size()| array of vertex areas for contact response | |
common::Buffer< GpuScalar > | FA |
|F.Size()| array of triangle areas for contact response | |
common::Buffer< GpuScalar, 3 > | mPositionsAtT |
Previous vertex positions. | |
common::Buffer< GpuScalar, 3 > | mInertialTargetPositions |
Inertial target for vertex positions. | |
common::Buffer< GpuScalar, 3 > | xb |
Write buffer for positions which handles data races. | |
common::Buffer< GpuScalar, 3 > | mVelocitiesAtT |
Previous vertex velocities. | |
common::Buffer< GpuScalar, 3 > | mVelocities |
Current vertex velocities. | |
common::Buffer< GpuScalar, 3 > | mExternalAcceleration |
External acceleration. | |
common::Buffer< GpuScalar > | mMass |
Lumped mass matrix diagonals. | |
common::Buffer< GpuScalar > | mQuadratureWeights |
common::Buffer< GpuScalar > | mShapeFunctionGradients |
4x3x|# elements| shape function gradients | |
common::Buffer< GpuScalar > | mLameCoefficients |
2x|# elements| 1st and 2nd Lame parameters | |
GpuScalar | mDetHZero |
Numerical zero for hessian determinant check. | |
common::Buffer< GpuIndex > | mVertexTetrahedronPrefix |
Vertex-tetrahedron adjacency list's prefix sum. | |
common::Buffer< GpuIndex > | mVertexTetrahedronNeighbours |
Vertex-tetrahedron adjacency list's neighbour list. | |
common::Buffer< GpuIndex > | mVertexTetrahedronLocalVertexIndices |
GpuScalar | mRayleighDamping |
Rayleigh damping coefficient. | |
GpuScalar | mCollisionPenalty |
Collision penalty coefficient. | |
GpuScalar | mFrictionCoefficient |
Coefficient of friction. | |
GpuScalar | mSmoothFrictionRelativeVelocityThreshold |
GpuIndexVectorX | mPptr |
common::Buffer< GpuIndex > | mPadj |
Partition vertices. | |
EInitializationStrategy | mInitializationStrategy |
Strategy to use to determine the initial BCD iterate. | |
GpuIndex | mGpuThreadBlockSize |
Number of threads per CUDA thread block. | |
cuda::stream_t | mStream |
Cuda stream on which this VBD instance will run. | |
VBD integrator [2].
Enum type for initialization strategy.
pbat::gpu::impl::vbd::Integrator::Integrator | ( | Data const & | data | ) |
Construct Integrator from data.
data | VBD simulation scenario |
kernels::BackwardEulerMinimization pbat::gpu::impl::vbd::Integrator::BdfDeviceParameters | ( | GpuScalar | dt, |
GpuScalar | dt2 ) |
Obtain Backward Euler time stepping minimization problem for device code.
dt | Time step |
dt2 | Time step squared |
Compute the inertial target positions of the BDF1 objective.
sdt | Time step |
sdt2 | Time step squared |
void pbat::gpu::impl::vbd::Integrator::InitializeActiveSet | ( | GpuScalar | dt | ) |
Detect candidate contact pairs for the current time step.
dt | Time step |
Compute starting point of BCD minimization.
sdt | Time step |
sdt2 | Time step squared |
void pbat::gpu::impl::vbd::Integrator::RunVbdIteration | ( | kernels::BackwardEulerMinimization & | bdf | ) |
Run a single iteration of the VBD's BDF minimization.
bdf | Device BDF minimization problem |
void pbat::gpu::impl::vbd::Integrator::SetBlockSize | ( | GpuIndex | blockSize | ) |
Set the number of threads per GPU block for per-vertex elastic energy computation.
blockSize | Number of threads per block |
void pbat::gpu::impl::vbd::Integrator::SetSceneBoundingBox | ( | Eigen::Vector< GpuScalar, 3 > const & | min, |
Eigen::Vector< GpuScalar, 3 > const & | max ) |
Set the bounding box over the scene used for spatial partitioning.
min | Minimum corner |
max | Maximum corner |
|
virtual |
VBD to iterate on the BDF minimization problem.
Override this method to implement different VBD optimization strategies
bdf | Device BDF minimization problem |
iterations | Number of iterations |
Reimplemented in pbat::gpu::impl::vbd::AndersonIntegrator, pbat::gpu::impl::vbd::ChebyshevIntegrator, and pbat::gpu::impl::vbd::TrustRegionIntegrator.
void pbat::gpu::impl::vbd::Integrator::Step | ( | GpuScalar | dt, |
GpuIndex | iterations, | ||
GpuIndex | substeps = GpuIndex{1} ) |
Execute one simulation step.
dt | Time step |
iterations | Number of optimization iterations per substep |
substeps | Number of substeps |
void pbat::gpu::impl::vbd::Integrator::TracedSolve | ( | kernels::BackwardEulerMinimization & | bdf, |
GpuIndex | iterations, | ||
GpuIndex | t, | ||
GpuIndex | s, | ||
std::string_view | dir ) |
VBD to iterate on the BDF minimization problem.
Saves all iterates to disk.
bdf | Device BDF minimization problem |
iterations | Number of iterations |
t | Current time step |
s | Current substep |
dir | Directory to save matrix market files |
void pbat::gpu::impl::vbd::Integrator::TracedStep | ( | GpuScalar | dt, |
GpuIndex | iterations, | ||
GpuIndex | substeps, | ||
GpuIndex | t, | ||
std::string_view | dir = "." ) |
Execute one simulation step with tracing to disk.
Saves matrix market files which follow the pattern {variable}.t.{timestep}.s.{substep}[.k.{iteration}].mtx
dt | Time step |
iterations | Number of optimization iterations per substep |
substeps | Number of substeps |
t | Current time step |
dir | Directory to save matrix market files |
void pbat::gpu::impl::vbd::Integrator::UpdateBdfState | ( | GpuScalar | sdt | ) |
Update the BDF state (i.e. positions and velocities) after solving the BDF minimization.
sdt | Time step |
common::Buffer<GpuIndex> pbat::gpu::impl::vbd::Integrator::fc |
|# verts * kMaxCollidingTrianglesPerVertex|
array of vertex-triangle contact pairs (i,f)
, s.t. f = fc[i*kMaxCollidingTrianglesPerVertex+c]
for 0 <= c < /< kMaxCollidingTrianglesPerVertex
. If f(c) < 0
, there is no contact, and f(c+j) < /< 0
is also true, for j > 0
.
GpuIndexVectorX pbat::gpu::impl::vbd::Integrator::mPptr |
|#partitions+1|
partition pointers, s.t. the range [Pptr[p], /< Pptr[p+1])
indexes into Padj
vertices from partition p
common::Buffer<GpuScalar> pbat::gpu::impl::vbd::Integrator::mQuadratureWeights |
|# elements|
array of quadrature weights (i.e. tetrahedron volumes for order 1)
GpuScalar pbat::gpu::impl::vbd::Integrator::mSmoothFrictionRelativeVelocityThreshold |
IPC smooth friction transition function's relative velocity threshold
common::Buffer<GpuIndex> pbat::gpu::impl::vbd::Integrator::mVertexTetrahedronLocalVertexIndices |
Vertex-tetrahedron adjacency list's ilocal property