sofa::core::componentmodel::behavior::BaseForceField Class Reference

Component computing forces within simulated bodies. More...

#include <BaseForceField.h>

Inheritance diagram for sofa::core::componentmodel::behavior::BaseForceField:

Inheritance graph
[legend]
Collaboration diagram for sofa::core::componentmodel::behavior::BaseForceField:

Collaboration graph
[legend]

Public Member Functions

virtual ~BaseForceField ()
virtual int getFracturedEdge ()
Vector operations
virtual void addForce ()=0
 Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.
virtual void addDForce (double kFactor=1.0, double bFactor=0.0)=0
 Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().
virtual void addDForceV (double kFactor=1.0, double bFactor=0.0)=0
 Same as addDForce(), except the velocity vector should be used instead of dx.
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 double getPotentialEnergy ()=0
 Get the potential energy associated to this ForceField.
Matrix operations
virtual void addKToMatrix (sofa::defaulttype::BaseMatrix *matrix, double kFact, unsigned int &offset)
 Compute the system matrix corresponding to k K.
virtual void addBToMatrix (sofa::defaulttype::BaseMatrix *matrix, double bFact, unsigned int &offset)
 Compute the system matrix corresponding to b B.
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.

Detailed Description

Component computing forces within simulated bodies.

This class define the abstract API common to all force fields. A force field computes forces applied to one or more simulated body given its current position and velocity.

Forces can be internal to a given body (attached to one MechanicalState, see the ForceField class), or link several bodies together (such as contact forces, see the InteractionForceField class).

For implicit integration schemes, it must also compute the derivative ( df, given a displacement dx ).

Definition at line 62 of file BaseForceField.h.


Constructor & Destructor Documentation

virtual sofa::core::componentmodel::behavior::BaseForceField::~BaseForceField (  )  [inline, virtual]

Definition at line 65 of file BaseForceField.h.


Member Function Documentation

void sofa::core::componentmodel::behavior::BaseForceField::addBToMatrix ( sofa::defaulttype::BaseMatrix *  matrix,
double  bFact,
unsigned int &  offset 
) [virtual]

Compute the system matrix corresponding to b B.

Parameters:
matrix matrix to add the result to
bFact coefficient for damping contributions (i.e. first derivatives term in the ODE)
offset current row/column offset

Definition at line 58 of file BaseForceField.cpp.

Referenced by addMBKToMatrix().

virtual void sofa::core::componentmodel::behavior::BaseForceField::addDForce ( double  kFactor = 1.0,
double  bFactor = 0.0 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseForceField::addDForceV ( double  kFactor = 1.0,
double  bFactor = 0.0 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseForceField::addForce (  )  [pure virtual]

void sofa::core::componentmodel::behavior::BaseForceField::addKToMatrix ( sofa::defaulttype::BaseMatrix *  matrix,
double  kFact,
unsigned int &  offset 
) [virtual]

Compute the system matrix corresponding to k K.

Parameters:
matrix matrix to add the result to
kFact coefficient for stiffness contributions (i.e. DOFs term in the ODE)
offset current row/column offset

Reimplemented in sofa::component::forcefield::BeamFEMForceField< DataTypes >, sofa::component::forcefield::HexahedronFEMForceField< DataTypes >, sofa::component::forcefield::TetrahedralCorotationalFEMForceField< DataTypes >, and sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >.

Definition at line 53 of file BaseForceField.cpp.

Referenced by addMBKToMatrix().

void sofa::core::componentmodel::behavior::BaseForceField::addMBKdx ( double  mFactor,
double  bFactor,
double  kFactor 
) [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 $ In most cases only one of these matrices will be non-null for a given component. For forcefields without mass it simply calls addDForce.

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 in sofa::core::componentmodel::behavior::Mass< DataTypes >.

Definition at line 41 of file BaseForceField.cpp.

References addDForce().

Referenced by sofa::simulation::MechanicalAddMBKdxVisitor::fwdForceField().

void sofa::core::componentmodel::behavior::BaseForceField::addMBKToMatrix ( sofa::defaulttype::BaseMatrix *  matrix,
double  mFact,
double  bFact,
double  kFact,
unsigned int &  offset 
) [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 in sofa::core::componentmodel::behavior::Mass< DataTypes >.

Definition at line 63 of file BaseForceField.cpp.

References addBToMatrix(), and addKToMatrix().

Referenced by sofa::simulation::MechanicalAddMBK_ToMatrixVisitor::fwdForceField().

void sofa::core::componentmodel::behavior::BaseForceField::addMBKv ( double  mFactor,
double  bFactor,
double  kFactor 
) [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 $ In most cases only one of these matrices will be non-null for a given component. For forcefields without mass it simply calls addDForceV.

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 in sofa::core::componentmodel::behavior::Mass< DataTypes >.

Definition at line 47 of file BaseForceField.cpp.

References addDForceV().

Referenced by sofa::simulation::MechanicalAddMBKdxVisitor::fwdForceField().

virtual int sofa::core::componentmodel::behavior::BaseForceField::getFracturedEdge (  )  [inline, virtual]

virtual double sofa::core::componentmodel::behavior::BaseForceField::getPotentialEnergy (  )  [pure virtual]


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

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