9 #include "imstkPbdCollisionConstraint.h" 10 #include "imstkPbdFemConstraint.h" 11 #include "imstkPbdConstraintFunctor.h" 12 #include "imstkDataTracker.h" 14 #include <unordered_map> 15 #include <unordered_set> 73 void enableBendConstraint(
const double stiffness,
const int stride,
const bool restLength0 =
true,
const int bodyId = 2);
82 const double particleRadius,
const double restDensity = 6378.0,
const int bodyId = 2);
98 void enableFemConstraint(PbdFemConstraint::MaterialType material,
double youngsModulus,
double poissonRatio,
const int bodyId);
112 m_functors[ConstraintGenType::Custom].push_back(functor);
117 m_functors[ConstraintGenType::Custom].push_back(
118 std::make_shared<PbdConstraintFunctorLambda>(functor));
121 std::unordered_map<ConstraintGenType, std::vector<std::shared_ptr<PbdConstraintFunctor>>>& getFunctors() {
return m_functors; }
131 const double linearDampCoeff,
const double angularDampCoeff = 0.01);
140 double getAngularDamping(
const int bodyId);
153 std::shared_ptr<PbdFemConstraintConfig> m_femParams =
167 std::shared_ptr<DataTracker> m_dataTracker;
172 std::unordered_map<ConstraintGenType, std::vector<std::shared_ptr<PbdConstraintFunctor>>> m_functors;
This class implements the position based dynamics model. The PbdModel is a constraint based model tha...
double m_linearDampingCoeff
Damping coefficient applied to linear velocity [0, 1].
void enableFemConstraint(PbdFemConstraint::MaterialType material, const int bodyId=2)
Enable a Fem constraint with the material provided.
Container for pbd constraints.
void computeElasticConstants()
If lame parameters (mu+lambda) are given in femParams, then youngs modulus and poissons ratio are com...
double m_angularDampingCoeff
Damping coefficient applied to angular velcoity [0, 1].
void enableBendConstraint(const double stiffness, const int stride, const bool restLength0=true, const int bodyId=2)
Enables a bend constraint with given stiffness, stride, and flag for 0 rest length You may enable mul...
double getLinearDamping(const int bodyId)
Returns global and per body damping multiplied together for a body 1.0 is fully damped/all velocity r...
void addPbdConstraintFunctor(std::shared_ptr< PbdConstraintFunctor > functor)
Adds a functor to generate constraints.
void enableConstraint(ConstraintGenType type, const double stiffness, const int bodyId=2)
Enables a constraint of type defined by ConstraintGenType with given stiffness. If constraint of that...
unsigned int m_iterations
Internal constraints pbd solver iterations.
void setBodyDamping(const int bodyId, const double linearDampCoeff, const double angularDampCoeff=0.01)
Set damping for a specific body 1.0 is fully damped/all velocity removed, 0.0 is no damping...
void enableConstantDensityConstraint(const double stiffness, const double particleRadius, const double restDensity=6378.0, const int bodyId=2)
Enables constant density constraint given the stiffness and particleSize.
ConstraintGenType
Gives the set of standard pbd constraint generation schemes/functors provided by iMSTK. Note, these do not correspond to constraint types as there may be multiple schemes for one constraint or even multiple constraints per scheme.
std::unordered_map< int, double > m_bodyAngularDampingCoeff
Per body angular damping, Body id -> angular damping for given body [0, 1].
bool m_doPartitioning
Does graph coloring to solve in parallel.
std::unordered_map< int, double > m_bodyLinearDampingCoeff
Per body linear damping, Body id -> linear damping for given body [0, 1].
double m_dt
Time step size.
SolverType
Type of solvers.
void enableDistanceConstraint(const double stiffness, const double stretch, const int bodyId)
Enables a Distance constraint on the body Will remove an existing distance constraint on the same bod...
Gives parameters for PBD simulation.
Either mu/lambda used, may be computed from youngs modulus and poissons ratio.
Vec3d m_gravity
Gravity acceleration.