traversorCell.h 4.29 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
*                                                                              *
* 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.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21 22 23
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/
24

Pierre Kraemer's avatar
Pierre Kraemer committed
25 26 27 28
#ifndef __TRAVERSOR_CELL_H__
#define __TRAVERSOR_CELL_H__

#include "Topology/generic/dart.h"
29
#include "Topology/generic/dartmarker.h"
30
#include "Topology/generic/cellmarker.h"
31
#include "Topology/generic/traversorGen.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
32 33 34 35

namespace CGoGN
{

36
template <typename MAP, unsigned int ORBIT>
37
class TraversorCell : public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
38 39 40
{
private:
	MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
41

Pierre Kraemer's avatar
Pierre Kraemer committed
42
	AttributeContainer* cont ;
Pierre Kraemer's avatar
Pierre Kraemer committed
43
	unsigned int qCurrent ;
Pierre Kraemer's avatar
Pierre Kraemer committed
44

45
	DartMarker* dmark ;
46
	CellMarker<ORBIT>* cmark ;
Pierre Kraemer's avatar
Pierre Kraemer committed
47 48
	AttributeMultiVector<Dart>* quickTraversal ;

Pierre Kraemer's avatar
Pierre Kraemer committed
49
	Dart current ;
50
	bool firstTraversal ;
Pierre Kraemer's avatar
Pierre Kraemer committed
51
	const FunctorSelect& m_good ;
Pierre Kraemer's avatar
Pierre Kraemer committed
52 53

public:
54
	TraversorCell(MAP& map, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) ;
55 56 57 58 59 60 61 62 63

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

64
	void skip(Dart d);
Pierre Kraemer's avatar
Pierre Kraemer committed
65 66
} ;

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

template <unsigned int ORBIT>
class TraversorCell<GenericMap,ORBIT> : public Traversor<GenericMap>
{
private:
	GenericMap& m ;

	AttributeContainer* cont ;
	unsigned int qCurrent ;

	DartMarker* dmark ;
	CellMarker<ORBIT>* cmark ;
	AttributeMultiVector<Dart>* quickTraversal ;

	Dart current ;
	bool firstTraversal ;
	const FunctorSelect& m_good ;

public:
	TraversorCell(GenericMap& map, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) ;

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

	void skip(Dart d);
} ;


Pierre Kraemer's avatar
Pierre Kraemer committed
100
template <typename MAP>
101
class TraversorV : public TraversorCell<MAP, VERTEX>
Pierre Kraemer's avatar
Pierre Kraemer committed
102 103
{
public:
104
	TraversorV(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, VERTEX>(m, good, forceDartMarker, thread)
105
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
106
};
Pierre Kraemer's avatar
Pierre Kraemer committed
107 108

template <typename MAP>
109
class TraversorE : public TraversorCell<MAP, EDGE>
Pierre Kraemer's avatar
Pierre Kraemer committed
110 111
{
public:
112
	TraversorE(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, EDGE>(m, good, forceDartMarker, thread)
113
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
114
};
Pierre Kraemer's avatar
Pierre Kraemer committed
115 116

template <typename MAP>
117
class TraversorF : public TraversorCell<MAP, FACE>
Pierre Kraemer's avatar
Pierre Kraemer committed
118 119
{
public:
120
	TraversorF(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, FACE>(m, good, forceDartMarker, thread)
121
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
122
};
Pierre Kraemer's avatar
Pierre Kraemer committed
123 124

template <typename MAP>
125
class TraversorW : public TraversorCell<MAP, VOLUME>
Pierre Kraemer's avatar
Pierre Kraemer committed
126 127
{
public:
128
	TraversorW(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, VOLUME>(m, good, forceDartMarker, thread)
129
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
130
};
Pierre Kraemer's avatar
Pierre Kraemer committed
131 132 133

} // namespace CGoGN

134 135
#include "Topology/generic/traversorCell.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
136
#endif