sofa::core::componentmodel::behavior::BaseMechanicalState Class Reference

Component storing all state vectors of a simulated body (position, velocity, etc). More...

#include <BaseMechanicalState.h>

Inheritance diagram for sofa::core::componentmodel::behavior::BaseMechanicalState:

Inheritance graph
[legend]
Collaboration diagram for sofa::core::componentmodel::behavior::BaseMechanicalState:

Collaboration graph
[legend]

Integration related methods

typedef helper::vector
< std::pair< VecId,
helper::vector< std::pair
< VecId, double > > > > 
VMultiOp
 Data structure describing a set of linear operation on vectors.
virtual void beginIntegration (double)
 Called at the beginning of each integration step.
virtual void endIntegration (double)
 Called at the end of each iteration step.
virtual void resetForce ()=0
 Set F = 0.
virtual void resetConstraint ()=0
 Reset the constraint matrix.
virtual void accumulateForce ()
 Add stored external forces to F.
virtual void accumulateDf ()
 Add external forces derivatives to F.
virtual void applyTranslation (const double dx, const double dy, const double dz)=0
 Translate the current state.
virtual void applyRotation (const double, const double, const double)
 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)=0
 Rotate the current state.
virtual void applyScale (const double s)=0
 Scale the current state.
virtual void writeX (std::ostream &out)=0
virtual void readX (std::istream &in)=0
virtual double compareX (std::istream &in)=0
virtual void writeV (std::ostream &out)=0
virtual void readV (std::istream &in)=0
virtual double compareV (std::istream &in)=0
virtual bool addBBox (double *, double *)
virtual void vAvail (VecId &v)=0
 Increment the index of the given VecId, so that all 'allocated' vectors in this state have a lower index.
virtual void vAlloc (VecId v)=0
 Allocate a new temporary vector.
virtual void vFree (VecId v)=0
 Free a temporary vector.
virtual void vOp (VecId v, VecId a=VecId::null(), VecId b=VecId::null(), double f=1.0)=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 double vDot (VecId a, VecId b)=0
 Compute the scalar products between two vectors.
virtual void vThreshold (VecId a, double threshold)=0
 Apply a threshold to all entries.
virtual void setX (VecId v)=0
 Make the position vector point to the identified vector.
virtual void setXfree (VecId v)=0
 Make the free-motion position vector point to the identified vector.
virtual void setVfree (VecId v)=0
 Make the free-motion velocity vector point to the identified vector.
virtual void setV (VecId v)=0
 Make the velocity vector point to the identified vector.
virtual void setF (VecId v)=0
 Make the force vector point to the identified vector.
virtual void setDx (VecId v)=0
 Make the displacement vector point to the identified vector.
virtual void setC (VecId v)=0
 Make the holonomic constraint system matrix point to either holonomic Constraints or nonHolonomic Constraints.
virtual void getCompliance (double **)
 new : get compliance on the constraints
virtual void applyContactForce (double *)
 apply contact force AND compute the subsequent dX
virtual void resetContactForce (void)
virtual void addDxToCollisionModel (void)=0
virtual void contributeToMatrixDimension (unsigned int *const, unsigned int *const)=0
 Add the Mechanical State Dimension [DOF number * DOF dimension] to the global matrix dimension.
virtual void loadInBaseVector (defaulttype::BaseVector *, VecId, unsigned int &)=0
 Load local mechanical data stored in the state in a global BaseVector basically stored in solvers.
virtual void addBaseVectorToState (VecId, defaulttype::BaseVector *, unsigned int &)=0
 Add data stored in a BaseVector to a local mechanical vector of the MechanicalState.
virtual void setOffset (unsigned int &)=0
 Update offset index during the subgraph traversal.

Data Structures

class  VecId
 Identify one vector stored in MechanicalState. More...

Public Member Functions

 BaseMechanicalState ()
virtual ~BaseMechanicalState ()
virtual void resize (int vsize)=0
 Resize all stored vector.
virtual int getSize () const
 functions that allows to have access to the geometry without a template class : not efficient
virtual double getPX (int) const
virtual double getPY (int) const
virtual double getPZ (int) const
Data output
virtual void printDOF (VecId, std::ostream &=std::cerr)=0
virtual void initGnuplot (const std::string)
virtual void exportGnuplot (double)
virtual unsigned printDOFWithElapsedTime (VecId, unsigned=0, unsigned=0, std::ostream &=std::cerr)

Detailed Description

Component storing all state vectors of a simulated body (position, velocity, etc).

This class only contains the data of the body and not any of its active computations, which are handled by the Mass, ForceField, and Constraint components.

Two types of vectors are used :

Several pre-defined vectors are stored : Other vectors can be allocated to store other temporary values. Vectors can be assigned efficiently by just swapping pointers.

In addition to state vectors, the current constraint system matrix is also stored, containing the coefficient of each constraint defined over the DOFs in this body.

Definition at line 79 of file BaseMechanicalState.h.


Member Typedef Documentation


Constructor & Destructor Documentation

sofa::core::componentmodel::behavior::BaseMechanicalState::BaseMechanicalState (  )  [inline]

Definition at line 82 of file BaseMechanicalState.h.

virtual sofa::core::componentmodel::behavior::BaseMechanicalState::~BaseMechanicalState (  )  [inline, virtual]

Definition at line 84 of file BaseMechanicalState.h.


Member Function Documentation

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::accumulateDf (  )  [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::accumulateForce (  )  [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::addBaseVectorToState ( VecId  ,
defaulttype::BaseVector *  ,
unsigned int &   
) [pure virtual]

virtual bool sofa::core::componentmodel::behavior::BaseMechanicalState::addBBox ( double *  ,
double *   
) [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::addDxToCollisionModel ( void   )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::applyContactForce ( double *   )  [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::applyRotation ( const defaulttype::Quat  q  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::applyRotation ( const   double,
const   double,
const   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 in sofa::component::MechanicalObject< DataTypes >, sofa::component::MechanicalObject< sofa::defaulttype::StdVectorTypes >, sofa::component::MechanicalObject< Rigid3Types >, and sofa::component::MechanicalObject< TDataTypes >.

Definition at line 123 of file BaseMechanicalState.h.

Referenced by sofa::simulation::TransformationVisitor::processMechanicalState().

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::applyScale ( const double  s  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::applyTranslation ( const double  dx,
const double  dy,
const double  dz 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::beginIntegration ( double   )  [inline, virtual]

virtual double sofa::core::componentmodel::behavior::BaseMechanicalState::compareV ( std::istream &  in  )  [pure virtual]

virtual double sofa::core::componentmodel::behavior::BaseMechanicalState::compareX ( std::istream &  in  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::contributeToMatrixDimension ( unsigned int *  const,
unsigned int *  const 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::endIntegration ( double   )  [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::exportGnuplot ( double   )  [inline, virtual]

Definition at line 316 of file BaseMechanicalState.h.

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::getCompliance ( double **   )  [inline, virtual]

virtual double sofa::core::componentmodel::behavior::BaseMechanicalState::getPX ( int   )  const [inline, virtual]

virtual double sofa::core::componentmodel::behavior::BaseMechanicalState::getPY ( int   )  const [inline, virtual]

virtual double sofa::core::componentmodel::behavior::BaseMechanicalState::getPZ ( int   )  const [inline, virtual]

virtual int sofa::core::componentmodel::behavior::BaseMechanicalState::getSize (  )  const [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::initGnuplot ( const std::string   )  [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::loadInBaseVector ( defaulttype::BaseVector *  ,
VecId  ,
unsigned int &   
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::printDOF ( VecId  ,
std::ostream &  = std::cerr 
) [pure virtual]

virtual unsigned sofa::core::componentmodel::behavior::BaseMechanicalState::printDOFWithElapsedTime ( VecId  ,
unsigned  = 0,
unsigned  = 0,
std::ostream &  = std::cerr 
) [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::readV ( std::istream &  in  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::readX ( std::istream &  in  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::resetConstraint (  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::resetContactForce ( void   )  [inline, virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::resetForce (  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::resize ( int  vsize  )  [pure virtual]

Resize all stored vector.

Implemented in sofa::component::collision::RayModel, sofa::component::collision::TSphereModel< TDataTypes >, sofa::component::collision::SphereTreeModel, sofa::component::MechanicalObject< DataTypes >, sofa::component::MechanicalObject< sofa::defaulttype::StdVectorTypes >, sofa::component::MechanicalObject< Rigid3Types >, and sofa::component::MechanicalObject< TDataTypes >.

Referenced by sofa::component::collision::SubsetContactMapper< sofa::component::collision::TSphereModel, DataTypes >::addPoint(), sofa::component::collision::RigidContactMapper< sofa::gpu::cuda::CudaRigidDistanceGridCollisionModel, DataTypes >::addPoint(), sofa::component::ParticleSource< TDataTypes >::animateBegin(), sofa::component::ParticleSink< TDataTypes >::animateBegin(), sofa::filemanager::pml::PMLStiffSpringForceField::createMechanicalState(), sofa::filemanager::pml::PMLMappedBody::createMechanicalState(), sofa::filemanager::pml::PMLFemForceField::createMechanicalState(), sofa::filemanager::pml::PMLRigidBody::createVisualModel(), SofaFlowVR::FlowVRInputMesh::flowvrBeginIteration(), sofa::filemanager::pml::PMLStiffSpringForceField::FusionBody(), sofa::filemanager::pml::PMLFemForceField::FusionBody(), sofa::component::ParticleSource< TDataTypes >::reset(), sofa::component::collision::SubsetContactMapper< sofa::component::collision::TSphereModel, DataTypes >::resize(), and sofa::component::collision::RigidContactMapper< sofa::gpu::cuda::CudaRigidDistanceGridCollisionModel, DataTypes >::resize().

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setC ( VecId  v  )  [pure 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()) 

Implemented in sofa::component::MechanicalObject< DataTypes >, sofa::component::MechanicalObject< sofa::defaulttype::StdVectorTypes >, sofa::component::MechanicalObject< Rigid3Types >, and sofa::component::MechanicalObject< TDataTypes >.

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setDx ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setF ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setOffset ( unsigned int &   )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setV ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setVfree ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setX ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::setXfree ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::vAlloc ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::vAvail ( VecId &  v  )  [pure virtual]

virtual double sofa::core::componentmodel::behavior::BaseMechanicalState::vDot ( VecId  a,
VecId  b 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::vFree ( VecId  v  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::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 in sofa::component::MechanicalObject< DataTypes >, sofa::component::MechanicalObject< sofa::defaulttype::StdVectorTypes >, sofa::component::MechanicalObject< Rigid3Types >, and sofa::component::MechanicalObject< TDataTypes >.

Definition at line 208 of file BaseMechanicalState.h.

References sofa::core::componentmodel::behavior::BaseMechanicalState::VecId::null(), and vOp().

Referenced by sofa::simulation::MechanicalVMultiOpVisitor::fwdMechanicalState(), and sofa::component::MechanicalObject< DataTypes >::vMultiOp().

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::vOp ( VecId  v,
VecId  a = VecId::null(),
VecId  b = VecId::null(),
double  f = 1.0 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::vThreshold ( VecId  a,
double  threshold 
) [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::writeV ( std::ostream &  out  )  [pure virtual]

virtual void sofa::core::componentmodel::behavior::BaseMechanicalState::writeX ( std::ostream &  out  )  [pure virtual]


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

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