PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
Integrator.h
Go to the documentation of this file.
1
10
11#ifndef PBAT_GPU_XPBD_INTEGRATOR_H
12#define PBAT_GPU_XPBD_INTEGRATOR_H
13
14#include "PhysicsBasedAnimationToolkitExport.h"
15#include "pbat/gpu/Aliases.h"
16#include "pbat/sim/xpbd/Data.h"
17#include "pbat/sim/xpbd/Enums.h"
18
19#include <array>
20#include <vector>
21
22namespace pbat::gpu::impl::xpbd {
23class Integrator;
24} // namespace pbat::gpu::impl::xpbd
25
26namespace pbat {
27namespace gpu {
28namespace xpbd {
29
34{
35 public:
37 using EConstraint = pbat::sim::xpbd::EConstraint;
38
39 // Constructors
44 PBAT_API Integrator(Data const& data);
45 Integrator(Integrator const&) = delete;
46 Integrator& operator=(Integrator const&) = delete;
51 PBAT_API Integrator(Integrator&&) noexcept;
57 PBAT_API Integrator& operator=(Integrator&&) noexcept;
64 PBAT_API void Step(GpuScalar dt, GpuIndex iterations, GpuIndex substeps);
69 PBAT_API GpuMatrixX Positions() const;
74 PBAT_API void SetPositions(Eigen::Ref<GpuMatrixX const> const& X);
79 PBAT_API void SetVelocities(Eigen::Ref<GpuMatrixX const> const& v);
84 PBAT_API void SetExternalAcceleration(Eigen::Ref<GpuMatrixX const> const& aext);
89 PBAT_API void SetMassInverse(Eigen::Ref<GpuMatrixX const> const& minv);
94 PBAT_API void SetLameCoefficients(Eigen::Ref<GpuMatrixX const> const& l);
100 PBAT_API void SetCompliance(Eigen::Ref<GpuMatrixX const> const& alpha, EConstraint eConstraint);
106 PBAT_API void SetFrictionCoefficients(GpuScalar muS, GpuScalar muK);
112 PBAT_API void SetSceneBoundingBox(
113 Eigen::Vector<GpuScalar, 3> const& min,
114 Eigen::Vector<GpuScalar, 3> const& max);
119 PBAT_API GpuMatrixX GetVelocity() const;
124 PBAT_API GpuMatrixX GetExternalAcceleration() const;
129 PBAT_API GpuVectorX GetMassInverse() const;
134 PBAT_API GpuMatrixX GetLameCoefficients() const;
139 PBAT_API GpuMatrixX GetShapeMatrixInverse() const;
144 PBAT_API GpuMatrixX GetRestStableGamma() const;
150 PBAT_API GpuMatrixX GetLagrangeMultiplier(EConstraint eConstraint) const;
156 PBAT_API GpuMatrixX GetCompliance(EConstraint eConstraint) const;
160 PBAT_API ~Integrator();
161
162 private:
163 impl::xpbd::Integrator* mImpl;
164};
165
166} // namespace xpbd
167} // namespace gpu
168} // namespace pbat
169
170#endif // PBAT_GPU_XPBD_INTEGRATOR_H
Definition Integrator.cuh:21
PBAT_API Integrator(Data const &data)
Construct a new Integrator object from the input XPBD data.
Definition Integrator.cu:14
PBAT_API GpuMatrixX GetLameCoefficients() const
Fetch the Lame coefficients from the GPU.
Definition Integrator.cu:100
PBAT_API GpuMatrixX GetExternalAcceleration() const
Fetch the external acceleration from the GPU.
Definition Integrator.cu:90
PBAT_API void SetLameCoefficients(Eigen::Ref< GpuMatrixX const > const &l)
Set the GPU Lame coefficients from the input CPU Lame coefficients.
Definition Integrator.cu:63
PBAT_API void SetMassInverse(Eigen::Ref< GpuMatrixX const > const &minv)
Set the GPU mass inverse from the input CPU mass inverse.
Definition Integrator.cu:58
PBAT_API GpuMatrixX GetShapeMatrixInverse() const
Fetch the shape matrix inverses from the GPU.
Definition Integrator.cu:106
PBAT_API void SetSceneBoundingBox(Eigen::Vector< GpuScalar, 3 > const &min, Eigen::Vector< GpuScalar, 3 > const &max)
Set the world bounding box for the current time step.
Definition Integrator.cu:78
PBAT_API GpuVectorX GetMassInverse() const
Fetch the mass inverse from the GPU.
Definition Integrator.cu:95
PBAT_API void SetFrictionCoefficients(GpuScalar muS, GpuScalar muK)
Set the friction coefficients to use for contact handling.
Definition Integrator.cu:73
PBAT_API GpuMatrixX GetVelocity() const
Fetch the vertex velocities from the GPU.
Definition Integrator.cu:85
PBAT_API void SetPositions(Eigen::Ref< GpuMatrixX const > const &X)
Set the GPU vertex positions from the input CPU vertex positions.
Definition Integrator.cu:43
PBAT_API GpuMatrixX Positions() const
Fetch the current positions from the GPU.
Definition Integrator.cu:38
PBAT_API GpuMatrixX GetLagrangeMultiplier(EConstraint eConstraint) const
Fetch the Lagrange multipliers from the GPU.
Definition Integrator.cu:118
PBAT_API void SetCompliance(Eigen::Ref< GpuMatrixX const > const &alpha, EConstraint eConstraint)
Set the GPU constraint compliances from the input CPU constraint compliances.
Definition Integrator.cu:68
pbat::sim::xpbd::EConstraint EConstraint
Constraint type enumeration short name.
Definition Integrator.h:37
PBAT_API GpuMatrixX GetRestStableGamma() const
Fetch the Stable Neo-Hookean rest-stable gamma from the GPU smith2018snh.
Definition Integrator.cu:112
PBAT_API void SetVelocities(Eigen::Ref< GpuMatrixX const > const &v)
Set the GPU vertex velocities from the input CPU vertex velocities.
Definition Integrator.cu:48
pbat::sim::xpbd::Data Data
Input XPBD data constructor parameter object short name.
Definition Integrator.h:36
PBAT_API void SetExternalAcceleration(Eigen::Ref< GpuMatrixX const > const &aext)
Set the GPU external acceleration from the input CPU external acceleration.
Definition Integrator.cu:53
PBAT_API void Step(GpuScalar dt, GpuIndex iterations, GpuIndex substeps)
Step once in time.
Definition Integrator.cu:33
PBAT_API GpuMatrixX GetCompliance(EConstraint eConstraint) const
Fetch the compliance from the GPU.
Definition Integrator.cu:129
Type aliases for GPU code.
GPU algorithm implementations.
Definition VertexTriangleMixedCcdDcd.h:21
(eXtended) Position-Based Dynamics (XPBD) bender2015position public GPU API
Definition Integrator.cu:12
GPU related public functionality.
Definition Buffer.cu:16
The main namespace of the library.
Definition Aliases.h:15
float GpuScalar
Scalar type for GPU code.
Definition Aliases.h:19
Eigen::Vector< Scalar, N > Vector
Fixed-size vector type.
Definition Aliases.h:24
Eigen::Vector< GpuScalar, Eigen::Dynamic > GpuVectorX
Vector type for GPU code.
Definition Aliases.h:27
Eigen::Matrix< GpuScalar, Eigen::Dynamic, Eigen::Dynamic > GpuMatrixX
Matrix type for GPU code.
Definition Aliases.h:22
std::int32_t GpuIndex
Index type for GPU code.
Definition Aliases.h:20
Definition Data.h:15