From 46763c7fe38556d9fe16d362f7649db5c1776d6b Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Fri, 28 Oct 2011 17:33:52 +0200 Subject: [PATCH] update traversorCell --- include/Topology/generic/traversor1.h | 82 --------------- include/Topology/generic/traversor2.h | 123 ----------------------- include/Topology/generic/traversorCell.h | 91 +++++++++++++++++ 3 files changed, 91 insertions(+), 205 deletions(-) create mode 100644 include/Topology/generic/traversorCell.h diff --git a/include/Topology/generic/traversor1.h b/include/Topology/generic/traversor1.h index a79cc737..efd15121 100644 --- a/include/Topology/generic/traversor1.h +++ b/include/Topology/generic/traversor1.h @@ -34,47 +34,6 @@ namespace CGoGN VERTEX CENTERED TRAVERSALS *******************************************************************************/ -// Traverse all the vertices of the map -template -class TraversorV -{ -private: - MAP& m ; - DartMarker mark ; - Dart current ; - -public: - TraversorV(MAP& map, Dart dart) : m(map), mark(map) - {} - - Dart begin() - { - mark.unmarkAll() ; - current = m.begin() ; - if(current == m.end()) - current = NIL ; - else - mark.markOrbit(VERTEX, current) ; - return current ; - } - Dart end() { return NIL ; } - Dart next() - { - if(current != NIL) - { - while(current != NIL && mark.isMarked(current)) - { - m.next(current) ; - if(current == m.end()) - current = NIL ; - } - if(current != NIL) - mark.markOrbit(VERTEX, current) ; - } - return current ; - } -} ; - // Traverse the edges incident to a given vertex template class Traversor1VE @@ -152,47 +111,6 @@ public: EDGE CENTERED TRAVERSALS *******************************************************************************/ -// Traverse all the vertices of the map -template -class TraversorE -{ -private: - MAP& m ; - DartMarker mark ; - Dart current ; - -public: - TraversorE(MAP& map, Dart dart) : m(map), mark(map) - {} - - Dart begin() - { - mark.unmarkAll() ; - current = m.begin() ; - if(current == m.end()) - current = NIL ; - else - mark.markOrbit(EDGE, current) ; - return current ; - } - Dart end() { return NIL ; } - Dart next() - { - if(current != NIL) - { - while(current != NIL && mark.isMarked(current)) - { - m.next(current) ; - if(current == m.end()) - current = NIL ; - } - if(current != NIL) - mark.markOrbit(EDGE, current) ; - } - return current ; - } -} ; - // Traverse the vertices incident to a given edge template class Traversor1EV diff --git a/include/Topology/generic/traversor2.h b/include/Topology/generic/traversor2.h index 1f98ce60..03dcde6a 100644 --- a/include/Topology/generic/traversor2.h +++ b/include/Topology/generic/traversor2.h @@ -34,47 +34,6 @@ namespace CGoGN VERTEX CENTERED TRAVERSALS *******************************************************************************/ -// Traverse all the vertices of the map -template -class TraversorV -{ -private: - MAP& m ; - DartMarker mark ; - Dart current ; - -public: - TraversorV(MAP& map, Dart dart) : m(map), mark(map) - {} - - Dart begin() - { - mark.unmarkAll() ; - current = m.begin() ; - if(current == m.end()) - current = NIL ; - else - mark.markOrbit(VERTEX, current) ; - return current ; - } - Dart end() { return NIL ; } - Dart next() - { - if(current != NIL) - { - while(current != NIL && mark.isMarked(current)) - { - m.next(current) ; - if(current == m.end()) - current = NIL ; - } - if(current != NIL) - mark.markOrbit(VERTEX, current) ; - } - return current ; - } -} ; - // Traverse the edges incident to a given vertex template class Traversor2VE @@ -210,47 +169,6 @@ public: EDGE CENTERED TRAVERSALS *******************************************************************************/ -// Traverse all the edges of the map -template -class TraversorE -{ -private: - MAP& m ; - DartMarker mark ; - Dart current ; - -public: - TraversorE(MAP& map, Dart dart) : m(map), mark(map) - {} - - Dart begin() - { - mark.unmarkAll() ; - current = m.begin() ; - if(current == m.end()) - current = NIL ; - else - mark.markOrbit(EDGE, current) ; - return current ; - } - Dart end() { return NIL ; } - Dart next() - { - if(current != NIL) - { - while(current != NIL && mark.isMarked(current)) - { - m.next(current) ; - if(current == m.end()) - current = NIL ; - } - if(current != NIL) - mark.markOrbit(EDGE, current) ; - } - return current ; - } -} ; - // Traverse the vertices incident to a given edge template class Traversor2EV @@ -379,47 +297,6 @@ public: FACE CENTERED TRAVERSALS *******************************************************************************/ -// Traverse all the faces of the map -template -class TraversorF -{ -private: - MAP& m ; - DartMarker mark ; - Dart current ; - -public: - TraversorF(MAP& map, Dart dart) : m(map), mark(map) - {} - - Dart begin() - { - mark.unmarkAll() ; - current = m.begin() ; - if(current == m.end()) - current = NIL ; - else - mark.markOrbit(FACE, current) ; - return current ; - } - Dart end() { return NIL ; } - Dart next() - { - if(current != NIL) - { - while(current != NIL && mark.isMarked(current)) - { - m.next(current) ; - if(current == m.end()) - current = NIL ; - } - if(current != NIL) - mark.markOrbit(FACE, current) ; - } - return current ; - } -} ; - // Traverse the vertices incident to a given face template class Traversor2FV diff --git a/include/Topology/generic/traversorCell.h b/include/Topology/generic/traversorCell.h new file mode 100644 index 00000000..94698c6a --- /dev/null +++ b/include/Topology/generic/traversorCell.h @@ -0,0 +1,91 @@ +/******************************************************************************* +* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * +* version 0.1 * +* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg * +* * +* This library is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by the * +* Free Software Foundation; either version 2.1 of the License, or (at your * +* option) any later version. * +* * +* This library is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* * +* Web site: http://cgogn.u-strasbg.fr/ * +* Contact information: cgogn@unistra.fr * +* * +*******************************************************************************/ + +#ifndef __TRAVERSOR_CELL_H__ +#define __TRAVERSOR_CELL_H__ + +#include "Topology/generic/dart.h" + +namespace CGoGN +{ + +template +class TraversorCell +{ +private: + MAP& m ; + DartMarker mark ; + Dart current ; + +public: + TraversorCell(MAP& map, Dart dart) : m(map), mark(map) + {} + + Dart begin() + { + mark.unmarkAll() ; + current = m.begin() ; + if(current == m.end()) + current = NIL ; + else + mark.markOrbit(ORBIT, current) ; + return current ; + } + Dart end() { return NIL ; } + Dart next() + { + if(current != NIL) + { + while(current != NIL && mark.isMarked(current)) + { + m.next(current) ; + if(current == m.end()) + current = NIL ; + } + if(current != NIL) + mark.markOrbit(ORBIT, current) ; + } + return current ; + } +} ; + +template +class TraversorV : public TraversorCell +{}; + +template +class TraversorE : public TraversorCell +{}; + +template +class TraversorF : public TraversorCell +{}; + +template +class TraversorW : public TraversorCell +{}; + +} // namespace CGoGN + +#endif -- GitLab