iMSTK
Interactive Medical Simulation Toolkit
imstkPbdFemTetConstraint.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkPbdFemConstraint.h"
10 
11 namespace imstk
12 {
20 {
21 public:
22  PbdFemTetConstraint(MaterialType mType = MaterialType::StVK) :
23  PbdFemConstraint(4, mType) { }
24 
25  IMSTK_TYPE_NAME(PbdFemTetConstraint)
26 
27 
28  bool initConstraint(
31  const Vec3d& p0, const Vec3d& p1, const Vec3d& p2, const Vec3d& p3,
32  const PbdParticleId& pIdx0, const PbdParticleId& pIdx1,
33  const PbdParticleId& pIdx2, const PbdParticleId& pIdx3,
34  PbdFemConstraintConfig config);
35 
42  bool computeValueAndGradient(PbdState& bodies,
43  double& c, std::vector<Vec3d>& dcdx) override;
44 
49  void handleInversions(
50  Mat3d& F,
51  Mat3d& U,
52  Mat3d& Fhat,
53  Mat3d& VT
54  ) const;
55 
59  void setInverstionHandling(const bool handleInversions) { m_handleInversions = handleInversions; }
60  bool getInverstionHandling() const { return m_handleInversions; }
62 
66  double getRestValue() const { return 0.0; }
67 
68 private:
69  bool m_handleInversions = true;
70 };
71 } // namespace imstk
std::pair< int, int > PbdParticleId
Index pair that refers to a particle in a PbdState. Index 0 is the body id, Index 1 is the particle i...
void setInverstionHandling(const bool handleInversions)
Set/Get Inversion Handling.
Compound Geometry.
double getRestValue() const
Return the rest configuration for the constraint Note: the implementation currently assumes an initia...
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 R...
The FEMTetConstraint class class for constraint as the elastic energy computed by linear shape functi...
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.
The PbdFemConstraint class for constraint as the elastic energy computed by linear shape functions wi...
Provides interface for accessing particles from a 2d array of PbdBody,Particles.
Definition: imstkPbdBody.h:229
Either mu/lambda used, may be computed from youngs modulus and poissons ratio.
bool computeValueAndGradient(PbdState &bodies, double &c, std::vector< Vec3d > &dcdx) override
Compute value and gradient of constraint function.