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

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

#include <TriangleData.h>

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

Inheritance graph
[legend]
Collaboration diagram for sofa::component::topology::TriangleData< 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

 TriangleData (size_type n, const T &value)
 Constructor.
 TriangleData (int n, const T &value)
 Constructor.
 TriangleData (long n, const T &value)
 Constructor.
 TriangleData (size_type n)
 Constructor.
 TriangleData (const sofa::helper::vector< T, Alloc > &x)
 Constructor.
 TriangleData (typename TriangleData< T >::const_iterator first, typename TriangleData< T, Alloc >::const_iterator last)
 Constructor.
 TriangleData (void(*createFunc)(int, void *, T &, const Triangle &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)=trd_basicCreateFunc, void *createParam=(void *) NULL, void(*destroyFunc)(int, void *, T &)=trd_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 TriangleSetTopology related events, ignore others.
void setCreateFunction (void(*createFunc)(int, void *, T &, const Triangle &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &))
void setDestroyFunction (void(*destroyFunc)(int, void *, T &))
void setDestroyParameter (void *destroyParam)
void setCreateParameter (void *createParam)
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 > &))

Private Member Functions

void swap (unsigned int i1, unsigned int i2)
 Swaps values at indices i1 and i2.
void add (unsigned int nbTriangles, const sofa::helper::vector< Triangle > &triangle, 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 Triangles removed.

Private Attributes

void(* m_createFunc )(int, void *, T &, const Triangle &, 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_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::TriangleData< T, Alloc >

A class for storing Triangle 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: Triangles added, removed, fused, renumbered).

Definition at line 71 of file TriangleData.h.


Member Typedef Documentation

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

const reference to a value (read only)

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

Definition at line 79 of file TriangleData.h.

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

reference to a value (read-write)

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

Definition at line 77 of file TriangleData.h.

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

size_type

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

Definition at line 75 of file TriangleData.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 83 of file TriangleData.h.

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

Constructor.

Definition at line 85 of file TriangleData.h.

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

Constructor.

Definition at line 87 of file TriangleData.h.

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

Constructor.

Definition at line 89 of file TriangleData.h.

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

Constructor.

Definition at line 91 of file TriangleData.h.

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

Constructor.

Definition at line 99 of file TriangleData.h.

template<class T , class Alloc = std::allocator<T>>
sofa::component::topology::TriangleData< T, Alloc >::TriangleData ( void(*)(int, void *, T &, const Triangle &, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)  createFunc = trd_basicCreateFunc,
void *  createParam = (void*)NULL,
void(*)(int, void *, T &)  destroyFunc = trd_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 103 of file TriangleData.h.


Member Function Documentation

template<typename T , typename Alloc >
void sofa::component::topology::TriangleData< T, Alloc >::add ( unsigned int  nbTriangles,
const sofa::helper::vector< Triangle > &  triangle,
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 105 of file TriangleData.inl.

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

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

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

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

Definition at line 117 of file TriangleData.h.

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

Definition at line 132 of file TriangleData.h.

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

Definition at line 137 of file TriangleData.h.

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

Definition at line 122 of file TriangleData.h.

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

Definition at line 127 of file TriangleData.h.

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

Definition at line 142 of file TriangleData.h.

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

Swaps values at indices i1 and i2.

Definition at line 97 of file TriangleData.inl.

Referenced by sofa::component::topology::TriangleData< T, Alloc >::remove().


Field Documentation

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

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

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::TriangleData< 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::TriangleData< T, Alloc >::m_destroyFunc)(int, void *, T &) [private]

template<class T , class Alloc = std::allocator<T>>
void* sofa::component::topology::TriangleData< 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 TriangleData.

Definition at line 183 of file TriangleData.h.

Referenced by sofa::component::topology::TriangleData< T, Alloc >::remove(), and sofa::component::topology::TriangleData< sofa::component::forcefield::TriangularFEMForceField::TriangleInformation >::setDestroyParameter().

template<class T , class Alloc = std::allocator<T>>
void(* sofa::component::topology::TriangleData< T, Alloc >::m_destroyTetrahedronFunc)(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:40 2008 for Sofa by  doxygen 1.5.7.1