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

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

#include <HexahedronFEMForceField.h>

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

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

Collaboration graph
[legend]

Public Types

typedef DataTypes::VecCoord VecCoord
typedef DataTypes::VecDeriv VecDeriv
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::Cube 
Element
typedef
core::componentmodel::topology::BaseMeshTopology::SeqCubes 
VecElement

Public Member Functions

 HexahedronFEMForceField ()
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 (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)
 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.
void addKToMatrix (sofa::defaulttype::BaseMatrix *mat, SReal k, unsigned int &offset)
 Compute the system matrix corresponding to k K.
void draw ()
 Render internal data of this object, for debugging purposes.

Data Fields

int method
Data< std::string > f_method
 the computation method of the displacements
Data< Real > f_poissonRatio
Data< Real > f_youngModulus
Data< bool > f_updateStiffnessMatrix
Data< bool > f_assembling

Static Public Attributes

static const int LARGE = 0
 Symbol of mean large displacements tetrahedron solver (frame = edges mean on the 3 directions).
static const int POLAR = 1
 Symbol of polar displacements tetrahedron solver.

Protected Types

typedef Vec< 24, Real > Displacement
 the displacement vector
typedef Mat< 6, 6, Real > MaterialStiffness
 the matrix of material stiffness
typedef vector< MaterialStiffness > VecMaterialStiffness
 a vector of material stiffness matrices
typedef Mat< 24, 24, Real > ElementStiffness
typedef helper::vector
< ElementStiffness > 
VecElementStiffness
typedef Mat< 3, 3, Real > Mat33
typedef Mat33 Transformation
 matrix for rigid transformations like rotations
typedef std::pair< int, Real > Col_Value
typedef vector< Col_Value > CompressedValue
typedef vector< CompressedValue > CompressedMatrix

Protected Member Functions

virtual void computeElementStiffness (ElementStiffness &K, const MaterialStiffness &M, const helper::fixed_array< Coord, 8 > &nodes, const int elementIndice, double stiffnessFactor=1.0)
Mat33 integrateStiffness (int signx0, int signy0, int signz0, int signx1, int signy1, int signz1, const Real u, const Real v, const Real w, const Mat33 &J_1)
void computeMaterialStiffness (int i)
void computeForce (Displacement &F, const Displacement &Depl, const ElementStiffness &K)
void initLarge (int i, const Element &elem)
void computeRotationLarge (Transformation &r, Coord &edgex, Coord &edgey)
virtual void accumulateForceLarge (Vector &f, const Vector &p, int i, const Element &elem)
void initPolar (int i, const Element &elem)
void computeRotationPolar (Transformation &r, Vec< 8, Coord > &nodes)
virtual void accumulateForcePolar (Vector &f, const Vector &p, int i, const Element &elem)

Protected Attributes

VecMaterialStiffness _materialsStiffnesses
 the material stiffness matrices vector
Data< VecElementStiffness > _elementStiffnesses
CompressedMatrix _stiffnesses
double m_potentialEnergy
sofa::core::componentmodel::topology::BaseMeshTopology * _mesh
topology::SparseGridTopology * _sparseGrid
const VecElement * _indexedElements
Data< VecCoord > _initialPoints
 the intial positions of the points
Mat< 8, 3, int > _coef
 coef of each vertices to compute the strain stress matrix
vector< helper::fixed_array
< Coord, 8 > > 
_rotatedInitialElements
 The initials positions in its frame.
vector< Transformation > _rotations
bool _alreadyInit

Static Protected Attributes

static const int _indices [8] = {0,1,3,2,4,5,7,6}
 indices ordering is different than in topology node

Detailed Description

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

Compute Finite Element forces based on hexahedral elements.

Corotational hexahedron from {NMPCPF05, author = "Nesme, Matthieu and Marchal, Maud and Promayon, Emmanuel and Chabanas, Matthieu and Payan, Yohan and Faure, Fran\c{c}ois", title = "Physically Realistic Interactive Simulation for Biological Soft Tissues", journal = "Recent Research Developments in Biomechanics", volume = "2", year = "2005", keywords = "surgical simulation physical animation truth cube", url = "http://www-evasion.imag.fr/Publications/2005/NMPCPF05" }

WARNING: indices ordering is different than in topology node

Y 7---------6 ^ / /| |/ Z / | 3----^----2 | | / | | | 4------|--5 | / | / |/ |/ 0---------1-->X

Definition at line 74 of file HexahedronFEMForceField.h.


Member Typedef Documentation

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

Definition at line 117 of file HexahedronFEMForceField.h.

Definition at line 119 of file HexahedronFEMForceField.h.

Definition at line 118 of file HexahedronFEMForceField.h.

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

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

template<class DataTypes >
typedef Vec<24, Real> sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::Displacement [protected]

the displacement vector

Definition at line 103 of file HexahedronFEMForceField.h.

template<class DataTypes >
typedef core::componentmodel::topology::BaseMeshTopology::Cube sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::Element

Definition at line 89 of file HexahedronFEMForceField.h.

template<class DataTypes >
typedef Mat<24, 24, Real> sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::ElementStiffness [protected]

Definition at line 109 of file HexahedronFEMForceField.h.

Definition at line 84 of file HexahedronFEMForceField.h.

template<class DataTypes >
typedef Mat<3, 3, Real> sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::Mat33 [protected]

Definition at line 113 of file HexahedronFEMForceField.h.

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

the matrix of material stiffness

Definition at line 105 of file HexahedronFEMForceField.h.

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

Definition at line 82 of file HexahedronFEMForceField.h.

template<class DataTypes >
typedef Mat33 sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::Transformation [protected]

matrix for rigid transformations like rotations

Definition at line 114 of file HexahedronFEMForceField.h.

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

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

template<class DataTypes >
typedef core::componentmodel::topology::BaseMeshTopology::SeqCubes sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::VecElement

Definition at line 90 of file HexahedronFEMForceField.h.

Definition at line 110 of file HexahedronFEMForceField.h.

a vector of material stiffness matrices

Definition at line 106 of file HexahedronFEMForceField.h.

Definition at line 79 of file HexahedronFEMForceField.h.


Constructor & Destructor Documentation


Member Function Documentation

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::accumulateForceLarge ( Vector &  f,
const Vector &  p,
int  i,
const Element &  elem 
) [inline, protected, virtual]

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::accumulateForcePolar ( Vector &  f,
const Vector &  p,
int  i,
const Element &  elem 
) [inline, protected, virtual]

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

References sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::_elementStiffnesses, sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::_indexedElements, sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::_indices, sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::_rotations, sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::computeForce(), and SOFA_NEW_HEXA.

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

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

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::computeElementStiffness ( ElementStiffness &  K,
const MaterialStiffness &  M,
const helper::fixed_array< Coord, 8 > &  nodes,
const int  elementIndice,
double  stiffnessFactor = 1.0 
) [inline, protected, virtual]

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

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::computeMaterialStiffness ( int  i  )  [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::computeRotationLarge ( Transformation &  r,
Coord &  edgex,
Coord &  edgey 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::computeRotationPolar ( Transformation &  r,
Vec< 8, Coord > &  nodes 
) [inline, protected]

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

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

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

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::initLarge ( int  i,
const Element &  elem 
) [inline, protected]

template<class DataTypes >
void sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::initPolar ( int  i,
const Element &  elem 
) [inline, protected]

template<class DataTypes >
HexahedronFEMForceField< DataTypes >::Mat33 sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::integrateStiffness ( int  signx0,
int  signy0,
int  signz0,
int  signx1,
int  signy1,
int  signz1,
const Real  u,
const Real  v,
const Real  w,
const Mat33 &  J_1 
) [inline, protected]

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

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

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

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

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

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

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


Field Documentation

template<class DataTypes >
Mat<8,3,int> sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::_coef [protected]

template<class DataTypes >
const int sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::_indices = {0,1,3,2,4,5,7,6} [inline, static, protected]

Definition at line 120 of file HexahedronFEMForceField.h.

template<class DataTypes >
Data<std::string> sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::f_method

template<class DataTypes >
const int sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::LARGE = 0 [static]

Symbol of mean large displacements tetrahedron solver (frame = edges mean on the 3 directions).

Definition at line 93 of file HexahedronFEMForceField.h.

Referenced by sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::addForce(), and sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::reinit().

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

Definition at line 121 of file HexahedronFEMForceField.h.

template<class DataTypes >
const int sofa::component::forcefield::HexahedronFEMForceField< DataTypes >::POLAR = 1 [static]


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