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

Compute Finite Element forces based on tetrahedral elements. More...

#include <TetrahedronFEMForceField.h>

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

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

Collaboration graph
[legend]

Full system matrix assembly support

typedef std::pair< int, Real > Col_Value
typedef vector< Col_Value > CompressedValue
typedef vector< CompressedValue > CompressedMatrix
CompressedMatrix _stiffnesses

Public Types

enum  { SMALL = 0, LARGE = 1, POLAR = 2 }
typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
typedef DataTypes::VecReal VecReal
typedef VecCoord Vector
typedef DataTypes::Coord Coord
typedef DataTypes::Deriv Deriv
typedef Coord::value_type Real
typedef
core::componentmodel::topology::BaseMeshTopology::index_type 
Index
typedef
core::componentmodel::topology::BaseMeshTopology::Tetra 
Element
typedef
core::componentmodel::topology::BaseMeshTopology::SeqTetras 
VecElement

Public Member Functions

void getRotation (Transformation &R, unsigned int nodeIdx)
 TetrahedronFEMForceField ()
void parse (core::objectmodel::BaseObjectDescription *arg)
 Parse the given description to assign values to this object's fields and potentially other parameters.
void setPoissonRatio (Real val)
void setYoungModulus (Real val)
void setMethod (std::string methodName)
void setMethod (int val)
void setUpdateStiffnessMatrix (bool val)
void setComputeGlobalMatrix (bool val)
virtual void init ()
 Initialization method called at graph modification, during bottom-up traversal.
virtual void reinit ()
 Update method called when variables used in precomputation are modified.
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, double kFactor, double bFactor)
 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 &x)
 Get the potential energy associated to this ForceField.
virtual void addKToMatrix (sofa::defaulttype::BaseMatrix *, SReal, unsigned int &)
 Compute the system matrix corresponding to k K.
void draw ()
 Render internal data of this object, for debugging purposes.

Data Fields

DataPtr< VecCoord > f_initialPoints
 the intial positions of the points
int method
Data< std::string > f_method
 the computation method of the displacements
Real _poissonRatio
DataPtr< Real > f_poissonRatio
Real _youngModulus
DataPtr< Real > f_youngModulus
VecReal _localStiffnessFactor
DataPtr< VecReal > f_localStiffnessFactor
bool _updateStiffnessMatrix
DataPtr< bool > f_updateStiffnessMatrix
bool _assembling
DataPtr< bool > f_assembling

Protected Types

typedef vector< MaterialStiffness > VecMaterialStiffness
 Vector of material stiffness of each tetrahedron.
typedef vector
< StrainDisplacement > 
VecStrainDisplacement
 a vector of strain-displacement matrices
Per element (tetrahedron) data
typedef VecNoInit< 12, Real > Displacement
 Displacement vector (deformation of the 4 corners of a tetrahedron.
typedef Mat< 6, 6, Real > MaterialStiffness
 Material stiffness matrix of a tetrahedron.
typedef Mat< 12, 6, Real > StrainDisplacement
 Strain-displacement matrix.
typedef MatNoInit< 3, 3, Real > Transformation
 Rigid transformation (rotation) matrix.
typedef Mat< 12, 12, Real > StiffnessMatrix
 Stiffness matrix ( = RJKJtRt with K the Material stiffness matrix, J the strain-displacement matrix, and R the transformation matrix if any ).

Protected Member Functions

void computeStrainDisplacement (StrainDisplacement &J, Coord a, Coord b, Coord c, Coord d)
Real peudo_determinant_for_coef (const Mat< 2, 3, Real > &M)
void computeStiffnessMatrix (StiffnessMatrix &S, StiffnessMatrix &SR, const MaterialStiffness &K, const StrainDisplacement &J, const Transformation &Rot)
void computeMaterialStiffness (int i, Index &a, Index &b, Index &c, Index &d)
void computeForce (Displacement &F, const Displacement &Depl, const MaterialStiffness &K, const StrainDisplacement &J)
void computeForce (Displacement &F, const Displacement &Depl, const MaterialStiffness &K, const StrainDisplacement &J, double fact)
void initSmall (int i, Index &a, Index &b, Index &c, Index &d)
void accumulateForceSmall (Vector &f, const Vector &p, typename VecElement::const_iterator elementIt, Index elementIndex)
void applyStiffnessSmall (Vector &f, const Vector &x, int i=0, Index a=0, Index b=1, Index c=2, Index d=3, double fact=1.0)
void initLarge (int i, Index &a, Index &b, Index &c, Index &d)
void computeRotationLarge (Transformation &r, const Vector &p, const Index &a, const Index &b, const Index &c)
void accumulateForceLarge (Vector &f, const Vector &p, typename VecElement::const_iterator elementIt, Index elementIndex)
void applyStiffnessLarge (Vector &f, const Vector &x, int i=0, Index a=0, Index b=1, Index c=2, Index d=3, double fact=1.0)
void initPolar (int i, Index &a, Index &b, Index &c, Index &d)
void accumulateForcePolar (Vector &f, const Vector &p, typename VecElement::const_iterator elementIt, Index elementIndex)
void applyStiffnessPolar (Vector &f, const Vector &x, int i=0, Index a=0, Index b=1, Index c=2, Index d=3, double fact=1.0)
void handleTopologyChange ()
 Handle topological Changes.

Protected Attributes

VecMaterialStiffness _materialsStiffnesses
 Vector of material stiffness matrices of each tetrahedron.
VecStrainDisplacement _strainDisplacements
 the strain-displacement matrices vector
SReal m_potentialEnergy
core::componentmodel::topology::BaseMeshTopology * _mesh
const VecElement * _indexedElements
VecCoord _initialPoints
 the intial positions of the points
bool needUpdateTopology
TetrahedronFEMForceFieldInternalData
< DataTypes > 
data
vector< helper::fixed_array
< Coord, 4 > > 
_rotatedInitialElements
 The initials positions in its frame.
vector< Transformation > _rotations
vector< Transformation > _initialRotations
vector< Transformation > _initialTransformation
vector< unsigned int > _rotationIdx

Friends

class TetrahedronFEMForceFieldInternalData< DataTypes >

Detailed Description

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

Compute Finite Element forces based on tetrahedral elements.

Definition at line 72 of file TetrahedronFEMForceField.h.


Member Typedef Documentation

template<class DataTypes >
typedef std::pair<int,Real> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::Col_Value [protected]

Definition at line 124 of file TetrahedronFEMForceField.h.

Definition at line 126 of file TetrahedronFEMForceField.h.

Definition at line 125 of file TetrahedronFEMForceField.h.

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

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

template<class DataTypes >
typedef VecNoInit<12, Real> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::Displacement [protected]

Displacement vector (deformation of the 4 corners of a tetrahedron.

Definition at line 97 of file TetrahedronFEMForceField.h.

Definition at line 84 of file TetrahedronFEMForceField.h.

Definition at line 83 of file TetrahedronFEMForceField.h.

template<class DataTypes >
typedef Mat<6, 6, Real> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::MaterialStiffness [protected]

Material stiffness matrix of a tetrahedron.

Definition at line 100 of file TetrahedronFEMForceField.h.

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

Definition at line 81 of file TetrahedronFEMForceField.h.

template<class DataTypes >
typedef Mat<12, 12, Real> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::StiffnessMatrix [protected]

Stiffness matrix ( = RJKJtRt with K the Material stiffness matrix, J the strain-displacement matrix, and R the transformation matrix if any ).

Definition at line 109 of file TetrahedronFEMForceField.h.

template<class DataTypes >
typedef Mat<12, 6, Real> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::StrainDisplacement [protected]

Strain-displacement matrix.

Definition at line 103 of file TetrahedronFEMForceField.h.

template<class DataTypes >
typedef MatNoInit<3, 3, Real> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::Transformation [protected]

Rigid transformation (rotation) matrix.

Definition at line 106 of file TetrahedronFEMForceField.h.

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

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

Definition at line 85 of file TetrahedronFEMForceField.h.

Vector of material stiffness of each tetrahedron.

Definition at line 114 of file TetrahedronFEMForceField.h.

template<class DataTypes >
typedef DataTypes::VecReal sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::VecReal

Definition at line 77 of file TetrahedronFEMForceField.h.

a vector of strain-displacement matrices

Definition at line 115 of file TetrahedronFEMForceField.h.

Definition at line 78 of file TetrahedronFEMForceField.h.


Member Enumeration Documentation

template<class DataTypes >
anonymous enum

Enumerator:
SMALL  Symbol of small displacements tetrahedron solver.
LARGE  Symbol of large displacements tetrahedron solver.
POLAR 

Definition at line 87 of file TetrahedronFEMForceField.h.


Constructor & Destructor Documentation

Definition at line 161 of file TetrahedronFEMForceField.h.


Member Function Documentation

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::accumulateForceLarge ( Vector &  f,
const Vector &  p,
typename VecElement::const_iterator  elementIt,
Index  elementIndex 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::accumulateForcePolar ( Vector &  f,
const Vector &  p,
typename VecElement::const_iterator  elementIt,
Index  elementIndex 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::accumulateForceSmall ( Vector &  f,
const Vector &  p,
typename VecElement::const_iterator  elementIt,
Index  elementIndex 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::addDForce ( VecDeriv &  df,
const VecDeriv &  dx,
double  kFactor,
double  bFactor 
) [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 += kFactor K dx + bFactor B dx $

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

To support old components that implement the deprecated addForce method without scalar coefficients, it defaults to using a temporaty vector to compute $ K dx $ and then manually scaling all values by kFactor.

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

Definition at line 1246 of file TetrahedronFEMForceField.inl.

References sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_indexedElements, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::applyStiffnessLarge(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::applyStiffnessPolar(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::applyStiffnessSmall(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::LARGE, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::method, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::POLAR, and sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::SMALL.

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

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::addKToMatrix ( sofa::defaulttype::BaseMatrix *  matrix,
SReal  kFact,
unsigned int &  offset 
) [inline, virtual]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::applyStiffnessLarge ( Vector &  f,
const Vector &  x,
int  i = 0,
Index  a = 0,
Index  b = 1,
Index  c = 2,
Index  d = 3,
double  fact = 1.0 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::applyStiffnessPolar ( Vector &  f,
const Vector &  x,
int  i = 0,
Index  a = 0,
Index  b = 1,
Index  c = 2,
Index  d = 3,
double  fact = 1.0 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::applyStiffnessSmall ( Vector &  f,
const Vector &  x,
int  i = 0,
Index  a = 0,
Index  b = 1,
Index  c = 2,
Index  d = 3,
double  fact = 1.0 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeForce ( Displacement &  F,
const Displacement &  Depl,
const MaterialStiffness &  K,
const StrainDisplacement &  J,
double  fact 
) [inline, protected]

Definition at line 322 of file TetrahedronFEMForceField.inl.

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeForce ( Displacement &  F,
const Displacement &  Depl,
const MaterialStiffness &  K,
const StrainDisplacement &  J 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeMaterialStiffness ( int  i,
Index &  a,
Index &  b,
Index &  c,
Index &  d 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeRotationLarge ( Transformation &  r,
const Vector &  p,
const Index &  a,
const Index &  b,
const Index &  c 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeStiffnessMatrix ( StiffnessMatrix &  S,
StiffnessMatrix &  SR,
const MaterialStiffness &  K,
const StrainDisplacement &  J,
const Transformation &  Rot 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeStrainDisplacement ( StrainDisplacement &  J,
Coord  a,
Coord  b,
Coord  c,
Coord  d 
) [inline, protected]

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

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

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::getRotation ( Transformation &  R,
unsigned int  nodeIdx 
) [inline]

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

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

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::initLarge ( int  i,
Index &  a,
Index &  b,
Index &  c,
Index &  d 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::initPolar ( int  i,
Index &  a,
Index &  b,
Index &  c,
Index &  d 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::initSmall ( int  i,
Index &  a,
Index &  b,
Index &  c,
Index &  d 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::parse ( core::objectmodel::BaseObjectDescription *  arg  )  [inline, virtual]

Parse the given description to assign values to this object's fields and potentially other parameters.

Reimplemented from sofa::core::objectmodel::Base.

Definition at line 981 of file TetrahedronFEMForceField.inl.

References sofa::core::objectmodel::BaseObjectDescription::getAttribute(), and sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setComputeGlobalMatrix().

template<class DataTypes >
TetrahedronFEMForceField< DataTypes >::Real sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::peudo_determinant_for_coef ( const Mat< 2, 3, Real > &  M  )  [inline, protected]

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

Update method called when variables used in precomputation are modified.

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

Definition at line 1131 of file TetrahedronFEMForceField.inl.

References sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_assembling, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_indexedElements, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_initialPoints, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_initialRotations, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_initialTransformation, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_materialsStiffnesses, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_rotatedInitialElements, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_rotationIdx, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_rotations, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_stiffnesses, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_strainDisplacements, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeMaterialStiffness(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::f_initialPoints, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::f_method, sofa::core::objectmodel::Data< T >::getValue(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getX0(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::initLarge(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::initPolar(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::initSmall(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::LARGE, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::method, sofa::core::componentmodel::behavior::ForceField< DataTypes >::mstate, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::POLAR, sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setMethod(), and sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::SMALL.

Referenced by sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::addForce(), and sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::init().

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setComputeGlobalMatrix ( bool  val  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setMethod ( int  val  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setMethod ( std::string  methodName  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setPoissonRatio ( Real  val  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setUpdateStiffnessMatrix ( bool  val  )  [inline]

template<class DataTypes >
void sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::setYoungModulus ( Real  val  )  [inline]


Friends And Related Function Documentation

template<class DataTypes >
friend class TetrahedronFEMForceFieldInternalData< DataTypes > [friend]

Definition at line 140 of file TetrahedronFEMForceField.h.


Field Documentation

template<class DataTypes >
vector<unsigned int> sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::_rotationIdx [protected]

Definition at line 139 of file TetrahedronFEMForceField.h.

Definition at line 131 of file TetrahedronFEMForceField.h.


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

Generated on Sun Nov 23 04:20:13 2008 for Sofa by  doxygen 1.5.7.1