sofa::core::componentmodel::behavior::MultiVector< Parent > Class Template Reference

Helper class providing a high-level view of underlying state vectors. More...

#include <MultiVector.h>

Inheritance diagram for sofa::core::componentmodel::behavior::MultiVector< Parent >:

Inheritance graph
[legend]
Collaboration diagram for sofa::core::componentmodel::behavior::MultiVector< Parent >:

Collaboration graph
[legend]

Public Types

typedef BaseMechanicalState::VecId VecId

Public Member Functions

 MultiVector (Parent *parent, VecId v)
 Refers to a state vector with the given ID (VecId::position(), VecId::velocity(), etc).
 MultiVector (Parent *parent, VecId::Type t)
 Allocate a new temporary vector with the given type (VecId::V_COORD or VecId::V_DERIV).
 ~MultiVector ()
 operator VecId ()
 Automatic conversion to the underlying VecId.
void clear ()
 v = 0
void eq (VecId a)
 v = a
void peq (VecId a, double f=1.0)
 v += a*f
void teq (double f)
 v *= f
double dot (VecId a)
void threshold (double threshold)
 nullify values below given threshold
double norm ()
void operator= (VecId a)
 v = a
void operator= (const MultiVector< Parent > &a)
 v = a
void operator+= (VecId a)
 v += a
void operator-= (VecId a)
 v -= a
void operator*= (double f)
 v *= f
void operator/= (double f)
 v /= f
double operator* (VecId a)
 return the scalar product dot(v,a)

Protected Member Functions

 MultiVector (const MultiVector< Parent > &v)
 Copy-constructor is forbidden.

Protected Attributes

Parent * parent
 Solver who is using this vector.
VecId v
 Identifier of this vector.
bool dynamic
 Flag indicating if this vector was dynamically allocated.

Friends

std::ostream & operator<< (std::ostream &out, const MultiVector< Parent > &mv)

Detailed Description

template<class Parent>
class sofa::core::componentmodel::behavior::MultiVector< Parent >

Helper class providing a high-level view of underlying state vectors.

It is used to convert math-like operations to call to computation methods.

Definition at line 51 of file MultiVector.h.


Member Typedef Documentation

Definition at line 54 of file MultiVector.h.


Constructor & Destructor Documentation

template<class Parent >
sofa::core::componentmodel::behavior::MultiVector< Parent >::MultiVector ( const MultiVector< Parent > &  v  )  [protected]

Copy-constructor is forbidden.

template<class Parent >
sofa::core::componentmodel::behavior::MultiVector< Parent >::MultiVector ( Parent *  parent,
VecId  v 
) [inline]

Refers to a state vector with the given ID (VecId::position(), VecId::velocity(), etc).

Definition at line 71 of file MultiVector.h.

template<class Parent >
sofa::core::componentmodel::behavior::MultiVector< Parent >::MultiVector ( Parent *  parent,
VecId::Type  t 
) [inline]

Allocate a new temporary vector with the given type (VecId::V_COORD or VecId::V_DERIV).

Definition at line 75 of file MultiVector.h.

template<class Parent >
sofa::core::componentmodel::behavior::MultiVector< Parent >::~MultiVector (  )  [inline]

Definition at line 78 of file MultiVector.h.


Member Function Documentation

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::clear (  )  [inline]

v = 0

Definition at line 90 of file MultiVector.h.

template<class Parent >
double sofa::core::componentmodel::behavior::MultiVector< Parent >::dot ( VecId  a  )  [inline]

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::eq ( VecId  a  )  [inline]

template<class Parent >
double sofa::core::componentmodel::behavior::MultiVector< Parent >::norm (  )  [inline]

Returns:
sqrt(v.v)

Definition at line 125 of file MultiVector.h.

template<class Parent >
sofa::core::componentmodel::behavior::MultiVector< Parent >::operator VecId (  )  [inline]

Automatic conversion to the underlying VecId.

Definition at line 84 of file MultiVector.h.

template<class Parent >
double sofa::core::componentmodel::behavior::MultiVector< Parent >::operator* ( VecId  a  )  [inline]

return the scalar product dot(v,a)

Definition at line 168 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::operator*= ( double  f  )  [inline]

v *= f

Definition at line 156 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::operator+= ( VecId  a  )  [inline]

v += a

Definition at line 144 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::operator-= ( VecId  a  )  [inline]

v -= a

Definition at line 150 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::operator/= ( double  f  )  [inline]

v /= f

Definition at line 162 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::operator= ( const MultiVector< Parent > &  a  )  [inline]

v = a

Definition at line 138 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::operator= ( VecId  a  )  [inline]

v = a

Definition at line 132 of file MultiVector.h.

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::peq ( VecId  a,
double  f = 1.0 
) [inline]

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::teq ( double  f  )  [inline]

template<class Parent >
void sofa::core::componentmodel::behavior::MultiVector< Parent >::threshold ( double  threshold  )  [inline]

nullify values below given threshold

Definition at line 119 of file MultiVector.h.

Referenced by sofa::component::odesolver::DampVelocitySolver::solve().


Friends And Related Function Documentation

template<class Parent >
std::ostream& operator<< ( std::ostream &  out,
const MultiVector< Parent > &  mv 
) [friend]

Definition at line 173 of file MultiVector.h.


Field Documentation

template<class Parent >
bool sofa::core::componentmodel::behavior::MultiVector< Parent >::dynamic [protected]

Flag indicating if this vector was dynamically allocated.

Definition at line 64 of file MultiVector.h.

Referenced by sofa::core::componentmodel::behavior::MultiVector< sofa::simulation::SolverImpl >::~MultiVector().

template<class Parent >
Parent* sofa::core::componentmodel::behavior::MultiVector< Parent >::parent [protected]

template<class Parent >
VecId sofa::core::componentmodel::behavior::MultiVector< Parent >::v [protected]


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

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