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

#include <SpringEdgeDataForceField.h>

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

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

Collaboration graph
[legend]

Data Structures

class  Loader
class  Mat3
struct  Spring

Public Types

typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
typedef DataTypes::Coord Coord
typedef DataTypes::Deriv Deriv
typedef Coord::value_type Real

Public Member Functions

 SpringEdgeDataForceField (core::componentmodel::behavior::MechanicalState< DataTypes > *_object)
bool load (const char *filename)
core::componentmodel::behavior::MechanicalState
< DataTypes > * 
getObject ()
virtual void init ()
 Initialization method called at graph modification, during bottom-up traversal.
void createDefaultSprings ()
virtual void handleEvent (Event *e)
 Handle an event.
virtual void addForce (VecDeriv &f, const VecCoord &x, const VecDeriv &v)
 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 &df, const VecDeriv &dx)
 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 &)
 Get the potential energy associated to this ForceField.
Real getStiffness () const
const Real getViscosity () const
const
component::topology::EdgeData
< Spring > & 
getSpringArray () const
void draw ()
 Render internal data of this object, for debugging purposes.
void clear (int reserve=0)

Protected Member Functions

z void addSpring (int m1, int m2, SReal ks, SReal kd, SReal initlen)
void resizeArray (unsigned int n)

Protected Attributes

double m_potentialEnergy
bool updateMatrix
 if the edge matrices should be updated
component::topology::EdgeData
< Spring > 
springArray
 where the springs information are stored
core::componentmodel::behavior::MechanicalState
< DataTypes > * 
object
component::topology::EdgeSetTopology
< DataTypes > * 
topology
 the EdgeSet topology used to get the list of edges
DataField< std::string > m_filename
 the filename where to load the spring information
DataField< double > m_stiffness
 By default, assume that all edges have the same stiffness.
DataField< double > m_viscosity
 By default, assume that all edges have the same viscosity.

Friends

class Loader

Detailed Description

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

Definition at line 50 of file SpringEdgeDataForceField.h.


Member Typedef Documentation

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

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

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

Definition at line 57 of file SpringEdgeDataForceField.h.

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

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


Constructor & Destructor Documentation


Member Function Documentation

template<class DataTypes >
void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addDForce ( VecDeriv &  df,
const VecDeriv &  dx 
) [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 ForceField::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::ForceField< DataTypes >.

Definition at line 240 of file SpringEdgeDataForceField.inl.

References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::dfdx, dot(), sofa::component::topology::EdgeSetTopologyContainer::getEdgeArray(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::kd, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::ks, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::restLength, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology, and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::updateMatrix.

template<class DataTypes >
void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [inline, virtual]

template<class DataTypes >
void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addSpring ( int  m1,
int  m2,
SReal  ks,
SReal  kd,
SReal  initlen 
) [inline, protected]

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

template<class DataTypes >
void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings (  )  [inline]

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

template<class DataTypes >
virtual double sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getPotentialEnergy ( const VecCoord &  x  )  [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::ForceField< DataTypes >.

Definition at line 117 of file SpringEdgeDataForceField.h.

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

template<class DataTypes >
const component::topology::EdgeData<Spring>& sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getSpringArray (  )  const [inline]

template<class DataTypes >
Real sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getStiffness (  )  const [inline]

template<class DataTypes >
const Real sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getViscosity (  )  const [inline]

template<class DataTypes >
void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::handleEvent ( Event *  e  )  [inline, virtual]

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

template<class DataTypes >
bool sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::load ( const char *  filename  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::resizeArray ( unsigned int  n  )  [inline, protected]


Friends And Related Function Documentation

template<class DataTypes >
friend class Loader [friend]

Definition at line 138 of file SpringEdgeDataForceField.h.


Field Documentation

template<class DataTypes >
DataField<std::string> sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_filename [protected]

the filename where to load the spring information

Definition at line 88 of file SpringEdgeDataForceField.h.

Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::init().

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

template<class DataTypes >
DataField<double> sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_stiffness [protected]

template<class DataTypes >
DataField<double> sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_viscosity [protected]

template<class DataTypes >
component::topology::EdgeSetTopology<DataTypes>* sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology [protected]


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

Generated on Sun Nov 23 04:19:38 2008 for Sofa by  doxygen 1.5.7.1