sofa::core::Mapping< TIn, TOut > Class Template Reference

Specialized interface to convert a model of type TIn to an other model of type TOut. More...

#include <Mapping.h>

Inheritance diagram for sofa::core::Mapping< TIn, TOut >:

Inheritance graph
[legend]
Collaboration diagram for sofa::core::Mapping< TIn, TOut >:

Collaboration graph
[legend]

Public Types

typedef TIn In
 Input Model Type.
typedef TOut Out
 Output Model Type.

Public Member Functions

 Mapping (In *from=NULL, Out *to=NULL)
 Constructor, taking input and output models as parameters.
virtual ~Mapping ()
 Destructor.
virtual void setModels (In *from, Out *to)
 Specify the input and output models.
In * getFromModel ()
 Return the pointer to the input model.
Out * getToModel ()
 Return the pointer to the output model.
objectmodel::BaseObject * getFrom ()
 Return the pointer to the input model.
objectmodel::BaseObject * getTo ()
 Return the pointer to the output model.
virtual void apply (typename Out::VecCoord &out, const typename In::VecCoord &in)=0
 Apply the mapping on position vectors.
virtual void applyJ (typename Out::VecDeriv &out, const typename In::VecDeriv &in)=0
 Apply the mapping on derived (velocity, displacement) vectors.
virtual void init ()
 Initialization method called at graph modification, during bottom-up traversal.
virtual void updateMapping ()
 Apply the mapping to position and velocity vectors.
virtual void disable ()
 Disable the mapping to get the original coordinates of the mapped model.
virtual std::string getTemplateName () const
 Get the template type names (if any) used to instantiate this object.

Static Public Member Functions

template<class T >
static bool canCreate (T *&obj, core::objectmodel::BaseContext *context, core::objectmodel::BaseObjectDescription *arg)
 Pre-construction check method called by ObjectFactory.
template<class T >
static void create (T *&obj, core::objectmodel::BaseContext *context, core::objectmodel::BaseObjectDescription *arg)
 Construction method called by ObjectFactory.
static std::string templateName (const Mapping< TIn, TOut > *=NULL)

Protected Member Functions

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

Protected Attributes

In * fromModel
 Input Model.
Out * toModel
 Output Model.
Data< std::string > object1
 Name of the Input Model.
Data< std::string > object2
 Name of the Output Model.

Detailed Description

template<class TIn, class TOut>
class sofa::core::Mapping< TIn, TOut >

Specialized interface to convert a model of type TIn to an other model of type TOut.

This Interface is used for the Mappings. A Mapping can convert one model to an other. For example, we can have a mapping from a BehaviorModel to a VisualModel.

Definition at line 47 of file Mapping.h.


Member Typedef Documentation

template<class TIn , class TOut >
typedef TIn sofa::core::Mapping< TIn, TOut >::In

Input Model Type.

Definition at line 51 of file Mapping.h.

template<class TIn , class TOut >
typedef TOut sofa::core::Mapping< TIn, TOut >::Out

Output Model Type.

Definition at line 53 of file Mapping.h.


Constructor & Destructor Documentation

template<class In , class Out >
sofa::core::Mapping< In, Out >::Mapping ( In *  from = NULL,
Out *  to = NULL 
) [inline]

Constructor, taking input and output models as parameters.

Note that if you do not specify these models here, you must called setModels with non-NULL value before the intialization (i.e. before init() is called).

Definition at line 42 of file Mapping.inl.

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

Destructor.

Definition at line 50 of file Mapping.inl.


Member Function Documentation

template<class TIn , class TOut >
virtual void sofa::core::Mapping< TIn, TOut >::apply ( typename Out::VecCoord &  out,
const typename In::VecCoord &  in 
) [pure virtual]

Apply the mapping on position vectors.

If the Mapping can be represented as a matrix J, this method computes $ out = J in $

This method must be reimplemented by all mappings.

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

template<class TIn , class TOut >
virtual void sofa::core::Mapping< TIn, TOut >::applyJ ( typename Out::VecDeriv &  out,
const typename In::VecDeriv &  in 
) [pure virtual]

Apply the mapping on derived (velocity, displacement) vectors.

If the Mapping can be represented as a matrix J, this method computes $ out = J in $

This method must be reimplemented by all mappings.

Referenced by sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateDx(), sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >::propagateV(), and sofa::core::Mapping< TIn, TOut >::updateMapping().

template<class TIn , class TOut >
template<class T >
static bool sofa::core::Mapping< TIn, TOut >::canCreate ( T *&  obj,
core::objectmodel::BaseContext *  context,
core::objectmodel::BaseObjectDescription *  arg 
) [inline, static]

Pre-construction check method called by ObjectFactory.

This implementation read the object1 and object2 attributes and check if they are compatible with the input and output model types of this mapping.

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

Definition at line 122 of file Mapping.h.

Referenced by sofa::core::Mapping< BaseMeshTopology, BaseMeshTopology >::canCreate().

template<class TIn , class TOut >
template<class T >
static void sofa::core::Mapping< TIn, TOut >::create ( T *&  obj,
core::objectmodel::BaseContext *  context,
core::objectmodel::BaseObjectDescription *  arg 
) [inline, static]

Construction method called by ObjectFactory.

This implementation read the object1 and object2 attributes to find the input and output models of this mapping.

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

Definition at line 140 of file Mapping.h.

template<class In , class Out >
void sofa::core::Mapping< In, Out >::disable (  )  [inline, virtual]

Disable the mapping to get the original coordinates of the mapped model.

It is for instance used in RigidMapping to get the local coordinates of the object.

Implements sofa::core::BaseMapping.

Definition at line 85 of file Mapping.inl.

template<class In , class Out >
objectmodel::BaseObject * sofa::core::Mapping< In, Out >::getFrom (  )  [inline, virtual]

Return the pointer to the input model.

Implements sofa::core::BaseMapping.

Definition at line 67 of file Mapping.inl.

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

Referenced by sofa::component::mapping::SPHFluidSurfaceMapping< In, Out >::init().

template<class In , class Out >
In * sofa::core::Mapping< In, Out >::getFromModel (  )  [inline]

Return the pointer to the input model.

Definition at line 55 of file Mapping.inl.

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

template<class TIn , class TOut >
bool sofa::core::Mapping< TIn, TOut >::getShow (  )  const [inline, protected]

If true, display the mapping.

Reimplemented in sofa::core::componentmodel::behavior::MechanicalMapping< In, Out >.

Definition at line 175 of file Mapping.h.

template<class TIn , class TOut >
virtual std::string sofa::core::Mapping< TIn, TOut >::getTemplateName (  )  const [inline, virtual]

Get the template type names (if any) used to instantiate this object.

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

Definition at line 159 of file Mapping.h.

template<class In , class Out >
objectmodel::BaseObject * sofa::core::Mapping< In, Out >::getTo (  )  [inline, virtual]

Return the pointer to the output model.

Implements sofa::core::BaseMapping.

Definition at line 73 of file Mapping.inl.

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

template<class In , class Out >
Out * sofa::core::Mapping< In, Out >::getToModel (  )  [inline]

Return the pointer to the output model.

Definition at line 61 of file Mapping.inl.

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

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

template<class In , class Out >
void sofa::core::Mapping< In, Out >::setModels ( In *  from,
Out *  to 
) [inline, virtual]

Specify the input and output models.

Definition at line 90 of file Mapping.inl.

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

template<class TIn , class TOut >
static std::string sofa::core::Mapping< TIn, TOut >::templateName ( const Mapping< TIn, TOut > *  = NULL  )  [inline, static]

template<class In , class Out >
void sofa::core::Mapping< In, Out >::updateMapping (  )  [inline, virtual]

Apply the mapping to position and velocity vectors.

This method call the internal apply(Out::VecCoord&,const In::VecCoord&) and applyJ(Out::VecDeriv&,const In::VecDeriv&) methods.

Implements sofa::core::BaseMapping.

Definition at line 96 of file Mapping.inl.

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

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


Field Documentation

template<class TIn , class TOut >
In* sofa::core::Mapping< TIn, TOut >::fromModel [protected]

template<class TIn , class TOut >
Data< std::string > sofa::core::Mapping< TIn, TOut >::object1 [protected]

Name of the Input Model.

Definition at line 61 of file Mapping.h.

template<class TIn , class TOut >
Data< std::string > sofa::core::Mapping< TIn, TOut >::object2 [protected]

Name of the Output Model.

Definition at line 63 of file Mapping.h.

template<class TIn , class TOut >
Out* sofa::core::Mapping< TIn, TOut >::toModel [protected]


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

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