sofa::component::forcefield::JointSpringForceField< DataTypes > Class Template Reference

JointSpringForceField simulates 6D springs between Rigid DOFS Use kst vector to specify the directionnal stiffnesses (on each local axe) Use ksr vector to specify the rotational stiffnesses (on each local axe). More...

#include <JointSpringForceField.h>

Inheritance diagram for sofa::component::forcefield::JointSpringForceField< DataTypes >:

Inheritance graph
[legend]
Collaboration diagram for sofa::component::forcefield::JointSpringForceField< DataTypes >:

Collaboration graph
[legend]

Data Structures

class  Spring

Public Types

enum  { N = Coord::static_size }
typedef
core::componentmodel::behavior::PairInteractionForceField
< DataTypes > 
Inherit
typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
typedef DataTypes::Coord Coord
typedef DataTypes::Deriv Deriv
typedef Coord::value_type Real
typedef
core::componentmodel::behavior::MechanicalState
< DataTypes > 
MechanicalState
typedef defaulttype::Mat< N, N,
Real > 
Mat
typedef Vec< N, Real > Vector

Public Member Functions

 JointSpringForceField (MechanicalState *object1, MechanicalState *object2)
 JointSpringForceField ()
core::componentmodel::behavior::MechanicalState
< DataTypes > * 
getObject1 ()
core::componentmodel::behavior::MechanicalState
< DataTypes > * 
getObject2 ()
virtual void init ()
 Initialization method called at graph modification, during bottom-up traversal.
virtual void addForce (VecDeriv &f1, VecDeriv &f2, const VecCoord &x1, const VecCoord &x2, const VecDeriv &v1, const VecDeriv &v2)
 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 (VecDeriv &df1, VecDeriv &df2, const VecDeriv &dx1, const VecDeriv &dx2)
 Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().
virtual double getPotentialEnergy (const VecCoord &, const VecCoord &)
 Get the potential energy associated to this ForceField.
sofa::helper::vector< Spring > * getSprings ()
void draw ()
 Render internal data of this object, for debugging purposes.
void clear (int reserve=0)
void addSpring (const Spring &s)
void addSpring (int m1, int m2, Real softKst, Real hardKst, Real softKsr, Real hardKsr, Real blocKsr, Real axmin, Real axmax, Real aymin, Real aymax, Real azmin, Real azmax, Real kd)

Protected Member Functions

void addSpringForce (double &potentialEnergy, VecDeriv &f1, const VecCoord &p1, const VecDeriv &v1, VecDeriv &f2, const VecCoord &p2, const VecDeriv &v2, int i, Spring &spring)
 Accumulate the spring force and compute and store its stiffness.
void addSpringDForce (VecDeriv &df1, const VecDeriv &dx1, VecDeriv &df2, const VecDeriv &dx2, int i, Spring &spring)
 Apply the stiffness, i.e. accumulate df given dx.

Protected Attributes

double m_potentialEnergy
Data< sofa::helper::vector
< Spring > > 
springs
 the list of the springs
VecCoord springRef
 the list of the local referentials of the springs
Data< bool > showLawfulTorsion
 bool to allow the display of the 2 parts of springs torsions
Data< bool > showExtraTorsion
JointSpringForceFieldInternalData
< DataTypes > 
data

Detailed Description

template<class DataTypes>
class sofa::component::forcefield::JointSpringForceField< DataTypes >

JointSpringForceField simulates 6D springs between Rigid DOFS Use kst vector to specify the directionnal stiffnesses (on each local axe) Use ksr vector to specify the rotational stiffnesses (on each local axe).

Definition at line 57 of file JointSpringForceField.h.


Member Typedef Documentation

template<class DataTypes >
typedef DataTypes::Coord sofa::component::forcefield::JointSpringForceField< DataTypes >::Coord

template<class DataTypes >
typedef DataTypes::Deriv sofa::component::forcefield::JointSpringForceField< DataTypes >::Deriv

Definition at line 60 of file JointSpringForceField.h.

Definition at line 68 of file JointSpringForceField.h.

Definition at line 66 of file JointSpringForceField.h.

template<class DataTypes >
typedef Coord::value_type sofa::component::forcefield::JointSpringForceField< DataTypes >::Real

Definition at line 65 of file JointSpringForceField.h.

template<class DataTypes >
typedef DataTypes::VecCoord sofa::component::forcefield::JointSpringForceField< DataTypes >::VecCoord

template<class DataTypes >
typedef DataTypes::VecDeriv sofa::component::forcefield::JointSpringForceField< DataTypes >::VecDeriv

template<class DataTypes >
typedef Vec<N,Real> sofa::component::forcefield::JointSpringForceField< DataTypes >::Vector

Definition at line 69 of file JointSpringForceField.h.


Member Enumeration Documentation

template<class DataTypes >
anonymous enum

Enumerator:
N 

Definition at line 67 of file JointSpringForceField.h.


Constructor & Destructor Documentation

template<class DataTypes >
sofa::component::forcefield::JointSpringForceField< DataTypes >::JointSpringForceField ( MechanicalState *  object1,
MechanicalState *  object2 
) [inline]

Definition at line 51 of file JointSpringForceField.inl.

Definition at line 60 of file JointSpringForceField.inl.


Member Function Documentation

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::addDForce ( VecDeriv &  df1,
VecDeriv &  df2,
const VecDeriv &  dx1,
const VecDeriv &  dx2 
) [inline, virtual]

Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce().

The derivative should be directly derived from the computations done by addForce. Any forces neglected in addDForce will be integrated explicitly (i.e. using its value at the beginning of the timestep).

If the ForceField can be represented as a matrix, this method computes $ df += K dx $

This method must be implemented by the component, and is usually called by the generic PairInteractionForceField::addDForce() method.

Deprecated:
to more efficiently accumulate contributions from all terms of the system equation, a new addDForce method allowing to pass two coefficients for the stiffness and damping terms should now be used.

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

Definition at line 194 of file JointSpringForceField.inl.

References sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringDForce(), and sofa::component::forcefield::JointSpringForceField< DataTypes >::springs.

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::addForce ( VecDeriv &  f1,
VecDeriv &  f2,
const VecCoord &  x1,
const VecCoord &  x2,
const VecDeriv &  v1,
const VecDeriv &  v2 
) [inline, virtual]

Given the current position and velocity states, update the current force vector by computing and adding the forces associated with this ForceField.

If the ForceField can be represented as a matrix, this method computes $ f += B v + K x $

This method must be implemented by the component, and is usually called by the generic ForceField::addForce() method.

Implements sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.

Definition at line 177 of file JointSpringForceField.inl.

References sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringForce(), sofa::component::forcefield::JointSpringForceField< DataTypes >::m_potentialEnergy, sofa::component::forcefield::JointSpringForceField< DataTypes >::springRef, and sofa::component::forcefield::JointSpringForceField< DataTypes >::springs.

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpring ( int  m1,
int  m2,
Real  softKst,
Real  hardKst,
Real  softKsr,
Real  hardKsr,
Real  blocKsr,
Real  axmin,
Real  axmax,
Real  aymin,
Real  aymax,
Real  azmin,
Real  azmax,
Real  kd 
) [inline]

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpring ( const Spring &  s  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringDForce ( VecDeriv &  df1,
const VecDeriv &  dx1,
VecDeriv &  df2,
const VecDeriv &  dx2,
int  i,
Spring &  spring 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::addSpringForce ( double &  potentialEnergy,
VecDeriv &  f1,
const VecCoord &  p1,
const VecDeriv &  v1,
VecDeriv &  f2,
const VecCoord &  p2,
const VecDeriv &  v2,
int  i,
Spring &  spring 
) [inline, protected]

Accumulate the spring force and compute and store its stiffness.

Definition at line 75 of file JointSpringForceField.inl.

References sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::blocStiffnessRot, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::bloquage, sofa::helper::Quater< Real >::createFromRotationVector(), sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::extraTorsion, force, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::freeMovements, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::hardStiffnessRot, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::hardStiffnessTrans, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::initRot, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::initTrans, sofa::helper::Quater< Real >::inverse(), sofa::defaulttype::invertMatrix(), sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::kd, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::lawfulTorsion, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::limitAngles, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::m1, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::m2, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::softStiffnessRot, sofa::component::forcefield::JointSpringForceField< DataTypes >::Spring::softStiffnessTrans, sofa::component::forcefield::JointSpringForceField< DataTypes >::springRef, sofa::helper::Quater< Real >::toEulerVector(), and sofa::helper::Quater< Real >::toMatrix().

Referenced by sofa::component::forcefield::JointSpringForceField< DataTypes >::addForce().

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::clear ( int  reserve = 0  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::draw (  )  [inline, virtual]

template<class DataTypes >
virtual double sofa::component::forcefield::JointSpringForceField< DataTypes >::getPotentialEnergy ( const VecCoord &  x1,
const VecCoord &  x2 
) [inline, virtual]

Get the potential energy associated to this ForceField.

Used to extimate the total energy of the system by some post-stabilization techniques.

This method must be implemented by the component, and is usually called by the generic ForceField::getPotentialEnergy() method.

Implements sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.

Definition at line 297 of file JointSpringForceField.h.

References sofa::component::forcefield::JointSpringForceField< DataTypes >::m_potentialEnergy.

template<class DataTypes >
sofa::helper::vector<Spring>* sofa::component::forcefield::JointSpringForceField< DataTypes >::getSprings (  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::JointSpringForceField< DataTypes >::init ( void   )  [inline, virtual]

Initialization method called at graph modification, during bottom-up traversal.

Reimplemented from sofa::core::objectmodel::BaseObject.

Definition at line 69 of file JointSpringForceField.inl.

References sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >::init().


Field Documentation

Definition at line 274 of file JointSpringForceField.h.

template<class DataTypes >
double sofa::component::forcefield::JointSpringForceField< DataTypes >::m_potentialEnergy [protected]

bool to allow the display of the 2 parts of springs torsions

Definition at line 271 of file JointSpringForceField.h.

Referenced by sofa::component::forcefield::JointSpringForceField< DataTypes >::draw().


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

Generated on Sun Nov 23 04:18:44 2008 for Sofa by  doxygen 1.5.7.1