sofa::simulation::SolverImpl Class Reference

Implementation of LinearSolver/OdeSolver/MasterSolver relying on component::System. More...

#include <OdeSolverImpl.h>

Inheritance diagram for sofa::simulation::SolverImpl:

Inheritance graph
[legend]
Collaboration diagram for sofa::simulation::SolverImpl:

Collaboration graph
[legend]

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.

Detailed Description

Implementation of LinearSolver/OdeSolver/MasterSolver relying on component::System.

Definition at line 42 of file OdeSolverImpl.h.


Member Typedef Documentation


Constructor & Destructor Documentation

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.


Member Function Documentation

void sofa::simulation::SolverImpl::accFromF ( VecId  a,
VecId  f 
) [virtual]

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]

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]

void sofa::simulation::SolverImpl::addSeparateGravity ( double  dt  )  [virtual]

void sofa::simulation::SolverImpl::computeContactDf ( VecId  df  )  [virtual]

void sofa::simulation::SolverImpl::computeContactForce ( VecId  result  )  [virtual]

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]

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]

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]

void sofa::simulation::SolverImpl::multiVectorPeqBaseVector ( VecId  dest,
defaulttype::BaseVector *  src = NULL,
unsigned int  offset = 0 
) [virtual]

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]

void sofa::simulation::SolverImpl::projectResponse ( VecId  dx,
double **  W = NULL 
) [virtual]

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().

void sofa::simulation::SolverImpl::propagateDxAndResetDf ( VecId  dx,
VecId  df 
) [virtual]

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]

void sofa::simulation::SolverImpl::v_clear ( VecId  v  )  [virtual]

void sofa::simulation::SolverImpl::v_dot ( VecId  a,
VecId  b 
) [virtual]

a dot b ( get result using finish )

Parameters:
b  a dot b ( get result using finish )

Definition at line 93 of file OdeSolverImpl.cpp.

References sofa::core::objectmodel::BaseObject::getContext(), and result.

void sofa::simulation::SolverImpl::v_eq ( VecId  v,
VecId  a 
) [virtual]

v=a

Parameters:
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().

void sofa::simulation::SolverImpl::v_op ( VecId  v,
VecId  a,
VecId  b,
double  f = 1.0 
) [virtual]

void sofa::simulation::SolverImpl::v_peq ( VecId  v,
VecId  a,
double  f = 1.0 
) [virtual]

v+=f*a

Parameters:
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]

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().


Field Documentation

Result of latest v_dot operation.

Definition at line 132 of file OdeSolverImpl.h.

Referenced by finish(), and v_dot().


The documentation for this class was generated from the following files:

Generated on Sun Nov 23 04:24:31 2008 for Sofa by  doxygen 1.5.7.1