sofa::simulation::MatrixLinearSolver< Matrix, Vector > Class Template Reference

#include <MatrixLinearSolver.h>

Inheritance diagram for sofa::simulation::MatrixLinearSolver< Matrix, Vector >:

Inheritance graph
[legend]
Collaboration diagram for sofa::simulation::MatrixLinearSolver< Matrix, Vector >:

Collaboration graph
[legend]

Public Types

typedef
sofa::core::componentmodel::behavior::BaseMechanicalState::VecId 
VecId

Public Member Functions

 MatrixLinearSolver ()
virtual ~MatrixLinearSolver ()
void resetSystem ()
 Reset the current linear system.
void resizeSystem (int n)
 Reset the current linear system.
void setSystemMBKMatrix (double mFact=0.0, double bFact=0.0, double kFact=0.0)
 Set the linear system matrix, combining the mechanical M,B,K matrices using the given coefficients.
void setSystemRHVector (VecId v)
 Set the linear system right-hand term vector, from the values contained in the (Mechanical/Physical)State objects.
void setSystemLHVector (VecId v)
 Set the initial estimate of the linear system left-hand term vector, from the values contained in the (Mechanical/Physical)State objects This vector will be replaced by the solution of the system once solveSystem is called.
Matrix * getSystemMatrix ()
 Get the linear system matrix, or NULL if this solver does not build it.
Vector * getSystemRHVector ()
 Get the linear system right-hand term vector, or NULL if this solver does not build it.
Vector * getSystemLHVector ()
 Get the linear system left-hand term vector, or NULL if this solver does not build it.
defaulttype::BaseMatrix * getSystemBaseMatrix ()
 Get the linear system matrix, or NULL if this solver does not build it.
defaulttype::BaseVector * getSystemRHBaseVector ()
 Get the linear system right-hand term vector, or NULL if this solver does not build it.
defaulttype::BaseVector * getSystemLHBaseVector ()
 Get the linear system left-hand term vector, or NULL if this solver does not build it.
virtual void solveSystem ()
 Solve the system as constructed using the previous methods.
virtual std::string getTemplateName () const
 Get the template type names (if any) used to instantiate this object.
template<>
component::linearsolver::TNewMatMatrix
< NEWMAT::SymmetricBandMatrix > * 
createMatrix ()
template<>
component::linearsolver::TNewMatMatrix
< NEWMAT::BandMatrix > * 
createMatrix ()
template<>
void resetSystem ()
 Reset the current linear system.
template<>
void resizeSystem (int)
template<>
void setSystemMBKMatrix (double mFact, double bFact, double kFact)
 Set the linear system matrix, combining the mechanical M,B,K matrices using the given coefficients.
template<>
void setSystemRHVector (VecId v)
 Set the linear system right-hand term vector, from the values contained in the (Mechanical/Physical)State objects.
template<>
void setSystemLHVector (VecId v)
 Set the initial estimate of the linear system left-hand term vector, from the values contained in the (Mechanical/Physical)State objects This vector will be replaced by the solution of the system once solveSystem is called.
template<>
void solveSystem ()
 Solve the system as constructed using the previous methods.
template<>
GraphScatteredMatrix * createMatrix ()
template<>
void deleteMatrix (GraphScatteredMatrix *v)
template<>
GraphScatteredVector * createVector ()
template<>
void deleteVector (GraphScatteredVector *v)
template<>
defaulttype::BaseMatrix * getSystemBaseMatrix ()
 Get the linear system matrix, or NULL if this solver does not build it.
template<>
defaulttype::BaseVector * getSystemRHBaseVector ()
 Get the linear system right-hand term vector, or NULL if this solver does not build it.
template<>
defaulttype::BaseVector * getSystemLHBaseVector ()
 Get the linear system left-hand term vector, or NULL if this solver does not build it.
template<>
void resetSystem ()
 Reset the current linear system.
template<>
void resizeSystem (int)
template<>
void setSystemMBKMatrix (double mFact, double bFact, double kFact)
 Set the linear system matrix, combining the mechanical M,B,K matrices using the given coefficients.
template<>
void setSystemRHVector (VecId v)
 Set the linear system right-hand term vector, from the values contained in the (Mechanical/Physical)State objects.
template<>
void setSystemLHVector (VecId v)
 Set the initial estimate of the linear system left-hand term vector, from the values contained in the (Mechanical/Physical)State objects This vector will be replaced by the solution of the system once solveSystem is called.
template<>
void solveSystem ()
 Solve the system as constructed using the previous methods.
template<>
GraphScatteredVector * createVector ()
template<>
void deleteVector (GraphScatteredVector *v)
template<>
GraphScatteredMatrix * createMatrix ()
template<>
void deleteMatrix (GraphScatteredMatrix *v)
template<>
defaulttype::BaseMatrix * getSystemBaseMatrix ()
 Get the linear system matrix, or NULL if this solver does not build it.
template<>
defaulttype::BaseVector * getSystemRHBaseVector ()
 Get the linear system right-hand term vector, or NULL if this solver does not build it.
template<>
defaulttype::BaseVector * getSystemLHBaseVector ()
 Get the linear system left-hand term vector, or NULL if this solver does not build it.

Static Public Member Functions

static std::string templateName (const MatrixLinearSolver< Matrix, Vector > *=NULL)

Protected Member Functions

virtual void invert (Matrix &)
virtual void solve (Matrix &M, Vector &solution, Vector &rh)=0
Vector * createVector ()
void deleteVector (Vector *v)
Matrix * createMatrix ()
void deleteMatrix (Matrix *v)

Protected Attributes

MatrixLinearSolverInternalData
< Matrix, Vector > * 
data
bool needInvert
Matrix * systemMatrix
Vector * systemRHVector
Vector * systemLHVector
VecId solutionVecId

Detailed Description

template<class Matrix, class Vector>
class sofa::simulation::MatrixLinearSolver< Matrix, Vector >

Definition at line 47 of file MatrixLinearSolver.h.


Member Typedef Documentation

template<class Matrix , class Vector >
typedef sofa::core::componentmodel::behavior::BaseMechanicalState::VecId sofa::simulation::MatrixLinearSolver< Matrix, Vector >::VecId

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 50 of file MatrixLinearSolver.h.


Constructor & Destructor Documentation

template<class Matrix , class Vector >
sofa::simulation::MatrixLinearSolver< Matrix, Vector >::MatrixLinearSolver (  )  [inline]

template<class Matrix , class Vector >
sofa::simulation::MatrixLinearSolver< Matrix, Vector >::~MatrixLinearSolver (  )  [inline, virtual]


Member Function Documentation

Definition at line 129 of file MatrixLinearSolver.cpp.

Definition at line 489 of file NewMatMatrix.h.

template<>
component::linearsolver::TNewMatMatrix< NEWMAT::SymmetricBandMatrix > * sofa::simulation::MatrixLinearSolver< component::linearsolver::TNewMatMatrix< NEWMAT::SymmetricBandMatrix >, component::linearsolver::NewMatVector >::createMatrix (  )  [inline]

Definition at line 473 of file NewMatMatrix.h.

template<class Matrix , class Vector >
Matrix * sofa::simulation::MatrixLinearSolver< Matrix, Vector >::createMatrix (  )  [inline, protected]

Definition at line 141 of file MatrixLinearSolver.cpp.

template<class Matrix , class Vector >
Vector * sofa::simulation::MatrixLinearSolver< Matrix, Vector >::createVector (  )  [inline, protected]

Definition at line 135 of file MatrixLinearSolver.cpp.

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::deleteMatrix ( Matrix *  v  )  [inline, protected]

Definition at line 147 of file MatrixLinearSolver.cpp.

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::deleteVector ( Vector *  v  )  [inline, protected]

template<>
defaulttype::BaseMatrix * sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::getSystemBaseMatrix (  )  [inline, virtual]

Get the linear system matrix, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

template<>
defaulttype::BaseMatrix * sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::getSystemBaseMatrix (  )  [inline, virtual]

Get the linear system matrix, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 153 of file MatrixLinearSolver.cpp.

template<class Matrix , class Vector >
defaulttype::BaseMatrix* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getSystemBaseMatrix (  )  [inline, virtual]

Get the linear system matrix, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 85 of file MatrixLinearSolver.h.

template<>
defaulttype::BaseVector * sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::getSystemLHBaseVector (  )  [inline, virtual]

Get the linear system left-hand term vector, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

template<>
defaulttype::BaseVector * sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::getSystemLHBaseVector (  )  [inline, virtual]

Get the linear system left-hand term vector, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 159 of file MatrixLinearSolver.cpp.

template<class Matrix , class Vector >
defaulttype::BaseVector* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getSystemLHBaseVector (  )  [inline, virtual]

Get the linear system left-hand term vector, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 91 of file MatrixLinearSolver.h.

template<class Matrix , class Vector >
Vector* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getSystemLHVector (  )  [inline]

Get the linear system left-hand term vector, or NULL if this solver does not build it.

Definition at line 82 of file MatrixLinearSolver.h.

template<class Matrix , class Vector >
Matrix* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getSystemMatrix (  )  [inline]

Get the linear system matrix, or NULL if this solver does not build it.

Definition at line 76 of file MatrixLinearSolver.h.

template<>
defaulttype::BaseVector * sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::getSystemRHBaseVector (  )  [inline, virtual]

Get the linear system right-hand term vector, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

template<>
defaulttype::BaseVector * sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::getSystemRHBaseVector (  )  [inline, virtual]

Get the linear system right-hand term vector, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 156 of file MatrixLinearSolver.cpp.

template<class Matrix , class Vector >
defaulttype::BaseVector* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getSystemRHBaseVector (  )  [inline, virtual]

Get the linear system right-hand term vector, or NULL if this solver does not build it.

Reimplemented from sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 88 of file MatrixLinearSolver.h.

template<class Matrix , class Vector >
Vector* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getSystemRHVector (  )  [inline]

Get the linear system right-hand term vector, or NULL if this solver does not build it.

Definition at line 79 of file MatrixLinearSolver.h.

template<class Matrix , class Vector >
virtual std::string sofa::simulation::MatrixLinearSolver< Matrix, Vector >::getTemplateName (  )  const [inline, virtual]

Get the template type names (if any) used to instantiate this object.

Reimplemented from sofa::core::objectmodel::Base.

Definition at line 96 of file MatrixLinearSolver.h.

template<class Matrix , class Vector >
virtual void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::invert ( Matrix &   )  [inline, protected, virtual]

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::resetSystem (  )  [inline, virtual]

Reset the current linear system.

Implements sofa::core::componentmodel::behavior::LinearSolver.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::resetSystem (  )  [inline, virtual]

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::resetSystem (  )  [inline, virtual]

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::resizeSystem ( int   )  [inline]

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::resizeSystem ( int   )  [inline]

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::resizeSystem ( int  n  )  [inline]

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::setSystemLHVector ( VecId  v  )  [inline, virtual]

Set the initial estimate of the linear system left-hand term vector, from the values contained in the (Mechanical/Physical)State objects This vector will be replaced by the solution of the system once solveSystem is called.

Implements sofa::core::componentmodel::behavior::LinearSolver.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::setSystemLHVector ( VecId  v  )  [inline, virtual]

Set the initial estimate of the linear system left-hand term vector, from the values contained in the (Mechanical/Physical)State objects This vector will be replaced by the solution of the system once solveSystem is called.

Implements sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 111 of file MatrixLinearSolver.cpp.

References sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solutionVecId, and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemLHVector.

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemLHVector ( VecId  v  )  [inline, virtual]

Set the initial estimate of the linear system left-hand term vector, from the values contained in the (Mechanical/Physical)State objects This vector will be replaced by the solution of the system once solveSystem is called.

Implements sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 187 of file MatrixLinearSolver.h.

References sofa::simulation::SolverImpl::multiVector2BaseVector(), sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solutionVecId, and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemLHVector.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::setSystemMBKMatrix ( double  mFact,
double  bFact,
double  kFact 
) [inline, virtual]

Set the linear system matrix, combining the mechanical M,B,K matrices using the given coefficients.

Todo:
Should we put this method in a specialized class for mechanical systems, or express it using more general terms (i.e. coefficients of the second order ODE to solve)

Implements sofa::core::componentmodel::behavior::LinearSolver.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::setSystemMBKMatrix ( double  mFact,
double  bFact,
double  kFact 
) [inline, virtual]

Set the linear system matrix, combining the mechanical M,B,K matrices using the given coefficients.

Todo:
Should we put this method in a specialized class for mechanical systems, or express it using more general terms (i.e. coefficients of the second order ODE to solve)

Implements sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 98 of file MatrixLinearSolver.cpp.

References sofa::simulation::MatrixLinearSolver< Matrix, Vector >::resetSystem(), and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemMatrix.

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemMBKMatrix ( double  mFact = 0.0,
double  bFact = 0.0,
double  kFact = 0.0 
) [inline, virtual]

Set the linear system matrix, combining the mechanical M,B,K matrices using the given coefficients.

Note that this automatically resizes the linear system to the number of active degrees of freedoms

Todo:
Should we put this method in a specialized class for mechanical systems, or express it using more general terms (i.e. coefficients of the second order ODE to solve)

Implements sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 166 of file MatrixLinearSolver.h.

References sofa::simulation::SolverImpl::addMBK_ToMatrix(), sofa::simulation::SolverImpl::getMatrixDimension(), sofa::simulation::MatrixLinearSolver< Matrix, Vector >::resizeSystem(), and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemMatrix.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::setSystemRHVector ( VecId  v  )  [inline, virtual]

Set the linear system right-hand term vector, from the values contained in the (Mechanical/Physical)State objects.

Implements sofa::core::componentmodel::behavior::LinearSolver.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::setSystemRHVector ( VecId  v  )  [inline, virtual]

Set the linear system right-hand term vector, from the values contained in the (Mechanical/Physical)State objects.

Implements sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 105 of file MatrixLinearSolver.cpp.

References sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemRHVector.

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::setSystemRHVector ( VecId  v  )  [inline, virtual]

Set the linear system right-hand term vector, from the values contained in the (Mechanical/Physical)State objects.

Implements sofa::core::componentmodel::behavior::LinearSolver.

Definition at line 179 of file MatrixLinearSolver.h.

References sofa::simulation::SolverImpl::multiVector2BaseVector(), and sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemRHVector.

template<class Matrix , class Vector >
virtual void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solve ( Matrix &  M,
Vector &  solution,
Vector &  rh 
) [protected, pure virtual]

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::solveSystem (  )  [inline, virtual]

Solve the system as constructed using the previous methods.

Implements sofa::core::componentmodel::behavior::LinearSolver.

template<>
void sofa::simulation::MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector >::solveSystem (  )  [inline, virtual]

template<class Matrix , class Vector >
void sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solveSystem (  )  [inline, virtual]

template<class Matrix , class Vector >
static std::string sofa::simulation::MatrixLinearSolver< Matrix, Vector >::templateName ( const MatrixLinearSolver< Matrix, Vector > *  = NULL  )  [inline, static]


Field Documentation

template<class Matrix , class Vector >
MatrixLinearSolverInternalData<Matrix,Vector>* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::data [protected]

template<class Matrix , class Vector >
bool sofa::simulation::MatrixLinearSolver< Matrix, Vector >::needInvert [protected]

template<class Matrix , class Vector >
VecId sofa::simulation::MatrixLinearSolver< Matrix, Vector >::solutionVecId [protected]

template<class Matrix , class Vector >
Vector* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemLHVector [protected]

template<class Matrix , class Vector >
Matrix* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemMatrix [protected]

template<class Matrix , class Vector >
Vector* sofa::simulation::MatrixLinearSolver< Matrix, Vector >::systemRHVector [protected]


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

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