7 #include "imstkCorotationalFemForceModel.h" 10 #pragma warning( push ) 11 #pragma warning( disable : 4458 ) 13 #include <corotationalLinearFEM.h> 15 #pragma warning( pop ) 20 CorotationalFemForceModel::CorotationalFemForceModel(std::shared_ptr<vega::VolumetricMesh> mesh,
const int warp) :
InternalForceModel(), m_warp(warp)
22 auto tetMesh = std::dynamic_pointer_cast<vega::TetMesh>(mesh);
23 m_corotationalLinearFem = std::make_shared<vega::CorotationalLinearFEM>(tetMesh.get());
29 double* data =
const_cast<double*
>(u.data());
30 m_corotationalLinearFem->ComputeEnergyAndForceAndStiffnessMatrix(data,
nullptr, internalForce.data(),
nullptr, m_warp);
36 double* data =
const_cast<double*
>(u.data());
37 m_corotationalLinearFem->ComputeEnergyAndForceAndStiffnessMatrix(data,
nullptr,
nullptr, m_vegaTangentStiffnessMatrix.get(), m_warp);
44 m_corotationalLinearFem->GetStiffnessMatrixTopology(tangentStiffnessMatrix);
50 double* data =
const_cast<double*
>(u.data());
51 m_corotationalLinearFem->ComputeEnergyAndForceAndStiffnessMatrix(data,
nullptr, internalForce.data(), m_vegaTangentStiffnessMatrix.get(), m_warp);
64 m_vegaTangentStiffnessMatrix = K;
void setTangentStiffness(std::shared_ptr< vega::SparseMatrix > K) override
Specify tangent stiffness matrix.
void setWarp(const int warp)
Turn on/off warp.
void getForceAndMatrix(const Vectord &u, Vectord &internalForce, SparseMatrixd &tangentStiffnessMatrix) override
Compute internal force internalForce and stiffness matrix tangentStiffnessMatrix at state ...
void getInternalForce(const Vectord &u, Vectord &internalForce) override
Compute internal force internalForce at state u.
void getTangentStiffnessMatrixTopology(vega::SparseMatrix **tangentStiffnessMatrix) override
Build the sparsity pattern for stiffness matrix.
Base class for internal force model within the following context.
void getTangentStiffnessMatrix(const Vectord &u, SparseMatrixd &tangentStiffnessMatrix) override
Compute stiffness matrix tangentStiffnessMatrix at state .
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...