#include <SpringForceField.h>


Data Structures | |
| class | Loader |
| class | Spring |
Public Types | |
| typedef core::componentmodel::behavior::PairInteractionForceField < DataTypes > | Inherit |
| typedef DataTypes::VecCoord | VecCoord |
| typedef DataTypes::VecDeriv | VecDeriv |
| typedef DataTypes::Coord | Coord |
| typedef DataTypes::Deriv | Deriv |
| typedef Coord::value_type | Real |
| typedef core::componentmodel::behavior::MechanicalState < DataTypes > | MechanicalState |
Public Member Functions | |
| SpringForceField (MechanicalState *object1, MechanicalState *object2, SReal _ks=100.0, SReal _kd=5.0) | |
| SpringForceField (SReal _ks=100.0, SReal _kd=5.0) | |
| virtual void | parse (core::objectmodel::BaseObjectDescription *arg) |
| Parse the given description to assign values to this object's fields and potentially other parameters. | |
| bool | load (const char *filename) |
| core::componentmodel::behavior::MechanicalState < DataTypes > * | getObject1 () |
| core::componentmodel::behavior::MechanicalState < DataTypes > * | getObject2 () |
| virtual void | init () |
| Initialization method called at graph modification, during bottom-up traversal. | |
| virtual void | addForce (VecDeriv &f1, VecDeriv &f2, const VecCoord &x1, const VecCoord &x2, const VecDeriv &v1, const VecDeriv &v2) |
| 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 &df1, VecDeriv &df2, const VecDeriv &dx1, const VecDeriv &dx2) |
| 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 &, const VecCoord &) |
| Get the potential energy associated to this ForceField. | |
| SReal | getStiffness () |
| SReal | getDamping () |
| void | setStiffness (SReal _ks) |
| void | setDamping (SReal _kd) |
| void | draw () |
| Render internal data of this object, for debugging purposes. | |
| void | clear (int reserve=0) |
| void | addSpring (int m1, int m2, SReal ks, SReal kd, SReal initlen) |
Protected Member Functions | |
| void | addSpringForce (SReal &potentialEnergy, VecDeriv &f1, const VecCoord &p1, const VecDeriv &v1, VecDeriv &f2, const VecCoord &p2, const VecDeriv &v2, int i, const Spring &spring) |
Protected Attributes | |
| SReal | m_potentialEnergy |
| Data< SReal > | ks |
| Data< SReal > | kd |
| Data< sofa::helper::vector < Spring > > | springs |
| SpringForceFieldInternalData < DataTypes > | data |
Friends | |
| class | SpringForceFieldInternalData< DataTypes > |
Definition at line 57 of file SpringForceField.h.
| typedef DataTypes::Coord sofa::component::forcefield::SpringForceField< DataTypes >::Coord |
Reimplemented from sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 63 of file SpringForceField.h.
| typedef DataTypes::Deriv sofa::component::forcefield::SpringForceField< DataTypes >::Deriv |
Reimplemented from sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 64 of file SpringForceField.h.
| typedef core::componentmodel::behavior::PairInteractionForceField<DataTypes> sofa::component::forcefield::SpringForceField< DataTypes >::Inherit |
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 60 of file SpringForceField.h.
| typedef core::componentmodel::behavior::MechanicalState<DataTypes> sofa::component::forcefield::SpringForceField< DataTypes >::MechanicalState |
| typedef Coord::value_type sofa::component::forcefield::SpringForceField< DataTypes >::Real |
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::QuadBendingSprings< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::forcefield::TriangleBendingSprings< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 65 of file SpringForceField.h.
| typedef DataTypes::VecCoord sofa::component::forcefield::SpringForceField< DataTypes >::VecCoord |
Reimplemented from sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::QuadBendingSprings< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::forcefield::TriangleBendingSprings< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 61 of file SpringForceField.h.
| typedef DataTypes::VecDeriv sofa::component::forcefield::SpringForceField< DataTypes >::VecDeriv |
Reimplemented from sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 62 of file SpringForceField.h.
| sofa::component::forcefield::SpringForceField< DataTypes >::SpringForceField | ( | MechanicalState * | object1, | |
| MechanicalState * | object2, | |||
| SReal | _ks = 100.0, |
|||
| SReal | _kd = 5.0 | |||
| ) | [inline] |
Definition at line 53 of file SpringForceField.inl.
| sofa::component::forcefield::SpringForceField< DataTypes >::SpringForceField | ( | SReal | _ks = 100.0, |
|
| SReal | _kd = 5.0 | |||
| ) | [inline] |
Definition at line 62 of file SpringForceField.inl.
| void sofa::component::forcefield::SpringForceField< DataTypes >::addDForce | ( | VecDeriv & | df1, | |
| VecDeriv & | df2, | |||
| const VecDeriv & | dx1, | |||
| const VecDeriv & | dx2 | |||
| ) | [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 PairInteractionForceField::addDForce() method.
Reimplemented from sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Definition at line 145 of file SpringForceField.inl.
| void sofa::component::forcefield::SpringForceField< DataTypes >::addForce | ( | VecDeriv & | f1, | |
| VecDeriv & | f2, | |||
| const VecCoord & | x1, | |||
| const VecCoord & | x2, | |||
| const VecDeriv & | v1, | |||
| const VecDeriv & | v2 | |||
| ) | [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::PairInteractionForceField< DataTypes >.
Reimplemented in sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 133 of file SpringForceField.inl.
References sofa::component::forcefield::SpringForceField< DataTypes >::addSpringForce(), sofa::component::forcefield::SpringForceField< DataTypes >::m_potentialEnergy, and sofa::component::forcefield::SpringForceField< DataTypes >::springs.
| void sofa::component::forcefield::SpringForceField< DataTypes >::addSpring | ( | int | m1, | |
| int | m2, | |||
| SReal | ks, | |||
| SReal | kd, | |||
| SReal | initlen | |||
| ) | [inline] |
Definition at line 138 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::springs.
Referenced by sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >::bwdInit(), and main().
| void sofa::component::forcefield::SpringForceField< DataTypes >::addSpringForce | ( | SReal & | potentialEnergy, | |
| VecDeriv & | f1, | |||
| const VecCoord & | p1, | |||
| const VecDeriv & | v1, | |||
| VecDeriv & | f2, | |||
| const VecCoord & | p2, | |||
| const VecDeriv & | v2, | |||
| int | i, | |||
| const Spring & | spring | |||
| ) | [inline, protected] |
Reimplemented in sofa::component::forcefield::StiffSpringForceField< DataTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 112 of file SpringForceField.inl.
References dot(), force, sofa::component::forcefield::SpringForceField< DataTypes >::Spring::initpos, sofa::component::forcefield::SpringForceField< DataTypes >::Spring::kd, sofa::component::forcefield::SpringForceField< DataTypes >::Spring::ks, sofa::component::forcefield::SpringForceField< DataTypes >::Spring::m1, and sofa::component::forcefield::SpringForceField< DataTypes >::Spring::m2.
Referenced by sofa::component::forcefield::SpringForceField< DataTypes >::addForce().
| void sofa::component::forcefield::SpringForceField< DataTypes >::clear | ( | int | reserve = 0 |
) | [inline] |
Definition at line 130 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::springs.
Referenced by sofa::component::forcefield::TriangleBendingSprings< DataTypes >::init(), and sofa::component::forcefield::MeshSpringForceField< DataTypes >::init().
| void sofa::component::forcefield::SpringForceField< DataTypes >::draw | ( | ) | [inline, virtual] |
Render internal data of this object, for debugging purposes.
Reimplemented from sofa::core::objectmodel::BaseObject.
Reimplemented in sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >, sofa::component::forcefield::QuadBendingSprings< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, and sofa::component::forcefield::SparseGridSpringForceField< DataTypes >.
Definition at line 151 of file SpringForceField.inl.
References sofa::core::objectmodel::BaseObject::getContext(), sofa::core::componentmodel::behavior::MechanicalState< TDataTypes >::getX(), sofa::helper::gl::glVertexT(), sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >::mstate1, sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >::mstate2, norm(), and sofa::component::forcefield::SpringForceField< DataTypes >::springs.
Referenced by sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >::draw().
| SReal sofa::component::forcefield::SpringForceField< DataTypes >::getDamping | ( | ) | [inline] |
Definition at line 122 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::kd.
Referenced by sofa::component::forcefield::BoxStiffSpringForceField< DataTypes >::bwdInit().
| core::componentmodel::behavior::MechanicalState<DataTypes>* sofa::component::forcefield::SpringForceField< DataTypes >::getObject1 | ( | ) | [inline] |
Definition at line 113 of file SpringForceField.h.
References sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >::mstate1.
| core::componentmodel::behavior::MechanicalState<DataTypes>* sofa::component::forcefield::SpringForceField< DataTypes >::getObject2 | ( | ) | [inline] |
Definition at line 114 of file SpringForceField.h.
References sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >::mstate2.
| virtual double sofa::component::forcefield::SpringForceField< DataTypes >::getPotentialEnergy | ( | const VecCoord & | x1, | |
| const VecCoord & | x2 | |||
| ) | [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::PairInteractionForceField< DataTypes >.
Definition at line 120 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::m_potentialEnergy.
| SReal sofa::component::forcefield::SpringForceField< DataTypes >::getStiffness | ( | ) | [inline] |
Definition at line 121 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::ks.
| void sofa::component::forcefield::SpringForceField< DataTypes >::init | ( | void | ) | [inline, virtual] |
Initialization method called at graph modification, during bottom-up traversal.
Reimplemented from sofa::core::objectmodel::BaseObject.
Reimplemented in sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::QuadBendingSprings< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, sofa::component::forcefield::TriangleBendingSprings< DataTypes >, sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 106 of file SpringForceField.inl.
References sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >::init().
| bool sofa::component::forcefield::SpringForceField< DataTypes >::load | ( | const char * | filename | ) | [inline] |
Definition at line 93 of file SpringForceField.inl.
References sofa::helper::io::MassSpringLoader::load().
Referenced by sofa::component::forcefield::SpringForceField< DataTypes >::parse().
| void sofa::component::forcefield::SpringForceField< 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.
Reimplemented in sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::SparseGridSpringForceField< DataTypes >, and sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 71 of file SpringForceField.inl.
References sofa::core::objectmodel::BaseObjectDescription::getAttribute(), sofa::component::forcefield::SpringForceField< DataTypes >::load(), and sofa::core::objectmodel::Base::parse().
Referenced by sofa::component::forcefield::SparseGridSpringForceField< DataTypes >::parse(), and sofa::component::forcefield::RegularGridSpringForceField< DataTypes >::parse().
| void sofa::component::forcefield::SpringForceField< DataTypes >::setDamping | ( | SReal | _kd | ) | [inline] |
Definition at line 124 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::kd.
| void sofa::component::forcefield::SpringForceField< DataTypes >::setStiffness | ( | SReal | _ks | ) | [inline] |
Definition at line 123 of file SpringForceField.h.
References sofa::component::forcefield::SpringForceField< DataTypes >::ks.
friend class SpringForceFieldInternalData< DataTypes > [friend] |
Definition at line 101 of file SpringForceField.h.
SpringForceFieldInternalData<DataTypes> sofa::component::forcefield::SpringForceField< DataTypes >::data [protected] |
Definition at line 98 of file SpringForceField.h.
Data<SReal> sofa::component::forcefield::SpringForceField< DataTypes >::kd [protected] |
Definition at line 96 of file SpringForceField.h.
Referenced by sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >::addForce(), sofa::component::forcefield::TriangleBendingSprings< DataTypes >::addSpring(), sofa::component::forcefield::QuadBendingSprings< DataTypes >::addSpring(), sofa::component::forcefield::SpringForceField< DataTypes >::getDamping(), sofa::component::forcefield::SpringForceField< DataTypes >::setDamping(), and sofa::gui::qt::ModifyObject::storeQtSpringTable().
Data<SReal> sofa::component::forcefield::SpringForceField< DataTypes >::ks [protected] |
Definition at line 95 of file SpringForceField.h.
Referenced by sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >::addForce(), sofa::component::forcefield::TriangleBendingSprings< DataTypes >::addSpring(), sofa::component::forcefield::QuadBendingSprings< DataTypes >::addSpring(), sofa::component::forcefield::SpringForceField< DataTypes >::getStiffness(), sofa::component::forcefield::SpringForceField< DataTypes >::setStiffness(), and sofa::gui::qt::ModifyObject::storeQtSpringTable().
SReal sofa::component::forcefield::SpringForceField< DataTypes >::m_potentialEnergy [protected] |
Reimplemented in sofa::component::forcefield::RegularGridSpringForceField< DataTypes >, sofa::component::forcefield::StiffSpringForceField< DataTypes >, and sofa::component::forcefield::StiffSpringForceField< sofa::defaulttype::StdVectorTypes >.
Definition at line 94 of file SpringForceField.h.
Referenced by sofa::component::forcefield::SpringForceField< DataTypes >::addForce(), and sofa::component::forcefield::SpringForceField< DataTypes >::getPotentialEnergy().
Data<sofa::helper::vector<Spring> > sofa::component::forcefield::SpringForceField< DataTypes >::springs [protected] |
Definition at line 97 of file SpringForceField.h.
Referenced by sofa::component::forcefield::StiffSpringForceField< DataTypes >::addDForce(), sofa::component::forcefield::SparseGridSpringForceField< DataTypes >::addDForce(), sofa::component::forcefield::RegularGridSpringForceField< DataTypes >::addDForce(), sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >::addForce(), sofa::component::forcefield::StiffSpringForceField< DataTypes >::addForce(), sofa::component::forcefield::SpringForceField< DataTypes >::addForce(), sofa::component::forcefield::SparseGridSpringForceField< DataTypes >::addForce(), sofa::component::forcefield::RegularGridSpringForceField< DataTypes >::addForce(), sofa::component::forcefield::SpringForceField< DataTypes >::Loader::addSpring(), sofa::component::forcefield::SpringForceField< DataTypes >::addSpring(), sofa::component::forcefield::MeshSpringForceField< DataTypes >::addSpring(), sofa::component::forcefield::SpringForceField< DataTypes >::clear(), and sofa::component::forcefield::SpringForceField< DataTypes >::draw().
1.5.7.1