iMSTK
Interactive Medical Simulation Toolkit
imstkInternalForceModel.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 "imstkMath.h"
10 #include "imstkInternalForceModelTypes.h"
11 
12 #ifdef WIN32
13 #pragma warning( push )
14 #pragma warning( disable : 4458 )
15 #pragma warning( disable : 4100 )
16 #endif
17 #include <forceModel.h>
18 #ifdef WIN32
19 #pragma warning( pop )
20 #endif
21 
22 namespace imstk
23 {
31 {
32 public:
33  InternalForceModel() = default;
34  virtual ~InternalForceModel() = default;
35 
39  virtual void getInternalForce(const Vectord& u, Vectord& internalForce) = 0;
40 
44  virtual void getTangentStiffnessMatrix(const Vectord& u, SparseMatrixd& tangentStiffnessMatrix) = 0;
45 
49  virtual void getTangentStiffnessMatrixTopology(vega::SparseMatrix** tangentStiffnessMatrix) = 0;
50 
55  virtual void getForceAndMatrix(const Vectord& u, Vectord& internalForce, SparseMatrixd& tangentStiffnessMatrix);
56 
60  static void updateValuesFromMatrix(std::shared_ptr<vega::SparseMatrix> vegaMatrix, double* values);
61 
65  virtual void setTangentStiffness(std::shared_ptr<vega::SparseMatrix> K) = 0;
66 };
67 } // namespace imstk
virtual void getForceAndMatrix(const Vectord &u, Vectord &internalForce, SparseMatrixd &tangentStiffnessMatrix)
Compute both internal force internalForce and stiffness matrix tangentStiffnessMatrix at state ...
Compound Geometry.
virtual void getTangentStiffnessMatrix(const Vectord &u, SparseMatrixd &tangentStiffnessMatrix)=0
Compute stiffness matrix tangentStiffnessMatrix at state .
virtual void setTangentStiffness(std::shared_ptr< vega::SparseMatrix > K)=0
Specify tangent stiffness matrix.
virtual void getTangentStiffnessMatrixTopology(vega::SparseMatrix **tangentStiffnessMatrix)=0
Build the sparsity pattern for stiffness matrix.
Base class for internal force model within the following context.
virtual void getInternalForce(const Vectord &u, Vectord &internalForce)=0
Compute internal force internalForce at state u.
static void updateValuesFromMatrix(std::shared_ptr< vega::SparseMatrix > vegaMatrix, double *values)
Update the values of the Eigen sparse matrix given the linearized array of data from the Vega matrix...