SOFA API  7352f41a
Open source framework for multi-physics simuation
sofa::core::MechanicalParams Class Reference

#include <MechanicalParams.h>

Class gathering parameters use by mechanical components methods, and transmitted by mechanical visitors. More...

Inheritance diagram for sofa::core::MechanicalParams:

Detailed Description

Class gathering parameters use by mechanical components methods, and transmitted by mechanical visitors.

Protected Attributes

SReal m_dt
 Time step. More...
 
bool m_implicit
 Is the time integration scheme implicit ? More...
 
bool m_energy
 Should the kinematic and potential energies be computed ? More...
 
ConstMultiVecCoordId m_x
 Ids of position vector. More...
 
ConstMultiVecDerivId m_v
 Ids of velocity vector. More...
 
ConstMultiVecDerivId m_f
 Ids of force vector. More...
 
ConstMultiVecDerivId m_dx
 Ids of dx vector (for implicit schemes) More...
 
ConstMultiVecDerivId m_df
 Ids of df vector (for implicit schemes) More...
 
SReal m_mFactor
 Mass matrix contributions factor (for implicit schemes) More...
 
SReal m_bFactor
 Damping matrix contributions factor (for implicit schemes) More...
 
SReal m_kFactor
 Stiffness matrix contributions factor (for implicit schemes) More...
 
bool m_supportOnlySymmetricMatrix
 True if a symmetric matrix is assumed in the left-hand term of the dynamics equations, for solvers specialized on symmetric matrices. More...
 

Public Member Functions

bool symmetricMatrix () const =delete
 
bool supportOnlySymmetricMatrix () const
 Symmetric matrix flag, for solvers specialized on symmetric matrices. More...
 
bool energy () const
 Should the kinematic and potential energies be computed ? More...
 
 MechanicalParams (const sofa::core::ExecParams &p=sofa::core::ExecParams())
 Constructor, initializing all VecIds to default values, implicit and energy flags to false. More...
 
 MechanicalParams (const MechanicalParams &mparams)
 Copy Constructor. More...
 
MechanicalParamssetExecParams (const core::ExecParams *params)
 
MechanicalParamsoperator= (const MechanicalParams &mparams)
 
Flags and parameters getters
SReal dt () const
 Time step. More...
 
bool implicit () const
 Is the time integration scheme implicit ? More...
 
SReal mFactor () const
 Mass matrix contributions factor (for implicit schemes) More...
 
SReal bFactor () const
 Damping matrix contributions factor (for implicit schemes) More...
 
SReal kFactor () const
 Stiffness matrix contributions factor (for implicit schemes) More...
 
Rayleigh Damping D = rayleighStiffness*K - rayleighMass*M
SReal kFactorIncludingRayleighDamping (SReal rayleighStiffness) const
 
SReal mFactorIncludingRayleighDamping (SReal rayleighMass) const
 
Access to vectors from a given state container (i.e. State or MechanicalState)
template<class S >
const Data< typename S::VecCoord > * readX (const S *state) const
 Read access to current position vector. More...
 
template<class S >
const Data< typename S::VecDeriv > * readV (const S *state) const
 Read access to current velocity vector. More...
 
template<class S >
const Data< typename S::VecDeriv > * readF (const S *state) const
 Read access to current force vector. More...
 
template<class S >
const Data< typename S::VecDeriv > * readDx (const S *state) const
 Read access to current dx vector (for implicit schemes) More...
 
template<class S >
const Data< typename S::VecDeriv > * readDf (const S *state) const
 Read access to current df vector (for implicit schemes) More...
 
- Public Member Functions inherited from sofa::core::ExecParams
bool checkValidStorage () const
 
ExecMode execMode () const
 Mode of execution requested. More...
 
int threadID () const
 Index of current thread (0 corresponding to the only thread in sequential mode, or first thread in parallel mode) More...
 
int nbThreads () const
 Number of threads currently known to Sofa. More...
 
 ExecParams ()
 
void update ()
 Make sure this instance is up-to-date relative to the current thread. More...
 
ExecParamssetExecMode (ExecMode v)
 Request a specific mode of execution. More...
 
ExecParamssetThreadID (int v)
 Specify the index of the current thread. More...
 

Static Public Member Functions

static const MechanicalParamsdefaultInstance ()
 Get the default MechanicalParams, to be used to provide a default values for method parameters. More...
 
- Static Public Member Functions inherited from sofa::core::ExecParams
static ExecParamsdefaultInstance ()
 Get the default ExecParams, to be used to provide a default values for method parameters. More...
 

Setup methods

Called by the OdeSolver from which the mechanical computations originate. They all return a reference to this MechanicalParam instance, to ease chaining multiple setup calls.

bool m_kFactorUsed
 Checks if the stiffness matrix contributions factor has been accessed. More...
 
MechanicalParamssetDt (SReal v)
 Set time step. More...
 
MechanicalParamssetImplicit (bool v)
 Specify if the time integration scheme is implicit. More...
 
MechanicalParamssetMFactor (SReal v)
 Set Mass matrix contributions factor (for implicit schemes) More...
 
MechanicalParamssetBFactor (SReal v)
 Set Damping matrix contributions factor (for implicit schemes) More...
 
MechanicalParamssetKFactor (SReal v)
 Set Stiffness matrix contributions factor (for implicit schemes) More...
 
MechanicalParamssetSymmetricMatrix (bool b)=delete
 
MechanicalParamssetSupportOnlySymmetricMatrix (bool b)
 Set the flag (for implicit schemes) specifying if solvers are only specialized for symmetric matrices. More...
 
void setKFactorUsed (bool b) const
 Checks wether or nor kFactor is used in ForceFields. Temporary here for compatiblity reasons. More...
 
bool getKFactorUsed () const
 
MechanicalParamssetEnergy (bool v)
 Specify if the potential and kinematic energies should be computed ? More...
 
const ConstMultiVecCoordIdx () const
 
ConstMultiVecCoordIdx ()
 
const ConstMultiVecDerivIdv () const
 
ConstMultiVecDerivIdv ()
 
const ConstMultiVecDerivIdf () const
 
ConstMultiVecDerivIdf ()
 
const ConstMultiVecDerivIddx () const
 
ConstMultiVecDerivIddx ()
 
const ConstMultiVecDerivIddf () const
 
ConstMultiVecDerivIddf ()
 
MechanicalParamssetX (ConstVecCoordId v)
 Set the IDs of position vector. More...
 
MechanicalParamssetX (ConstMultiVecCoordId v)
 
template<class StateSet >
MechanicalParamssetX (const StateSet &g, ConstVecCoordId v)
 
MechanicalParamssetV (ConstVecDerivId v)
 Set the IDs of velocity vector. More...
 
MechanicalParamssetV (ConstMultiVecDerivId v)
 
template<class StateSet >
MechanicalParamssetV (const StateSet &g, ConstVecDerivId v)
 
MechanicalParamssetF (ConstVecDerivId v)
 Set the IDs of force vector. More...
 
MechanicalParamssetF (ConstMultiVecDerivId v)
 
template<class StateSet >
MechanicalParamssetF (const StateSet &g, ConstVecDerivId v)
 
MechanicalParamssetDx (ConstVecDerivId v)
 Set the IDs of dx vector (for implicit schemes) More...
 
MechanicalParamssetDx (ConstMultiVecDerivId v)
 
template<class StateSet >
MechanicalParamssetDx (const StateSet &g, ConstVecDerivId v)
 
MechanicalParamssetDf (ConstVecDerivId v)
 Set the IDs of df vector (for implicit schemes) More...
 
MechanicalParamssetDf (ConstMultiVecDerivId v)
 
template<class StateSet >
MechanicalParamssetDf (const StateSet &g, ConstVecDerivId v)
 

Experimental compliance API

SReal m_implicitVelocity
 ratio of future and current force used for velocity update (1 is fully implicit, 0 is fully explicit) More...
 
SReal m_implicitPosition
 ratio of future and current velocity used for position update (1 is fully implicit, 0 is fully explicit) More...
 
void setImplicitVelocity (SReal i)
 
const SReal & implicitVelocity () const
 
void setImplicitPosition (SReal i)
 
const SReal & implicitPosition () const
 

Attribute details

◆ m_bFactor

SReal sofa::core::MechanicalParams::m_bFactor
protected

Damping matrix contributions factor (for implicit schemes)

◆ m_df

ConstMultiVecDerivId sofa::core::MechanicalParams::m_df
protected

Ids of df vector (for implicit schemes)

◆ m_dt

SReal sofa::core::MechanicalParams::m_dt
protected

Time step.

◆ m_dx

ConstMultiVecDerivId sofa::core::MechanicalParams::m_dx
protected

Ids of dx vector (for implicit schemes)

◆ m_energy

bool sofa::core::MechanicalParams::m_energy
protected

Should the kinematic and potential energies be computed ?

◆ m_f

ConstMultiVecDerivId sofa::core::MechanicalParams::m_f
protected

Ids of force vector.

◆ m_implicit

bool sofa::core::MechanicalParams::m_implicit
protected

Is the time integration scheme implicit ?

◆ m_implicitPosition

SReal sofa::core::MechanicalParams::m_implicitPosition
protected

ratio of future and current velocity used for position update (1 is fully implicit, 0 is fully explicit)

◆ m_implicitVelocity

SReal sofa::core::MechanicalParams::m_implicitVelocity
protected

ratio of future and current force used for velocity update (1 is fully implicit, 0 is fully explicit)

◆ m_kFactor

SReal sofa::core::MechanicalParams::m_kFactor
protected

Stiffness matrix contributions factor (for implicit schemes)

◆ m_kFactorUsed

bool sofa::core::MechanicalParams::m_kFactorUsed
mutableprotected

Checks if the stiffness matrix contributions factor has been accessed.

◆ m_mFactor

SReal sofa::core::MechanicalParams::m_mFactor
protected

Mass matrix contributions factor (for implicit schemes)

◆ m_supportOnlySymmetricMatrix

bool sofa::core::MechanicalParams::m_supportOnlySymmetricMatrix
protected

True if a symmetric matrix is assumed in the left-hand term of the dynamics equations, for solvers specialized on symmetric matrices.

◆ m_v

ConstMultiVecDerivId sofa::core::MechanicalParams::m_v
protected

Ids of velocity vector.

◆ m_x

ConstMultiVecCoordId sofa::core::MechanicalParams::m_x
protected

Ids of position vector.

Constructor details

◆ MechanicalParams() [1/2]

sofa::core::MechanicalParams::MechanicalParams ( const sofa::core::ExecParams p = sofa::core::ExecParams())

Constructor, initializing all VecIds to default values, implicit and energy flags to false.

◆ MechanicalParams() [2/2]

sofa::core::MechanicalParams::MechanicalParams ( const MechanicalParams mparams)

Copy Constructor.

Function details

◆ bFactor()

SReal sofa::core::MechanicalParams::bFactor ( ) const
inline

Damping matrix contributions factor (for implicit schemes)

◆ defaultInstance()

const MechanicalParams * sofa::core::MechanicalParams::defaultInstance ( )
static

Get the default MechanicalParams, to be used to provide a default values for method parameters.

◆ df() [1/2]

ConstMultiVecDerivId& sofa::core::MechanicalParams::df ( )
inline

◆ df() [2/2]

const ConstMultiVecDerivId& sofa::core::MechanicalParams::df ( ) const
inline

◆ dt()

SReal sofa::core::MechanicalParams::dt ( ) const
inline

Time step.

◆ dx() [1/2]

ConstMultiVecDerivId& sofa::core::MechanicalParams::dx ( )
inline

◆ dx() [2/2]

const ConstMultiVecDerivId& sofa::core::MechanicalParams::dx ( ) const
inline

◆ energy()

bool sofa::core::MechanicalParams::energy ( ) const
inline

Should the kinematic and potential energies be computed ?

◆ f() [1/2]

ConstMultiVecDerivId& sofa::core::MechanicalParams::f ( )
inline

◆ f() [2/2]

const ConstMultiVecDerivId& sofa::core::MechanicalParams::f ( ) const
inline

◆ getKFactorUsed()

bool sofa::core::MechanicalParams::getKFactorUsed ( ) const
inline

◆ implicit()

bool sofa::core::MechanicalParams::implicit ( ) const
inline

Is the time integration scheme implicit ?

◆ implicitPosition()

const SReal& sofa::core::MechanicalParams::implicitPosition ( ) const
inline

◆ implicitVelocity()

const SReal& sofa::core::MechanicalParams::implicitVelocity ( ) const
inline

◆ kFactor()

SReal sofa::core::MechanicalParams::kFactor ( ) const
inline

Stiffness matrix contributions factor (for implicit schemes)

◆ kFactorIncludingRayleighDamping()

SReal sofa::core::MechanicalParams::kFactorIncludingRayleighDamping ( SReal  rayleighStiffness) const
inline
Returns
kfactor + bfactor*rayleighStiffness

◆ mFactor()

SReal sofa::core::MechanicalParams::mFactor ( ) const
inline

Mass matrix contributions factor (for implicit schemes)

◆ mFactorIncludingRayleighDamping()

SReal sofa::core::MechanicalParams::mFactorIncludingRayleighDamping ( SReal  rayleighMass) const
inline
Returns
mfactor + bfactor*rayleighMass

◆ operator=()

MechanicalParams * sofa::core::MechanicalParams::operator= ( const MechanicalParams mparams)

◆ readDf()

template<class S >
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readDf ( const S *  state) const
inline

Read access to current df vector (for implicit schemes)

◆ readDx()

template<class S >
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readDx ( const S *  state) const
inline

Read access to current dx vector (for implicit schemes)

◆ readF()

template<class S >
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readF ( const S *  state) const
inline

Read access to current force vector.

◆ readV()

template<class S >
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readV ( const S *  state) const
inline

Read access to current velocity vector.

◆ readX()

template<class S >
const Data<typename S::VecCoord>* sofa::core::MechanicalParams::readX ( const S *  state) const
inline

Read access to current position vector.

◆ setBFactor()

MechanicalParams& sofa::core::MechanicalParams::setBFactor ( SReal  v)
inline

Set Damping matrix contributions factor (for implicit schemes)

◆ setDf() [1/3]

template<class StateSet >
MechanicalParams& sofa::core::MechanicalParams::setDf ( const StateSet &  g,
ConstVecDerivId  v 
)
inline

◆ setDf() [2/3]

MechanicalParams& sofa::core::MechanicalParams::setDf ( ConstMultiVecDerivId  v)
inline

◆ setDf() [3/3]

MechanicalParams& sofa::core::MechanicalParams::setDf ( ConstVecDerivId  v)
inline

Set the IDs of df vector (for implicit schemes)

◆ setDt()

MechanicalParams& sofa::core::MechanicalParams::setDt ( SReal  v)
inline

Set time step.

◆ setDx() [1/3]

template<class StateSet >
MechanicalParams& sofa::core::MechanicalParams::setDx ( const StateSet &  g,
ConstVecDerivId  v 
)
inline

◆ setDx() [2/3]

MechanicalParams& sofa::core::MechanicalParams::setDx ( ConstMultiVecDerivId  v)
inline

◆ setDx() [3/3]

MechanicalParams& sofa::core::MechanicalParams::setDx ( ConstVecDerivId  v)
inline

Set the IDs of dx vector (for implicit schemes)

◆ setEnergy()

MechanicalParams& sofa::core::MechanicalParams::setEnergy ( bool  v)
inline

Specify if the potential and kinematic energies should be computed ?

◆ setExecParams()

MechanicalParams * sofa::core::MechanicalParams::setExecParams ( const core::ExecParams params)

◆ setF() [1/3]

template<class StateSet >
MechanicalParams& sofa::core::MechanicalParams::setF ( const StateSet &  g,
ConstVecDerivId  v 
)
inline

◆ setF() [2/3]

MechanicalParams& sofa::core::MechanicalParams::setF ( ConstMultiVecDerivId  v)
inline

◆ setF() [3/3]

MechanicalParams& sofa::core::MechanicalParams::setF ( ConstVecDerivId  v)
inline

Set the IDs of force vector.

◆ setImplicit()

MechanicalParams& sofa::core::MechanicalParams::setImplicit ( bool  v)
inline

Specify if the time integration scheme is implicit.

◆ setImplicitPosition()

void sofa::core::MechanicalParams::setImplicitPosition ( SReal  i)
inline

◆ setImplicitVelocity()

void sofa::core::MechanicalParams::setImplicitVelocity ( SReal  i)
inline

◆ setKFactor()

MechanicalParams& sofa::core::MechanicalParams::setKFactor ( SReal  v)
inline

Set Stiffness matrix contributions factor (for implicit schemes)

◆ setKFactorUsed()

void sofa::core::MechanicalParams::setKFactorUsed ( bool  b) const
inline

Checks wether or nor kFactor is used in ForceFields. Temporary here for compatiblity reasons.

◆ setMFactor()

MechanicalParams& sofa::core::MechanicalParams::setMFactor ( SReal  v)
inline

Set Mass matrix contributions factor (for implicit schemes)

◆ setSupportOnlySymmetricMatrix()

MechanicalParams& sofa::core::MechanicalParams::setSupportOnlySymmetricMatrix ( bool  b)
inline

Set the flag (for implicit schemes) specifying if solvers are only specialized for symmetric matrices.

◆ setSymmetricMatrix()

MechanicalParams& sofa::core::MechanicalParams::setSymmetricMatrix ( bool  b)
delete

◆ setV() [1/3]

template<class StateSet >
MechanicalParams& sofa::core::MechanicalParams::setV ( const StateSet &  g,
ConstVecDerivId  v 
)
inline

◆ setV() [2/3]

MechanicalParams& sofa::core::MechanicalParams::setV ( ConstMultiVecDerivId  v)
inline

◆ setV() [3/3]

MechanicalParams& sofa::core::MechanicalParams::setV ( ConstVecDerivId  v)
inline

Set the IDs of velocity vector.

◆ setX() [1/3]

template<class StateSet >
MechanicalParams& sofa::core::MechanicalParams::setX ( const StateSet &  g,
ConstVecCoordId  v 
)
inline

◆ setX() [2/3]

MechanicalParams& sofa::core::MechanicalParams::setX ( ConstMultiVecCoordId  v)
inline

◆ setX() [3/3]

MechanicalParams& sofa::core::MechanicalParams::setX ( ConstVecCoordId  v)
inline

Set the IDs of position vector.

◆ supportOnlySymmetricMatrix()

bool sofa::core::MechanicalParams::supportOnlySymmetricMatrix ( ) const
inline

Symmetric matrix flag, for solvers specialized on symmetric matrices.

◆ symmetricMatrix()

bool sofa::core::MechanicalParams::symmetricMatrix ( ) const
delete

◆ v() [1/2]

ConstMultiVecDerivId& sofa::core::MechanicalParams::v ( )
inline

◆ v() [2/2]

const ConstMultiVecDerivId& sofa::core::MechanicalParams::v ( ) const
inline

◆ x() [1/2]

ConstMultiVecCoordId& sofa::core::MechanicalParams::x ( )
inline

◆ x() [2/2]

const ConstMultiVecCoordId& sofa::core::MechanicalParams::x ( ) const
inline