#include <PointSubset.h>

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. | |
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.
| typedef helper::vector<unsigned int>::const_iterator sofa::component::topology::PointSubset::const_iterator |
Definition at line 76 of file PointSubset.h.
| typedef helper::vector<unsigned int>::const_reference sofa::component::topology::PointSubset::const_reference |
Definition at line 72 of file PointSubset.h.
| typedef helper::vector<unsigned int>::const_reverse_iterator sofa::component::topology::PointSubset::const_reverse_iterator |
Definition at line 78 of file PointSubset.h.
| typedef helper::vector<unsigned int>::difference_type sofa::component::topology::PointSubset::difference_type |
Definition at line 74 of file PointSubset.h.
| typedef helper::vector<unsigned int>::iterator sofa::component::topology::PointSubset::iterator |
Definition at line 75 of file PointSubset.h.
| typedef helper::vector<unsigned int>::pointer sofa::component::topology::PointSubset::pointer |
Definition at line 70 of file PointSubset.h.
| typedef helper::vector<unsigned int>::reference sofa::component::topology::PointSubset::reference |
Definition at line 71 of file PointSubset.h.
| typedef helper::vector<unsigned int>::reverse_iterator sofa::component::topology::PointSubset::reverse_iterator |
Definition at line 77 of file PointSubset.h.
| typedef helper::vector<unsigned int>::size_type sofa::component::topology::PointSubset::size_type |
Definition at line 73 of file PointSubset.h.
| typedef helper::vector<unsigned int>::value_type sofa::component::topology::PointSubset::value_type |
Definition at line 69 of file PointSubset.h.
| 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.
| 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] |
| reference sofa::component::topology::PointSubset::back | ( | ) | [inline] |
| const_iterator sofa::component::topology::PointSubset::begin | ( | ) | const [inline] |
| iterator sofa::component::topology::PointSubset::begin | ( | ) | [inline] |
Definition at line 122 of file PointSubset.h.
References m_subset.
Referenced by sofa::component::constraint::BoxConstraint< DataTypes >::draw(), sofa::component::ParticleSource< TDataTypes >::handleTopologyChange(), sofa::component::constraint::FixedConstraintInternalData< gpu::cuda::CudaVectorTypes< TCoord, TDeriv, TReal > >::init(), and sofa::component::ParticleSource< TDataTypes >::PSRemovalFunction().
| size_type sofa::component::topology::PointSubset::capacity | ( | ) | const [inline] |
| void sofa::component::topology::PointSubset::clear | ( | ) | [inline] |
Definition at line 172 of file PointSubset.h.
References m_subset.
Referenced by sofa::component::ParticleSink< TDataTypes >::projectPosition(), and sofa::component::ParticleSource< TDataTypes >::reset().
| bool sofa::component::topology::PointSubset::empty | ( | ) | const [inline] |
Definition at line 144 of file PointSubset.h.
References m_subset.
Referenced by sofa::component::constraint::FixedConstraintInternalData< gpu::cuda::CudaVectorTypes< TCoord, TDeriv, TReal > >::init(), sofa::component::ParticleSource< TDataTypes >::projectPosition(), sofa::component::ParticleSource< TDataTypes >::projectResponse(), sofa::component::ParticleSink< TDataTypes >::projectResponse(), and sofa::component::ParticleSource< TDataTypes >::projectVelocity().
| const_iterator sofa::component::topology::PointSubset::end | ( | ) | const [inline] |
| iterator sofa::component::topology::PointSubset::end | ( | ) | [inline] |
Definition at line 124 of file PointSubset.h.
References m_subset.
Referenced by sofa::component::constraint::BoxConstraint< DataTypes >::draw(), sofa::component::ParticleSource< TDataTypes >::handleTopologyChange(), sofa::component::constraint::FixedConstraintInternalData< gpu::cuda::CudaVectorTypes< TCoord, TDeriv, TReal > >::init(), and sofa::component::ParticleSource< TDataTypes >::PSRemovalFunction().
| const_reference sofa::component::topology::PointSubset::front | ( | ) | const [inline] |
| reference sofa::component::topology::PointSubset::front | ( | ) | [inline] |
| 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 | |||
| ) |
Handle PointSetTopology related events, ignore others.
Definition at line 43 of file PointSubset.cpp.
References getArray(), lastPointIndex, sofa::core::componentmodel::topology::POINTSADDED, sofa::core::componentmodel::topology::POINTSINDICESSWAP, sofa::core::componentmodel::topology::POINTSREMOVED, sofa::core::componentmodel::topology::POINTSRENUMBERING, renumber(), setTotalPointSetArraySize(), and swap().
Referenced by sofa::component::ParticleSource< TDataTypes >::handleTopologyChange(), and sofa::component::ParticleSink< TDataTypes >::handleTopologyChange().
| size_type sofa::component::topology::PointSubset::max_size | ( | ) | const [inline] |
| const_reference sofa::component::topology::PointSubset::operator[] | ( | size_type | i | ) | const [inline] |
| void sofa::component::topology::PointSubset::pop_back | ( | ) | [inline] |
| void sofa::component::topology::PointSubset::push_back | ( | const unsigned int | t | ) | [inline] |
Definition at line 164 of file PointSubset.h.
References m_subset.
Referenced by sofa::gui::qt::ModifyObject::createTable(), and sofa::component::ParticleSink< TDataTypes >::projectPosition().
| const_reverse_iterator sofa::component::topology::PointSubset::rbegin | ( | ) | const [inline] |
| reverse_iterator sofa::component::topology::PointSubset::rbegin | ( | ) | [inline] |
| 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] |
| reverse_iterator sofa::component::topology::PointSubset::rend | ( | ) | [inline] |
| 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] |
| 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] |
Definition at line 105 of file PointSubset.h.
References m_removalFunc.
Referenced by sofa::component::ParticleSource< TDataTypes >::init(), sofa::component::constraint::LinearMovementConstraint< DataTypes >::init(), sofa::component::constraint::FixedPlaneConstraint< DataTypes >::init(), sofa::component::constraint::FixedConstraint< DataTypes >::init(), and sofa::component::constraint::AttachConstraint< DataTypes >::init().
| void sofa::component::topology::PointSubset::setRemovalParameter | ( | void * | removeParam | ) | [inline] |
Definition at line 110 of file PointSubset.h.
References m_removeParam.
Referenced by sofa::component::ParticleSource< TDataTypes >::init(), sofa::component::constraint::LinearMovementConstraint< DataTypes >::init(), sofa::component::constraint::FixedPlaneConstraint< DataTypes >::init(), sofa::component::constraint::FixedConstraint< DataTypes >::init(), and sofa::component::constraint::AttachConstraint< DataTypes >::init().
| void sofa::component::topology::PointSubset::setTestFunction | ( | bool(*)(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &) | testNewPointFunc | ) | [inline] |
Definition at line 99 of file PointSubset.h.
References m_testNewPointFunc.
Referenced by sofa::component::ParticleSource< TDataTypes >::init(), sofa::component::constraint::LinearMovementConstraint< DataTypes >::init(), sofa::component::constraint::FixedPlaneConstraint< DataTypes >::init(), sofa::component::constraint::FixedConstraint< DataTypes >::init(), and sofa::component::constraint::AttachConstraint< DataTypes >::init().
| void sofa::component::topology::PointSubset::setTestParameter | ( | void * | testParam | ) | [inline] |
Definition at line 115 of file PointSubset.h.
References m_testParam.
Referenced by sofa::component::ParticleSource< TDataTypes >::init(), sofa::component::constraint::LinearMovementConstraint< DataTypes >::init(), sofa::component::constraint::FixedPlaneConstraint< DataTypes >::init(), sofa::component::constraint::FixedConstraint< DataTypes >::init(), and sofa::component::constraint::AttachConstraint< DataTypes >::init().
| 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] |
Definition at line 138 of file PointSubset.h.
References m_subset.
Referenced by add(), sofa::component::ParticleSource< TDataTypes >::handleTopologyChange(), sofa::component::ParticleSource< TDataTypes >::projectPosition(), sofa::component::ParticleSource< TDataTypes >::projectResponse(), sofa::component::ParticleSink< TDataTypes >::projectResponse(), and sofa::component::ParticleSource< TDataTypes >::projectVelocity().
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] |
| 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().
| 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.
unsigned int sofa::component::topology::PointSubset::lastPointIndex [private] |
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().
void(* sofa::component::topology::PointSubset::m_removalFunc)(int, void *) [private] |
Removal function, called when points in the subset are removed.
Referenced by remove(), and setRemovalFunction().
void* sofa::component::topology::PointSubset::m_removeParam [private] |
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().
helper::vector< unsigned int > sofa::component::topology::PointSubset::m_subset [private] |
Actual point subset stored.
Definition at line 195 of file PointSubset.h.
Referenced by add(), back(), begin(), capacity(), clear(), empty(), end(), front(), getArray(), max_size(), sofa::component::topology::operator<<(), sofa::component::topology::operator>>(), operator[](), pop_back(), push_back(), rbegin(), remove(), rend(), renumber(), reserve(), resize(), size(), and swap().
bool(* sofa::component::topology::PointSubset::m_testNewPointFunc)(int, void *, const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double > &) [private] |
void* sofa::component::topology::PointSubset::m_testParam [private] |
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().
1.5.7.1