iMSTK
Interactive Medical Simulation Toolkit
Public Member Functions | List of all members
imstk::PbdFemTetConstraint Class Reference

The FEMTetConstraint class class for constraint as the elastic energy computed by linear shape functions with tetrahedral mesh. More...

#include <imstkPbdFemTetConstraint.h>

Inheritance diagram for imstk::PbdFemTetConstraint:
Inheritance graph
[legend]
Collaboration diagram for imstk::PbdFemTetConstraint:
Collaboration graph
[legend]

Public Member Functions

 PbdFemTetConstraint (MaterialType mType=MaterialType::StVK)
 
bool initConstraint (const Vec3d &p0, const Vec3d &p1, const Vec3d &p2, const Vec3d &p3, const PbdParticleId &pIdx0, const PbdParticleId &pIdx1, const PbdParticleId &pIdx2, const PbdParticleId &pIdx3, PbdFemConstraintConfig config)
 Initialize the constraint.
 
bool computeValueAndGradient (PbdState &bodies, double &c, std::vector< Vec3d > &dcdx) override
 Compute value and gradient of constraint function. More...
 
void handleInversions (Mat3d &F, Mat3d &U, Mat3d &Fhat, Mat3d &VT) const
 Handle inverted tets with the method described by Irving et. al. in "Invertible Finite Elements For Robust Simulation of Large Deformation".
 
double getRestValue () const
 Return the rest configuration for the constraint Note: the implementation currently assumes an initial strain energy of 0.
 
void setInverstionHandling (const bool handleInversions)
 Set/Get Inversion Handling.
 
bool getInverstionHandling () const
 
- Public Member Functions inherited from imstk::PbdFemConstraint
 PbdFemConstraint (const unsigned int cardinality, MaterialType mType=MaterialType::StVK)
 
- Public Member Functions inherited from imstk::PbdConstraint
virtual const std::string getTypeName () const =0
 
std::vector< PbdParticleId > & getParticles ()
 Get the vertex indices of the constraint.
 
bool getCorrectVelocity () const
 Get/Set whether velocity should be corrected for this constraint.
 
void setCorrectVelocity (const bool correctVelocity)
 
const Vec3d & getGradient (const int i) const
 Get gradient given the particle index in constraint.
 
double getForce (const double dt) const
 Get the force magnitude, valid after solving lambda Only valid with xpbd.
 
double getConstraintC () const
 Get constraint value C (how much the constraint is violated)
 
double getLambda () const
 Get constraint value C (how much the constraint is violated)
 
void zeroOutLambda ()
 Zero's out the lagrange multplier before integration only used for xpbd, must be called before solving.
 
virtual void projectConstraint (PbdState &bodies, const double dt, const SolverType &type)
 Update positions by projecting constraints.
 
virtual void correctVelocity (PbdState &bodies, const double dt)
 Correct velocities according to friction and restitution Corrects according to the gradient direction.
 
double computeGeneralizedInvMass (const PbdState &bodies, const size_t particleIndex) const
 Compute generalized inverse mass of the particle. Note perf sensitive function. It has been intentionally inlined. More...
 
double computeGeneralizedInvMass (const PbdState &bodies, const size_t particleIndex, const Vec3d &r) const
 Compute generalized inverse mass of the particle. More...
 
double getRestitution () const
 Get/Set restitution.
 
void setRestitution (const double restitution)
 
double getFriction () const
 Get/Set friction.
 
void setFriction (const double friction)
 
double getStiffness () const
 Get/Set the stiffness.
 
void setStiffness (const double stiffness)
 
double getCompliance () const
 Get/Set the compliance This function is also provided in case users need 0 compliance.
 
void setCompliance (const double compliance)
 

Additional Inherited Members

- Public Types inherited from imstk::PbdFemConstraint
enum  MaterialType { Linear, Corotation, StVK, NeoHookean }
 
- Public Types inherited from imstk::PbdConstraint
enum  SolverType { xPBD = 0, PBD }
 Type of solvers.
 
- Public Attributes inherited from imstk::PbdFemConstraint
double m_initialElementVolume = 0.0
 Volume of the element.
 
MaterialType m_material
 Material type.
 
Mat3d m_invRestMat
 
PbdFemConstraintConfig m_config
 
- Protected Member Functions inherited from imstk::PbdConstraint
 PbdConstraint (const size_t numParticles)
 
- Protected Attributes inherited from imstk::PbdConstraint
std::vector< PbdParticleIdm_particles
 body, particle index
 
std::vector< Vec3d > m_dcdx
 Normalized constraint gradients (per particle)
 
double m_stiffness = 1.0
 used in PBD, [0, 1]
 
double m_compliance = 1e-7
 used in xPBD, inverse of Stiffness
 
double m_lambda = 0.0
 Lagrange multiplier.
 
double m_C = 0.0
 Constraint Value.
 
double m_friction = 0.0
 
double m_restitution = 0.0
 
bool m_correctVelocity = false
 

Detailed Description

The FEMTetConstraint class class for constraint as the elastic energy computed by linear shape functions with tetrahedral mesh.

Definition at line 19 of file imstkPbdFemTetConstraint.h.

Member Function Documentation

◆ computeValueAndGradient()

bool imstk::PbdFemTetConstraint::computeValueAndGradient ( PbdState bodies,
double &  c,
std::vector< Vec3d > &  dcdx 
)
overridevirtual

Compute value and gradient of constraint function.

Parameters
[in,out]setof bodies involved in system
[in,out]cconstraint value
[in,out]dcdxconstraint gradient

Implements imstk::PbdConstraint.

Definition at line 43 of file imstkPbdFemTetConstraint.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: