#include <OdeSolverImpl.h>


Public Types | |
| typedef sofa::core::componentmodel::behavior::BaseMechanicalState::VecId | VecId |
Public Member Functions | |
| SolverImpl () | |
| virtual | ~SolverImpl () |
Vector operations | |
Most of these operations can be hidden by using the MultiVector class. | |
| virtual double | finish () |
| Wait for the completion of previous operations and return the result of the last v_dot call. | |
| virtual VecId | v_alloc (VecId::Type t) |
| Allocate a temporary vector. | |
| virtual void | v_free (VecId v) |
| Free a previously allocated temporary vector. | |
| virtual void | v_clear (VecId v) |
| v=0 | |
| virtual void | v_eq (VecId v, VecId a) |
| v=a | |
| virtual void | v_peq (VecId v, VecId a, double f=1.0) |
| v+=f*a | |
| virtual void | v_teq (VecId v, double f) |
| v*=f | |
| virtual void | v_op (VecId v, VecId a, VecId b, double f=1.0) |
| v=a+b*f | |
| virtual void | v_dot (VecId a, VecId b) |
| a dot b ( get result using finish ) | |
| virtual void | v_threshold (VecId a, double threshold) |
| nullify the values below the given threshold | |
| virtual void | propagateDx (VecId dx) |
| Propagate the given displacement through all mappings. | |
| virtual void | propagateDxAndResetDf (VecId dx, VecId df) |
| Propagate the given displacement through all mappings and reset the current force delta. | |
| virtual void | projectResponse (VecId dx, double **W=NULL) |
| Apply projective constraints to the given vector. | |
| virtual void | addMdx (VecId res, VecId dx=VecId(), double factor=1.0) |
| res += factor M.dx | |
| virtual void | integrateVelocity (VecId res, VecId x, VecId v, double dt) |
| res = x + v.dt | |
| virtual void | accFromF (VecId a, VecId f) |
| a = M^-1 . f | |
| virtual void | computeForce (VecId result, bool clear=true, bool accumulate=true) |
| Compute the current force (given the latest propagated position and velocity). | |
| virtual void | computeDf (VecId df, bool clear=true, bool accumulate=true) |
| Compute the current force delta (given the latest propagated displacement). | |
| virtual void | computeDfV (VecId df, bool clear=true, bool accumulate=true) |
| Compute the current force delta (given the latest propagated velocity). | |
| virtual void | addMBKdx (VecId df, double m, double b, double k, bool clear=true, bool accumulate=true) |
| accumulate $ df += (m M + b B + k K) dx $ (given the latest propagated displacement) | |
| virtual void | addMBKv (VecId df, double m, double b, double k, bool clear=true, bool accumulate=true) |
| accumulate $ df += (m M + b B + k K) velocity $ | |
| virtual void | addSeparateGravity (double dt) |
| Add dt*Gravity to the velocity. | |
| virtual void | computeContactForce (VecId result) |
| virtual void | computeContactDf (VecId df) |
Matrix operations | |
| virtual void | addMBK_ToMatrix (defaulttype::BaseMatrix *A, double mFact=1.0, double bFact=1.0, double kFact=1.0, unsigned int offset=0) |
| virtual void | getMatrixDimension (unsigned int *const, unsigned int *const) |
| virtual void | multiVector2BaseVector (VecId src, defaulttype::BaseVector *dest=NULL, unsigned int offset=0) |
| virtual void | multiVectorPeqBaseVector (VecId dest, defaulttype::BaseVector *src=NULL, unsigned int offset=0) |
Debug operations | |
| virtual void | print (VecId v, std::ostream &out) |
| Dump the content of the given vector. | |
| virtual void | printWithElapsedTime (VecId v, unsigned time, std::ostream &out=std::cerr) |
Protected Attributes | |
| double | result |
| Result of latest v_dot operation. | |
Definition at line 42 of file OdeSolverImpl.h.
| typedef sofa::core::componentmodel::behavior::BaseMechanicalState::VecId sofa::simulation::SolverImpl::VecId |
Reimplemented in sofa::simulation::MatrixLinearSolver< Matrix, Vector >, sofa::simulation::OdeSolverImpl, and sofa::simulation::MatrixLinearSolver< TMatrix, TVector >.
Definition at line 45 of file OdeSolverImpl.h.
| sofa::simulation::SolverImpl::SolverImpl | ( | ) |
Definition at line 43 of file OdeSolverImpl.cpp.
| sofa::simulation::SolverImpl::~SolverImpl | ( | ) | [virtual] |
Definition at line 47 of file OdeSolverImpl.cpp.
a = M^-1 . f
Definition at line 130 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::OdeSolverImpl::computeAcc(), sofa::simulation::OdeSolverImpl::computeContactAcc(), and sofa::component::odesolver::EulerSolver::solve().
| void sofa::simulation::SolverImpl::addMBK_ToMatrix | ( | defaulttype::BaseMatrix * | A, | |
| double | mFact = 1.0, |
|||
| double | bFact = 1.0, |
|||
| double | kFact = 1.0, |
|||
| unsigned int | offset = 0 | |||
| ) | [virtual] |
Definition at line 253 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemMBKMatrix().
| void sofa::simulation::SolverImpl::addMBKdx | ( | VecId | df, | |
| double | m, | |||
| double | b, | |||
| double | k, | |||
| bool | clear = true, |
|||
| bool | accumulate = true | |||
| ) | [virtual] |
accumulate $ df += (m M + b B + k K) dx $ (given the latest propagated displacement)
Definition at line 170 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::GraphScatteredMatrix::apply().
| void sofa::simulation::SolverImpl::addMBKv | ( | VecId | df, | |
| double | m, | |||
| double | b, | |||
| double | k, | |||
| bool | clear = true, |
|||
| bool | accumulate = true | |||
| ) | [virtual] |
accumulate $ df += (m M + b B + k K) velocity $
Definition at line 180 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::component::odesolver::EulerImplicitSolver::solve().
| void sofa::simulation::SolverImpl::addMdx | ( | VecId | res, | |
| VecId | dx = VecId(), |
|||
| double | factor = 1.0 | |||
| ) | [virtual] |
res += factor M.dx
Definition at line 120 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::GraphScatteredMatrix::apply(), sofa::component::odesolver::EulerImplicitSolver::solve(), and sofa::component::odesolver::CGImplicitSolver::solve().
| void sofa::simulation::SolverImpl::addSeparateGravity | ( | double | dt | ) | [virtual] |
Add dt*Gravity to the velocity.
Definition at line 203 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::component::odesolver::StaticSolver::solve(), sofa::component::odesolver::RungeKutta4Solver::solve(), sofa::component::odesolver::RungeKutta2Solver::solve(), sofa::component::odesolver::EulerSolver::solve(), sofa::component::odesolver::EulerImplicitSolver::solve(), sofa::component::odesolver::DampVelocitySolver::solve(), and sofa::component::odesolver::CGImplicitSolver::solve().
| void sofa::simulation::SolverImpl::computeContactDf | ( | VecId | df | ) | [virtual] |
Definition at line 215 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
| void sofa::simulation::SolverImpl::computeContactForce | ( | VecId | result | ) | [virtual] |
Definition at line 208 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::OdeSolverImpl::computeContactAcc().
| void sofa::simulation::SolverImpl::computeDf | ( | VecId | df, | |
| bool | clear = true, |
|||
| bool | accumulate = true | |||
| ) | [virtual] |
Compute the current force delta (given the latest propagated displacement).
Definition at line 150 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::GraphScatteredMatrix::apply(), and sofa::component::odesolver::CGImplicitSolver::solve().
| void sofa::simulation::SolverImpl::computeDfV | ( | VecId | df, | |
| bool | clear = true, |
|||
| bool | accumulate = true | |||
| ) | [virtual] |
Compute the current force delta (given the latest propagated velocity).
Definition at line 160 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::component::odesolver::EulerImplicitSolver::solve(), and sofa::component::odesolver::CGImplicitSolver::solve().
| void sofa::simulation::SolverImpl::computeForce | ( | VecId | result, | |
| bool | clear = true, |
|||
| bool | accumulate = true | |||
| ) | [virtual] |
Compute the current force (given the latest propagated position and velocity).
Definition at line 140 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::OdeSolverImpl::computeAcc(), sofa::component::odesolver::StaticSolver::solve(), sofa::component::odesolver::EulerSolver::solve(), sofa::component::odesolver::EulerImplicitSolver::solve(), and sofa::component::odesolver::CGImplicitSolver::solve().
| double sofa::simulation::SolverImpl::finish | ( | ) | [virtual] |
Wait for the completion of previous operations and return the result of the last v_dot call.
Note that currently all methods are blocking so finish simply return the result of the last v_dot call.
Definition at line 50 of file OdeSolverImpl.cpp.
References result.
Referenced by addMBKdx(), addMBKv(), computeContactDf(), computeContactForce(), computeDf(), computeDfV(), computeForce(), and propagateDxAndResetDf().
| void sofa::simulation::SolverImpl::getMatrixDimension | ( | unsigned int * const | nbRow, | |
| unsigned int * const | nbCol | |||
| ) | [virtual] |
Definition at line 248 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemMBKMatrix().
| void sofa::simulation::SolverImpl::integrateVelocity | ( | VecId | res, | |
| VecId | x, | |||
| VecId | v, | |||
| double | dt | |||
| ) | [virtual] |
res = x + v.dt
Definition at line 125 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
| void sofa::simulation::SolverImpl::multiVector2BaseVector | ( | VecId | src, | |
| defaulttype::BaseVector * | dest = NULL, |
|||
| unsigned int | offset = 0 | |||
| ) | [virtual] |
Definition at line 268 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemLHVector(), and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemRHVector().
| void sofa::simulation::SolverImpl::multiVectorPeqBaseVector | ( | VecId | dest, | |
| defaulttype::BaseVector * | src = NULL, |
|||
| unsigned int | offset = 0 | |||
| ) | [virtual] |
Definition at line 276 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solveSystem().
| void sofa::simulation::SolverImpl::print | ( | VecId | v, | |
| std::ostream & | out | |||
| ) | [virtual] |
Dump the content of the given vector.
Definition at line 235 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
| void sofa::simulation::SolverImpl::printWithElapsedTime | ( | VecId | v, | |
| unsigned | time, | |||
| std::ostream & | out = std::cerr | |||
| ) | [virtual] |
Definition at line 240 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext(), and sofa::helper::system::thread::CTime::getTicksPerSec().
| void sofa::simulation::SolverImpl::projectResponse | ( | VecId | dx, | |
| double ** | W = NULL | |||
| ) | [virtual] |
Apply projective constraints to the given vector.
Definition at line 115 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::GraphScatteredMatrix::apply(), sofa::simulation::OdeSolverImpl::computeAcc(), sofa::simulation::OdeSolverImpl::computeContactAcc(), sofa::component::odesolver::StaticSolver::solve(), sofa::component::odesolver::EulerSolver::solve(), sofa::component::odesolver::EulerImplicitSolver::solve(), and sofa::component::odesolver::CGImplicitSolver::solve().
| void sofa::simulation::SolverImpl::propagateDx | ( | VecId | dx | ) | [virtual] |
Propagate the given displacement through all mappings.
Definition at line 104 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::GraphScatteredMatrix::apply(), and sofa::component::odesolver::CGImplicitSolver::solve().
Propagate the given displacement through all mappings and reset the current force delta.
Definition at line 109 of file OdeSolverImpl.cpp.
References finish(), and sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::simulation::GraphScatteredMatrix::apply().
| SolverImpl::VecId sofa::simulation::SolverImpl::v_alloc | ( | VecId::Type | t | ) | [virtual] |
Allocate a temporary vector.
Definition at line 55 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext(), and sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::V_FIRST_DYNAMIC_INDEX.
| void sofa::simulation::SolverImpl::v_clear | ( | VecId | v | ) | [virtual] |
v=0
| v | v=0 |
Definition at line 70 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::component::odesolver::CGImplicitSolver::solve(), and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solveSystem().
a dot b ( get result using finish )
| b | a dot b ( get result using finish ) |
Definition at line 93 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext(), and result.
v=a
| a | v=a |
Definition at line 75 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
| void sofa::simulation::SolverImpl::v_free | ( | VecId | v | ) | [virtual] |
Free a previously allocated temporary vector.
Definition at line 64 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
v=a+b*f
| f | v=a+b*f |
Definition at line 88 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
Referenced by sofa::component::linearsolver::CGLinearSolver< TMatrix, TVector >::cgstep_beta(), and sofa::component::odesolver::CGImplicitSolver::solve().
v+=f*a
| f | v+=f*a |
Definition at line 80 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
| void sofa::simulation::SolverImpl::v_teq | ( | VecId | v, | |
| double | f | |||
| ) | [virtual] |
v*=f
| f | v*=f |
Definition at line 84 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext(), and sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::null().
| void sofa::simulation::SolverImpl::v_threshold | ( | VecId | a, | |
| double | threshold | |||
| ) | [virtual] |
nullify the values below the given threshold
Definition at line 99 of file OdeSolverImpl.cpp.
References sofa::core::objectmodel::BaseObject::getContext().
double sofa::simulation::SolverImpl::result [protected] |
1.5.7.1