From 552df716e998bb8b5973c48e538fa8348fdfaf99 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Thu, 11 Oct 2012 14:56:58 +0200 Subject: [PATCH] correct Traversor3XY to skip boundary volumes --- include/Topology/generic/genericmap.hpp | 2 +- include/Topology/generic/traversor3.h | 14 ------------ include/Topology/generic/traversor3.hpp | 30 ++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/include/Topology/generic/genericmap.hpp b/include/Topology/generic/genericmap.hpp index 995aa984..f2d57a75 100644 --- a/include/Topology/generic/genericmap.hpp +++ b/include/Topology/generic/genericmap.hpp @@ -615,7 +615,7 @@ unsigned int GenericMap::getNbOrbits(const FunctorSelect& good) template unsigned int GenericMap::degree(Dart d) { - assert(ORBIT != INCIDENT || !"degree does not manage adjacency counting"); + assert(ORBIT != INCIDENT || !"degree does not manage adjacency counting") ; Traversor* t = TraversorFactory::createIncident(*(reinterpret_cast(this)), d, dimension(), ORBIT, INCIDENT) ; FunctorCount fcount ; t->applyFunctor(fcount) ; diff --git a/include/Topology/generic/traversor3.h b/include/Topology/generic/traversor3.h index e7486dc0..729ded27 100644 --- a/include/Topology/generic/traversor3.h +++ b/include/Topology/generic/traversor3.h @@ -69,8 +69,6 @@ private: CellMarkerStore* m_cmark ; Dart m_current ; TraversorDartsOfOrbit m_tradoo; -// unsigned int m_orbx; -// unsigned int m_orby; bool m_allocated; bool m_first; public: @@ -104,8 +102,6 @@ public: }; - - /** * Traverse vertices incident to volume */ @@ -136,7 +132,6 @@ public: Traversor3WF(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY(m, dart, forceDartMarker, thread) {} }; - /** * Traverse vertices incident to face */ @@ -167,7 +162,6 @@ public: Traversor3FW(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY(m, dart, forceDartMarker, thread) {} }; - /** * Traverse vertices incident to edge */ @@ -198,8 +192,6 @@ public: Traversor3EW(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY(m, dart, forceDartMarker, thread) {} }; - - /** * Traverse edges incident to vertex */ @@ -230,8 +222,6 @@ public: Traversor3VW(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY(m, dart, forceDartMarker, thread) {} }; - - /** * Traverse vertices adjacent to a vertex by an edge */ @@ -262,7 +252,6 @@ public: Traversor3VVaW(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY(m, d, forceDartMarker, thread) {} }; - /** * Traverse edges adjacent to an egde by a vertex */ @@ -293,7 +282,6 @@ public: Traversor3EEaW(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY(m, d, forceDartMarker, thread) {} }; - /** * Traverse faces adjacent to a face by a vertex */ @@ -324,7 +312,6 @@ public: Traversor3FFaW(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY(m, d, forceDartMarker, thread) {} }; - /** * Traverse volumes adjacent to a volume by a vertex */ @@ -355,7 +342,6 @@ public: Traversor3WWaF(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY(m, d, forceDartMarker, thread) {} }; - } // namespace CGoGN #include "Topology/generic/traversor3.hpp" diff --git a/include/Topology/generic/traversor3.hpp b/include/Topology/generic/traversor3.hpp index 4641f479..1f02fa2e 100644 --- a/include/Topology/generic/traversor3.hpp +++ b/include/Topology/generic/traversor3.hpp @@ -141,7 +141,7 @@ Dart Traversor3XY::begin() else m_dmark->unmarkAll(); } - m_first=false; + m_first = false; m_current = m_tradoo.begin() ; // for the case of beginning with a given MarkerForTraversor @@ -158,6 +158,13 @@ Dart Traversor3XY::begin() m_current = m_tradoo.next(); } } + + if(ORBY == VOLUME) + { + if(m_map.isBoundaryMarked(m_current)) + m_current = next(); + } + return m_current; } @@ -176,6 +183,11 @@ Dart Traversor3XY::next() { m_cmark->mark(m_current); m_current = m_tradoo.next(); + if(ORBY == VOLUME) + { + if(m_map.isBoundaryMarked(m_current)) + m_cmark->mark(m_current); + } while ((m_current != NIL) && m_cmark->isMarked(m_current)) m_current = m_tradoo.next(); } @@ -192,6 +204,22 @@ Dart Traversor3XY::next() else m_dmark->markOrbit(m_current); m_current = m_tradoo.next(); + if(ORBY == VOLUME) + { + if(m_map.isBoundaryMarked(m_current)) + { + if (ORBX == VOLUME) + { + // if allocated we are in a local traversal of volume so we can mark only darts of volume + if (m_allocated) + m_dmark->markOrbit(m_current); + else + m_dmark->markOrbit(m_current); // here we need to mark all the darts + } + else + m_dmark->markOrbit(m_current); + } + } while ((m_current != NIL) && m_dmark->isMarked(m_current)) m_current = m_tradoo.next(); } -- GitLab