SOFA API  204a38a7
Open source framework for multi-physics simuation
sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes > Class Template Reference

#include <PrecomputedWarpPreconditioner.h>

Linear system solver based on a precomputed inverse matrix, wrapped by a per-node rotation matrix. More...

Inheritance diagram for sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >:

Detailed Description

template<class TDataTypes>
class sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >

Linear system solver based on a precomputed inverse matrix, wrapped by a per-node rotation matrix.

Public Attributes

Data< booljmjt_twostep
 Use two step algorithm to compute JMinvJt. More...
 
sofa::core::objectmodel::lifecycle::RemovedData f_verbose {this, "v23.12", "v24.06", "verbose", "This Data is no longer used"}
 
Data< booluse_file
 Dump system matrix in a file. More...
 
Data< boolshare_matrix
 Share the compliance matrix in memory if they are related to the same file (WARNING: might require to reload Sofa when opening a new scene...) More...
 
SingleLink< PrecomputedWarpPreconditioner, sofa::core::behavior::LinearSolver, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINKl_linearSolver
 Link towards the linear solver used to precompute the first matrix. More...
 
Data< booluse_rotations
 Use Rotations around the preconditioner. More...
 
Data< double > draw_rotations_scale
 Scale rotations in draw function. More...
 
MStatemstate
 

Protected Attributes

TVector R
 
TVector T
 
std::vector< boolisActiveDofs
 
PrecomputedWarpPreconditionerInternalData< TDataTypes > internalData
 
bool first
 
bool _rotate
 
bool usePrecond
 
double init_mFact
 
double init_bFact
 
double init_kFact
 
double dt
 
double factInt
 
unsigned systemSize
 
unsigned dof_on_node
 
unsigned nb_dofs
 
unsigned matrixSize
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(PrecomputedWarpPreconditioner, TDataTypes), SOFA_TEMPLATE2(sofa::component::linearsolver::MatrixLinearSolver, TMatrix, TVector))
 
void solve (TMatrix &M, TVector &x, TVector &b) override
 
void invert (TMatrix &M) override
 
void setSystemMBKMatrix (const core::MechanicalParams *mparams) override
 
bool addJMInvJt (linearalgebra::BaseMatrix *result, linearalgebra::BaseMatrix *J, SReal fact) override
 
void draw (const core::visual::VisualParams *vparams) override
 
void init () override
 
void loadMatrix (TMatrix &M)
 
bool hasUpdatedMatrix () override
 
TBaseMatrixgetSystemMatrixInv ()
 
- Public Member Functions inherited from sofa::component::linearsolver::MatrixLinearSolver< linearalgebra::CompressedRowSparseMatrix< TDataTypes::Real >, PrecomputedWarpPreconditionerInternalData< TDataTypes >::TBaseVector >
void resetSystem ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void resetSystem ()
 
void resizeSystem (Size n)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void resizeSystem (Size)
 
void setSystemMBKMatrix (const core::MechanicalParams *mparams)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void setSystemMBKMatrix (const core::MechanicalParams *mparams)
 
void rebuildSystem (SReal, SReal)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void rebuildSystem (SReal massFactor, SReal forceFactor)
 
void setSystemLHVector (core::MultiVecDerivId v)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void setSystemLHVector (core::MultiVecDerivId v)
 
void applySystemSolution ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void applySystemSolution ()
 
void applyConstraintForce (const sofa::core::ConstraintParams *, sofa::core::MultiVecDerivId, const linearalgebra::BaseVector *)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void applyConstraintForce (const sofa::core::ConstraintParams *, sofa::core::MultiVecDerivId, const linearalgebra::BaseVector *)
 
void computeResidual (const core::ExecParams *, linearalgebra::BaseVector *)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void computeResidual (const core::ExecParams *params, linearalgebra::BaseVector *f)
 
GraphScatteredVectorcreatePersistentVector ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API GraphScatteredVectorcreatePersistentVector ()
 
linearalgebra::BaseMatrixgetSystemBaseMatrix ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API linearalgebra::BaseMatrixgetSystemBaseMatrix ()
 
linearalgebra::BaseVectorgetSystemRHBaseVector ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API linearalgebra::BaseVectorgetSystemRHBaseVector ()
 
linearalgebra::BaseVectorgetSystemLHBaseVector ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API linearalgebra::BaseVectorgetSystemLHBaseVector ()
 
void checkLinearSystem ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void checkLinearSystem ()
 
bool addJMInvJtLocal (GraphScatteredMatrix *M, MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector, NoThreadManager >::ResMatrixType *result, const MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector, NoThreadManager >::JMatrixType *J, const SReal fact)
 

Static Public Member Functions

template<class T >
static bool canCreate (T *&obj, core::objectmodel::BaseContext *context, core::objectmodel::BaseObjectDescription *arg)
 

Protected Member Functions

 PrecomputedWarpPreconditioner ()
 
void checkLinearSystem () override
 
void rotateConstraints ()
 
void loadMatrixWithCholeskyDecomposition (TMatrix &M)
 
void loadMatrixWithSolver ()
 
template<class JMatrix >
void ComputeResult (linearalgebra::BaseMatrix *result, JMatrix &J, float fact)
 
template<class JMatrix >
void computeActiveDofs (JMatrix &J)
 

Attribute details

◆ _rotate

template<class TDataTypes >
bool sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::_rotate
protected

◆ dof_on_node

template<class TDataTypes >
unsigned sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::dof_on_node
protected

◆ draw_rotations_scale

template<class TDataTypes >
Data<double> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::draw_rotations_scale

Scale rotations in draw function.

◆ dt

template<class TDataTypes >
double sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::dt
protected

◆ f_verbose

template<class TDataTypes >
sofa::core::objectmodel::lifecycle::RemovedData sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::f_verbose {this, "v23.12", "v24.06", "verbose", "This Data is no longer used"}

◆ factInt

template<class TDataTypes >
double sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::factInt
protected

◆ first

template<class TDataTypes >
bool sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::first
protected

◆ init_bFact

template<class TDataTypes >
double sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::init_bFact
protected

◆ init_kFact

template<class TDataTypes >
double sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::init_kFact
protected

◆ init_mFact

template<class TDataTypes >
double sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::init_mFact
protected

◆ internalData

template<class TDataTypes >
PrecomputedWarpPreconditionerInternalData<TDataTypes> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::internalData
protected

◆ isActiveDofs

template<class TDataTypes >
std::vector<bool> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::isActiveDofs
protected

◆ jmjt_twostep

template<class TDataTypes >
Data<bool> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::jmjt_twostep

Use two step algorithm to compute JMinvJt.

◆ l_linearSolver

Link towards the linear solver used to precompute the first matrix.

◆ matrixSize

template<class TDataTypes >
unsigned sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::matrixSize
protected

◆ mstate

◆ nb_dofs

template<class TDataTypes >
unsigned sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::nb_dofs
protected

◆ R

template<class TDataTypes >
TVector sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::R
protected

◆ share_matrix

template<class TDataTypes >
Data<bool> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::share_matrix

Share the compliance matrix in memory if they are related to the same file (WARNING: might require to reload Sofa when opening a new scene...)

◆ systemSize

template<class TDataTypes >
unsigned sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::systemSize
protected

◆ T

template<class TDataTypes >
TVector sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::T
protected

◆ use_file

template<class TDataTypes >
Data<bool> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::use_file

Dump system matrix in a file.

◆ use_rotations

template<class TDataTypes >
Data<bool> sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::use_rotations

Use Rotations around the preconditioner.

◆ usePrecond

template<class TDataTypes >
bool sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::usePrecond
protected

Constructor details

◆ PrecomputedWarpPreconditioner()

Function details

◆ addJMInvJt()

template<class TDataTypes >
bool sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::addJMInvJt ( linearalgebra::BaseMatrix result,
linearalgebra::BaseMatrix J,
SReal  fact 
)
override

◆ canCreate()

template<class TDataTypes >
template<class T >
static bool sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::canCreate ( T *&  obj,
core::objectmodel::BaseContext context,
core::objectmodel::BaseObjectDescription arg 
)
inlinestatic

Pre-construction check method called by ObjectFactory. Check that DataTypes matches the MechanicalState.

◆ checkLinearSystem()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::checkLinearSystem
overrideprotected

◆ computeActiveDofs()

template<class TDataTypes >
template<class JMatrix >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::computeActiveDofs ( JMatrix &  J)
protected

◆ ComputeResult()

template<class TDataTypes >
template<class JMatrix >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::ComputeResult ( linearalgebra::BaseMatrix result,
JMatrix &  J,
float  fact 
)
protected

◆ draw()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::draw ( const core::visual::VisualParams vparams)
override

◆ getSystemMatrixInv()

template<class TDataTypes >
TBaseMatrix* sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::getSystemMatrixInv ( )
inline

◆ hasUpdatedMatrix()

template<class TDataTypes >
bool sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::hasUpdatedMatrix ( )
inlineoverride

◆ init()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::init ( void  )
override

◆ invert()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::invert ( TMatrix M)
override

◆ loadMatrix()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::loadMatrix ( TMatrix M)

◆ loadMatrixWithCholeskyDecomposition()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::loadMatrixWithCholeskyDecomposition ( TMatrix M)
protected

◆ loadMatrixWithSolver()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::loadMatrixWithSolver
protected

◆ rotateConstraints()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::rotateConstraints
protected

◆ setSystemMBKMatrix()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::setSystemMBKMatrix ( const core::MechanicalParams mparams)
override

◆ SOFA_CLASS()

template<class TDataTypes >
sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::SOFA_CLASS ( SOFA_TEMPLATE(PrecomputedWarpPreconditioner< TDataTypes >, TDataTypes)  ,
SOFA_TEMPLATE2(sofa::component::linearsolver::MatrixLinearSolver, TMatrix, TVector  
)

◆ solve()

template<class TDataTypes >
void sofa::component::linearsolver::preconditioner::PrecomputedWarpPreconditioner< TDataTypes >::solve ( TMatrix M,
TVector x,
TVector b 
)
override