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

FrameSpringForceField simulates 6D springs between moving frames Use stiffnessTrans vector to specify the directionnal stiffnesses (on each local axis) Use stiffnessRot vector to specify the rotational stiffnesses (on each local axis). More...

#include <FrameSpringForceField.h>

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

Inheritance graph
[legend]
Collaboration diagram for sofa::component::forcefield::FrameSpringForceField< 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 > VecN

Public Member Functions

 FrameSpringForceField (MechanicalState *object1, MechanicalState *object2)
 FrameSpringForceField ()
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 softKsr, 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
FrameSpringForceFieldInternalData
< DataTypes > 
data

Detailed Description

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

FrameSpringForceField simulates 6D springs between moving frames Use stiffnessTrans vector to specify the directionnal stiffnesses (on each local axis) Use stiffnessRot vector to specify the rotational stiffnesses (on each local axis).

Definition at line 56 of file FrameSpringForceField.h.


Member Typedef Documentation

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

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

Definition at line 59 of file FrameSpringForceField.h.

Definition at line 67 of file FrameSpringForceField.h.

Definition at line 65 of file FrameSpringForceField.h.

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

Definition at line 64 of file FrameSpringForceField.h.

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

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

template<class DataTypes >
typedef Vec<N,Real> sofa::component::forcefield::FrameSpringForceField< DataTypes >::VecN

Definition at line 68 of file FrameSpringForceField.h.


Member Enumeration Documentation

template<class DataTypes >
anonymous enum

Enumerator:
N 

Definition at line 66 of file FrameSpringForceField.h.


Constructor & Destructor Documentation

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

Definition at line 52 of file FrameSpringForceField.inl.

Definition at line 61 of file FrameSpringForceField.inl.


Member Function Documentation

template<class DataTypes >
void sofa::component::forcefield::FrameSpringForceField< 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 154 of file FrameSpringForceField.inl.

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

template<class DataTypes >
void sofa::component::forcefield::FrameSpringForceField< 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 137 of file FrameSpringForceField.inl.

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

template<class DataTypes >
void sofa::component::forcefield::FrameSpringForceField< DataTypes >::addSpring ( int  m1,
int  m2,
Real  softKst,
Real  softKsr,
Real  kd 
) [inline]

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

template<class DataTypes >
void sofa::component::forcefield::FrameSpringForceField< 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::FrameSpringForceField< 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]

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

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

template<class DataTypes >
virtual double sofa::component::forcefield::FrameSpringForceField< 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 193 of file FrameSpringForceField.h.

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

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

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

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

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

Definition at line 70 of file FrameSpringForceField.inl.

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


Field Documentation

Definition at line 170 of file FrameSpringForceField.h.

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

Definition at line 168 of file FrameSpringForceField.h.

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

Definition at line 167 of file FrameSpringForceField.h.


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

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