sofa::core::componentmodel::behavior::MechanicalMapping< In, Out > Class Template Reference

Specialized interface to convert a mechanical model of type In to another mechanical model of type Out. More...

#include <MechanicalMapping.h>

Inheritance diagram for sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >:

Inheritance graph
[legend]
Collaboration diagram for sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >:

Collaboration graph
[legend]

Public Member Functions

 MechanicalMapping (In *from, Out *to)
virtual ~MechanicalMapping ()
virtual void applyJT (typename In::VecDeriv &out, const typename Out::VecDeriv &in)=0
 Apply the reverse mapping on force vectors.
virtual void applyJT (typename In::VecConst &, const typename Out::VecConst &)
 Apply the reverse mapping on constraint matrix.
virtual BaseMechanicalState * getMechFrom ()
 Get the source (upper) model.
virtual BaseMechanicalState * getMechTo ()
 Get the destination (lower, mapped) model.
virtual bool isMechanical ()
 Return false if this mapping should only be used as a regular mapping instead of a mechanical mapping.
virtual void init ()
 Initialization method called at graph modification, during bottom-up traversal.
virtual void propagateX ()
 Propagate position from the source model to the destination model.
virtual void propagateXfree ()
 Propagate free-motion position from the source model to the destination model.
virtual void propagateV ()
 Propagate velocity from the source model to the destination model.
virtual void propagateDx ()
 Propagate displacement from the source model to the destination model.
virtual void accumulateForce ()
 Accumulate forces from the destination model back to the source model.
virtual void accumulateDf ()
 Accumulate force deltas from the destination model back to the source model.
virtual void accumulateConstraint ()
 Accumulate constraint from the destination model back to the source model.

Static Public Member Functions

static std::string templateName (const MechanicalMapping< In, Out > *=NULL)

Data Fields

Data< bool > f_isMechanical

Protected Member Functions

bool getShow () const
 If true, display the mapping.

Detailed Description

template<class In, class Out>
class sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >

Specialized interface to convert a mechanical model of type In to another mechanical model of type Out.

A MechanicalMapping is a mapping between two MechanicalState. Position, velocity and displacement are propagated from the source (upper) model to the destination (lower, or mapped) model, while forces and constraints are accumulated back from the destination model to the source model.

If the mapping is linear, then it can be represented by a matrix J, and most computations correspond to multiply this matrix or its transpose to the given vectors.

Definition at line 60 of file MechanicalMapping.h.


Constructor & Destructor Documentation

template<class In , class Out >
sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::MechanicalMapping ( In *  from,
Out *  to 
) [inline]

Definition at line 51 of file MechanicalMapping.inl.

template<class In , class Out >
sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::~MechanicalMapping (  )  [inline, virtual]

Definition at line 58 of file MechanicalMapping.inl.


Member Function Documentation

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::accumulateConstraint (  )  [inline, virtual]

Accumulate constraint from the destination model back to the source model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ C_in += J^t C_out $

This method retrieves the constraint matrices and call the internal applyJT() method implemented by the component.

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

Definition at line 134 of file MechanicalMapping.inl.

References sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::applyJT(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::accumulateDf (  )  [inline, virtual]

Accumulate force deltas from the destination model back to the source model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ df_in += J^t df_out $

This method retrieves the force vectors and call the internal applyJT() method implemented by the component.

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

Definition at line 127 of file MechanicalMapping.inl.

References sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::applyJT(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::accumulateForce (  )  [inline, virtual]

Accumulate forces from the destination model back to the source model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ f_in += J^t f_out $

This method retrieves the force vectors and call the internal applyJT() method implemented by the component.

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

Definition at line 117 of file MechanicalMapping.inl.

References sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::applyJT(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
virtual void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::applyJT ( typename In::VecConst &  ,
const typename Out::VecConst &   
) [inline, virtual]

Apply the reverse mapping on constraint matrix.

If the MechanicalMapping can be represented as a matrix J, this method computes $ Out += J^t In $

This method must be reimplemented by all mappings if they need to support constraints.

Definition at line 83 of file MechanicalMapping.h.

template<class In , class Out >
virtual void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::applyJT ( typename In::VecDeriv &  out,
const typename Out::VecDeriv &  in 
) [pure virtual]

Apply the reverse mapping on force vectors.

If the MechanicalMapping can be represented as a matrix J, this method computes $ out += J^t in $

This method must be reimplemented by all mappings.

Referenced by sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::accumulateConstraint(), sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::accumulateDf(), and sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::accumulateForce().

template<class In , class Out >
BaseMechanicalState * sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::getMechFrom (  )  [inline, virtual]

Get the source (upper) model.

Implements sofa::core::componentmodel::behavior::BaseMechanicalMapping.

Definition at line 63 of file MechanicalMapping.inl.

References sofa::core::Mapping< TIn, TOut >::fromModel.

template<class In , class Out >
BaseMechanicalState * sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::getMechTo (  )  [inline, virtual]

Get the destination (lower, mapped) model.

Implements sofa::core::componentmodel::behavior::BaseMechanicalMapping.

Definition at line 69 of file MechanicalMapping.inl.

References sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
bool sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::getShow (  )  const [inline, protected]

If true, display the mapping.

Reimplemented from sofa::core::Mapping< TIn, TOut >.

Definition at line 158 of file MechanicalMapping.h.

References sofa::core::objectmodel::BaseObject::getContext().

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::init (  )  [inline, virtual]

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

Reimplemented from sofa::core::Mapping< TIn, TOut >.

Definition at line 81 of file MechanicalMapping.inl.

References sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateXfree(), and sofa::core::Mapping< TIn, TOut >::updateMapping().

template<class In , class Out >
bool sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::isMechanical (  )  [inline, virtual]

Return false if this mapping should only be used as a regular mapping instead of a mechanical mapping.

Implements sofa::core::componentmodel::behavior::BaseMechanicalMapping.

Definition at line 75 of file MechanicalMapping.inl.

References sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::f_isMechanical.

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateDx (  )  [inline, virtual]

Propagate displacement from the source model to the destination model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ dx_out = J dx_in $

This method retrieves the dx vectors and call the internal applyJ() method implemented by the component.

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

Definition at line 102 of file MechanicalMapping.inl.

References sofa::core::Mapping< TIn, TOut >::applyJ(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateV (  )  [inline, virtual]

Propagate velocity from the source model to the destination model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ v_out = J v_in $

This method retrieves the v vectors and call the internal apply() method implemented by the component.

Implements sofa::core::componentmodel::behavior::BaseMechanicalMapping.

Definition at line 95 of file MechanicalMapping.inl.

References sofa::core::Mapping< TIn, TOut >::applyJ(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateX (  )  [inline, virtual]

Propagate position from the source model to the destination model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ x_out = J x_in $

This method retrieves the x vectors and call the internal apply() method implemented by the component.

Implements sofa::core::componentmodel::behavior::BaseMechanicalMapping.

Definition at line 88 of file MechanicalMapping.inl.

References sofa::core::Mapping< TIn, TOut >::apply(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

template<class In , class Out >
void sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateXfree (  )  [inline, virtual]

Propagate free-motion position from the source model to the destination model.

If the MechanicalMapping can be represented as a matrix J, this method computes $ xfree_out = J xfree_in $

This method retrieves the xfree vectors and call the internal apply() method implemented by the component.

Implements sofa::core::componentmodel::behavior::BaseMechanicalMapping.

Definition at line 109 of file MechanicalMapping.inl.

References sofa::core::Mapping< TIn, TOut >::apply(), sofa::core::Mapping< TIn, TOut >::fromModel, and sofa::core::Mapping< TIn, TOut >::toModel.

Referenced by sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::init().

template<class In , class Out >
static std::string sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::templateName ( const MechanicalMapping< In, Out > *  = NULL  )  [inline, static]

Definition at line 152 of file MechanicalMapping.h.


Field Documentation


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

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