#include <SpringEdgeDataForceField.h>


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 |
Definition at line 50 of file SpringEdgeDataForceField.h.
| typedef DataTypes::Coord sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Coord |
Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.
Definition at line 55 of file SpringEdgeDataForceField.h.
| typedef DataTypes::Deriv sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Deriv |
Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.
Definition at line 56 of file SpringEdgeDataForceField.h.
| typedef Coord::value_type sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Real |
Definition at line 57 of file SpringEdgeDataForceField.h.
| typedef DataTypes::VecCoord sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::VecCoord |
Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.
Definition at line 53 of file SpringEdgeDataForceField.h.
| typedef DataTypes::VecDeriv sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::VecDeriv |
Reimplemented from sofa::core::componentmodel::behavior::ForceField< DataTypes >.
Definition at line 54 of file SpringEdgeDataForceField.h.
| sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::SpringEdgeDataForceField | ( | core::componentmodel::behavior::MechanicalState< DataTypes > * | _object | ) | [inline] |
Definition at line 122 of file SpringEdgeDataForceField.inl.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray.
| 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.
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.
| void sofa::component::forcefield::SpringEdgeDataForceField< 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 209 of file SpringEdgeDataForceField.inl.
References dot(), force, sofa::component::topology::EdgeSetTopologyContainer::getEdgeArray(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::kd, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::ks, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_potentialEnergy, 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.
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addSpring | ( | int | m1, | |
| int | m2, | |||
| SReal | ks, | |||
| SReal | kd, | |||
| SReal | initlen | |||
| ) | [inline, protected] |
Definition at line 112 of file SpringEdgeDataForceField.inl.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray, and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology.
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::clear | ( | int | reserve = 0 |
) | [inline] |
Definition at line 132 of file SpringEdgeDataForceField.h.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray.
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings | ( | ) | [inline] |
Definition at line 164 of file SpringEdgeDataForceField.inl.
References sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgeLength(), sofa::component::topology::EdgeSetTopologyContainer::getEdgeArray(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_stiffness, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_viscosity, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray, and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::init().
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::draw | ( | ) | [inline, virtual] |
Render internal data of this object, for debugging purposes.
Reimplemented from sofa::core::objectmodel::BaseObject.
Definition at line 297 of file SpringEdgeDataForceField.inl.
References sofa::core::objectmodel::BaseObject::getContext(), sofa::component::topology::EdgeSetTopologyContainer::getEdgeArray(), norm(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::Spring::restLength, sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray, and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology.
| core::componentmodel::behavior::MechanicalState<DataTypes>* sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getObject | ( | ) | [inline] |
Definition at line 105 of file SpringEdgeDataForceField.h.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::object.
| 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.
| const component::topology::EdgeData<Spring>& sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getSpringArray | ( | ) | const [inline] |
Definition at line 125 of file SpringEdgeDataForceField.h.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray.
Referenced by sofa::component::forcefield::springCreationFunction().
| Real sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getStiffness | ( | ) | const [inline] |
Definition at line 119 of file SpringEdgeDataForceField.h.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_stiffness.
Referenced by sofa::component::forcefield::springCreationFunction().
| const Real sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getViscosity | ( | ) | const [inline] |
Definition at line 122 of file SpringEdgeDataForceField.h.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_viscosity.
Referenced by sofa::component::forcefield::springCreationFunction().
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::handleEvent | ( | Event * | e | ) | [inline, virtual] |
Handle an event.
Reimplemented from sofa::core::objectmodel::BaseObject.
Definition at line 180 of file SpringEdgeDataForceField.inl.
References sofa::core::objectmodel::BaseObject::getContext(), sofa::component::topology::TopologyChangedEvent::getTopology(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray, and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology.
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::init | ( | void | ) | [inline, virtual] |
Initialization method called at graph modification, during bottom-up traversal.
Reimplemented from sofa::core::objectmodel::BaseObject.
Definition at line 134 of file SpringEdgeDataForceField.inl.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings(), sofa::core::objectmodel::BaseObject::f_listening, sofa::core::objectmodel::BaseObject::getContext(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::load(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_filename, sofa::core::objectmodel::Data< T >::setValue(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology.
| bool sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::load | ( | const char * | filename | ) | [inline] |
Definition at line 96 of file SpringEdgeDataForceField.inl.
References sofa::helper::io::MassSpringLoader::load().
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::init().
| void sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::resizeArray | ( | unsigned int | n | ) | [inline, protected] |
Definition at line 107 of file SpringEdgeDataForceField.inl.
References sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray.
friend class Loader [friend] |
Definition at line 138 of file SpringEdgeDataForceField.h.
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().
double sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_potentialEnergy [protected] |
Definition at line 79 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addForce(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getPotentialEnergy().
DataField<double> sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_stiffness [protected] |
By default, assume that all edges have the same stiffness.
Definition at line 90 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getStiffness().
DataField<double> sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::m_viscosity [protected] |
By default, assume that all edges have the same viscosity.
Definition at line 92 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getViscosity().
core::componentmodel::behavior::MechanicalState<DataTypes>* sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::object [protected] |
Definition at line 84 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getObject().
component::topology::EdgeData<Spring> sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::springArray [protected] |
where the springs information are stored
Definition at line 83 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addDForce(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addForce(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addSpring(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::clear(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::draw(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::getSpringArray(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::handleEvent(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::resizeArray(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::SpringEdgeDataForceField().
component::topology::EdgeSetTopology<DataTypes>* sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::topology [protected] |
the EdgeSet topology used to get the list of edges
Definition at line 86 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addDForce(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addForce(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addSpring(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::createDefaultSprings(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::draw(), sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::handleEvent(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::init().
bool sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::updateMatrix [protected] |
if the edge matrices should be updated
Definition at line 81 of file SpringEdgeDataForceField.h.
Referenced by sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addDForce(), and sofa::component::forcefield::SpringEdgeDataForceField< DataTypes >::addForce().
1.5.7.1