sofa::core::componentmodel::behavior::Mass< DataTypes > Class Template Reference

Component responsible for mass-related computations (gravity, acceleration). More...

#include <Mass.h>

Inheritance diagram for sofa::core::componentmodel::behavior::Mass< DataTypes >:

Inheritance graph
[legend]
Collaboration diagram for sofa::core::componentmodel::behavior::Mass< DataTypes >:

Collaboration graph
[legend]

Vector operations

std::ofstream * m_gnuplotFileEnergy
 stream to export Kinematic, Potential and Mechanical Energy to gnuplot files
virtual void addMDx (double factor=1.0)
 f += factor M dx
virtual void accFromF ()
 dx = M^-1 f
virtual void addMDx (VecDeriv &f, const VecDeriv &dx, double factor=1.0)=0
 f += factor M dx
virtual void accFromF (VecDeriv &a, const VecDeriv &f)=0
 dx = M^-1 f
virtual void addDForce (VecDeriv &, const VecDeriv &, double, double)
 Mass forces (gravity) often have null derivative.
virtual double getKineticEnergy ()
 vMv/2 using dof->getV()
virtual double getKineticEnergy (const VecDeriv &v)=0
 vMv/2
virtual void addMBKdx (double mFactor, double bFactor, double kFactor)
 Accumulate the contribution of M, B, and/or K matrices multiplied by the dx vector with the given coefficients.
virtual void addMBKv (double mFactor, double bFactor, double kFactor)
 Accumulate the contribution of M, B, and/or K matrices multiplied by the v vector with the given coefficients.
virtual void addMBKToMatrix (sofa::defaulttype::BaseMatrix *matrix, double mFact, double bFact, double kFact, unsigned int &offset)
 Compute the system matrix corresponding to m M + b B + k K.
virtual void initGnuplot (const std::string path)
 initialization to export kinetic and potential energy to gnuplot files format
virtual void exportGnuplot (double time)
 export kinetic and potential energy state at "time" to a gnuplot file
virtual void addGravityToV (double dt)=0
 perform v += dt*g operation. Used if mass wants to added G separately from the other forces to v.

Public Types

typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
typedef DataTypes::Coord Coord
typedef DataTypes::Deriv Deriv

Public Member Functions

 Mass (MechanicalState< DataTypes > *mm=NULL)
virtual ~Mass ()

Detailed Description

template<class DataTypes>
class sofa::core::componentmodel::behavior::Mass< DataTypes >

Component responsible for mass-related computations (gravity, acceleration).

Mass can be defined either as a scalar, vector, or a full mass-matrix. It is responsible for converting forces to accelerations (for explicit integrators), or displacements to forces (for implicit integrators).

It is also a ForceField, computing gravity-related forces.

Definition at line 56 of file Mass.h.


Member Typedef Documentation

template<class DataTypes >
typedef DataTypes::Coord sofa::core::componentmodel::behavior::Mass< DataTypes >::Coord

template<class DataTypes >
typedef DataTypes::Deriv sofa::core::componentmodel::behavior::Mass< DataTypes >::Deriv

template<class DataTypes >
typedef DataTypes::VecCoord sofa::core::componentmodel::behavior::Mass< DataTypes >::VecCoord

template<class DataTypes >
typedef DataTypes::VecDeriv sofa::core::componentmodel::behavior::Mass< DataTypes >::VecDeriv


Constructor & Destructor Documentation

template<class DataTypes >
sofa::core::componentmodel::behavior::Mass< DataTypes >::Mass ( MechanicalState< DataTypes > *  mm = NULL  )  [inline]

template<class DataTypes >
sofa::core::componentmodel::behavior::Mass< DataTypes >::~Mass (  )  [inline, virtual]

Definition at line 53 of file Mass.inl.


Member Function Documentation

template<class DataTypes >
virtual void sofa::core::componentmodel::behavior::Mass< DataTypes >::accFromF ( VecDeriv &  a,
const VecDeriv &  f 
) [pure virtual]

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::accFromF (  )  [inline, virtual]

template<class DataTypes >
virtual void sofa::core::componentmodel::behavior::Mass< DataTypes >::addDForce ( VecDeriv &  ,
const VecDeriv &  ,
double  ,
double   
) [inline, virtual]

Mass forces (gravity) often have null derivative.

Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.

Definition at line 94 of file Mass.h.

template<class DataTypes >
virtual void sofa::core::componentmodel::behavior::Mass< DataTypes >::addGravityToV ( double  dt  )  [pure virtual]

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::addMBKdx ( double  mFactor,
double  bFactor,
double  kFactor 
) [inline, virtual]

Accumulate the contribution of M, B, and/or K matrices multiplied by the dx vector with the given coefficients.

This method computes $ df += mFactor M dx + bFactor B dx + kFactor K dx $ For masses, it calls both addMdx and addDForce (which is often empty).

Parameters:
mFact coefficient for mass contributions (i.e. second-order derivatives term in the ODE)
bFact coefficient for damping contributions (i.e. first derivatives term in the ODE)
kFact coefficient for stiffness contributions (i.e. DOFs term in the ODE)

Reimplemented from sofa::core::componentmodel::behavior::BaseForceField.

Definition at line 80 of file Mass.inl.

References sofa::core::componentmodel::behavior::Mass< DataTypes >::addMDx().

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::addMBKToMatrix ( sofa::defaulttype::BaseMatrix *  matrix,
double  mFact,
double  bFact,
double  kFact,
unsigned int &  offset 
) [inline, virtual]

Compute the system matrix corresponding to m M + b B + k K.

Parameters:
matrix matrix to add the result to
mFact coefficient for mass contributions (i.e. second-order derivatives term in the ODE)
bFact coefficient for damping contributions (i.e. first derivatives term in the ODE)
kFact coefficient for stiffness contributions (i.e. DOFs term in the ODE)
offset current row/column offset

Reimplemented from sofa::core::componentmodel::behavior::BaseForceField.

Definition at line 99 of file Mass.inl.

References sofa::core::componentmodel::behavior::BaseMass::addMToMatrix().

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::addMBKv ( double  mFactor,
double  bFactor,
double  kFactor 
) [inline, virtual]

Accumulate the contribution of M, B, and/or K matrices multiplied by the v vector with the given coefficients.

This method computes $ df += mFactor M v + bFactor B v + kFactor K v $ For masses, it calls both addMdx and addDForce (which is often empty).

Parameters:
mFact coefficient for mass contributions (i.e. second-order derivatives term in the ODE)
bFact coefficient for damping contributions (i.e. first derivatives term in the ODE)
kFact coefficient for stiffness contributions (i.e. DOFs term in the ODE)

Reimplemented from sofa::core::componentmodel::behavior::BaseForceField.

Definition at line 88 of file Mass.inl.

References sofa::core::componentmodel::behavior::Mass< DataTypes >::addMDx(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getF(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getV(), and sofa::core::componentmodel::behavior::ForceField< DataTypes >::mstate.

template<class DataTypes >
virtual void sofa::core::componentmodel::behavior::Mass< DataTypes >::addMDx ( VecDeriv &  f,
const VecDeriv &  dx,
double  factor = 1.0 
) [pure virtual]

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::addMDx ( double  factor = 1.0  )  [inline, virtual]

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::exportGnuplot ( double  time  )  [inline, virtual]

template<class DataTypes >
virtual double sofa::core::componentmodel::behavior::Mass< DataTypes >::getKineticEnergy ( const VecDeriv &  v  )  [pure virtual]

template<class DataTypes >
double sofa::core::componentmodel::behavior::Mass< DataTypes >::getKineticEnergy (  )  [inline, virtual]

template<class DataTypes >
void sofa::core::componentmodel::behavior::Mass< DataTypes >::initGnuplot ( const std::string  path  )  [inline, virtual]

initialization to export kinetic and potential energy to gnuplot files format

Implements sofa::core::componentmodel::behavior::BaseMass.

Definition at line 107 of file Mass.inl.

References sofa::core::objectmodel::Base::getName(), and sofa::core::componentmodel::behavior::Mass< DataTypes >::m_gnuplotFileEnergy.


Field Documentation

template<class DataTypes >
std::ofstream* sofa::core::componentmodel::behavior::Mass< DataTypes >::m_gnuplotFileEnergy [protected]

stream to export Kinematic, Potential and Mechanical Energy to gnuplot files

Definition at line 155 of file Mass.h.

Referenced by sofa::core::componentmodel::behavior::Mass< DataTypes >::exportGnuplot(), and sofa::core::componentmodel::behavior::Mass< DataTypes >::initGnuplot().


The documentation for this class was generated from the following files:

Generated on Sun Nov 23 04:22:41 2008 for Sofa by  doxygen 1.5.7.1