sofa::component::MechanicalObject< DataTypes > Class Template Reference

#include <MechanicalObject.h>

Inheritance diagram for sofa::component::MechanicalObject< DataTypes >:

Inheritance graph
[legend]
Collaboration diagram for sofa::component::MechanicalObject< DataTypes >:

Collaboration graph
[legend]

Integration-related data

sofa::helper::vector< VecCoord * > vectorsCoord
sofa::helper::vector< VecDeriv * > vectorsDeriv
sofa::helper::vector< VecConst * > vectorsConst
int vsize
 Number of elements to allocate in vectors.
void setVecCoord (unsigned int index, VecCoord *v)
void setVecDeriv (unsigned int index, VecDeriv *v)
void setVecConst (unsigned int index, VecConst *v)

Data Structures

class  Loader

Public Types

typedef MechanicalState
< DataTypes > 
Inherited
typedef Inherited::VecId VecId
typedef Inherited::VMultiOp VMultiOp
 Data structure describing a set of linear operation on vectors.
typedef DataTypes::VecCoord VecCoord
 Container of Coord values with the same API as sofa::helper::vector.
typedef DataTypes::VecDeriv VecDeriv
 Container of Deriv values with the same API as sofa::helper::vector.
typedef DataTypes::Coord Coord
 Position values.
typedef DataTypes::Deriv Deriv
 Derivative values (velocity, forces, displacements).
typedef DataTypes::Real Real
 Scalar values (float or double).
typedef DataTypes::SparseDeriv SparseDeriv
 Index + Deriv value (entry of a sparse vector).
typedef DataTypes::SparseVecDeriv SparseVecDeriv
 Sparse vector of Deriv values (defining coefficient of a constraint).
typedef DataTypes::VecConst VecConst
 Vector of constraints (i.e. of SparseVecDeriv).

Public Member Functions

 MechanicalObject ()
MechanicalObject & operator= (const MechanicalObject &)
virtual ~MechanicalObject ()
virtual bool load (const char *filename)
virtual void parse (BaseObjectDescription *arg)
 Parse the given description to assign values to this object's fields and potentially other parameters.
virtual VecCoord * getX ()
 Return the current position vector (read-write access).
virtual VecDeriv * getV ()
 Return the current velocity vector (read-write access).
virtual VecDeriv * getF ()
 Return the force vector (read-write access).
virtual VecDeriv * getExternalForces ()
 Return the external forces vector (read-write access).
virtual VecDeriv * getDx ()
 Return the displacement vector (read-write access).
virtual VecConst * getC ()
 Return the constraints system matrix (read-write access).
virtual VecCoord * getXfree ()
 Return the free-motion position vector (read-write access).
virtual VecDeriv * getVfree ()
 Return the free-motion velocity vector (read-write access).
VecCoord * getX0 ()
 Return the current position vector (read-write access).
virtual const VecCoord * getX () const
 Return the current position vector (read-only access).
virtual const VecCoord * getX0 () const
 Return the current position vector (read-only access).
virtual const VecDeriv * getV () const
 Return the current velocity vector (read-only access).
virtual const VecDeriv * getV0 () const
 Return the initial velocity vector (read-only access).
virtual const VecDeriv * getF () const
 Return the force vector (read-only access).
virtual const VecDeriv * getExternalForces () const
 Return the external forces vector (read-write access).
virtual const VecDeriv * getDx () const
 Return the displacement vector (read-only access).
virtual const VecConst * getC () const
 Return the constraints system matrix (read-only access).
virtual const VecCoord * getXfree () const
 Return the free-motion position vector (read-only access).
virtual const VecDeriv * getVfree () const
 Return the free-motion velocity vector (read-only access).
virtual void init ()
 Initialization method called at graph modification, during bottom-up traversal.
virtual void reinit ()
 Update method called when variables used in precomputation are modified.
virtual void storeResetState ()
 Save the initial state for later uses in reset().
virtual void reset ()
 Reset to initial state.
virtual void writeX (std::ostream &out)
virtual void readX (std::istream &in)
virtual double compareX (std::istream &in)
virtual void writeV (std::ostream &out)
virtual void readV (std::istream &in)
virtual double compareV (std::istream &in)
virtual void writeState (std::ostream &out)
 Write current state to the given output stream.
virtual void initGnuplot (const std::string path)
virtual void exportGnuplot (Real time)
virtual void resize (int vsize)
 Resize all stored vector.
virtual bool addBBox (double *minBBox, double *maxBBox)
int getSize () const
 functions that allows to have access to the geometry without a template class : not efficient
double getPX (int i) const
double getPY (int i) const
double getPZ (int i) const
void replaceValue (const int inputIndex, const int outputIndex)
 Overwrite values at index outputIndex by the ones at inputIndex.
void swapValues (const int idx1, const int idx2)
 Exchange values at indices idx1 and idx2.
void renumberValues (const sofa::helper::vector< unsigned int > &index)
 Reorder values according to parameter.
void computeWeightedValue (const unsigned int i, const sofa::helper::vector< unsigned int > &ancestors, const sofa::helper::vector< double > &coefs)
 Replace the value at index by the sum of the ancestors values weithed by the coefs.
void computeNewPoint (const unsigned int i, const sofa::helper::vector< double > &m_x)
 Compute the values attached to a new point.
void forcePointPosition (const unsigned int i, const sofa::helper::vector< double > &m_x)
virtual void applyTranslation (const double dx, const double dy, const double dz)
 Translate the current state.
virtual void applyRotation (const double rx, const double ry, const double rz)
 Rotate the current state This method is optional, it is used when the user want to interactively change the position of an object using Euler angles.
virtual void applyRotation (const defaulttype::Quat q)
 Rotate the current state.
virtual void applyScale (const double s)
 Scale the current state.
void getIndicesInSpace (sofa::helper::vector< unsigned > &indices, Real xmin, Real xmax, Real ymin, Real ymax, Real zmin, Real zmax) const
 Get the indices of the particles located in the given bounding box.
void setFilename (std::string s)
std::string getFilename ()
virtual void addDxToCollisionModel (void)
void setConstraintId (unsigned int)
 Add a constraint ID.
sofa::helper::vector< unsigned
int > & 
getConstraintId ()
 Return the constraint IDs corresponding to the entries in the constraints matrix returned by getC().
virtual void handleStateChange ()
 Handle state Changes.
template<>
void applyRotation (const defaulttype::Quat q)
 Rotate the current state.
template<>
bool addBBox (double *, double *)
template<>
void applyRotation (const defaulttype::Quat q)
 Rotate the current state.
template<>
bool addBBox (double *, double *)
template<>
void applyRotation (const defaulttype::Quat q)
 Rotate the current state.
template<>
bool addBBox (double *minBBox, double *maxBBox)
template<>
void applyRotation (const defaulttype::Quat q)
 Rotate the current state.
template<>
bool addBBox (double *minBBox, double *maxBBox)
virtual void contributeToMatrixDimension (unsigned int *const, unsigned int *const)
 Matrices and Vectors Interface
virtual void loadInBaseVector (defaulttype::BaseVector *, VecId, unsigned int &)
 Load local mechanical data stored in the state in a global BaseVector basically stored in solvers.
virtual void addBaseVectorToState (VecId, defaulttype::BaseVector *, unsigned int &)
 Add data stored in a BaseVector to a local mechanical vector of the MechanicalState.
virtual void setOffset (unsigned int &)
 Update offset index during the subgraph traversal.
Integration related methods
virtual void beginIntegration (Real dt)
virtual void endIntegration (Real dt)
virtual void accumulateForce ()
 Add stored external forces to F.
VecCoord * getVecCoord (unsigned int index)
 Return a VecCoord given its index.
const VecCoord * getVecCoord (unsigned int index) const
 Return a VecCoord given its index, or NULL if it does not exists.
VecDeriv * getVecDeriv (unsigned int index)
 Return a VecDeriv given its index.
const VecDeriv * getVecDeriv (unsigned int index) const
 Return a VecDeriv given its index, or NULL if it does not exists.
VecConst * getVecConst (unsigned int index)
 Return a VecConst given its index.
const VecConst * getVecConst (unsigned int index) const
 Return a VecConst given its index, or NULL if it does not exists.
virtual void vAvail (VecId &v)
 Increment the index of the given VecId, so that all 'allocated' vectors in this state have a lower index.
virtual void vAlloc (VecId v)
 Allocate a new temporary vector.
virtual void vFree (VecId v)
 Free a temporary vector.
virtual void vOp (VecId v, VecId a=VecId::null(), VecId b=VecId::null(), double f=1.0)
 Compute a linear operation on vectors : v = a + b * f.
virtual void vMultiOp (const VMultiOp &ops)
 Perform a sequence of linear vector accumulation operation $r_i = sum_j (v_j*f_{ij})$.
virtual void vThreshold (VecId a, double threshold)
 Apply a threshold to all entries.
virtual double vDot (VecId a, VecId b)
 Compute the scalar products between two vectors.
virtual void setX (VecId v)
 Make the position vector point to the identified vector.
virtual void setXfree (VecId v)
 Make the free-motion position vector point to the identified vector.
virtual void setVfree (VecId v)
 Make the free-motion velocity vector point to the identified vector.
virtual void setV (VecId v)
 Make the velocity vector point to the identified vector.
virtual void setF (VecId v)
 Make the force vector point to the identified vector.
virtual void setDx (VecId v)
 Make the displacement vector point to the identified vector.
virtual void setC (VecId v)
 Make the holonomic constraint system matrix point to either holonomic Constraints or nonHolonomic Constraints.
virtual void resetForce ()
 Set F = 0.
virtual void resetConstraint ()
 Reset the constraint matrix.
Debug
virtual void printDOF (VecId, std::ostream &=std::cerr)
virtual unsigned printDOFWithElapsedTime (VecId, unsigned=0, unsigned=0, std::ostream &=std::cerr)
void draw ()
 Render internal data of this object, for debugging purposes.

Data Fields

XDataPtr< DataTypes > *const f_X
VDataPtr< DataTypes > *const f_V
VDataPtr< DataTypes > *const f_F
VDataPtr< DataTypes > *const f_Dx
XDataPtr< DataTypes > *const f_Xfree
VDataPtr< DataTypes > *const f_Vfree
XDataPtr< DataTypes > *const f_X0
Data< SReal > restScale
Data< bool > debugViewIndices
Data< float > debugViewIndicesScale

Protected Attributes

VecCoord * x
VecDeriv * v
VecDeriv * f
VecDeriv * dx
VecCoord * x0
VecCoord * reset_position
VecDeriv * v0
VecDeriv * internalForces
VecDeriv * externalForces
VecCoord * xfree
VecDeriv * vfree
VecConst * c
sofa::helper::vector< unsigned
int > 
constraintId
bool initialized
Data< Vector3 > translation
Data< Vector3 > rotation
Data< SReal > scale
Data< std::string > filename
MechanicalObjectInternalData
< DataTypes > 
data
std::ofstream * m_gnuplotFileX
std::ofstream * m_gnuplotFileV
sofa::core::componentmodel::topology::BaseMeshTopology * _topology

Friends

class MechanicalObjectInternalData< DataTypes >

Detailed Description

template<class DataTypes>
class sofa::component::MechanicalObject< DataTypes >

Definition at line 57 of file MechanicalObject.h.


Member Typedef Documentation

template<class DataTypes >
typedef DataTypes::Coord sofa::component::MechanicalObject< DataTypes >::Coord

Position values.

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 65 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::Deriv sofa::component::MechanicalObject< DataTypes >::Deriv

Derivative values (velocity, forces, displacements).

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 66 of file MechanicalObject.h.

Definition at line 60 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::Real sofa::component::MechanicalObject< DataTypes >::Real

Scalar values (float or double).

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Reimplemented in sofa::component::collision::TSphereModel< TDataTypes >.

Definition at line 67 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::SparseDeriv sofa::component::MechanicalObject< DataTypes >::SparseDeriv

Index + Deriv value (entry of a sparse vector).

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 68 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::SparseVecDeriv sofa::component::MechanicalObject< DataTypes >::SparseVecDeriv

Sparse vector of Deriv values (defining coefficient of a constraint).

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 69 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::VecConst sofa::component::MechanicalObject< DataTypes >::VecConst

Vector of constraints (i.e. of SparseVecDeriv).

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 70 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::VecCoord sofa::component::MechanicalObject< DataTypes >::VecCoord

Container of Coord values with the same API as sofa::helper::vector.

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Reimplemented in sofa::component::collision::SphereTreeModel.

Definition at line 63 of file MechanicalObject.h.

template<class DataTypes >
typedef DataTypes::VecDeriv sofa::component::MechanicalObject< DataTypes >::VecDeriv

Container of Deriv values with the same API as sofa::helper::vector.

Reimplemented from sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 64 of file MechanicalObject.h.

template<class DataTypes >
typedef Inherited::VecId sofa::component::MechanicalObject< DataTypes >::VecId

Definition at line 61 of file MechanicalObject.h.

Data structure describing a set of linear operation on vectors.

See also:
vMultiOp

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

Definition at line 62 of file MechanicalObject.h.


Constructor & Destructor Documentation

template<class DataTypes >
sofa::component::MechanicalObject< DataTypes >::MechanicalObject (  )  [inline]

Definition at line 58 of file MechanicalObject.inl.

References sofa::core::objectmodel::Base::addField(), sofa::component::MechanicalObject< DataTypes >::debugViewIndices, sofa::component::MechanicalObject< DataTypes >::debugViewIndicesScale, sofa::component::MechanicalObject< DataTypes >::dx, sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::dx(), sofa::component::MechanicalObject< DataTypes >::externalForces, sofa::component::MechanicalObject< DataTypes >::f, sofa::component::MechanicalObject< DataTypes >::f_Dx, sofa::component::MechanicalObject< DataTypes >::f_F, sofa::component::MechanicalObject< DataTypes >::f_V, sofa::component::MechanicalObject< DataTypes >::f_Vfree, sofa::component::MechanicalObject< DataTypes >::f_X, sofa::component::MechanicalObject< DataTypes >::f_X0, sofa::component::MechanicalObject< DataTypes >::f_Xfree, sofa::component::MechanicalObject< DataTypes >::filename, sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::force(), sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::freePosition(), sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::freeVelocity(), sofa::core::objectmodel::Base::initData(), sofa::component::MechanicalObject< DataTypes >::initialized, sofa::component::MechanicalObject< DataTypes >::internalForces, sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::position(), sofa::component::MechanicalObject< DataTypes >::resize(), sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::restPosition(), sofa::component::MechanicalObject< DataTypes >::restScale, sofa::component::MechanicalObject< DataTypes >::rotation, sofa::component::MechanicalObject< DataTypes >::scale, sofa::component::MechanicalObject< DataTypes >::setVecCoord(), sofa::component::MechanicalObject< DataTypes >::setVecDeriv(), sofa::component::MechanicalObject< DataTypes >::translation, sofa::component::MechanicalObject< DataTypes >::v, sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::velocity(), sofa::component::MechanicalObject< DataTypes >::vfree, sofa::component::MechanicalObject< DataTypes >::x, sofa::component::MechanicalObject< DataTypes >::x0, and sofa::component::MechanicalObject< DataTypes >::xfree.

template<class DataTypes >
sofa::component::MechanicalObject< DataTypes >::~MechanicalObject (  )  [inline, virtual]


Member Function Documentation

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::accumulateForce (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::addBaseVectorToState ( VecId  dest,
defaulttype::BaseVector *  src,
unsigned int &  offset 
) [inline, virtual]

template<>
bool sofa::component::MechanicalObject< Vec1fTypes >::addBBox ( double *  minBBox,
double *  maxBBox 
) [inline, virtual]

template<>
bool sofa::component::MechanicalObject< Vec1dTypes >::addBBox ( double *  minBBox,
double *  maxBBox 
) [inline, virtual]

template<>
bool sofa::component::MechanicalObject< Vec1fTypes >::addBBox ( double *  ,
double *   
) [inline, virtual]

template<>
bool sofa::component::MechanicalObject< Vec1dTypes >::addBBox ( double *  ,
double *   
) [inline, virtual]

template<class DataTypes >
bool sofa::component::MechanicalObject< DataTypes >::addBBox ( double *  minBBox,
double *  maxBBox 
) [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::addDxToCollisionModel ( void   )  [inline, virtual]

template<>
void sofa::component::MechanicalObject< defaulttype::Rigid3fTypes >::applyRotation ( const defaulttype::Quat  q  )  [inline, virtual]

Rotate the current state.

Implements sofa::core::componentmodel::behavior::BaseMechanicalState.

template<>
void sofa::component::MechanicalObject< defaulttype::Rigid3dTypes >::applyRotation ( const defaulttype::Quat  q  )  [inline, virtual]

Rotate the current state.

Implements sofa::core::componentmodel::behavior::BaseMechanicalState.

template<>
void sofa::component::MechanicalObject< defaulttype::Rigid3fTypes >::applyRotation ( const defaulttype::Quat  q  )  [inline, virtual]

template<>
void sofa::component::MechanicalObject< defaulttype::Rigid3dTypes >::applyRotation ( const defaulttype::Quat  q  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::applyRotation ( const defaulttype::Quat  q  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::applyRotation ( const double  double,
const double  double,
const double  double 
) [inline, virtual]

Rotate the current state This method is optional, it is used when the user want to interactively change the position of an object using Euler angles.

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

Definition at line 547 of file MechanicalObject.inl.

Referenced by sofa::component::MechanicalObject< DataTypes >::reinit().

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::applyScale ( const double  s  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::applyTranslation ( const double  dx,
const double  dy,
const double  dz 
) [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::beginIntegration ( Real  dt  )  [inline, virtual]

template<class DataTypes >
double sofa::component::MechanicalObject< DataTypes >::compareV ( std::istream &  in  )  [inline, virtual]

template<class DataTypes >
double sofa::component::MechanicalObject< DataTypes >::compareX ( std::istream &  in  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::computeNewPoint ( const unsigned int  i,
const sofa::helper::vector< double > &  m_x 
) [inline]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::computeWeightedValue ( const unsigned int  i,
const sofa::helper::vector< unsigned int > &  ancestors,
const sofa::helper::vector< double > &  coefs 
) [inline]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::contributeToMatrixDimension ( unsigned int * const  nbRow,
unsigned int * const  nbCol 
) [inline, virtual]

Matrices and Vectors Interface

Add the Mechanical State Dimension [DOF number * DOF dimension] to the global matrix dimension

Implements sofa::core::componentmodel::behavior::BaseMechanicalState.

Definition at line 793 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::v.

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::draw (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::endIntegration ( Real  dt  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::exportGnuplot ( Real  time  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::forcePointPosition ( const unsigned int  i,
const sofa::helper::vector< double > &  m_x 
) [inline]

template<class DataTypes >
virtual const VecConst* sofa::component::MechanicalObject< DataTypes >::getC (  )  const [inline, virtual]

Return the constraints system matrix (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 163 of file MechanicalObject.h.

template<class DataTypes >
virtual VecConst* sofa::component::MechanicalObject< DataTypes >::getC (  )  [inline, virtual]

Return the constraints system matrix (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 151 of file MechanicalObject.h.

Referenced by sofa::component::MechanicalObject< DataTypes >::resetConstraint().

template<class DataTypes >
sofa::helper::vector< unsigned int > & sofa::component::MechanicalObject< DataTypes >::getConstraintId (  )  [inline, virtual]

Return the constraint IDs corresponding to the entries in the constraints matrix returned by getC().

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 1935 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::constraintId.

template<class DataTypes >
virtual const VecDeriv* sofa::component::MechanicalObject< DataTypes >::getDx (  )  const [inline, virtual]

Return the displacement vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 162 of file MechanicalObject.h.

template<class DataTypes >
virtual VecDeriv* sofa::component::MechanicalObject< DataTypes >::getDx (  )  [inline, virtual]

Return the displacement vector (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 150 of file MechanicalObject.h.

template<class DataTypes >
virtual const VecDeriv* sofa::component::MechanicalObject< DataTypes >::getExternalForces (  )  const [inline, virtual]

Return the external forces vector (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 161 of file MechanicalObject.h.

template<class DataTypes >
virtual VecDeriv* sofa::component::MechanicalObject< DataTypes >::getExternalForces (  )  [inline, virtual]

Return the external forces vector (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 149 of file MechanicalObject.h.

template<class DataTypes >
virtual const VecDeriv* sofa::component::MechanicalObject< DataTypes >::getF ( void   )  const [inline, virtual]

Return the force vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 160 of file MechanicalObject.h.

template<class DataTypes >
virtual VecDeriv* sofa::component::MechanicalObject< DataTypes >::getF ( void   )  [inline, virtual]

template<class DataTypes >
std::string sofa::component::MechanicalObject< DataTypes >::getFilename (  )  [inline]

Definition at line 267 of file MechanicalObject.h.

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::getIndicesInSpace ( sofa::helper::vector< unsigned > &  indices,
Real  xmin,
Real  xmax,
Real  ymin,
Real  ymax,
Real  zmin,
Real  zmax 
) const [inline, virtual]

template<class DataTypes >
double sofa::component::MechanicalObject< DataTypes >::getPX ( int  i  )  const [inline, virtual]

template<class DataTypes >
double sofa::component::MechanicalObject< DataTypes >::getPY ( int  i  )  const [inline, virtual]

template<class DataTypes >
double sofa::component::MechanicalObject< DataTypes >::getPZ ( int  i  )  const [inline, virtual]

template<class DataTypes >
int sofa::component::MechanicalObject< DataTypes >::getSize (  )  const [inline, virtual]

template<class DataTypes >
virtual const VecDeriv* sofa::component::MechanicalObject< DataTypes >::getV (  )  const [inline, virtual]

Return the current velocity vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 158 of file MechanicalObject.h.

template<class DataTypes >
virtual VecDeriv* sofa::component::MechanicalObject< DataTypes >::getV (  )  [inline, virtual]

template<class DataTypes >
virtual const VecDeriv* sofa::component::MechanicalObject< DataTypes >::getV0 (  )  const [inline, virtual]

Return the initial velocity vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 159 of file MechanicalObject.h.

template<class DataTypes >
const MechanicalObject< DataTypes >::VecConst * sofa::component::MechanicalObject< DataTypes >::getVecConst ( unsigned int  index  )  const [inline, virtual]

Return a VecConst given its index, or NULL if it does not exists.

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 1231 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::vectorsConst.

template<class DataTypes >
MechanicalObject< DataTypes >::VecConst * sofa::component::MechanicalObject< DataTypes >::getVecConst ( unsigned int  index  )  [inline, virtual]

template<class DataTypes >
const MechanicalObject< DataTypes >::VecCoord * sofa::component::MechanicalObject< DataTypes >::getVecCoord ( unsigned int  index  )  const [inline, virtual]

Return a VecCoord given its index, or NULL if it does not exists.

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 1188 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::vectorsCoord.

template<class DataTypes >
MechanicalObject< DataTypes >::VecCoord * sofa::component::MechanicalObject< DataTypes >::getVecCoord ( unsigned int  index  )  [inline, virtual]

template<class DataTypes >
const MechanicalObject< DataTypes >::VecDeriv * sofa::component::MechanicalObject< DataTypes >::getVecDeriv ( unsigned int  index  )  const [inline, virtual]

Return a VecDeriv given its index, or NULL if it does not exists.

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 1209 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::vectorsDeriv.

template<class DataTypes >
MechanicalObject< DataTypes >::VecDeriv * sofa::component::MechanicalObject< DataTypes >::getVecDeriv ( unsigned int  index  )  [inline, virtual]

template<class DataTypes >
virtual const VecDeriv* sofa::component::MechanicalObject< DataTypes >::getVfree (  )  const [inline, virtual]

Return the free-motion velocity vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 165 of file MechanicalObject.h.

template<class DataTypes >
virtual VecDeriv* sofa::component::MechanicalObject< DataTypes >::getVfree (  )  [inline, virtual]

Return the free-motion velocity vector (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 153 of file MechanicalObject.h.

template<class DataTypes >
virtual const VecCoord* sofa::component::MechanicalObject< DataTypes >::getX (  )  const [inline, virtual]

Return the current position vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 156 of file MechanicalObject.h.

template<class DataTypes >
virtual VecCoord* sofa::component::MechanicalObject< DataTypes >::getX (  )  [inline, virtual]

template<class DataTypes >
virtual const VecCoord* sofa::component::MechanicalObject< DataTypes >::getX0 (  )  const [inline, virtual]

Return the current position vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 157 of file MechanicalObject.h.

template<class DataTypes >
VecCoord* sofa::component::MechanicalObject< DataTypes >::getX0 (  )  [inline, virtual]

Return the current position vector (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 154 of file MechanicalObject.h.

Referenced by sofa::component::MechanicalObject< DataTypes >::computeNewPoint().

template<class DataTypes >
virtual const VecCoord* sofa::component::MechanicalObject< DataTypes >::getXfree (  )  const [inline, virtual]

Return the free-motion position vector (read-only access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 164 of file MechanicalObject.h.

template<class DataTypes >
virtual VecCoord* sofa::component::MechanicalObject< DataTypes >::getXfree (  )  [inline, virtual]

Return the free-motion position vector (read-write access).

Implements sofa::core::componentmodel::behavior::MechanicalState< DataTypes >.

Definition at line 152 of file MechanicalObject.h.

Referenced by sofa::component::MechanicalObject< DataTypes >::computeNewPoint().

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::handleStateChange (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::init ( void   )  [inline, virtual]

Initialization method called at graph modification, during bottom-up traversal.

Reimplemented from sofa::core::objectmodel::BaseObject.

Reimplemented in sofa::component::collision::RayPickInteractor, and sofa::component::collision::TSphereModel< TDataTypes >.

Definition at line 892 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::_topology, sofa::component::MechanicalObject< DataTypes >::f_Dx, sofa::component::MechanicalObject< DataTypes >::f_F, sofa::component::MechanicalObject< DataTypes >::f_V, sofa::component::MechanicalObject< DataTypes >::f_Vfree, sofa::component::MechanicalObject< DataTypes >::f_X, sofa::component::MechanicalObject< DataTypes >::f_X0, sofa::component::MechanicalObject< DataTypes >::f_Xfree, sofa::core::objectmodel::BaseContext::get(), sofa::core::objectmodel::BaseObject::getContext(), sofa::core::objectmodel::BaseContext::getMeshTopology(), sofa::core::componentmodel::topology::Topology::getNbPoints(), sofa::component::MeshLoader::getNbPoints(), sofa::core::componentmodel::topology::BaseMeshTopology::getPX(), sofa::component::MeshLoader::getPX(), sofa::core::componentmodel::topology::BaseMeshTopology::getPY(), sofa::component::MeshLoader::getPY(), sofa::core::componentmodel::topology::BaseMeshTopology::getPZ(), sofa::component::MeshLoader::getPZ(), sofa::component::MechanicalObject< DataTypes >::getV(), sofa::component::MechanicalObject< DataTypes >::getX(), sofa::core::componentmodel::topology::BaseMeshTopology::hasPos(), sofa::component::MechanicalObject< DataTypes >::initialized, sofa::component::MechanicalObject< DataTypes >::reinit(), sofa::component::MechanicalObject< DataTypes >::resize(), sofa::component::MechanicalObject< DataTypes >::restScale, sofa::component::MechanicalObject< DataTypes >::v, sofa::component::MechanicalObject< DataTypes >::v0, sofa::component::MechanicalObject< DataTypes >::vsize, sofa::component::MechanicalObject< DataTypes >::x, sofa::component::MechanicalObject< DataTypes >::x0, and sofa::component::MechanicalObject< DataTypes >::xfree.

Referenced by sofa::component::collision::TSphereModel< TDataTypes >::init().

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::initGnuplot ( const std::string  path  )  [inline, virtual]

template<class DataTypes >
bool sofa::component::MechanicalObject< DataTypes >::load ( const char *  filename  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::loadInBaseVector ( defaulttype::BaseVector *  dest,
VecId  src,
unsigned int &  offset 
) [inline, virtual]

template<class DataTypes >
MechanicalObject< DataTypes > & sofa::component::MechanicalObject< DataTypes >::operator= ( const MechanicalObject< DataTypes > &  obj  )  [inline]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::parse ( BaseObjectDescription *  arg  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::printDOF ( VecId  v,
std::ostream &  out = std::cerr 
) [inline, virtual]

template<class DataTypes >
unsigned sofa::component::MechanicalObject< DataTypes >::printDOFWithElapsedTime ( VecId  v,
unsigned  count = 0,
unsigned  time = 0,
std::ostream &  out = std::cerr 
) [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::readV ( std::istream &  in  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::readX ( std::istream &  in  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::reinit (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::renumberValues ( const sofa::helper::vector< unsigned int > &  index  )  [inline]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::replaceValue ( const int  inputIndex,
const int  outputIndex 
) [inline]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::reset ( void   )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::resetConstraint (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::resetForce (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::resize ( int  vsize  )  [inline, virtual]

Resize all stored vector.

Implements sofa::core::componentmodel::behavior::BaseMechanicalState.

Reimplemented in sofa::component::collision::RayModel, sofa::component::collision::TSphereModel< TDataTypes >, and sofa::component::collision::SphereTreeModel.

Definition at line 500 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::externalForces, sofa::component::MechanicalObject< DataTypes >::initialized, sofa::component::MechanicalObject< DataTypes >::internalForces, sofa::component::MechanicalObject< DataTypes >::reset_position, sofa::component::MechanicalObject< DataTypes >::v0, sofa::component::MechanicalObject< DataTypes >::vectorsCoord, sofa::component::MechanicalObject< DataTypes >::vectorsDeriv, sofa::component::MechanicalObject< DataTypes >::vsize, and sofa::component::MechanicalObject< DataTypes >::x0.

Referenced by sofa::component::MechanicalObject< DataTypes >::Loader::addMass(), sofa::component::collision::DefaultPickingManager< TDataTypes, ContactForceField >::attach(), sofa::component::MechanicalObject< DataTypes >::computeNewPoint(), sofa::component::MechanicalObject< DataTypes >::handleStateChange(), sofa::component::topology::Edge2QuadTopologicalMapping::init(), sofa::component::MechanicalObject< DataTypes >::init(), sofa::component::container::ArticulatedHierarchyContainer::init(), main(), sofa::component::MechanicalObject< DataTypes >::MechanicalObject(), sofa::component::MechanicalObject< DataTypes >::operator=(), sofa::component::MechanicalObject< DataTypes >::parse(), sofa::component::MechanicalObject< DataTypes >::readV(), sofa::component::MechanicalObject< DataTypes >::readX(), and sofa::component::MechanicalObject< DataTypes >::reset().

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setC ( VecId  v  )  [inline, virtual]

Make the holonomic constraint system matrix point to either holonomic Constraints or nonHolonomic Constraints.

To reset it to the default storage or to make it point to holonomicConstraints use

To make it point to nonNolonomicConstraints use
 setC(VecId::NonHolonomicC()) 

Implements sofa::core::componentmodel::behavior::BaseMechanicalState.

Definition at line 1839 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::c, sofa::component::MechanicalObject< DataTypes >::getVecConst(), sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::index, sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::type, and sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::V_CONST.

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setConstraintId ( unsigned int   )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setDx ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setF ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setFilename ( std::string  s  )  [inline]

Definition at line 266 of file MechanicalObject.h.

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setOffset ( unsigned int &  offset  )  [inline, virtual]

Update offset index during the subgraph traversal.

Implements sofa::core::componentmodel::behavior::BaseMechanicalState.

Definition at line 804 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::v.

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setV ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setVecConst ( unsigned int  index,
VecConst *  v 
) [inline, protected]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setVecCoord ( unsigned int  index,
VecCoord *  v 
) [inline, protected]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setVecDeriv ( unsigned int  index,
VecDeriv *  v 
) [inline, protected]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setVfree ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setX ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::setXfree ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::storeResetState (  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::swapValues ( const int  idx1,
const int  idx2 
) [inline]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::vAlloc ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::vAvail ( VecId &  v  )  [inline, virtual]

template<class DataTypes >
double sofa::component::MechanicalObject< DataTypes >::vDot ( VecId  a,
VecId  b 
) [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::vFree ( VecId  v  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::vMultiOp ( const VMultiOp &  ops  )  [inline, virtual]

Perform a sequence of linear vector accumulation operation $r_i = sum_j (v_j*f_{ij})$.

This is used to compute in on steps operations such as $v = v + a*dt, x = x + v*dt$. Note that if the result vector appears inside the expression, it must be the first operand. By default this method decompose the computation into multiple vOp calls.

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

Definition at line 1644 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::getVecCoord(), sofa::component::MechanicalObject< DataTypes >::getVecDeriv(), sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::V_COORD, sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::V_DERIV, and sofa::core::componentmodel::behavior::BaseMechanicalState::vMultiOp().

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::vOp ( VecId  v,
VecId  a = VecId::null(),
VecId  b = VecId::null(),
double  f = 1.0 
) [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::vThreshold ( VecId  a,
double  threshold 
) [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::writeState ( std::ostream &  out  )  [inline, virtual]

Write current state to the given output stream.

Reimplemented from sofa::core::objectmodel::BaseObject.

Definition at line 1124 of file MechanicalObject.inl.

References sofa::component::MechanicalObject< DataTypes >::writeV(), and sofa::component::MechanicalObject< DataTypes >::writeX().

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::writeV ( std::ostream &  out  )  [inline, virtual]

template<class DataTypes >
void sofa::component::MechanicalObject< DataTypes >::writeX ( std::ostream &  out  )  [inline, virtual]


Friends And Related Function Documentation

template<class DataTypes >
friend class MechanicalObjectInternalData< DataTypes > [friend]

Definition at line 114 of file MechanicalObject.h.


Field Documentation

template<class DataTypes >
VecConst* sofa::component::MechanicalObject< DataTypes >::c [protected]

template<class DataTypes >
sofa::helper::vector<unsigned int> sofa::component::MechanicalObject< DataTypes >::constraintId [protected]

Definition at line 112 of file MechanicalObject.h.

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::dx [protected]

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::externalForces [protected]

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::f [protected]

template<class DataTypes >
VDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_Dx

template<class DataTypes >
VDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_F

template<class DataTypes >
VDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_V

template<class DataTypes >
VDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_Vfree

template<class DataTypes >
XDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_X

template<class DataTypes >
XDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_X0

template<class DataTypes >
XDataPtr<DataTypes>* const sofa::component::MechanicalObject< DataTypes >::f_Xfree

template<class DataTypes >
Data< std::string > sofa::component::MechanicalObject< DataTypes >::filename [protected]

template<class DataTypes >
bool sofa::component::MechanicalObject< DataTypes >::initialized [protected]

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::internalForces [protected]

template<class DataTypes >
std::ofstream* sofa::component::MechanicalObject< DataTypes >::m_gnuplotFileV [protected]

template<class DataTypes >
std::ofstream* sofa::component::MechanicalObject< DataTypes >::m_gnuplotFileX [protected]

template<class DataTypes >
VecCoord* sofa::component::MechanicalObject< DataTypes >::reset_position [protected]

template<class DataTypes >
Data< Vector3> sofa::component::MechanicalObject< DataTypes >::rotation [protected]

template<class DataTypes >
Data< SReal > sofa::component::MechanicalObject< DataTypes >::scale [protected]

template<class DataTypes >
Data< Vector3 > sofa::component::MechanicalObject< DataTypes >::translation [protected]

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::v [protected]

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::v0 [protected]

template<class DataTypes >
VecDeriv* sofa::component::MechanicalObject< DataTypes >::vfree [protected]

template<class DataTypes >
int sofa::component::MechanicalObject< DataTypes >::vsize [protected]

template<class DataTypes >
VecCoord* sofa::component::MechanicalObject< DataTypes >::x [protected]

template<class DataTypes >
VecCoord* sofa::component::MechanicalObject< DataTypes >::x0 [protected]

template<class DataTypes >
VecCoord* sofa::component::MechanicalObject< DataTypes >::xfree [protected]


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

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