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

Bending springs added between vertices of quads sharing a common edge. More...

#include <QuadularBendingSprings.h>

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

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

Collaboration graph
[legend]

Data Structures

class  EdgeInformation
class  Mat3

Public Types

enum  { N = Coord::static_size }
typedef
core::componentmodel::behavior::ForceField
< DataTypes > 
Inherited
typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
typedef DataTypes::Coord Coord
typedef DataTypes::Deriv Deriv
typedef Coord::value_type Real
typedef defaulttype::Mat< N, N,
Real > 
Mat

Public Member Functions

 QuadularBendingSprings ()
 ~QuadularBendingSprings ()
virtual double getPotentialEnergy (const VecCoord &x)
 Get the potential energy associated to this ForceField.
virtual void init ()
 Searches quad topology and creates the bending springs.
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 getKs () const
virtual double getKd () const
void setKs (const double ks)
void setKd (const double kd)
virtual void handleTopologyChange ()
 Handle topological Changes.
void draw ()
 Render internal data of this object, for debugging purposes.
void initTextures ()
void update ()

Protected Member Functions

EdgeData< EdgeInformation > & getEdgeInfo ()

Static Protected Member Functions

static void QuadularBSEdgeCreationFunction (int edgeIndex, void *param, EdgeInformation &ei, const Edge &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)
static void QuadularBSQuadCreationFunction (const sofa::helper::vector< unsigned int > &quadAdded, void *param, vector< EdgeInformation > &edgeData)
static void QuadularBSQuadDestructionFunction (const sofa::helper::vector< unsigned int > &quadAdded, void *param, vector< EdgeInformation > &edgeData)

Protected Attributes

EdgeData< EdgeInformation > edgeInfo
sofa::core::componentmodel::topology::BaseMeshTopology * _topology
bool updateMatrix
Data< double > f_ks
Data< double > f_kd
double m_potentialEnergy

Detailed Description

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

Bending springs added between vertices of quads sharing a common edge.

The springs connect the vertices not belonging to the common edge. It compresses when the surface bends along the common edge.

Definition at line 61 of file QuadularBendingSprings.h.


Member Typedef Documentation

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

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

Definition at line 64 of file QuadularBendingSprings.h.

Definition at line 74 of file QuadularBendingSprings.h.

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

Definition at line 71 of file QuadularBendingSprings.h.

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

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


Member Enumeration Documentation

template<class DataTypes >
anonymous enum

Enumerator:
N 

Definition at line 73 of file QuadularBendingSprings.h.


Constructor & Destructor Documentation

Definition at line 296 of file QuadularBendingSprings.inl.


Member Function Documentation

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

References sofa::component::forcefield::QuadularBendingSprings< DataTypes >::_topology, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::DfDx, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::edgeInfo, sofa::core::componentmodel::topology::BaseMeshTopology::getNbEdges(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::is_activated, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m1, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m2, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m3, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m4, and sofa::component::forcefield::QuadularBendingSprings< DataTypes >::updateMatrix.

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::addForce ( VecDeriv &  f,
const VecCoord &  x,
const VecDeriv &  v 
) [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::ForceField< DataTypes >.

Definition at line 520 of file QuadularBendingSprings.inl.

References sofa::component::forcefield::QuadularBendingSprings< DataTypes >::_topology, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::DfDx, dot(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::edgeInfo, force, sofa::core::componentmodel::topology::BaseMeshTopology::getNbEdges(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::is_activated, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::kd, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::ks, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m1, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m2, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m3, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m4, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::m_potentialEnergy, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::restlength1, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::restlength2, and sofa::component::forcefield::QuadularBendingSprings< DataTypes >::updateMatrix.

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

template<class DataTypes >
EdgeData<EdgeInformation>& sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getEdgeInfo (  )  [inline, protected]

template<class DataTypes >
virtual double sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getKd (  )  const [inline, virtual]

template<class DataTypes >
virtual double sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getKs (  )  const [inline, virtual]

template<class DataTypes >
double sofa::component::forcefield::QuadularBendingSprings< 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 513 of file QuadularBendingSprings.inl.

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

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

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::initTextures (  )  [inline]

Definition at line 155 of file QuadularBendingSprings.h.

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::QuadularBSEdgeCreationFunction ( int  edgeIndex,
void *  param,
EdgeInformation &  ei,
const Edge &  ,
const sofa::helper::vector< unsigned int > &  ,
const sofa::helper::vector< double > &   
) [inline, static, protected]

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::QuadularBSQuadCreationFunction ( const sofa::helper::vector< unsigned int > &  quadAdded,
void *  param,
vector< EdgeInformation > &  edgeData 
) [inline, static, protected]

describe the jth edge index of quad no i

describe the jth vertex index of quad no i

set to zero the edge stiffness matrix

Definition at line 84 of file QuadularBendingSprings.inl.

References sofa::component::forcefield::QuadularBendingSprings< DataTypes >::_topology, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::DfDx, sofa::core::componentmodel::topology::BaseMeshTopology::getEdgeIndexInQuad(), sofa::core::componentmodel::topology::BaseMeshTopology::getEdgeQuadShell(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getKd(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getKs(), sofa::core::componentmodel::topology::BaseMeshTopology::getQuad(), sofa::core::componentmodel::topology::BaseMeshTopology::getQuadEdgeShell(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getX0(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::is_activated, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::is_initialized, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::kd, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::ks, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m1, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m2, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m3, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m4, sofa::core::componentmodel::behavior::ForceField< DataTypes >::mstate, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::restlength1, and sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::restlength2.

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

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::QuadularBSQuadDestructionFunction ( const sofa::helper::vector< unsigned int > &  quadAdded,
void *  param,
vector< EdgeInformation > &  edgeData 
) [inline, static, protected]

describe the jth edge index of quad no i

describe the jth vertex index of quad no i

Definition at line 181 of file QuadularBendingSprings.inl.

References sofa::component::forcefield::QuadularBendingSprings< DataTypes >::_topology, sofa::core::componentmodel::topology::BaseMeshTopology::getEdgeIndexInQuad(), sofa::core::componentmodel::topology::BaseMeshTopology::getEdgeQuadShell(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getKd(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::getKs(), sofa::core::componentmodel::topology::BaseMeshTopology::getQuad(), sofa::core::componentmodel::topology::BaseMeshTopology::getQuadEdgeShell(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getX0(), sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::is_activated, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::is_initialized, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::kd, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::ks, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m1, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m2, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m3, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::m4, sofa::core::componentmodel::behavior::ForceField< DataTypes >::mstate, sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::restlength1, and sofa::component::forcefield::QuadularBendingSprings< DataTypes >::EdgeInformation::restlength2.

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

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::setKd ( const double  kd  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::setKs ( const double  ks  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::QuadularBendingSprings< DataTypes >::update (  )  [inline]

Definition at line 156 of file QuadularBendingSprings.h.


Field Documentation

template<class DataTypes >
Data<double> sofa::component::forcefield::QuadularBendingSprings< DataTypes >::f_kd [protected]

template<class DataTypes >
Data<double> sofa::component::forcefield::QuadularBendingSprings< DataTypes >::f_ks [protected]

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


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

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