Commit 2aaa9d77 authored by Sauvage's avatar Sauvage

ajout d'un champ booleen isInsideCollected pour faire des verifs (assert)

parent 2b430240
...@@ -60,6 +60,8 @@ protected: ...@@ -60,6 +60,8 @@ protected:
Dart centerDart; Dart centerDart;
bool isInsideCollected;
std::vector<Dart> insideVertices; std::vector<Dart> insideVertices;
std::vector<Dart> insideEdges; std::vector<Dart> insideEdges;
std::vector<Dart> insideFaces; std::vector<Dart> insideFaces;
...@@ -71,6 +73,7 @@ public: ...@@ -71,6 +73,7 @@ public:
inline void init(Dart d) inline void init(Dart d)
{ {
centerDart = d; centerDart = d;
isInsideCollected = false;
insideVertices.clear(); insideVertices.clear();
insideEdges.clear(); insideEdges.clear();
insideFaces.clear(); insideFaces.clear();
...@@ -97,14 +100,14 @@ public: ...@@ -97,14 +100,14 @@ public:
inline Dart getCenterDart() const { return centerDart; } inline Dart getCenterDart() const { return centerDart; }
inline const std::vector<Dart>& getInsideVertices() const { return insideVertices; } inline const std::vector<Dart>& getInsideVertices() const { assert(isInsideCollected || !"getInsideVertices: inside cells have not been collected.") ; return insideVertices; }
inline const std::vector<Dart>& getInsideEdges() const { return insideEdges; } inline const std::vector<Dart>& getInsideEdges() const { assert(isInsideCollected || !"getInsideEdges: inside cells have not been collected.") ; return insideEdges; }
inline const std::vector<Dart>& getInsideFaces() const { return insideFaces; } inline const std::vector<Dart>& getInsideFaces() const { assert(isInsideCollected || !"getInsideFaces: inside cells have not been collected.") ; return insideFaces; }
inline const std::vector<Dart>& getBorder() const { return border; } inline const std::vector<Dart>& getBorder() const { return border; }
inline unsigned int getNbInsideVertices() const { return insideVertices.size(); } inline unsigned int getNbInsideVertices() const { assert(isInsideCollected || !"getNbInsideVertices: inside cells have not been collected.") ; return insideVertices.size(); }
inline unsigned int getNbInsideEdges() const { return insideEdges.size(); } inline unsigned int getNbInsideEdges() const { assert(isInsideCollected || !"getNbInsideEdges: inside cells have not been collected.") ; return insideEdges.size(); }
inline unsigned int getNbInsideFaces() const { return insideFaces.size(); } inline unsigned int getNbInsideFaces() const { assert(isInsideCollected || !"getNbInsideFaces: inside cells have not been collected.") ; return insideFaces.size(); }
inline unsigned int getNbBorder() const { return border.size(); } inline unsigned int getNbBorder() const { return border.size(); }
template <typename PPFP> template <typename PPFP>
......
...@@ -40,12 +40,13 @@ namespace Selection ...@@ -40,12 +40,13 @@ namespace Selection
*********************************************************/ *********************************************************/
template <typename PFP> template <typename PFP>
Collector<PFP>::Collector(typename PFP::MAP& m, unsigned int thread) : map(m), m_thread(thread) Collector<PFP>::Collector(typename PFP::MAP& m, unsigned int thread) : map(m), m_thread(thread), isInsideCollected(false)
{} {}
template <typename PFP> template <typename PFP>
inline bool Collector<PFP>::applyOnInsideVertices(FunctorType& f) inline bool Collector<PFP>::applyOnInsideVertices(FunctorType& f)
{ {
assert(isInsideCollected || !"applyOnInsideVertices: inside cells have not been collected.") ;
for(std::vector<Dart>::iterator iv = insideVertices.begin(); iv != insideVertices.end(); ++iv) for(std::vector<Dart>::iterator iv = insideVertices.begin(); iv != insideVertices.end(); ++iv)
if(f(*iv)) if(f(*iv))
return true ; return true ;
...@@ -55,6 +56,7 @@ inline bool Collector<PFP>::applyOnInsideVertices(FunctorType& f) ...@@ -55,6 +56,7 @@ inline bool Collector<PFP>::applyOnInsideVertices(FunctorType& f)
template <typename PFP> template <typename PFP>
inline bool Collector<PFP>::applyOnInsideEdges(FunctorType& f) inline bool Collector<PFP>::applyOnInsideEdges(FunctorType& f)
{ {
assert(isInsideCollected || !"applyOnInsideEdges: inside cells have not been collected.") ;
for(std::vector<Dart>::iterator iv = insideEdges.begin(); iv != insideEdges.end(); ++iv) for(std::vector<Dart>::iterator iv = insideEdges.begin(); iv != insideEdges.end(); ++iv)
if(f(*iv)) if(f(*iv))
return true ; return true ;
...@@ -64,6 +66,7 @@ inline bool Collector<PFP>::applyOnInsideEdges(FunctorType& f) ...@@ -64,6 +66,7 @@ inline bool Collector<PFP>::applyOnInsideEdges(FunctorType& f)
template <typename PFP> template <typename PFP>
inline bool Collector<PFP>::applyOnInsideFaces(FunctorType& f) inline bool Collector<PFP>::applyOnInsideFaces(FunctorType& f)
{ {
assert(isInsideCollected || !"applyOnInsideFaces: inside cells have not been collected.") ;
for(std::vector<Dart>::iterator iv = insideFaces.begin(); iv != insideFaces.end(); ++iv) for(std::vector<Dart>::iterator iv = insideFaces.begin(); iv != insideFaces.end(); ++iv)
if(f(*iv)) if(f(*iv))
return true ; return true ;
...@@ -106,6 +109,7 @@ template <typename PFP> ...@@ -106,6 +109,7 @@ template <typename PFP>
void Collector_OneRing<PFP>::collectAll(Dart d) void Collector_OneRing<PFP>::collectAll(Dart d)
{ {
this->init(d); this->init(d);
this->isInsideCollected = true;
this->insideEdges.reserve(16); this->insideEdges.reserve(16);
this->insideFaces.reserve(16); this->insideFaces.reserve(16);
this->border.reserve(16); this->border.reserve(16);
...@@ -146,6 +150,7 @@ void Collector_WithinSphere<PFP>::collectAll(Dart d) ...@@ -146,6 +150,7 @@ void Collector_WithinSphere<PFP>::collectAll(Dart d)
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
this->init(d); this->init(d);
this->isInsideCollected = true;
this->insideEdges.reserve(32); this->insideEdges.reserve(32);
this->insideFaces.reserve(32); this->insideFaces.reserve(32);
this->border.reserve(32); this->border.reserve(32);
...@@ -254,6 +259,7 @@ void Collector_WithinSphere<PFP>::collectBorder(Dart d) ...@@ -254,6 +259,7 @@ void Collector_WithinSphere<PFP>::collectBorder(Dart d)
template <typename PFP> template <typename PFP>
void Collector_WithinSphere<PFP>::computeArea() void Collector_WithinSphere<PFP>::computeArea()
{ {
assert(this->isInsideCollected || !"computeArea: inside cells have not been collected.") ;
area = 0; area = 0;
typename PFP::VEC3 centerPosition = this->position[this->centerDart]; typename PFP::VEC3 centerPosition = this->position[this->centerDart];
...@@ -292,6 +298,7 @@ void Collector_NormalAngle<PFP>::collectAll(Dart d) ...@@ -292,6 +298,7 @@ void Collector_NormalAngle<PFP>::collectAll(Dart d)
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
this->init(d); this->init(d);
this->isInsideCollected = true;
this->insideEdges.reserve(32); this->insideEdges.reserve(32);
this->insideFaces.reserve(32); this->insideFaces.reserve(32);
this->border.reserve(32); this->border.reserve(32);
...@@ -414,6 +421,7 @@ void Collector_Vertices<PFP>::collectAll(Dart d) ...@@ -414,6 +421,7 @@ void Collector_Vertices<PFP>::collectAll(Dart d)
crit.init(d); crit.init(d);
this->init(d); this->init(d);
this->isInsideCollected = true;
this->insideEdges.reserve(32); this->insideEdges.reserve(32);
this->insideFaces.reserve(32); this->insideFaces.reserve(32);
this->border.reserve(32); this->border.reserve(32);
...@@ -529,6 +537,7 @@ void Collector_NormalAngle_Triangles<PFP>::collectAll(Dart d) ...@@ -529,6 +537,7 @@ void Collector_NormalAngle_Triangles<PFP>::collectAll(Dart d)
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
this->init(d); this->init(d);
this->isInsideCollected = true;
this->insideVertices.reserve(32); this->insideVertices.reserve(32);
this->insideEdges.reserve(32); this->insideEdges.reserve(32);
this->insideFaces.reserve(32); this->insideFaces.reserve(32);
...@@ -680,6 +689,7 @@ void Collector_Triangles<PFP>::collectAll(Dart d) ...@@ -680,6 +689,7 @@ void Collector_Triangles<PFP>::collectAll(Dart d)
crit.init(d); crit.init(d);
this->init(d); this->init(d);
this->isInsideCollected = true;
this->insideVertices.reserve(32); this->insideVertices.reserve(32);
this->insideEdges.reserve(32); this->insideEdges.reserve(32);
this->insideFaces.reserve(32); this->insideFaces.reserve(32);
...@@ -813,6 +823,7 @@ template <typename PFP> ...@@ -813,6 +823,7 @@ template <typename PFP>
void Collector_Dijkstra_Vertices<PFP>::collectAll(Dart dinit) void Collector_Dijkstra_Vertices<PFP>::collectAll(Dart dinit)
{ {
init(dinit); init(dinit);
this->isInsideCollected = true;
CellMarkerStore<VERTEX> vmReached (this->map, this->m_thread); CellMarkerStore<VERTEX> vmReached (this->map, this->m_thread);
vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart)); vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart));
...@@ -977,6 +988,7 @@ template <typename PFP> ...@@ -977,6 +988,7 @@ template <typename PFP>
void Collector_Dijkstra<PFP>::collectAll(Dart dinit) void Collector_Dijkstra<PFP>::collectAll(Dart dinit)
{ {
init(dinit); init(dinit);
this->isInsideCollected = true;
CellMarkerStore<VERTEX> vmReached (this->map, this->m_thread); CellMarkerStore<VERTEX> vmReached (this->map, this->m_thread);
vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart)); vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment