sofa::component::topology::PointData< T, Alloc > Class Template Reference

A class for storing point related data. More...

#include <PointData.h>

Inheritance diagram for sofa::component::topology::PointData< T, Alloc >:

Inheritance graph
[legend]
Collaboration diagram for sofa::component::topology::PointData< T, Alloc >:

Collaboration graph
[legend]

Public Types

typedef sofa::helper::vector
< T, Alloc >::size_type 
size_type
 size_type
typedef sofa::helper::vector
< T, Alloc >::reference 
reference
 reference to a value (read-write)
typedef sofa::helper::vector
< T, Alloc >::const_reference 
const_reference
 const reference to a value (read only)

Public Member Functions

 PointData (size_type n, const T &value)
 Constructor.
 PointData (int n, const T &value)
 Constructor.
 PointData (long n, const T &value)
 Constructor.
 PointData (size_type n)
 Constructor.
 PointData (const sofa::helper::vector< T, Alloc > &x)
 Constructor.
 PointData (typename PointData< T >::const_iterator first, typename PointData< T, Alloc >::const_iterator last)
 Constructor.
 PointData (void(*createFunc)(int, void *, T &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)=pd_basicCreateFunc, void *createParam=(void *) NULL, void(*destroyFunc)(int, void *, T &)=pd_basicDestroyFunc, void *destroyParam=(void *) NULL)
 Optionnaly takes 2 parameters, a creation and a destruction function that will be called when adding/deleting elements.
void handleTopologyEvents (std::list< const core::componentmodel::topology::TopologyChange * >::const_iterator changeIt, std::list< const core::componentmodel::topology::TopologyChange * >::const_iterator &end)
 Handle PointSetTopology related events, ignore others.
void setCreateFunction (void(*createFunc)(int, void *, T &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &))
void setDestroyFunction (void(*destroyFunc)(int, void *, T &))
void setCreateEdgeFunction (void(*createEdgeFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setDestroyEdgeFunction (void(*destroyEdgeFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setCreateTriangleFunction (void(*createTriangleFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setDestroyTriangleFunction (void(*destroyTriangleFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setCreateQuadFunction (void(*createQuadFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setDestroyQuadFunction (void(*destroyQuadFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setCreateTetrahedronFunction (void(*createTetrahedronFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setDestroyTetrahedronFunction (void(*destroyTetrahedronFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &))
void setDestroyParameter (void *destroyParam)
void setCreateParameter (void *createParam)

Private Member Functions

void swap (unsigned int i1, unsigned int i2)
 Swaps values at indices i1 and i2.
void add (unsigned int nbPoints, const sofa::helper::vector< sofa::helper::vector< unsigned int > > &ancestors, const sofa::helper::vector< sofa::helper::vector< double > > &coefs)
 Add some values. Values are added at the end of the vector.
void remove (const sofa::helper::vector< unsigned int > &index)
 Remove the values corresponding to the points removed.
void renumber (const sofa::helper::vector< unsigned int > &index)
 Reorder the values.

Private Attributes

void(* m_createFunc )(int, void *, T &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)
 Creation function, called when adding elements.
void(* m_destroyFunc )(int, void *, T &)
 Destruction function, called when deleting elements.
void(* m_createEdgeFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Creation function, called when adding edges elements.
void(* m_destroyEdgeFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Destruction function, called when removing edges elements.
void(* m_createTriangleFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Creation function, called when adding triangles elements.
void(* m_destroyTriangleFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Destruction function, called when removing triangles elements.
void(* m_createQuadFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Creation function, called when adding quads elements.
void(* m_destroyQuadFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Destruction function, called when removing quads elements.
void(* m_createTetrahedronFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Creation function, called when adding tetrahedra elements.
void(* m_destroyTetrahedronFunc )(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)
 Destruction function, called when removing tetrahedra elements.
void * m_createParam
 Parameter to be passed to creation function.
void * m_destroyParam
 Parameter to be passed to destruction function.

Detailed Description

template<class T, class Alloc = std::allocator<T>>
class sofa::component::topology::PointData< T, Alloc >

A class for storing point related data.

Automatically manages topology changes.

This class is a wrapper of class helper::vector that is made to take care transparently of all topology changes that might happen (non exhaustive list: points added, removed, fused, renumbered).

Definition at line 69 of file PointData.h.


Member Typedef Documentation

template<class T , class Alloc = std::allocator<T>>
typedef sofa::helper::vector<T,Alloc>::const_reference sofa::component::topology::PointData< T, Alloc >::const_reference

const reference to a value (read only)

Reimplemented from sofa::helper::vector< T, Alloc >.

Definition at line 77 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
typedef sofa::helper::vector<T,Alloc>::reference sofa::component::topology::PointData< T, Alloc >::reference

reference to a value (read-write)

Reimplemented from sofa::helper::vector< T, Alloc >.

Definition at line 75 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
typedef sofa::helper::vector<T,Alloc>::size_type sofa::component::topology::PointData< T, Alloc >::size_type

size_type

Reimplemented from sofa::helper::vector< T, Alloc >.

Definition at line 73 of file PointData.h.


Constructor & Destructor Documentation

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( size_type  n,
const T &  value 
) [inline]

Constructor.

Definition at line 81 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( int  n,
const T &  value 
) [inline]

Constructor.

Definition at line 83 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( long  n,
const T &  value 
) [inline]

Constructor.

Definition at line 85 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( size_type  n  )  [inline, explicit]

Constructor.

Definition at line 87 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( const sofa::helper::vector< T, Alloc > &  x  )  [inline]

Constructor.

Definition at line 89 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( typename PointData< T >::const_iterator  first,
typename PointData< T, Alloc >::const_iterator  last 
) [inline]

Constructor.

Definition at line 97 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::PointData< T, Alloc >::PointData ( void(*)(int, void *, T &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)  createFunc = pd_basicCreateFunc,
void *  createParam = (void*)NULL,
void(*)(int, void *, T &)  destroyFunc = pd_basicDestroyFunc,
void *  destroyParam = (void*)NULL 
) [inline]

Optionnaly takes 2 parameters, a creation and a destruction function that will be called when adding/deleting elements.

Definition at line 102 of file PointData.h.


Member Function Documentation

template<typename T , typename Alloc >
void sofa::component::topology::PointData< T, Alloc >::add ( unsigned int  nbPoints,
const sofa::helper::vector< sofa::helper::vector< unsigned int > > &  ancestors,
const sofa::helper::vector< sofa::helper::vector< double > > &  coefs 
) [inline, private]

Add some values. Values are added at the end of the vector.

Definition at line 159 of file PointData.inl.

References sofa::component::topology::PointData< T, Alloc >::m_createFunc, and sofa::component::topology::PointData< T, Alloc >::m_createParam.

template<typename T , typename Alloc >
void sofa::component::topology::PointData< T, Alloc >::handleTopologyEvents ( std::list< const core::componentmodel::topology::TopologyChange * >::const_iterator  changeIt,
std::list< const core::componentmodel::topology::TopologyChange * >::const_iterator &  end 
) [inline]

Handle PointSetTopology related events, ignore others.

Definition at line 51 of file PointData.inl.

References sofa::component::topology::EdgesAdded::edgeIndexArray, sofa::core::componentmodel::topology::EDGESADDED, sofa::core::componentmodel::topology::EDGESREMOVED, sofa::component::topology::EdgesRemoved::getArray(), sofa::component::topology::TrianglesRemoved::getArray(), sofa::component::topology::TetrahedraRemoved::getArray(), sofa::component::topology::PointData< T, Alloc >::m_createEdgeFunc, sofa::component::topology::PointData< T, Alloc >::m_createParam, sofa::component::topology::PointData< T, Alloc >::m_createTetrahedronFunc, sofa::component::topology::PointData< T, Alloc >::m_createTriangleFunc, sofa::component::topology::PointData< T, Alloc >::m_destroyEdgeFunc, sofa::component::topology::PointData< T, Alloc >::m_destroyTetrahedronFunc, sofa::component::topology::PointData< T, Alloc >::m_destroyTriangleFunc, sofa::core::componentmodel::topology::POINTSADDED, sofa::core::componentmodel::topology::POINTSINDICESSWAP, sofa::core::componentmodel::topology::POINTSREMOVED, sofa::core::componentmodel::topology::POINTSRENUMBERING, sofa::component::topology::PointData< T, Alloc >::renumber(), sofa::component::topology::PointData< T, Alloc >::swap(), sofa::core::componentmodel::topology::TETRAHEDRAADDED, sofa::core::componentmodel::topology::TETRAHEDRAREMOVED, sofa::component::topology::TetrahedraAdded::tetrahedronIndexArray, sofa::component::topology::TrianglesAdded::triangleIndexArray, sofa::core::componentmodel::topology::TRIANGLESADDED, and sofa::core::componentmodel::topology::TRIANGLESREMOVED.

Referenced by sofa::component::mass::DiagonalMass< DataTypes, MassType >::handleTopologyChange().

template<typename T , typename Alloc >
void sofa::component::topology::PointData< T, Alloc >::remove ( const sofa::helper::vector< unsigned int > &  index  )  [inline, private]

template<typename T , typename Alloc >
void sofa::component::topology::PointData< T, Alloc >::renumber ( const sofa::helper::vector< unsigned int > &  index  )  [inline, private]

Reorder the values.

Definition at line 200 of file PointData.inl.

Referenced by sofa::component::topology::PointData< T, Alloc >::handleTopologyEvents().

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setCreateEdgeFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  createEdgeFunc  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setCreateFunction ( void(*)(int, void *, T &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)  createFunc  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setCreateParameter ( void *  createParam  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setCreateQuadFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  createQuadFunc  )  [inline]

Definition at line 148 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setCreateTetrahedronFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  createTetrahedronFunc  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setCreateTriangleFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  createTriangleFunc  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setDestroyEdgeFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  destroyEdgeFunc  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setDestroyFunction ( void(*)(int, void *, T &)  destroyFunc  )  [inline]

Definition at line 125 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setDestroyParameter ( void *  destroyParam  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setDestroyQuadFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  destroyQuadFunc  )  [inline]

Definition at line 153 of file PointData.h.

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setDestroyTetrahedronFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  destroyTetrahedronFunc  )  [inline]

template<class T , class Alloc = std::allocator<T>>
void sofa::component::topology::PointData< T, Alloc >::setDestroyTriangleFunction ( void(*)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &)  destroyTriangleFunc  )  [inline]

template<typename T , typename Alloc >
void sofa::component::topology::PointData< T, Alloc >::swap ( unsigned int  i1,
unsigned int  i2 
) [inline, private]


Field Documentation

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_createEdgeFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_createFunc)(int, void *, T &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &) [private]

template<class T , class Alloc = std::allocator<T>>
void* sofa::component::topology::PointData< T, Alloc >::m_createParam [private]

Parameter to be passed to creation function.

Warning : construction and destruction of this object is not of the responsibility of PointData.

Definition at line 232 of file PointData.h.

Referenced by sofa::component::topology::PointData< T, Alloc >::add(), sofa::component::topology::PointData< T, Alloc >::handleTopologyEvents(), and sofa::component::topology::PointData< Inherit::MappingData1D >::setCreateParameter().

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_createQuadFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

Creation function, called when adding quads elements.

Referenced by sofa::component::topology::PointData< Inherit::MappingData1D >::setCreateQuadFunction().

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_createTetrahedronFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_createTriangleFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_destroyEdgeFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_destroyFunc)(int, void *, T &) [private]

template<class T , class Alloc = std::allocator<T>>
void* sofa::component::topology::PointData< T, Alloc >::m_destroyParam [private]

Parameter to be passed to destruction function.

Warning : construction and destruction of this object is not of the responsibility of PointData.

Definition at line 238 of file PointData.h.

Referenced by sofa::component::topology::PointData< T, Alloc >::remove(), and sofa::component::topology::PointData< Inherit::MappingData1D >::setDestroyParameter().

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_destroyQuadFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

Destruction function, called when removing quads elements.

Referenced by sofa::component::topology::PointData< Inherit::MappingData1D >::setDestroyQuadFunction().

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_destroyTetrahedronFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::PointData< T, Alloc >::m_destroyTriangleFunc)(const sofa::helper::vector< unsigned int > &, void *, helper::vector< T > &) [private]


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

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