SOFA API  59c939c2
Open source framework for multi-physics simuation
sofa::component::container::MechanicalObject< DataTypes > Class Template Reference

#include <MechanicalObject.h>

This class can be overridden if needed for additionnal storage within template specializations. More...

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

Detailed Description

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

This class can be overridden if needed for additionnal storage within template specializations.

MechanicalObject class.

Public Attributes

Data< VecCoordx
 position coordinates of the degrees of freedom More...
 
Data< VecDerivv
 velocity coordinates of the degrees of freedom More...
 
Data< VecDerivf
 force vector of the degrees of freedom More...
 
Data< VecCoordx0
 rest position coordinates of the degrees of freedom More...
 
Data< VecDerivexternalForces
 externalForces vector of the degrees of freedom More...
 
Data< VecDerivdx
 dx vector of the degrees of freedom More...
 
Data< VecCoordxfree
 free position coordinates of the degrees of freedom More...
 
Data< VecDerivvfree
 free velocity coordinates of the degrees of freedom More...
 
Data< MatrixDerivc
 constraints applied to the degrees of freedom More...
 
Data< MatrixDerivm
 mappingJacobian applied to the degrees of freedom More...
 
Data< VecCoordreset_position
 reset position coordinates of the degrees of freedom More...
 
Data< VecDerivreset_velocity
 reset velocity coordinates of the degrees of freedom More...
 
defaulttype::MapMapSparseMatrix< Derivc2
 
Data< SReal > restScale
 optional scaling of rest position coordinates (to simulated pre-existing internal tension).(default = 1.0) More...
 
Data< boold_useTopology
 Shall this object rely on any active topology to initialize its size and positions. More...
 
Data< boolshowObject
 Show objects. (default=false) More...
 
Data< floatshowObjectScale
 Scale for object display. (default=0.1) More...
 
Data< boolshowIndices
 Show indices. (default=false) More...
 
Data< floatshowIndicesScale
 Scale for indices display. (default=0.02) More...
 
Data< boolshowVectors
 Show velocity. (default=false) More...
 
Data< floatshowVectorsScale
 Scale for vectors display. (default=0.0001) More...
 
Data< intdrawMode
 The way vectors will be drawn: - 0: Line - 1:Cylinder - 2: Arrow. The DOFS will be drawn: - 0: point - >1: sphere. (default=0) More...
 
Data< defaulttype::Vec4f > d_color
 drawing color More...
 
- Public Attributes inherited from sofa::core::behavior::BaseMechanicalState
ForceMask forceMask
 Mask to filter the particles. Used inside MechanicalMappings inside applyJ and applyJT methods. More...
 
- Public Attributes inherited from sofa::core::objectmodel::BaseObject
Data< boolf_listening
 if true, handle the events, otherwise ignore the events More...
 
- Public Attributes inherited from sofa::core::objectmodel::Base
helper::system::SofaOStream< helper::logging::Message::Warningserr
 
helper::system::SofaOStream< helper::logging::Message::Infosout
 
helper::system::SofaEndl< Basesendl
 runs the stream processing More...
 
Data< std::string > name
 Name of the object. More...
 
Data< boolf_printLog
 if true, emits extra messages at runtime. More...
 
Data< sofa::core::objectmodel::TagSetf_tags
 list of the subsets the objet belongs to More...
 
Data< sofa::defaulttype::BoundingBoxf_bbox
 this object bounding box More...
 
Data< ComponentStated_componentstate
 the object state More...
 
Data< ComponentState > & m_componentstate {d_componentstate}
 TODO bruno: uncomment once c++17 is enabled in SOFA. More...
 
std::string m_definitionSourceFileName {""}
 
int m_definitionSourceFilePos {-1}
 
std::string m_instanciationSourceFileName {""}
 
int m_instanciationSourceFilePos {-1}
 

Protected Attributes

Data< intd_size
 Size of the vectors. More...
 
SingleLink< MechanicalObject< DataTypes >, core::topology::BaseMeshTopology, BaseLink::FLAG_STRONGLINK|BaseLink::FLAG_STOREPATHl_topology
 
Data< intf_reserve
 Size to reserve when creating vectors. (default=0) More...
 
bool m_initialized
 
MechanicalObjectInternalData< DataTypesdata
 Given the number of a constraint Equation, find the index in the MatrixDeriv C, where the constraint is actually stored. More...
 
std::ofstream * m_gnuplotFileX
 
std::ofstream * m_gnuplotFileV
 
Initial geometric transformations
Data< Vector3translation
 Translation of the DOFs. More...
 
Data< Vector3rotation
 Rotation of the DOFs. More...
 
Data< Vector3scale
 Scale of the DOFs in 3 dimensions. More...
 
Data< Vector3translation2
 Translation of the DOFs, applied after the rest position has been computed. More...
 
Data< Vector3rotation2
 Rotation of the DOFs, applied the after the rest position has been computed. More...
 
- Protected Attributes inherited from sofa::core::objectmodel::BaseObject
SingleLink< BaseObject, BaseContext, BaseLink::FLAG_DOUBLELINKl_context
 
LinkSlaves l_slaves
 
SingleLink< BaseObject, BaseObject, BaseLink::FLAG_DOUBLELINKl_master
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
VecData m_vecData
 List of fields (Data instances) More...
 
MapData m_aliasData
 name -> Data multi-map (includes names and aliases) More...
 
VecLink m_vecLink
 List of links. More...
 
MapLink m_aliasLink
 name -> Link multi-map (includes names and aliases) More...
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(MechanicalObject, DataTypes), SOFA_TEMPLATE(sofa::core::behavior::MechanicalState, DataTypes))
 
MechanicalObjectoperator= (const MechanicalObject &)
 
void parse (core::objectmodel::BaseObjectDescription *arg) override
 Parse the given description to assign values to this object's fields and potentially other parameters. More...
 
void init () override
 Initialization method called at graph creation and modification, during top-down traversal. More...
 
void reinit () override
 Update method called when variables used in precomputation are modified. More...
 
void storeResetState () override
 Save the initial state for later uses in reset() More...
 
void reset () override
 Reset to initial state. More...
 
void writeVec (core::ConstVecId v, std::ostream &out) override
 
void readVec (core::VecId v, std::istream &in) override
 
SReal compareVec (core::ConstVecId v, std::istream &in) override
 
void writeState (std::ostream &out) override
 Write current state to the given output stream. More...
 
void initGnuplot (const std::string path) override
 
void exportGnuplot (SReal time) override
 
void resize (size_t vsize) override
 Resize all stored vector. More...
 
virtual void reserve (size_t vsize)
 
size_t getSize () const override
 Current size of all stored vectors. More...
 
SReal getPX (size_t i) const override
 
SReal getPY (size_t i) const override
 
SReal getPZ (size_t i) const override
 
SReal getVX (size_t i) const
 
SReal getVY (size_t i) const
 
SReal getVZ (size_t i) const
 
void replaceValue (const int inputIndex, const int outputIndex)
 Overwrite values at index outputIndex by the ones at inputIndex. More...
 
void swapValues (const int idx1, const int idx2)
 Exchange values at indices idx1 and idx2. More...
 
void renumberValues (const sofa::helper::vector< unsigned int > &index)
 Reorder values according to parameter. More...
 
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. More...
 
void forcePointPosition (const unsigned int i, const sofa::helper::vector< double > &m_x)
 Force the position of a point (and force its velocity to zero value) More...
 
void getIndicesInSpace (sofa::helper::vector< unsigned > &indices, Real xmin, Real xmax, Real ymin, Real ymax, Real zmin, Real zmax) const override
 Get the indices of the particles located in the given bounding box. More...
 
bool addBBox (SReal *minBBox, SReal *maxBBox) override
 update the given bounding box, to include this More...
 
void computeBBox (const core::ExecParams *params, bool onlyVisible=false) override
 Bounding Box computation method. More...
 
virtual std::list< ConstraintBlockconstraintBlocks (const std::list< unsigned int > &indices) const override
 Express the matrix L in term of block of matrices, using the indices of the lines in the MatrixDeriv container. More...
 
SReal getConstraintJacobianTimesVecDeriv (unsigned int line, core::ConstVecId id) override
 Compute the error given a state vector and a line of the Jacobian (line in vector C) More...
 
void handleStateChange () override
 
bool pickParticles (const core::ExecParams *params, double rayOx, double rayOy, double rayOz, double rayDx, double rayDy, double rayDz, double radius0, double dRadius, std::multimap< double, std::pair< sofa::core::behavior::BaseMechanicalState *, int > > &particles) override
 
bool isIndependent () const
 if this mechanical object stores independent dofs (in opposition to mapped dofs) More...
 
template<>
void applyRotation (const defaulttype::Quat q)
 Rotate the current state. More...
 
template<>
void addFromBaseVectorDifferentSize (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset)
 Perform dest[ offset + i ][j] += src[i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects) More...
 
template<>
void addFromBaseVectorSameSize (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset)
 Perform dest[i][j] += src[offset + i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects) More...
 
template<>
void draw (const core::visual::VisualParams *vparams)
 Render internal data of this object, for debugging purposes. More...
 
template<>
SOFA_BASE_MECHANICS_API void applyRotation (const defaulttype::Quat q)
 Rotate the current state. More...
 
template<>
SOFA_BASE_MECHANICS_API void addFromBaseVectorSameSize (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset)
 Perform dest[i][j] += src[offset + i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects) More...
 
template<>
SOFA_BASE_MECHANICS_API void addFromBaseVectorDifferentSize (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset)
 Perform dest[ offset + i ][j] += src[i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects) More...
 
template<>
SOFA_BASE_MECHANICS_API void draw (const core::visual::VisualParams *vparams)
 Render internal data of this object, for debugging purposes. More...
 
New vectors access API based on VecId
Data< VecCoord > * write (core::VecCoordId v) override
 
const Data< VecCoord > * read (core::ConstVecCoordId v) const override
 
Data< VecDeriv > * write (core::VecDerivId v) override
 
const Data< VecDeriv > * read (core::ConstVecDerivId v) const override
 
Data< MatrixDeriv > * write (core::MatrixDerivId v) override
 
const Data< MatrixDeriv > * read (core::ConstMatrixDerivId v) const override
 
Initial transformations application methods.
void applyTranslation (const SReal dx, const SReal dy, const SReal dz) override
 Apply translation vector to the position. More...
 
void applyRotation (const SReal rx, const SReal ry, const SReal rz) override
 Rotation using Euler Angles in degree. More...
 
void applyRotation (const defaulttype::Quat q) override
 Rotate the current state. More...
 
void applyScale (const SReal sx, const SReal sy, const SReal sz) override
 Scale the current state. More...
 
Base Matrices and Vectors Interface
void copyToBaseVector (defaulttype::BaseVector *dest, core::ConstVecId src, unsigned int &offset) override
 
void copyFromBaseVector (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset) override
 
void addToBaseVector (defaulttype::BaseVector *dest, core::ConstVecId src, unsigned int &offset) override
 
void addFromBaseVectorSameSize (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset) override
 
void addFromBaseVectorDifferentSize (core::VecId dest, const defaulttype::BaseVector *src, unsigned int &offset) override
 
Initial transformations accessors.
void setTranslation (SReal dx, SReal dy, SReal dz)
 
void setRotation (SReal rx, SReal ry, SReal rz)
 
void setScale (SReal sx, SReal sy, SReal sz)
 
virtual Vector3 getTranslation () const
 
virtual Vector3 getRotation () const
 
Vector3 getScale () const override
 
Integration related methods
void beginIntegration (SReal dt) override
 Called at the beginning of each integration step. More...
 
void endIntegration (const core::ExecParams *params, SReal dt) override
 Called at the end of each integration step. More...
 
void accumulateForce (const core::ExecParams *params, core::VecDerivId f=core::VecDerivId::force()) override
 Add stored external forces to F. More...
 
void vAvail (const core::ExecParams *params, core::VecCoordId &v) override
 Increment the index of the given VecCoordId, so that all 'allocated' vectors in this state have a lower index. More...
 
void vAvail (const core::ExecParams *params, core::VecDerivId &v) override
 Increment the index of the given VecDerivId, so that all 'allocated' vectors in this state have a lower index. More...
 
void vAlloc (const core::ExecParams *params, core::VecCoordId v) override
 Increment the index of the given MatrixDerivId, so that all 'allocated' vectors in this state have a lower index. More...
 
void vAlloc (const core::ExecParams *params, core::VecDerivId v) override
 Allocate a new temporary vector. More...
 
void vRealloc (const core::ExecParams *params, core::VecCoordId v) override
 Allocate a new temporary vector. More...
 
void vRealloc (const core::ExecParams *params, core::VecDerivId v) override
 Reallocate a new temporary vector. More...
 
void vFree (const core::ExecParams *params, core::VecCoordId v) override
 Free a temporary vector. More...
 
void vFree (const core::ExecParams *params, core::VecDerivId v) override
 Free a temporary vector. More...
 
void vInit (const core::ExecParams *params, core::VecCoordId v, core::ConstVecCoordId vSrc) override
 Free a temporary vector. More...
 
void vInit (const core::ExecParams *params, core::VecDerivId v, core::ConstVecDerivId vSrc) override
 Initialize an unset vector. More...
 
void vOp (const core::ExecParams *params, core::VecId v, core::ConstVecId a=core::ConstVecId::null(), core::ConstVecId b=core::ConstVecId::null(), SReal f=1.0) override
 Initialize an unset vector. More...
 
void vMultiOp (const core::ExecParams *params, const VMultiOp &ops) override
 Perform a sequence of linear vector accumulation operation $r_i = sum_j (v_j*f_{ij})$. More...
 
void vThreshold (core::VecId a, SReal threshold) override
 Apply a threshold (lower bound) to all entries. More...
 
SReal vDot (const core::ExecParams *params, core::ConstVecId a, core::ConstVecId b) override
 Compute the scalar products between two vectors. More...
 
SReal vSum (const core::ExecParams *params, core::ConstVecId a, unsigned l) override
 Sum of the entries of state vector a at the power of l>0. This is used to compute the l-norm of the vector. More...
 
SReal vMax (const core::ExecParams *params, core::ConstVecId a) override
 Maximum of the absolute values of the entries of state vector a. This is used to compute the infinite-norm of the vector. More...
 
size_t vSize (const core::ExecParams *params, core::ConstVecId v) override
 Get vector size. More...
 
void resetForce (const core::ExecParams *params, core::VecDerivId f=core::VecDerivId::force()) override
 Set F = 0. More...
 
void resetAcc (const core::ExecParams *params, core::VecDerivId a=core::VecDerivId::dx()) override
 Set Acc =0. More...
 
void resetConstraint (const core::ConstraintParams *cparams) override
 Reset the constraint matrix. More...
 
void getConstraintJacobian (const core::ConstraintParams *cparams, sofa::defaulttype::BaseMatrix *J, unsigned int &off) override
 build the jacobian of the constraint in a baseMatrix More...
 
void buildIdentityBlocksInJacobian (const sofa::helper::vector< unsigned int > &list_n, core::MatrixDerivId &mID) override
 fill the jacobian matrix (of the constraints) with identity blocks on the provided list of nodes(dofs) More...
 
Debug
void printDOF (core::ConstVecId, std::ostream &=std::cerr, int firstIndex=0, int range=-1) const override
 
unsigned printDOFWithElapsedTime (core::ConstVecId, unsigned=0, unsigned=0, std::ostream &=std::cerr) override
 
void draw (const core::visual::VisualParams *vparams) override
 Render internal data of this object, for debugging purposes. More...
 
- Public Member Functions inherited from sofa::core::behavior::MechanicalState< DataTypes >
 SOFA_CLASS2 (SOFA_TEMPLATE(MechanicalState, DataTypes), BaseMechanicalState, SOFA_TEMPLATE(State, DataTypes))
 
size_t getCoordDimension () const override
 
size_t getDerivDimension () const override
 
void copyToBuffer (SReal *dst, ConstVecId src, unsigned n) const override
 
void copyFromBuffer (VecId dst, const SReal *src, unsigned n) override
 
void addFromBuffer (VecId dst, const SReal *src, unsigned n) override
 
- Public Member Functions inherited from sofa::core::behavior::BaseMechanicalState
 SOFA_ABSTRACT_CLASS (BaseMechanicalState, BaseState)
 
bool insertInNode (objectmodel::BaseNode *node) override
 
bool removeInNode (objectmodel::BaseNode *node) override
 
virtual void handleStateChange (core::topology::Topology *t)
 Handle state Changes from a given Topology. More...
 
virtual size_t getMatrixBlockSize () const
 Get the number of scalars per Deriv value, as necessary to build mechanical matrices and vectors. More...
 
virtual size_t getMatrixSize () const
 Get the number of rows necessary to build mechanical matrices and vectors. More...
 
virtual void copyToBuffer (SReal *dst, ConstVecId src, unsigned int n) const =0
 Copy data to an external, user-allocated buffer. More...
 
virtual void copyFromBuffer (VecId dst, const SReal *src, unsigned int n)=0
 Copy data from an external, user-allocated buffer. More...
 
virtual void addFromBuffer (VecId dst, const SReal *src, unsigned int n)=0
 Add data from an external, user-allocated buffer. More...
 
- Public Member Functions inherited from sofa::core::BaseState
 SOFA_ABSTRACT_CLASS (BaseState, objectmodel::BaseObject)
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseObject
 SOFA_CLASS (BaseObject, Base)
 
void setSrc (const std::string &v, std::vector< std::string > *attributeList=nullptr)
 Sets a source Object and parses it to collect dependent Data. More...
 
void setSrc (const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr)
 
void * findLinkDestClass (const BaseClass *destType, const std::string &path, const BaseLink *link) override
 
virtual std::string getPathName () const
 Return the full path name of this object. More...
 
template<class T >
T::SPtr searchLocal () const
 Local search of an object of the given type. More...
 
template<class T >
T::SPtr searchUp () const
 Upward search of an object of the given type, starting from the local context. More...
 
template<class T >
T::SPtr searchDown () const
 Downward search of an object of the given type, starting from the local context. More...
 
template<class T >
T::SPtr searchFromRoot () const
 
template<class T >
T::SPtr searchInParents () const
 
template<class T >
helper::vector< typename T::SPtr > searchAllLocal () const
 Local search of all objects of the given type. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllUp () const
 Upward search of all objects of the given type, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllDown () const
 Downward search of all objects of the given type, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllFromRoot () const
 Search of all objects of the given type, starting from the root. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllInParents () const
 
template<class T >
helper::vector< typename T::SPtr > searchAllLocal (const Tag &t) const
 Local search of all objects of the given type with a given Tag. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllUp (const Tag &t) const
 Upward search of all objects of the given type with a given Tag, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllDown (const Tag &t) const
 Downward search of all objects of the given typee with a given Tag, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllFromRoot (const Tag &t) const
 Search of all objects of the given typee with a given Tag, starting from the root. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllInParents (const Tag &t) const
 
template<class T >
helper::vector< typename T::SPtr > searchAllLocal (const TagSet &t) const
 Local search of all objects of the given type with a given TagSet. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllUp (const TagSet &t) const
 Upward search of all objects of the given type with a given TagSet, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllDown (const TagSet &t) const
 Downward search of all objects of the given typee with a given TagSet, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllFromRoot (const TagSet &t) const
 Search of all objects of the given typee with a given TagSet, starting from the root. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllInParents (const TagSet &t) const
 
SReal getTime () const
 Current time. More...
 
const BaseContextgetContext () const
 
BaseContextgetContext ()
 
const BaseObjectgetMaster () const
 
BaseObjectgetMaster ()
 
const VecSlavesgetSlaves () const
 
BaseObjectgetSlave (const std::string &name) const
 
virtual void addSlave (BaseObject::SPtr s)
 
virtual void removeSlave (BaseObject::SPtr s)
 
virtual void handleEvent (Event *)
 Handle an event. More...
 
virtual void handleTopologyChange ()
 
virtual void handleTopologyChange (core::topology::Topology *t)
 
void parse (BaseObjectDescription *arg) override
 Parse the given description to assign values to this object's fields and potentially other parameters. More...
 
virtual void bwdInit ()
 Initialization method called at graph creation and modification, during bottom-up traversal. More...
 
void updateInternal ()
 Update method called when variables (used to compute other internal variables) are modified. More...
 
virtual void cleanup ()
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputToCallback (const std::string &name, BaseData *output)
 
const std::string & getName () const
 Accessor to the object name. More...
 
void setName (const std::string &n)
 Set the name of this object. More...
 
void setName (const std::string &n, int counter)
 Set the name of this object, adding an integer counter. More...
 
virtual std::string getTypeName () const
 Get the type name of this object (i.e. class and template types) More...
 
virtual std::string getClassName () const
 Get the class name of this object. More...
 
virtual std::string getTemplateName () const
 Get the template type names (if any) used to instantiate this object. More...
 
virtual std::string getNameSpaceName () const
 Get the template type names (if any) used to instantiate this object. More...
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 Set the source filename (where the component is implemented) More...
 
const std::string & getDefinitionSourceFileName () const
 Get the source filename (where the component is implemented) More...
 
void setDefinitionSourceFilePos (const int)
 Set the source location (where the component is implemented) More...
 
int getDefinitionSourceFilePos () const
 Get the source location (where the component is implemented) More...
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
const std::string getWarnings () const
 
const std::string getOutputs () const
 use getLoggedMessageAsString() or getLoggedMessage instead. More...
 
void clearWarnings ()
 use getLoggedMessageAsString() or getLoggedMessage instead. More...
 
void clearOutputs ()
 use clearLoggedMessages() instead More...
 
void processStream (std::ostream &out)
 use clearLoggedMessages() instead More...
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
bool IsInheritingFromBase ()
 
const sofa::core::objectmodel::TagSetgetTags () const
 Represents the subsets the object belongs to. More...
 
bool hasTag (Tag t) const
 Return true if the object belong to the given subset. More...
 
void addTag (Tag t)
 Add a subset qualification to the object. More...
 
void removeTag (Tag t)
 Remove a subset qualification to the object. More...
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 Assign one field value (Data or Link) More...
 
virtual bool hasField (const std::string &attribute) const
 Check if a given Data field or Link exists. More...
 
void parseFields (const std::list< std::string > &str)
 Assign the field values stored in the given list of name + value pairs of strings. More...
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 Assign the field values stored in the given map of name -> value pairs. More...
 
void writeDatas (std::map< std::string, std::string * > &str)
 Write the current field values to the given map of name -> value pairs. More...
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 Find data fields given a name: several can be found as we look into the alias map. More...
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 Find link fields given a name: several can be found as we look into the alias map. More...
 
virtual void updateLinks (bool logErrors=true)
 Update pointers in case the pointed-to objects have appeared. More...
 
template<class T >
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
template<class T >
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 Remove a data field. More...
 
void addAlias (BaseData *field, const char *alias)
 Add an alias to a Data. More...
 
void addLink (BaseLink *l)
 Add a link. More...
 
void addAlias (BaseLink *link, const char *alias)
 Add an alias to a Link. More...
 
const VecDatagetDataFields () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapDatagetDataAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
const VecLinkgetLinks () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapLinkgetLinkAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
template<class T >
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 
- Public Member Functions inherited from sofa::core::State< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(State, DataTypes), BaseState)
 
void computeBBox (const core::ExecParams *params, bool onlyVisible=false) override
 
objectmodel::BaseDatabaseWrite (VecId v) override
 
const objectmodel::BaseDatabaseRead (ConstVecId v) const override
 
ReadVecCoord readPositions () const
 
WriteVecCoord writePositions ()
 
WriteOnlyVecCoord writeOnlyPositions ()
 
ReadVecCoord readRestPositions () const
 
WriteVecCoord writeRestPositions ()
 
WriteOnlyVecCoord writeOnlyRestPositions ()
 
ReadVecDeriv readVelocities () const
 
WriteVecDeriv writeVelocities ()
 
WriteOnlyVecDeriv writeOnlyVelocities ()
 
ReadVecDeriv readForces () const
 
WriteVecDeriv writeForces ()
 
WriteOnlyVecDeriv writeOnlyForces ()
 
ReadVecDeriv readDx () const
 
WriteVecDeriv writeDx ()
 
WriteOnlyVecDeriv writeOnlyDx ()
 
ReadVecDeriv readNormals () const
 

Protected Member Functions

 MechanicalObject ()
 
virtual ~MechanicalObject ()
 
void drawIndices (const core::visual::VisualParams *vparams)
 Internal function : Draw indices in 3d coordinates. More...
 
void drawVectors (const core::visual::VisualParams *vparams)
 Internal function : Draw vectors. More...
 
- Protected Member Functions inherited from sofa::core::behavior::MechanicalState< DataTypes >
 ~MechanicalState () override
 
- Protected Member Functions inherited from sofa::core::behavior::BaseMechanicalState
 BaseMechanicalState ()
 
 ~BaseMechanicalState () override
 
- Protected Member Functions inherited from sofa::core::BaseState
 BaseState ()
 
 ~BaseState () override
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseObject
 BaseObject ()
 
 ~BaseObject () override
 
virtual void doUpdateInternal ()
 Implementation of the internal update. More...
 
void changeContextLink (BaseContext *before, BaseContext *&after)
 
void changeSlavesLink (BaseObject::SPtr ptr, unsigned int, bool add)
 This method insures that slaves objects have master and context links set correctly. More...
 
void trackInternalData (const BaseData &data)
 Method called to add the Data to the DataTracker (listing the Data to track) More...
 
void cleanTracker ()
 
bool hasDataChanged (const BaseData &data)
 Method called to know if a tracked Data has changed. More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 Helper method used by initData() More...
 
template<class T >
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
- Protected Member Functions inherited from sofa::core::State< DataTypes >
 State ()
 
 ~State () override
 

Friends

class MechanicalObjectInternalData< DataTypes >
 

Integration-related data

sofa::helper::vector< Data< VecCoord > * > vectorsCoord
 Coordinates DOFs vectors table (static and dynamic allocated) More...
 
sofa::helper::vector< Data< VecDeriv > * > vectorsDeriv
 Derivates DOFs vectors table (static and dynamic allocated) More...
 
sofa::helper::vector< Data< MatrixDeriv > * > vectorsMatrixDeriv
 Constraint vectors table. More...
 
void setVecCoord (unsigned int, Data< VecCoord > *)
 Inserts VecCoord DOF coordinates vector at index in the vectorsCoord container. More...
 
void setVecDeriv (unsigned int, Data< VecDeriv > *)
 Inserts VecDeriv DOF derivates vector at index in the vectorsDeriv container. More...
 
void setVecMatrixDeriv (unsigned int, Data< MatrixDeriv > *)
 Inserts MatrixDeriv DOF at index in the MatrixDeriv container. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from sofa::core::behavior::MechanicalState< DataTypes >
static std::string shortName (const T *ptr=nullptr, objectmodel::BaseObjectDescription *arg=nullptr)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::BaseObject
template<class T >
static bool canCreate (T *, BaseContext *, BaseObjectDescription *)
 Pre-construction check method called by ObjectFactory. More...
 
template<class T >
static T::SPtr create (T *, BaseContext *context, BaseObjectDescription *arg)
 Construction method called by ObjectFactory. More...
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
template<class T >
static void dynamicCast (T *&ptr, Base *b)
 
template<class T >
static std::string typeName (const T *ptr=nullptr)
 
template<class T >
static std::string className (const T *ptr=nullptr)
 
template<class T >
static std::string namespaceName (const T *ptr=nullptr)
 
template<class T >
static std::string templateName (const T *ptr=nullptr)
 
template<class T >
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 

Attribute details

constraints applied to the degrees of freedom

template<class DataTypes >
Data< defaulttype::Vec4f > sofa::component::container::MechanicalObject< DataTypes >::d_color

drawing color

template<class DataTypes >
Data< int > sofa::component::container::MechanicalObject< DataTypes >::d_size
protected

Size of the vectors.

template<class DataTypes >
Data< bool > sofa::component::container::MechanicalObject< DataTypes >::d_useTopology

Shall this object rely on any active topology to initialize its size and positions.

Given the number of a constraint Equation, find the index in the MatrixDeriv C, where the constraint is actually stored.

template<class DataTypes >
Data< int > sofa::component::container::MechanicalObject< DataTypes >::drawMode

The way vectors will be drawn: - 0: Line - 1:Cylinder - 2: Arrow. The DOFS will be drawn: - 0: point - >1: sphere. (default=0)

dx vector of the degrees of freedom

template<class DataTypes >
Data< VecDeriv > sofa::component::container::MechanicalObject< DataTypes >::externalForces

externalForces vector of the degrees of freedom

force vector of the degrees of freedom

template<class DataTypes >
Data< int > sofa::component::container::MechanicalObject< DataTypes >::f_reserve
protected

Size to reserve when creating vectors. (default=0)

mappingJacobian applied to the degrees of freedom

template<class DataTypes >
std::ofstream* sofa::component::container::MechanicalObject< DataTypes >::m_gnuplotFileV
protected
template<class DataTypes >
std::ofstream* sofa::component::container::MechanicalObject< DataTypes >::m_gnuplotFileX
protected
template<class DataTypes >
bool sofa::component::container::MechanicalObject< DataTypes >::m_initialized
protected
template<class DataTypes >
Data< VecCoord > sofa::component::container::MechanicalObject< DataTypes >::reset_position

reset position coordinates of the degrees of freedom

template<class DataTypes >
Data< VecDeriv > sofa::component::container::MechanicalObject< DataTypes >::reset_velocity

reset velocity coordinates of the degrees of freedom

template<class DataTypes >
Data< SReal > sofa::component::container::MechanicalObject< DataTypes >::restScale

optional scaling of rest position coordinates (to simulated pre-existing internal tension).(default = 1.0)

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

Rotation of the DOFs.

template<class DataTypes >
Data< Vector3 > sofa::component::container::MechanicalObject< DataTypes >::rotation2
protected

Rotation of the DOFs, applied the after the rest position has been computed.

template<class DataTypes >
Data< Vector3 > sofa::component::container::MechanicalObject< DataTypes >::scale
protected

Scale of the DOFs in 3 dimensions.

template<class DataTypes >
Data< bool > sofa::component::container::MechanicalObject< DataTypes >::showIndices

Show indices. (default=false)

template<class DataTypes >
Data< float > sofa::component::container::MechanicalObject< DataTypes >::showIndicesScale

Scale for indices display. (default=0.02)

template<class DataTypes >
Data< bool > sofa::component::container::MechanicalObject< DataTypes >::showObject

Show objects. (default=false)

template<class DataTypes >
Data< float > sofa::component::container::MechanicalObject< DataTypes >::showObjectScale

Scale for object display. (default=0.1)

template<class DataTypes >
Data< bool > sofa::component::container::MechanicalObject< DataTypes >::showVectors

Show velocity. (default=false)

template<class DataTypes >
Data< float > sofa::component::container::MechanicalObject< DataTypes >::showVectorsScale

Scale for vectors display. (default=0.0001)

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

Translation of the DOFs.

template<class DataTypes >
Data< Vector3 > sofa::component::container::MechanicalObject< DataTypes >::translation2
protected

Translation of the DOFs, applied after the rest position has been computed.

velocity coordinates of the degrees of freedom

template<class DataTypes >
sofa::helper::vector< Data< VecCoord > * > sofa::component::container::MechanicalObject< DataTypes >::vectorsCoord
protected

Coordinates DOFs vectors table (static and dynamic allocated)

template<class DataTypes >
sofa::helper::vector< Data< VecDeriv > * > sofa::component::container::MechanicalObject< DataTypes >::vectorsDeriv
protected

Derivates DOFs vectors table (static and dynamic allocated)

template<class DataTypes >
sofa::helper::vector< Data< MatrixDeriv > * > sofa::component::container::MechanicalObject< DataTypes >::vectorsMatrixDeriv
protected

Constraint vectors table.

template<class DataTypes >
Data< VecDeriv > sofa::component::container::MechanicalObject< DataTypes >::vfree

free velocity coordinates of the degrees of freedom

position coordinates of the degrees of freedom

rest position coordinates of the degrees of freedom

template<class DataTypes >
Data< VecCoord > sofa::component::container::MechanicalObject< DataTypes >::xfree

free position coordinates of the degrees of freedom

Constructor details

template<class DataTypes >
sofa::component::container::MechanicalObject< DataTypes >::MechanicalObject ( )
protected
template<class DataTypes >
sofa::component::container::MechanicalObject< DataTypes >::~MechanicalObject ( )
protectedvirtual

Function details

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::accumulateForce ( const core::ExecParams params,
core::VecDerivId  f = core::VecDerivId::force() 
)
overridevirtual

Add stored external forces to F.

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

template<class DataTypes >
bool sofa::component::container::MechanicalObject< DataTypes >::addBBox ( SReal *  minBBox,
SReal *  maxBBox 
)
overridevirtual

update the given bounding box, to include this

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

template<>
void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::addFromBaseVectorDifferentSize ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
virtual

Perform dest[ offset + i ][j] += src[i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects)

Parameters
offsetthe offset in the MechanicalObject local vector specified by VecId dest. It will be updated to the first scalar value after the ones used by this operation when this method returns.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::addFromBaseVectorDifferentSize ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
overridevirtual

src size can be smaller or equal to dest size. Performs: dest[ offset + i ][j] += src[i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects)

Parameters
offsetthe offset in the MechanicalObject local vector specified by VecId dest. It will be updated to the first scalar value after the ones used by this operation when this method returns.

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

template<>
SOFA_BASE_MECHANICS_API void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::addFromBaseVectorDifferentSize ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
virtual

Perform dest[ offset + i ][j] += src[i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects)

Parameters
offsetthe offset in the MechanicalObject local vector specified by VecId dest. It will be updated to the first scalar value after the ones used by this operation when this method returns.

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

template<>
void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::addFromBaseVectorSameSize ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
virtual

Perform dest[i][j] += src[offset + i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects)

Parameters
offsetthe offset in the BaseVector where the scalar values will be used. It will be updated to the first scalar value after the ones used by this operation when this method returns

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::addFromBaseVectorSameSize ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
overridevirtual

src and dest must have the same size. Performs: dest[i][j] += src[offset + i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects)

Parameters
offsetthe offset in the BaseVector where the scalar values will be used. It will be updated to the first scalar value after the ones used by this operation when this method returns

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

template<>
SOFA_BASE_MECHANICS_API void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::addFromBaseVectorSameSize ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
virtual

Perform dest[i][j] += src[offset + i][j] 0<= i < src_entries 0<= j < 3 (for 3D objects) 0 <= j < 2 (for 2D objects)

Parameters
offsetthe offset in the BaseVector where the scalar values will be used. It will be updated to the first scalar value after the ones used by this operation when this method returns

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::addToBaseVector ( defaulttype::BaseVector dest,
core::ConstVecId  src,
unsigned int offset 
)
overridevirtual

Add data to a global BaseVector from the state stored in a local vector

Parameters
offsetthe offset in the BaseVector where the scalar values will be used. It will be updated to the first scalar value after the ones used by this operation when this method returns

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

template<>
void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::applyRotation ( const defaulttype::Quat  q)
virtual

Rotate the current state.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::applyRotation ( const SReal  rx,
const SReal  ry,
const SReal  rz 
)
overridevirtual

Rotation using Euler Angles in degree.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::applyRotation ( const defaulttype::Quat  q)
overridevirtual

Rotate the current state.

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

template<>
SOFA_BASE_MECHANICS_API void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::applyRotation ( const defaulttype::Quat  q)
virtual

Rotate the current state.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::applyScale ( const SReal  ,
const SReal  ,
const SReal   
)
overridevirtual

Scale the current state.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::applyTranslation ( const SReal  dx,
const SReal  dy,
const SReal  dz 
)
overridevirtual

Apply translation vector to the position.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::beginIntegration ( SReal  )
overridevirtual

Called at the beginning of each integration step.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::buildIdentityBlocksInJacobian ( const sofa::helper::vector< unsigned int > &  list_n,
core::MatrixDerivId mID 
)
overridevirtual

fill the jacobian matrix (of the constraints) with identity blocks on the provided list of nodes(dofs)

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

template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::compareVec ( core::ConstVecId  v,
std::istream &  in 
)
overridevirtual
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::computeBBox ( const core::ExecParams params,
bool  onlyVisible = false 
)
overridevirtual

Bounding Box computation method.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::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.

Sum of the coefs should usually equal to 1.0

template<class DataTypes >
std::list< core::behavior::BaseMechanicalState::ConstraintBlock > sofa::component::container::MechanicalObject< DataTypes >::constraintBlocks ( const std::list< unsigned int > &  indices) const
overridevirtual

Express the matrix L in term of block of matrices, using the indices of the lines in the MatrixDeriv container.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::copyFromBaseVector ( core::VecId  dest,
const defaulttype::BaseVector src,
unsigned int offset 
)
overridevirtual

Copy data to a local vector the state stored in a global BaseVector

Parameters
offsetthe offset in the BaseVector where the scalar values will be used. It will be updated to the first scalar value after the ones used by this operation when this method returns

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::copyToBaseVector ( defaulttype::BaseVector dest,
core::ConstVecId  src,
unsigned int offset 
)
overridevirtual

Copy data to a global BaseVector the state stored in a local vector

Parameters
offsetthe offset in the BaseVector where the scalar values will be used. It will be updated to the first scalar value after the ones used by this operation when this method returns

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

Render internal data of this object, for debugging purposes.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::draw ( const core::visual::VisualParams )
inlineoverridevirtual

Render internal data of this object, for debugging purposes.

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

template<>
SOFA_BASE_MECHANICS_API void sofa::component::container::MechanicalObject< defaulttype::Rigid3Types >::draw ( const core::visual::VisualParams )
virtual

Render internal data of this object, for debugging purposes.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::drawIndices ( const core::visual::VisualParams vparams)
inlineprotected

Internal function : Draw indices in 3d coordinates.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::drawVectors ( const core::visual::VisualParams vparams)
inlineprotected

Internal function : Draw vectors.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::endIntegration ( const core::ExecParams params,
SReal   
)
overridevirtual

Called at the end of each integration step.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::exportGnuplot ( SReal  time)
overridevirtual
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::forcePointPosition ( const unsigned int  i,
const sofa::helper::vector< double > &  m_x 
)

Force the position of a point (and force its velocity to zero value)

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::getConstraintJacobian ( const core::ConstraintParams params,
sofa::defaulttype::BaseMatrix J,
unsigned int off 
)
overridevirtual

build the jacobian of the constraint in a baseMatrix

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

template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getConstraintJacobianTimesVecDeriv ( unsigned int  ,
core::ConstVecId   
)
overridevirtual

Compute the error given a state vector and a line of the Jacobian (line in vector C)

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

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

Get the indices of the particles located in the given bounding box.

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

template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getPX ( size_t  i) const
inlineoverridevirtual
template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getPY ( size_t  i) const
inlineoverridevirtual
template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getPZ ( size_t  i) const
inlineoverridevirtual
template<class DataTypes >
virtual Vector3 sofa::component::container::MechanicalObject< DataTypes >::getRotation ( ) const
inlinevirtual
template<class DataTypes >
Vector3 sofa::component::container::MechanicalObject< DataTypes >::getScale ( ) const
inlineoverridevirtual
template<class DataTypes >
size_t sofa::component::container::MechanicalObject< DataTypes >::getSize ( ) const
inlineoverridevirtual

Current size of all stored vectors.

Implements sofa::core::BaseState.

template<class DataTypes >
virtual Vector3 sofa::component::container::MechanicalObject< DataTypes >::getTranslation ( ) const
inlinevirtual
template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getVX ( size_t  i) const
inline
template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getVY ( size_t  i) const
inline
template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::getVZ ( size_t  i) const
inline
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::handleStateChange ( )
overridevirtual

Handle state Changes

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::init ( void  )
overridevirtual

Initialization method called at graph creation and modification, during top-down traversal.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::initGnuplot ( const std::string  path)
overridevirtual
template<class DataTypes >
bool sofa::component::container::MechanicalObject< DataTypes >::isIndependent ( ) const

if this mechanical object stores independent dofs (in opposition to mapped dofs)

template<class DataTypes >
MechanicalObject< DataTypes > & sofa::component::container::MechanicalObject< DataTypes >::operator= ( const MechanicalObject< DataTypes > &  obj)
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::parse ( core::objectmodel::BaseObjectDescription arg)
overridevirtual

Parse the given description to assign values to this object's fields and potentially other parameters.

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

template<class DataTypes >
bool sofa::component::container::MechanicalObject< DataTypes >::pickParticles ( const core::ExecParams params,
double  rayOx,
double  rayOy,
double  rayOz,
double  rayDx,
double  rayDy,
double  rayDz,
double  radius0,
double  dRadius,
std::multimap< double, std::pair< sofa::core::behavior::BaseMechanicalState *, int > > &  particles 
)
overridevirtual

Find mechanical particles hit by the given ray. A mechanical particle is defined as a 2D or 3D, position or rigid DOF Returns false if this object does not support picking

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::printDOF ( core::ConstVecId  v,
std::ostream &  out = std::cerr,
int  firstIndex = 0,
int  range = -1 
) const
overridevirtual
template<class DataTypes >
unsigned sofa::component::container::MechanicalObject< DataTypes >::printDOFWithElapsedTime ( core::ConstVecId  v,
unsigned  count = 0,
unsigned  time = 0,
std::ostream &  out = std::cerr 
)
overridevirtual
template<class DataTypes >
const Data< typename MechanicalObject< DataTypes >::VecCoord > * sofa::component::container::MechanicalObject< DataTypes >::read ( core::ConstVecCoordId  v) const
overridevirtual
template<class DataTypes >
const Data< typename MechanicalObject< DataTypes >::VecDeriv > * sofa::component::container::MechanicalObject< DataTypes >::read ( core::ConstVecDerivId  v) const
overridevirtual
template<class DataTypes >
const Data< typename MechanicalObject< DataTypes >::MatrixDeriv > * sofa::component::container::MechanicalObject< DataTypes >::read ( core::ConstMatrixDerivId  v) const
overridevirtual
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::readVec ( core::VecId  v,
std::istream &  in 
)
overridevirtual
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::reinit ( )
overridevirtual

Update method called when variables used in precomputation are modified.

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

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

Reorder values according to parameter.

Result of this method is : newValue[ i ] = oldValue[ index[i] ];

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

Overwrite values at index outputIndex by the ones at inputIndex.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::reserve ( size_t  vsize)
virtual
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::reset ( )
overridevirtual

Reset to initial state.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::resetAcc ( const core::ExecParams params,
core::VecDerivId  a = core::VecDerivId::dx() 
)
overridevirtual

Set Acc =0.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::resetConstraint ( const core::ConstraintParams params)
overridevirtual

Reset the constraint matrix.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::resetForce ( const core::ExecParams params,
core::VecDerivId  f = core::VecDerivId::force() 
)
overridevirtual

Set F = 0.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::resize ( size_t  vsize)
overridevirtual

Resize all stored vector.

Implements sofa::core::BaseState.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::setRotation ( SReal  rx,
SReal  ry,
SReal  rz 
)
inline
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::setScale ( SReal  sx,
SReal  sy,
SReal  sz 
)
inline
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::setTranslation ( SReal  dx,
SReal  dy,
SReal  dz 
)
inline
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::setVecCoord ( unsigned int  index,
Data< VecCoord > *  v 
)
protected

Inserts VecCoord DOF coordinates vector at index in the vectorsCoord container.

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

Inserts VecDeriv DOF derivates vector at index in the vectorsDeriv container.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::setVecMatrixDeriv ( unsigned int  index,
Data< MatrixDeriv > *  m 
)
protected

Inserts MatrixDeriv DOF at index in the MatrixDeriv container.

template<class DataTypes >
sofa::component::container::MechanicalObject< DataTypes >::SOFA_CLASS ( SOFA_TEMPLATE(MechanicalObject< DataTypes >, DataTypes ,
SOFA_TEMPLATE(sofa::core::behavior::MechanicalState, DataTypes  
)
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::storeResetState ( )
overridevirtual

Save the initial state for later uses in reset()

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

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

Exchange values at indices idx1 and idx2.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vAlloc ( const core::ExecParams params,
core::VecCoordId  v 
)
overridevirtual

Increment the index of the given MatrixDerivId, so that all 'allocated' vectors in this state have a lower index.

Allocate a new temporary vector

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vAlloc ( const core::ExecParams params,
core::VecDerivId  v 
)
overridevirtual

Allocate a new temporary vector.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vAvail ( const core::ExecParams params,
core::VecCoordId v 
)
overridevirtual

Increment the index of the given VecCoordId, so that all 'allocated' vectors in this state have a lower index.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vAvail ( const core::ExecParams params,
core::VecDerivId v 
)
overridevirtual

Increment the index of the given VecDerivId, so that all 'allocated' vectors in this state have a lower index.

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

template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::vDot ( const core::ExecParams params,
core::ConstVecId  a,
core::ConstVecId  b 
)
overridevirtual

Compute the scalar products between two vectors.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vFree ( const core::ExecParams params,
core::VecCoordId  v 
)
overridevirtual

Free a temporary vector.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vFree ( const core::ExecParams params,
core::VecDerivId  v 
)
overridevirtual

Free a temporary vector.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vInit ( const core::ExecParams params,
core::VecCoordId  v,
core::ConstVecCoordId  vSrc 
)
overridevirtual

Free a temporary vector.

Initialize an unset vector

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vInit ( const core::ExecParams params,
core::VecDerivId  v,
core::ConstVecDerivId  vSrc 
)
overridevirtual

Initialize an unset vector.

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

template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::vMax ( const core::ExecParams params,
core::ConstVecId  a 
)
overridevirtual

Maximum of the absolute values of the entries of state vector a. This is used to compute the infinite-norm of the vector.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vMultiOp ( const core::ExecParams params,
const VMultiOp ops 
)
overridevirtual

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.

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::behavior::BaseMechanicalState.

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vOp ( const core::ExecParams params,
core::VecId  v,
core::ConstVecId  a = core::ConstVecId::null(),
core::ConstVecId  b = core::ConstVecId::null(),
SReal  f = 1.0 
)
overridevirtual

Initialize an unset vector.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vRealloc ( const core::ExecParams params,
core::VecCoordId  v 
)
overridevirtual

Allocate a new temporary vector.

Reallocate a new temporary vector

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vRealloc ( const core::ExecParams params,
core::VecDerivId  v 
)
overridevirtual

Reallocate a new temporary vector.

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

template<class DataTypes >
size_t sofa::component::container::MechanicalObject< DataTypes >::vSize ( const core::ExecParams params,
core::ConstVecId  v 
)
overridevirtual

Get vector size.

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

template<class DataTypes >
SReal sofa::component::container::MechanicalObject< DataTypes >::vSum ( const core::ExecParams params,
core::ConstVecId  a,
unsigned  l 
)
overridevirtual

Sum of the entries of state vector a at the power of l>0. This is used to compute the l-norm of the vector.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::vThreshold ( core::VecId  a,
SReal  threshold 
)
overridevirtual

Apply a threshold (lower bound) to all entries.

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

template<class DataTypes >
Data< typename MechanicalObject< DataTypes >::VecCoord > * sofa::component::container::MechanicalObject< DataTypes >::write ( core::VecCoordId  v)
overridevirtual
template<class DataTypes >
Data< typename MechanicalObject< DataTypes >::VecDeriv > * sofa::component::container::MechanicalObject< DataTypes >::write ( core::VecDerivId  v)
overridevirtual
template<class DataTypes >
Data< typename MechanicalObject< DataTypes >::MatrixDeriv > * sofa::component::container::MechanicalObject< DataTypes >::write ( core::MatrixDerivId  v)
overridevirtual
template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::writeState ( std::ostream &  out)
overridevirtual

Write current state to the given output stream.

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

template<class DataTypes >
void sofa::component::container::MechanicalObject< DataTypes >::writeVec ( core::ConstVecId  v,
std::ostream &  out 
)
overridevirtual

Related details

template<class DataTypes >
friend class MechanicalObjectInternalData< DataTypes >
friend