#include <MechanicalOperations.h>
Public Attributes | |
core::MechanicalParams | mparams |
core::ConstraintParams | cparams |
core::objectmodel::BaseContext * | ctx |
Protected Attributes | |
VisitorExecuteFunc | executeVisitor |
Static Protected Attributes | |
static std::map< core::objectmodel::BaseContext *, bool > | hasShownMissingLinearSolverMap |
Store if the "missing linear solver" error message has already been shown for a given context. More... | |
Public Member Functions | |
MechanicalOperations (const core::MechanicalParams *mparams, core::objectmodel::BaseContext *ctx, bool precomputedTraversalOrder=false) | |
MechanicalOperations (const core::ExecParams *params, core::objectmodel::BaseContext *ctx, bool precomputedTraversalOrder=false) | |
core::MechanicalParams * | operator-> () |
operator const core::MechanicalParams * () | |
Mechanical Vector operations | |
void | propagateDx (core::MultiVecDerivId dx, bool ignore_flag=false) |
Propagate the given displacement through all mappings. More... | |
void | propagateDxAndResetDf (core::MultiVecDerivId dx, core::MultiVecDerivId df) |
Propagate the given displacement through all mappings and reset the current force delta. More... | |
void | propagateX (core::MultiVecCoordId x) |
Propagate the given position through all mappings. More... | |
void | propagateV (core::MultiVecDerivId v) |
Propagate the given velocity through all mappings. More... | |
void | propagateXAndV (core::MultiVecCoordId x, core::MultiVecDerivId v) |
Propagate the given position and velocity through all mappings. More... | |
void | propagateXAndResetF (core::MultiVecCoordId x, core::MultiVecDerivId f) |
Propagate the given position through all mappings and reset the current force delta. More... | |
void | projectPosition (core::MultiVecCoordId x, SReal time=0.0) |
Apply projective constraints to the given position vector. More... | |
void | projectVelocity (core::MultiVecDerivId v, SReal time=0.0) |
Apply projective constraints to the given velocity vector. More... | |
void | projectResponse (core::MultiVecDerivId dx, double **W=nullptr) |
Apply projective constraints to the given vector. More... | |
void | projectPositionAndVelocity (core::MultiVecCoordId x, core::MultiVecDerivId v, double time=0.0) |
Apply projective constraints to the given position and velocity vectors. More... | |
void | addMdx (core::MultiVecDerivId res, core::MultiVecDerivId dx, SReal factor=1.0) |
res += factor M.dx More... | |
void | integrateVelocity (core::MultiVecDerivId res, core::ConstMultiVecCoordId x, core::ConstMultiVecDerivId v, SReal dt) |
res = x + v.dt More... | |
void | accFromF (core::MultiVecDerivId a, core::ConstMultiVecDerivId f) |
void | computeEnergy (SReal &kineticEnergy, SReal &potentialEnergy) |
Compute Energy. More... | |
void | computeForce (core::MultiVecDerivId result, bool clear=true, bool accumulate=true) |
Compute the current force (given the latest propagated position and velocity) More... | |
void | computeDf (core::MultiVecDerivId df, bool clear=true, bool accumulate=true) |
Compute the current force delta (given the latest propagated displacement) More... | |
void | computeDfV (core::MultiVecDerivId df, bool clear=true, bool accumulate=true) |
Compute the current force delta (given the latest propagated velocity) More... | |
void | addMBKdx (core::MultiVecDerivId df, SReal m, SReal b, SReal k, bool clear=true, bool accumulate=true) |
accumulate $ df += (m M + b B + k K) dx $ (given the latest propagated displacement) More... | |
void | addMBKv (core::MultiVecDerivId df, SReal m, SReal b, SReal k, bool clear=true, bool accumulate=true) |
accumulate $ df += (m M + b B + k K) velocity $ More... | |
void | addSeparateGravity (SReal dt, core::MultiVecDerivId result=core::VecDerivId::velocity()) |
Add dt*Gravity to the velocity. More... | |
void | computeContactForce (core::MultiVecDerivId result) |
void | computeContactDf (core::MultiVecDerivId df) |
void | computeAcc (SReal t, core::MultiVecDerivId a, core::MultiVecCoordId x, core::MultiVecDerivId v) |
Compute a(x,v) at time t. Parameters x and v not const due to propagation through mappings. More... | |
void | computeForce (SReal t, core::MultiVecDerivId f, core::MultiVecCoordId x, core::MultiVecDerivId v) |
Compute f(x,v) at time t. Parameters x and v not const due to propagation through mappings. More... | |
void | computeContactAcc (SReal t, core::MultiVecDerivId a, core::MultiVecCoordId x, core::MultiVecDerivId v) |
Matrix operations | |
void | getMatrixDimension (sofa::Size *const, sofa::Size *const, sofa::core::behavior::MultiMatrixAccessor *matrix=nullptr) |
void | getMatrixDimension (sofa::core::behavior::MultiMatrixAccessor *matrix) |
void | addMBK_ToMatrix (const sofa::core::behavior::MultiMatrixAccessor *matrix, SReal mFact, SReal bFact, SReal kFact) |
void | multiVector2BaseVector (core::ConstMultiVecId src, linearalgebra::BaseVector *dest, const sofa::core::behavior::MultiMatrixAccessor *matrix) |
void | baseVector2MultiVector (const linearalgebra::BaseVector *src, core::MultiVecId dest, const sofa::core::behavior::MultiMatrixAccessor *matrix) |
void | multiVectorPeqBaseVector (core::MultiVecDerivId dest, const linearalgebra::BaseVector *src, const sofa::core::behavior::MultiMatrixAccessor *matrix) |
Debug operations | |
void | print (core::ConstMultiVecId v, std::ostream &out) |
Dump the content of the given vector. More... | |
void | printWithElapsedTime (core::ConstMultiVecId v, unsigned time, std::ostream &out=std::cerr) |
Protected Member Functions | |
void | setX (core::MultiVecCoordId &v) |
void | setX (core::ConstMultiVecCoordId &v) |
void | setV (core::MultiVecDerivId &v) |
void | setV (core::ConstMultiVecDerivId &v) |
void | setF (core::MultiVecDerivId &v) |
void | setF (core::ConstMultiVecDerivId &v) |
void | setDx (core::MultiVecDerivId &v) |
void | setDx (core::ConstMultiVecDerivId &v) |
void | setDf (core::MultiVecDerivId &v) |
void | setDf (core::ConstMultiVecDerivId &v) |
void | showMissingLinearSolverError () const |
Warn the user that a linear solver is required but has not been found. More... | |
Matrix operations using LinearSolver components | |
SReal | bFact |
SReal SReal | kFact |
void | resetSystem (core::behavior::LinearSolver *linearSolver) |
void | setSystemMBKMatrix (SReal mFact, SReal bFact, SReal kFact, core::behavior::LinearSolver *linearSolver) |
void | setSystemRHVector (core::MultiVecDerivId v, core::behavior::LinearSolver *linearSolver) |
void | setSystemLHVector (core::MultiVecDerivId v, core::behavior::LinearSolver *linearSolver) |
void | solveSystem (core::behavior::LinearSolver *linearSolver) |
void | print (std::ostream &out, core::behavior::LinearSolver *linearSolver) |
SOFA_ATTRIBUTE_DEPRECATED_MECHANICALOPERATIONS_RESETSYSTEM () void m_resetSystem() | |
SOFA_ATTRIBUTE_DEPRECATED_MECHANICALOPERATIONS_SETSYSTEMMBKMATRIX () void m_setSystemMBKMatrix(SReal mFact | |
SReal sofa::simulation::common::MechanicalOperations::bFact |
core::ConstraintParams sofa::simulation::common::MechanicalOperations::cparams |
core::objectmodel::BaseContext* sofa::simulation::common::MechanicalOperations::ctx |
|
protected |
|
staticprotected |
Store if the "missing linear solver" error message has already been shown for a given context.
SReal SReal sofa::simulation::common::MechanicalOperations::kFact |
core::MechanicalParams sofa::simulation::common::MechanicalOperations::mparams |
sofa::simulation::common::MechanicalOperations::MechanicalOperations | ( | const core::MechanicalParams * | mparams, |
core::objectmodel::BaseContext * | ctx, | ||
bool | precomputedTraversalOrder = false |
||
) |
sofa::simulation::common::MechanicalOperations::MechanicalOperations | ( | const core::ExecParams * | params, |
core::objectmodel::BaseContext * | ctx, | ||
bool | precomputedTraversalOrder = false |
||
) |
void sofa::simulation::common::MechanicalOperations::accFromF | ( | core::MultiVecDerivId | a, |
core::ConstMultiVecDerivId | f | ||
) |
a = M^-1 . f
f | a = M^-1 . f |
void sofa::simulation::common::MechanicalOperations::addMBK_ToMatrix | ( | const sofa::core::behavior::MultiMatrixAccessor * | matrix, |
SReal | mFact, | ||
SReal | bFact, | ||
SReal | kFact | ||
) |
void sofa::simulation::common::MechanicalOperations::addMBKdx | ( | core::MultiVecDerivId | df, |
SReal | m, | ||
SReal | b, | ||
SReal | k, | ||
bool | clear = true , |
||
bool | accumulate = true |
||
) |
accumulate $ df += (m M + b B + k K) dx $ (given the latest propagated displacement)
void sofa::simulation::common::MechanicalOperations::addMBKv | ( | core::MultiVecDerivId | df, |
SReal | m, | ||
SReal | b, | ||
SReal | k, | ||
bool | clear = true , |
||
bool | accumulate = true |
||
) |
accumulate $ df += (m M + b B + k K) velocity $
void sofa::simulation::common::MechanicalOperations::addMdx | ( | core::MultiVecDerivId | res, |
core::MultiVecDerivId | dx, | ||
SReal | factor = 1.0 |
||
) |
res += factor M.dx
void sofa::simulation::common::MechanicalOperations::addSeparateGravity | ( | SReal | dt, |
core::MultiVecDerivId | result = core::VecDerivId::velocity() |
||
) |
Add dt*Gravity to the velocity.
void sofa::simulation::common::MechanicalOperations::baseVector2MultiVector | ( | const linearalgebra::BaseVector * | src, |
core::MultiVecId | dest, | ||
const sofa::core::behavior::MultiMatrixAccessor * | matrix | ||
) |
void sofa::simulation::common::MechanicalOperations::computeAcc | ( | SReal | t, |
core::MultiVecDerivId | a, | ||
core::MultiVecCoordId | x, | ||
core::MultiVecDerivId | v | ||
) |
Compute a(x,v) at time t. Parameters x and v not const due to propagation through mappings.
void sofa::simulation::common::MechanicalOperations::computeContactAcc | ( | SReal | t, |
core::MultiVecDerivId | a, | ||
core::MultiVecCoordId | x, | ||
core::MultiVecDerivId | v | ||
) |
void sofa::simulation::common::MechanicalOperations::computeContactDf | ( | core::MultiVecDerivId | df | ) |
void sofa::simulation::common::MechanicalOperations::computeContactForce | ( | core::MultiVecDerivId | result | ) |
void sofa::simulation::common::MechanicalOperations::computeDf | ( | core::MultiVecDerivId | df, |
bool | clear = true , |
||
bool | accumulate = true |
||
) |
Compute the current force delta (given the latest propagated displacement)
void sofa::simulation::common::MechanicalOperations::computeDfV | ( | core::MultiVecDerivId | df, |
bool | clear = true , |
||
bool | accumulate = true |
||
) |
Compute the current force delta (given the latest propagated velocity)
void sofa::simulation::common::MechanicalOperations::computeEnergy | ( | SReal & | kineticEnergy, |
SReal & | potentialEnergy | ||
) |
Compute Energy.
Apply projective constraints to the given velocity vector.
void sofa::simulation::common::MechanicalOperations::computeForce | ( | core::MultiVecDerivId | result, |
bool | clear = true , |
||
bool | accumulate = true |
||
) |
Compute the current force (given the latest propagated position and velocity)
void sofa::simulation::common::MechanicalOperations::computeForce | ( | SReal | t, |
core::MultiVecDerivId | f, | ||
core::MultiVecCoordId | x, | ||
core::MultiVecDerivId | v | ||
) |
Compute f(x,v) at time t. Parameters x and v not const due to propagation through mappings.
|
inline |
void sofa::simulation::common::MechanicalOperations::getMatrixDimension | ( | sofa::Size * const | nbRow, |
sofa::Size * const | nbCol, | ||
sofa::core::behavior::MultiMatrixAccessor * | matrix = nullptr |
||
) |
void sofa::simulation::common::MechanicalOperations::integrateVelocity | ( | core::MultiVecDerivId | res, |
core::ConstMultiVecCoordId | x, | ||
core::ConstMultiVecDerivId | v, | ||
SReal | dt | ||
) |
res = x + v.dt
void sofa::simulation::common::MechanicalOperations::multiVector2BaseVector | ( | core::ConstMultiVecId | src, |
linearalgebra::BaseVector * | dest, | ||
const sofa::core::behavior::MultiMatrixAccessor * | matrix | ||
) |
void sofa::simulation::common::MechanicalOperations::multiVectorPeqBaseVector | ( | core::MultiVecDerivId | dest, |
const linearalgebra::BaseVector * | src, | ||
const sofa::core::behavior::MultiMatrixAccessor * | matrix | ||
) |
|
inline |
|
inline |
void sofa::simulation::common::MechanicalOperations::print | ( | core::ConstMultiVecId | v, |
std::ostream & | out | ||
) |
Dump the content of the given vector.
void sofa::simulation::common::MechanicalOperations::print | ( | std::ostream & | out, |
core::behavior::LinearSolver * | linearSolver | ||
) |
void sofa::simulation::common::MechanicalOperations::printWithElapsedTime | ( | core::ConstMultiVecId | v, |
unsigned | time, | ||
std::ostream & | out = std::cerr |
||
) |
void sofa::simulation::common::MechanicalOperations::projectPosition | ( | core::MultiVecCoordId | x, |
SReal | time = 0.0 |
||
) |
Apply projective constraints to the given position vector.
void sofa::simulation::common::MechanicalOperations::projectPositionAndVelocity | ( | core::MultiVecCoordId | x, |
core::MultiVecDerivId | v, | ||
double | time = 0.0 |
||
) |
Apply projective constraints to the given position and velocity vectors.
void sofa::simulation::common::MechanicalOperations::projectResponse | ( | core::MultiVecDerivId | dx, |
double ** | W = nullptr |
||
) |
Apply projective constraints to the given vector.
void sofa::simulation::common::MechanicalOperations::projectVelocity | ( | core::MultiVecDerivId | v, |
SReal | time = 0.0 |
||
) |
Apply projective constraints to the given velocity vector.
void sofa::simulation::common::MechanicalOperations::propagateDx | ( | core::MultiVecDerivId | dx, |
bool | ignore_flag = false |
||
) |
Propagate the given displacement through all mappings.
void sofa::simulation::common::MechanicalOperations::propagateDxAndResetDf | ( | core::MultiVecDerivId | dx, |
core::MultiVecDerivId | df | ||
) |
Propagate the given displacement through all mappings and reset the current force delta.
void sofa::simulation::common::MechanicalOperations::propagateV | ( | core::MultiVecDerivId | v | ) |
Propagate the given velocity through all mappings.
void sofa::simulation::common::MechanicalOperations::propagateX | ( | core::MultiVecCoordId | x | ) |
Propagate the given position through all mappings.
void sofa::simulation::common::MechanicalOperations::propagateXAndResetF | ( | core::MultiVecCoordId | x, |
core::MultiVecDerivId | f | ||
) |
Propagate the given position through all mappings and reset the current force delta.
void sofa::simulation::common::MechanicalOperations::propagateXAndV | ( | core::MultiVecCoordId | x, |
core::MultiVecDerivId | v | ||
) |
Propagate the given position and velocity through all mappings.
void sofa::simulation::common::MechanicalOperations::resetSystem | ( | core::behavior::LinearSolver * | linearSolver | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void sofa::simulation::common::MechanicalOperations::setSystemLHVector | ( | core::MultiVecDerivId | v, |
core::behavior::LinearSolver * | linearSolver | ||
) |
void sofa::simulation::common::MechanicalOperations::setSystemMBKMatrix | ( | SReal | mFact, |
SReal | bFact, | ||
SReal | kFact, | ||
core::behavior::LinearSolver * | linearSolver | ||
) |
void sofa::simulation::common::MechanicalOperations::setSystemRHVector | ( | core::MultiVecDerivId | v, |
core::behavior::LinearSolver * | linearSolver | ||
) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Warn the user that a linear solver is required but has not been found.
sofa::simulation::common::MechanicalOperations::SOFA_ATTRIBUTE_DEPRECATED_MECHANICALOPERATIONS_RESETSYSTEM | ( | ) |
sofa::simulation::common::MechanicalOperations::SOFA_ATTRIBUTE_DEPRECATED_MECHANICALOPERATIONS_SETSYSTEMMBKMATRIX | ( | ) |
void sofa::simulation::common::MechanicalOperations::solveSystem | ( | core::behavior::LinearSolver * | linearSolver | ) |