#include <BaseForceField.h>


Public Member Functions | |
| virtual | ~BaseForceField () |
| virtual int | getFracturedEdge () |
Vector operations | |
| virtual void | addForce ()=0 |
| 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 (double kFactor=1.0, double bFactor=0.0)=0 |
| Compute the force derivative given a small displacement from the position and velocity used in the previous call to addForce(). | |
| virtual void | addDForceV (double kFactor=1.0, double bFactor=0.0)=0 |
| Same as addDForce(), except the velocity vector should be used instead of dx. | |
| virtual void | addMBKdx (double mFactor, double bFactor, double kFactor) |
| Accumulate the contribution of M, B, and/or K matrices multiplied by the dx vector with the given coefficients. | |
| virtual void | addMBKv (double mFactor, double bFactor, double kFactor) |
| Accumulate the contribution of M, B, and/or K matrices multiplied by the v vector with the given coefficients. | |
| virtual double | getPotentialEnergy ()=0 |
| Get the potential energy associated to this ForceField. | |
Matrix operations | |
| virtual void | addKToMatrix (sofa::defaulttype::BaseMatrix *matrix, double kFact, unsigned int &offset) |
| Compute the system matrix corresponding to k K. | |
| virtual void | addBToMatrix (sofa::defaulttype::BaseMatrix *matrix, double bFact, unsigned int &offset) |
| Compute the system matrix corresponding to b B. | |
| virtual void | addMBKToMatrix (sofa::defaulttype::BaseMatrix *matrix, double mFact, double bFact, double kFact, unsigned int &offset) |
| Compute the system matrix corresponding to m M + b B + k K. | |
This class define the abstract API common to all force fields. A force field computes forces applied to one or more simulated body given its current position and velocity.
Forces can be internal to a given body (attached to one MechanicalState, see the ForceField class), or link several bodies together (such as contact forces, see the InteractionForceField class).
For implicit integration schemes, it must also compute the derivative ( df, given a displacement dx ).
Definition at line 62 of file BaseForceField.h.
| virtual sofa::core::componentmodel::behavior::BaseForceField::~BaseForceField | ( | ) | [inline, virtual] |
Definition at line 65 of file BaseForceField.h.
| void sofa::core::componentmodel::behavior::BaseForceField::addBToMatrix | ( | sofa::defaulttype::BaseMatrix * | matrix, | |
| double | bFact, | |||
| unsigned int & | offset | |||
| ) | [virtual] |
Compute the system matrix corresponding to b B.
| matrix | matrix to add the result to | |
| bFact | coefficient for damping contributions (i.e. first derivatives term in the ODE) | |
| offset | current row/column offset |
Definition at line 58 of file BaseForceField.cpp.
Referenced by addMBKToMatrix().
| virtual void sofa::core::componentmodel::behavior::BaseForceField::addDForce | ( | double | kFactor = 1.0, |
|
| double | bFactor = 0.0 | |||
| ) | [pure 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 $
Implemented in sofa::core::componentmodel::behavior::ForceField< TDataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< TDataTypes1, TDataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< TDataTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::gpu::cuda::CudaVectorTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::defaulttype::StdVectorTypes >, sofa::core::componentmodel::behavior::ForceField< DataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< DataTypes1, DataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< CudaVec3fTypes >, and sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Referenced by addMBKdx(), and sofa::simulation::MechanicalComputeDfVisitor::fwdForceField().
| virtual void sofa::core::componentmodel::behavior::BaseForceField::addDForceV | ( | double | kFactor = 1.0, |
|
| double | bFactor = 0.0 | |||
| ) | [pure virtual] |
Same as addDForce(), except the velocity vector should be used instead of dx.
If the ForceField can be represented as a matrix, this method computes $ df += kFactor K v + bFactor B v $
Implemented in sofa::core::componentmodel::behavior::ForceField< TDataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< TDataTypes1, TDataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< TDataTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::gpu::cuda::CudaVectorTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::defaulttype::StdVectorTypes >, sofa::core::componentmodel::behavior::ForceField< DataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< DataTypes1, DataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< CudaVec3fTypes >, and sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Referenced by addMBKv(), and sofa::simulation::MechanicalComputeDfVisitor::fwdForceField().
| virtual void sofa::core::componentmodel::behavior::BaseForceField::addForce | ( | ) | [pure 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 $
Implemented in sofa::core::componentmodel::behavior::ForceField< TDataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< TDataTypes1, TDataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< TDataTypes >, sofa::component::forcefield::TensorForceField< DataTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::gpu::cuda::CudaVectorTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::defaulttype::StdVectorTypes >, sofa::core::componentmodel::behavior::ForceField< DataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< DataTypes1, DataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< CudaVec3fTypes >, and sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >.
Referenced by sofa::simulation::MechanicalComputeForceVisitor::fwdForceField(), and sofa::simulation::AnimateVisitor::fwdInteractionForceField().
| void sofa::core::componentmodel::behavior::BaseForceField::addKToMatrix | ( | sofa::defaulttype::BaseMatrix * | matrix, | |
| double | kFact, | |||
| unsigned int & | offset | |||
| ) | [virtual] |
Compute the system matrix corresponding to k K.
| matrix | matrix to add the result to | |
| kFact | coefficient for stiffness contributions (i.e. DOFs term in the ODE) | |
| offset | current row/column offset |
Reimplemented in sofa::component::forcefield::BeamFEMForceField< DataTypes >, sofa::component::forcefield::HexahedronFEMForceField< DataTypes >, sofa::component::forcefield::TetrahedralCorotationalFEMForceField< DataTypes >, and sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >.
Definition at line 53 of file BaseForceField.cpp.
Referenced by addMBKToMatrix().
| void sofa::core::componentmodel::behavior::BaseForceField::addMBKdx | ( | double | mFactor, | |
| double | bFactor, | |||
| double | kFactor | |||
| ) | [virtual] |
Accumulate the contribution of M, B, and/or K matrices multiplied by the dx vector with the given coefficients.
This method computes $ df += mFactor M dx + bFactor B dx + kFactor K dx $ In most cases only one of these matrices will be non-null for a given component. For forcefields without mass it simply calls addDForce.
| mFact | coefficient for mass contributions (i.e. second-order derivatives term in the ODE) | |
| bFact | coefficient for damping contributions (i.e. first derivatives term in the ODE) | |
| kFact | coefficient for stiffness contributions (i.e. DOFs term in the ODE) |
Reimplemented in sofa::core::componentmodel::behavior::Mass< DataTypes >.
Definition at line 41 of file BaseForceField.cpp.
References addDForce().
Referenced by sofa::simulation::MechanicalAddMBKdxVisitor::fwdForceField().
| void sofa::core::componentmodel::behavior::BaseForceField::addMBKToMatrix | ( | sofa::defaulttype::BaseMatrix * | matrix, | |
| double | mFact, | |||
| double | bFact, | |||
| double | kFact, | |||
| unsigned int & | offset | |||
| ) | [virtual] |
Compute the system matrix corresponding to m M + b B + k K.
| matrix | matrix to add the result to | |
| mFact | coefficient for mass contributions (i.e. second-order derivatives term in the ODE) | |
| bFact | coefficient for damping contributions (i.e. first derivatives term in the ODE) | |
| kFact | coefficient for stiffness contributions (i.e. DOFs term in the ODE) | |
| offset | current row/column offset |
Reimplemented in sofa::core::componentmodel::behavior::Mass< DataTypes >.
Definition at line 63 of file BaseForceField.cpp.
References addBToMatrix(), and addKToMatrix().
Referenced by sofa::simulation::MechanicalAddMBK_ToMatrixVisitor::fwdForceField().
| void sofa::core::componentmodel::behavior::BaseForceField::addMBKv | ( | double | mFactor, | |
| double | bFactor, | |||
| double | kFactor | |||
| ) | [virtual] |
Accumulate the contribution of M, B, and/or K matrices multiplied by the v vector with the given coefficients.
This method computes $ df += mFactor M v + bFactor B v + kFactor K v $ In most cases only one of these matrices will be non-null for a given component. For forcefields without mass it simply calls addDForceV.
| mFact | coefficient for mass contributions (i.e. second-order derivatives term in the ODE) | |
| bFact | coefficient for damping contributions (i.e. first derivatives term in the ODE) | |
| kFact | coefficient for stiffness contributions (i.e. DOFs term in the ODE) |
Reimplemented in sofa::core::componentmodel::behavior::Mass< DataTypes >.
Definition at line 47 of file BaseForceField.cpp.
References addDForceV().
Referenced by sofa::simulation::MechanicalAddMBKdxVisitor::fwdForceField().
| virtual int sofa::core::componentmodel::behavior::BaseForceField::getFracturedEdge | ( | ) | [inline, virtual] |
Reimplemented in sofa::component::forcefield::TriangularFEMForceField< DataTypes >.
Definition at line 159 of file BaseForceField.h.
| virtual double sofa::core::componentmodel::behavior::BaseForceField::getPotentialEnergy | ( | ) | [pure virtual] |
Get the potential energy associated to this ForceField.
Used to extimate the total energy of the system by some post-stabilization techniques.
Implemented in sofa::core::componentmodel::behavior::ForceField< TDataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< TDataTypes1, TDataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< TDataTypes >, sofa::component::forcefield::MeshSpringForceField< DataTypes >, sofa::component::forcefield::TensorForceField< DataTypes >, sofa::component::interactionforcefield::RepulsiveSpringForceField< DataTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::gpu::cuda::CudaVectorTypes >, sofa::core::componentmodel::behavior::ForceField< sofa::defaulttype::StdVectorTypes >, sofa::core::componentmodel::behavior::ForceField< DataTypes >, sofa::core::componentmodel::behavior::MixedInteractionForceField< DataTypes1, DataTypes2 >, sofa::core::componentmodel::behavior::PairInteractionForceField< CudaVec3fTypes >, sofa::core::componentmodel::behavior::PairInteractionForceField< DataTypes >, and sofa::component::forcefield::MeshSpringForceField< sofa::defaulttype::StdVectorTypes >.
Referenced by sofa::simulation::MechanicalComputeEnergyVisitor::fwdForceField().
1.5.7.1