sofa::component::topology::PointSubset Class Reference

A class for storing indices of points as to define a subset of the DOFs. More...

#include <PointSubset.h>

Collaboration diagram for sofa::component::topology::PointSubset:

Collaboration graph
[legend]

Public Types

typedef helper::vector
< unsigned int >::value_type 
value_type
typedef helper::vector
< unsigned int >::pointer 
pointer
typedef helper::vector
< unsigned int >::reference 
reference
typedef helper::vector
< unsigned int >
::const_reference 
const_reference
typedef helper::vector
< unsigned int >::size_type 
size_type
typedef helper::vector
< unsigned int >
::difference_type 
difference_type
typedef helper::vector
< unsigned int >::iterator 
iterator
typedef helper::vector
< unsigned int >
::const_iterator 
const_iterator
typedef helper::vector
< unsigned int >
::reverse_iterator 
reverse_iterator
typedef helper::vector
< unsigned int >
::const_reverse_iterator 
const_reverse_iterator

Public Member Functions

 PointSubset (bool(*testNewPointFunc)(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)=ps_testNewPointFunc, void *testParam=(void *) NULL, void(*removeFunc)(int, void *)=ps_removeFunc, void *removeParam=(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, const unsigned int totalPointSetArraySize)
 Handle PointSetTopology related events, ignore others.
void setTestFunction (bool(*testNewPointFunc)(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &))
void setRemovalFunction (void(*removeFunc)(int, void *))
void setRemovalParameter (void *removeParam)
void setTestParameter (void *testParam)
const helper::vector< unsigned
int > & 
getArray () const
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
size_type size () const
size_type max_size () const
size_type capacity () const
bool empty () const
reference operator[] (size_type n)
const_reference operator[] (size_type i) const
void reserve (size_t n)
reference front ()
const_reference front () const
reference back ()
const_reference back () const
void push_back (const unsigned int t)
void pop_back ()
void swap (helper::vector< unsigned int > &vector)
void swap (PointSubset &pointSubset)
void clear ()
void resize (size_t n)

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.
void setTotalPointSetArraySize (const unsigned int s)

Private Attributes

helper::vector< unsigned int > m_subset
 Actual point subset stored.
bool(* m_testNewPointFunc )(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)
 test function, called when new points are created.
void(* m_removalFunc )(int, void *)
 Removal function, called when points in the subset are removed.
void * m_testParam
 Parameter to be passed to test function.
void * m_removeParam
 Parameter to be passed to removal function.
unsigned int lastPointIndex
 to handle properly the removal of items, the container must know the index of the last element

Friends

std::ostream & operator<< (std::ostream &ostream, const PointSubset &pointSubset)
 Needed to be compliant with Data.
std::istream & operator>> (std::istream &i, PointSubset &pointSubset)
 Needed to be compliant with Data.

Detailed Description

A class for storing indices of points as to define a subset of the DOFs.

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 65 of file PointSubset.h.


Member Typedef Documentation

Definition at line 76 of file PointSubset.h.

Definition at line 72 of file PointSubset.h.

Definition at line 78 of file PointSubset.h.

Definition at line 74 of file PointSubset.h.

Definition at line 75 of file PointSubset.h.

Definition at line 70 of file PointSubset.h.

Definition at line 71 of file PointSubset.h.

Definition at line 77 of file PointSubset.h.

Definition at line 73 of file PointSubset.h.

Definition at line 69 of file PointSubset.h.


Constructor & Destructor Documentation

sofa::component::topology::PointSubset::PointSubset ( bool(*)(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)  testNewPointFunc = ps_testNewPointFunc,
void *  testParam = (void*)NULL,
void(*)(int, void *)  removeFunc = ps_removeFunc,
void *  removeParam = (void*)NULL 
) [inline]

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

Definition at line 82 of file PointSubset.h.


Member Function Documentation

void sofa::component::topology::PointSubset::add ( unsigned int  nbPoints,
const sofa::helper::vector< sofa::helper::vector< unsigned int > > &  ancestors,
const sofa::helper::vector< sofa::helper::vector< double > > &  coefs 
) [private]

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

Definition at line 98 of file PointSubset.cpp.

References m_subset, m_testParam, and size().

const_reference sofa::component::topology::PointSubset::back (  )  const [inline]

Definition at line 162 of file PointSubset.h.

References m_subset.

reference sofa::component::topology::PointSubset::back (  )  [inline]

Definition at line 160 of file PointSubset.h.

References m_subset.

const_iterator sofa::component::topology::PointSubset::begin (  )  const [inline]

Definition at line 126 of file PointSubset.h.

References m_subset.

iterator sofa::component::topology::PointSubset::begin (  )  [inline]

size_type sofa::component::topology::PointSubset::capacity (  )  const [inline]

Definition at line 142 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::clear (  )  [inline]

bool sofa::component::topology::PointSubset::empty (  )  const [inline]

const_iterator sofa::component::topology::PointSubset::end (  )  const [inline]

Definition at line 128 of file PointSubset.h.

References m_subset.

iterator sofa::component::topology::PointSubset::end (  )  [inline]

const_reference sofa::component::topology::PointSubset::front (  )  const [inline]

Definition at line 158 of file PointSubset.h.

References m_subset.

reference sofa::component::topology::PointSubset::front (  )  [inline]

Definition at line 156 of file PointSubset.h.

References m_subset.

const helper::vector< unsigned int >& sofa::component::topology::PointSubset::getArray (  )  const [inline]

Definition at line 120 of file PointSubset.h.

References m_subset.

Referenced by handleTopologyEvents().

void sofa::component::topology::PointSubset::handleTopologyEvents ( std::list< const core::componentmodel::topology::TopologyChange * >::const_iterator  changeIt,
std::list< const core::componentmodel::topology::TopologyChange * >::const_iterator &  end,
const unsigned int  totalPointSetArraySize 
)

size_type sofa::component::topology::PointSubset::max_size (  )  const [inline]

Definition at line 140 of file PointSubset.h.

References m_subset.

const_reference sofa::component::topology::PointSubset::operator[] ( size_type  i  )  const [inline]

Definition at line 148 of file PointSubset.h.

References m_subset.

reference sofa::component::topology::PointSubset::operator[] ( size_type  n  )  [inline]

Definition at line 146 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::pop_back (  )  [inline]

Definition at line 166 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::push_back ( const unsigned int  t  )  [inline]

const_reverse_iterator sofa::component::topology::PointSubset::rbegin (  )  const [inline]

Definition at line 134 of file PointSubset.h.

References m_subset.

reverse_iterator sofa::component::topology::PointSubset::rbegin (  )  [inline]

Definition at line 130 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::remove ( const sofa::helper::vector< unsigned int > &  index  )  [private]

Remove the values corresponding to the points removed.

Definition at line 121 of file PointSubset.cpp.

References lastPointIndex, m_removalFunc, m_removeParam, and m_subset.

const_reverse_iterator sofa::component::topology::PointSubset::rend (  )  const [inline]

Definition at line 136 of file PointSubset.h.

References m_subset.

reverse_iterator sofa::component::topology::PointSubset::rend (  )  [inline]

Definition at line 132 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::renumber ( const sofa::helper::vector< unsigned int > &  index  )  [private]

Reorder the values.

Definition at line 190 of file PointSubset.cpp.

References m_subset.

Referenced by handleTopologyEvents().

void sofa::component::topology::PointSubset::reserve ( size_t  n  )  [inline]

Definition at line 154 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::resize ( size_t  n  )  [inline]

Definition at line 174 of file PointSubset.h.

References m_subset.

Referenced by sofa::component::ParticleSource< TDataTypes >::animateBegin().

void sofa::component::topology::PointSubset::setRemovalFunction ( void(*)(int, void *)  removeFunc  )  [inline]

void sofa::component::topology::PointSubset::setRemovalParameter ( void *  removeParam  )  [inline]

void sofa::component::topology::PointSubset::setTestFunction ( bool(*)(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &)  testNewPointFunc  )  [inline]

void sofa::component::topology::PointSubset::setTestParameter ( void *  testParam  )  [inline]

void sofa::component::topology::PointSubset::setTotalPointSetArraySize ( const unsigned int  s  )  [inline, private]

Definition at line 191 of file PointSubset.h.

References lastPointIndex.

Referenced by handleTopologyEvents().

size_type sofa::component::topology::PointSubset::size ( void   )  const [inline]

void sofa::component::topology::PointSubset::swap ( unsigned int  i1,
unsigned int  i2 
) [private]

Swaps values at indices i1 and i2.

Definition at line 91 of file PointSubset.cpp.

References m_subset.

void sofa::component::topology::PointSubset::swap ( PointSubset &  pointSubset  )  [inline]

Definition at line 170 of file PointSubset.h.

References m_subset.

void sofa::component::topology::PointSubset::swap ( helper::vector< unsigned int > &  vector  )  [inline]

Definition at line 168 of file PointSubset.h.

References m_subset.

Referenced by handleTopologyEvents().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ostream,
const PointSubset &  pointSubset 
) [friend]

Needed to be compliant with Data.

Needed to be compliant with Datas.

Definition at line 199 of file PointSubset.cpp.

std::istream& operator>> ( std::istream &  i,
PointSubset &  pointSubset 
) [friend]

Needed to be compliant with Data.

Needed to be compliant with Datas.

Definition at line 205 of file PointSubset.cpp.


Field Documentation

to handle properly the removal of items, the container must know the index of the last element

Definition at line 216 of file PointSubset.h.

Referenced by handleTopologyEvents(), remove(), and setTotalPointSetArraySize().

Removal function, called when points in the subset are removed.

Referenced by remove(), and setRemovalFunction().

Parameter to be passed to removal function.

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

Definition at line 213 of file PointSubset.h.

Referenced by remove(), and setRemovalParameter().

test function, called when new points are created.

Referenced by setTestFunction().

Parameter to be passed to test function.

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

Definition at line 207 of file PointSubset.h.

Referenced by add(), and setTestParameter().


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

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