SOFA API  caf3b296
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_symmetricMatrix
 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
 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...
 
Access to vectors from a given SingleLink to a state container (i.e. State or MechanicalState)
template<class Owner , class S , unsigned int flags>
const Data< typename S::VecCoord > * readX (const SingleLink< Owner, S, flags > &state) const
 Read access to current position vector. More...
 
template<class Owner , class S , unsigned int flags>
const Data< typename S::VecDeriv > * readV (const SingleLink< Owner, S, flags > &state) const
 Read access to current velocity vector. More...
 
template<class Owner , class S , unsigned int flags>
const Data< typename S::VecDeriv > * readF (const SingleLink< Owner, S, flags > &state) const
 Read access to current force vector. More...
 
template<class Owner , class S , unsigned int flags>
const Data< typename S::VecDeriv > * readDx (const SingleLink< Owner, S, flags > &state) const
 Read access to current dx vector (for implicit schemes) More...
 
template<class Owner , class S , unsigned int flags>
const Data< typename S::VecDeriv > * readDf (const SingleLink< Owner, S, flags > &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...
 
int aspectID () const
 
ExecParamssetAspectID (int)
 Specify the aspect 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...
 
static int currentAspect ()
 
static int currentAspect (const core::ExecParams *)
 

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)
 Set the symmetric matrix flag (for implicit schemes), for solvers specialized on 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

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

Damping matrix contributions factor (for implicit schemes)

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

Ids of df vector (for implicit schemes)

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

Time step.

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

Ids of dx vector (for implicit schemes)

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

Should the kinematic and potential energies be computed ?

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

Ids of force vector.

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

Is the time integration scheme implicit ?

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)

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)

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

Stiffness matrix contributions factor (for implicit schemes)

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

Checks if the stiffness matrix contributions factor has been accessed.

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

Mass matrix contributions factor (for implicit schemes)

bool sofa::core::MechanicalParams::m_symmetricMatrix
protected

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

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

Ids of velocity vector.

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

Ids of position vector.

Constructor details

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.

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

Copy Constructor.

Function details

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

Damping matrix contributions factor (for implicit schemes)

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

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

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

Time step.

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

Should the kinematic and potential energies be computed ?

const ConstMultiVecDerivId& sofa::core::MechanicalParams::f ( ) const
inline
ConstMultiVecDerivId& sofa::core::MechanicalParams::f ( )
inline
bool sofa::core::MechanicalParams::getKFactorUsed ( ) const
inline
bool sofa::core::MechanicalParams::implicit ( ) const
inline

Is the time integration scheme implicit ?

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

Stiffness matrix contributions factor (for implicit schemes)

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

Mass matrix contributions factor (for implicit schemes)

SReal sofa::core::MechanicalParams::mFactorIncludingRayleighDamping ( SReal  rayleighMass) const
inline
Returns
mfactor + bfactor*rayleighMass
MechanicalParams * sofa::core::MechanicalParams::operator= ( const MechanicalParams mparams)
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)

template<class Owner , class S , unsigned int flags>
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readDf ( const SingleLink< Owner, S, flags > &  state) const
inline

Read access to current df vector (for implicit schemes)

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)

template<class Owner , class S , unsigned int flags>
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readDx ( const SingleLink< Owner, S, flags > &  state) const
inline

Read access to current dx vector (for implicit schemes)

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

Read access to current force vector.

template<class Owner , class S , unsigned int flags>
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readF ( const SingleLink< Owner, S, flags > &  state) const
inline

Read access to current force vector.

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

Read access to current velocity vector.

template<class Owner , class S , unsigned int flags>
const Data<typename S::VecDeriv>* sofa::core::MechanicalParams::readV ( const SingleLink< Owner, S, flags > &  state) const
inline

Read access to current velocity vector.

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

Read access to current position vector.

template<class Owner , class S , unsigned int flags>
const Data<typename S::VecCoord>* sofa::core::MechanicalParams::readX ( const SingleLink< Owner, S, flags > &  state) const
inline

Read access to current position vector.

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

Set Damping matrix contributions factor (for implicit schemes)

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

Set the IDs of df vector (for implicit schemes)

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

Set time step.

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

Set the IDs of dx vector (for implicit schemes)

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

Specify if the potential and kinematic energies should be computed ?

MechanicalParams * sofa::core::MechanicalParams::setExecParams ( const core::ExecParams params)
MechanicalParams& sofa::core::MechanicalParams::setF ( ConstVecDerivId  v)
inline

Set the IDs of force vector.

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

Specify if the time integration scheme is implicit.

void sofa::core::MechanicalParams::setImplicitPosition ( SReal  i)
inline
void sofa::core::MechanicalParams::setImplicitVelocity ( SReal  i)
inline
MechanicalParams& sofa::core::MechanicalParams::setKFactor ( SReal  v)
inline

Set Stiffness matrix contributions factor (for implicit schemes)

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

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

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

Set Mass matrix contributions factor (for implicit schemes)

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

Set the symmetric matrix flag (for implicit schemes), for solvers specialized on symmetric matrices.

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

Set the IDs of velocity vector.

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

Set the IDs of position vector.

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

Symmetric matrix flag, for solvers specialized on symmetric matrices.

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