iMSTK
Interactive Medical Simulation Toolkit
|
Gives parameters for PBD simulation. More...
#include <imstkPbdModelConfig.h>
Public Types | |
enum | ConstraintGenType { Custom, Distance, FemTet, Volume, Area, Bend, Dihedral, ConstantDensity } |
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. | |
Public Member Functions | |
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 type already exists, sets the stiffness on it. More... | |
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 body. More... | |
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 multiple with differing strides If constraint with same stride already exists, updates the stiffness and restLength0 on it. More... | |
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. More... | |
void | enableFemConstraint (PbdFemConstraint::MaterialType material, const int bodyId=2) |
Enable a Fem constraint with the material provided. More... | |
void | enableFemConstraint (PbdFemConstraint::MaterialType material, double youngsModulus, double poissonRatio, const int bodyId) |
Enable a Fem constraint with the material provided and parameters. More... | |
void | computeElasticConstants () |
If lame parameters (mu+lambda) are given in femParams, then youngs modulus and poissons ratio are computed Conversely if youngs and poissons are given, lame parameters are computed. | |
void | addPbdConstraintFunctor (std::shared_ptr< PbdConstraintFunctor > functor) |
Adds a functor to generate constraints. More... | |
void | addPbdConstraintFunctor (std::function< void(PbdConstraintContainer &)> functor) |
std::unordered_map< ConstraintGenType, std::vector< std::shared_ptr< PbdConstraintFunctor > > > & | getFunctors () |
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. More... | |
double | getLinearDamping (const int bodyId) |
Returns global and per body damping multiplied together for a body 1.0 is fully damped/all velocity removed, 0.0 is no damping. More... | |
double | getAngularDamping (const int bodyId) |
Public Attributes | |
double | m_linearDampingCoeff = 0.01 |
Damping coefficient applied to linear velocity [0, 1]. | |
double | m_angularDampingCoeff = 0.01 |
Damping coefficient applied to angular velcoity [0, 1]. | |
unsigned int | m_iterations = 10 |
Internal constraints pbd solver iterations. | |
double | m_dt = 0.01 |
Time step size. | |
bool | m_doPartitioning = true |
Does graph coloring to solve in parallel. | |
Vec3d | m_gravity = Vec3d(0.0, -9.81, 0.0) |
Gravity acceleration. | |
std::shared_ptr< PbdFemConstraintConfig > | m_femParams |
PbdConstraint::SolverType | m_solverType = PbdConstraint::SolverType::xPBD |
std::unordered_map< int, double > | m_bodyLinearDampingCoeff |
Per body linear damping, Body id -> linear damping for given body [0, 1]. | |
std::unordered_map< int, double > | m_bodyAngularDampingCoeff |
Per body angular damping, Body id -> angular damping for given body [0, 1]. | |
std::shared_ptr< DataTracker > | m_dataTracker |
Protected Attributes | |
std::unordered_map< ConstraintGenType, std::vector< std::shared_ptr< PbdConstraintFunctor > > > | m_functors |
Friends | |
class | PbdModel |
Gives parameters for PBD simulation.
Definition at line 24 of file imstkPbdModelConfig.h.
|
inline |
Adds a functor to generate constraints.
Must | contain operator(PbdConstraintContainer&), could be a PbdConstraintFunctor or std::function<void(PbdConstraintContainer&)> |
Definition at line 110 of file imstkPbdModelConfig.h.
void imstk::PbdModelConfig::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 multiple with differing strides If constraint with same stride already exists, updates the stiffness and restLength0 on it.
stiffness | How much constraint is enforced |
stride | Distance between vertex connections |
restLength0 | When true rest length (and angle) are constrained to 0, useful when mesh initial/resting state is not 0 angled |
bodyId | Body to add the constraint throughout, -1 applies to all bodies |
Definition at line 129 of file imstkPbdModelConfig.cpp.
void imstk::PbdModelConfig::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.
stiffness | how much constraint is enforced |
particleRadius,radius | of particle |
bodyId | Body to add the constraint throughout, -1 applies to all bodies |
Definition at line 153 of file imstkPbdModelConfig.cpp.
void imstk::PbdModelConfig::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 type already exists, sets the stiffness on it.
type | Generation scheme type |
stiffness | How much constraint is enforced |
bodyId | Body to add the constraint throughout, -1 applies to all bodies |
Definition at line 59 of file imstkPbdModelConfig.cpp.
void imstk::PbdModelConfig::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 body.
stiffness | How much constraint is enforced |
stretch | Allows to stretch or relax the material, the constraint restlength is multiplied by the strech factor |
bodyId | Body to add the constraint |
Definition at line 115 of file imstkPbdModelConfig.cpp.
void imstk::PbdModelConfig::enableFemConstraint | ( | PbdFemConstraint::MaterialType | material, |
const int | bodyId = 2 |
||
) |
Enable a Fem constraint with the material provided.
material | FEM model type |
bodyId | Body to add the constraint throughout, -1 applies to all bodies This function uses the global deformable parameter object, its only provided for backwards compatibility, don't use it |
Definition at line 172 of file imstkPbdModelConfig.cpp.
void imstk::PbdModelConfig::enableFemConstraint | ( | PbdFemConstraint::MaterialType | material, |
double | youngsModulus, | ||
double | poissonRatio, | ||
const int | bodyId | ||
) |
Enable a Fem constraint with the material provided and parameters.
material | FEM model type |
youngsModulus | the youngs modulus of the material |
poissonRatio | the Poisson ration of the material |
bodyId | Body to add the constraint throughout |
Definition at line 189 of file imstkPbdModelConfig.cpp.
double imstk::PbdModelConfig::getLinearDamping | ( | const int | bodyId | ) |
Returns global and per body damping multiplied together for a body 1.0 is fully damped/all velocity removed, 0.0 is no damping.
bodyId | Body that is damped |
Definition at line 217 of file imstkPbdModelConfig.cpp.
void imstk::PbdModelConfig::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.
bodyId | Body to damp |
How | much to damp linear velocity |
How | much to damp angular velocity |
Definition at line 209 of file imstkPbdModelConfig.cpp.
std::shared_ptr<PbdFemConstraintConfig> imstk::PbdModelConfig::m_femParams |
Definition at line 153 of file imstkPbdModelConfig.h.