Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

traversorCell.h 4.5 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
37
38
39
40
41
42
43
44
45
46
47
48
/// Macro for simple syntax traversal (can be nested)
/// parameters:
///   - cell type
///   - name of iterator variable (automatically declared)
///   - map type
///   - map used
///
/// Ex: FOR_ALL_CELLS(VERTEX, di, myMap) { ... }
///
#define FOR_ALL_CELLS(ORBIT, NAME_ITER, MAP_TYPE, MAP_PARAM) TraversorCell<MAP_TYPE, (ORBIT)>  NAME_ITER_TraversalMacroLocalLoop(MAP_PARAM); \
	for (Dart NAME_ITER = NAME_ITER_TraversalMacroLocalLoop.begin(); NAME_ITER != NAME_ITER_TraversalMacroLocalLoop.end(); NAME_ITER = NAME_ITER_TraversalMacroLocalLoop.next())


49
template <typename MAP, unsigned int ORBIT>
Sylvain Thery's avatar
Sylvain Thery committed
50
class TraversorCell //: public Traversor<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
51
52
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
53
	const MAP& m ;
Pierre Kraemer's avatar
Pierre Kraemer committed
54

Sylvain Thery's avatar
Sylvain Thery committed
55
	const AttributeContainer* cont ;
Pierre Kraemer's avatar
Pierre Kraemer committed
56
	unsigned int qCurrent ;
Pierre Kraemer's avatar
Pierre Kraemer committed
57

58
	DartMarker* dmark ;
59
	CellMarker<ORBIT>* cmark ;
Sylvain Thery's avatar
Sylvain Thery committed
60
	const AttributeMultiVector<Dart>* quickTraversal ;
Pierre Kraemer's avatar
Pierre Kraemer committed
61

Pierre Kraemer's avatar
Pierre Kraemer committed
62
	Dart current ;
63
	bool firstTraversal ;
Pierre Kraemer's avatar
Pierre Kraemer committed
64
65

public:
Sylvain Thery's avatar
Sylvain Thery committed
66
	TraversorCell(const MAP& map, bool forceDartMarker = false, unsigned int thread = 0) ;
67
68
69

	~TraversorCell() ;

70
	inline Dart begin() ;
71

72
	inline Dart end() ;
73

74
	inline Dart next() ;
75

76
	inline void skip(Dart d);
Pierre Kraemer's avatar
Pierre Kraemer committed
77
78
} ;

79
80

template <unsigned int ORBIT>
81
class TraversorCell<GenericMap, ORBIT> //: public Traversor<GenericMap>
82
83
{
private:
Sylvain Thery's avatar
Sylvain Thery committed
84
	const GenericMap& m ;
85

Sylvain Thery's avatar
Sylvain Thery committed
86
	const AttributeContainer* cont ;
87
88
89
90
	unsigned int qCurrent ;

	DartMarker* dmark ;
	CellMarker<ORBIT>* cmark ;
Sylvain Thery's avatar
Sylvain Thery committed
91
	const AttributeMultiVector<Dart>* quickTraversal ;
92
93
94
95
96

	Dart current ;
	bool firstTraversal ;

public:
Sylvain Thery's avatar
Sylvain Thery committed
97
	TraversorCell(const GenericMap& map, bool forceDartMarker = false, unsigned int thread = 0) ;
98
99
100

	~TraversorCell() ;

101
	inline Dart begin() ;
102

103
	inline Dart end() ;
104

105
	inline Dart next() ;
106

107
	inline void skip(Dart d);
108
109
110
} ;


Pierre Kraemer's avatar
Pierre Kraemer committed
111
template <typename MAP>
112
class TraversorV : public TraversorCell<MAP, VERTEX>
Pierre Kraemer's avatar
Pierre Kraemer committed
113
114
{
public:
Sylvain Thery's avatar
Sylvain Thery committed
115
	TraversorV(const MAP& m, unsigned int thread = 0) : TraversorCell<MAP, VERTEX>(m, false, thread)
116
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
117
};
Pierre Kraemer's avatar
Pierre Kraemer committed
118
119

template <typename MAP>
120
class TraversorE : public TraversorCell<MAP, EDGE>
Pierre Kraemer's avatar
Pierre Kraemer committed
121
122
{
public:
Sylvain Thery's avatar
Sylvain Thery committed
123
	TraversorE(const MAP& m, unsigned int thread = 0) : TraversorCell<MAP, EDGE>(m, false, thread)
124
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
125
};
Pierre Kraemer's avatar
Pierre Kraemer committed
126
127

template <typename MAP>
128
class TraversorF : public TraversorCell<MAP, FACE>
Pierre Kraemer's avatar
Pierre Kraemer committed
129
130
{
public:
Sylvain Thery's avatar
Sylvain Thery committed
131
	TraversorF(const MAP& m, unsigned int thread = 0) : TraversorCell<MAP, FACE>(m, false, thread)
132
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
133
};
Pierre Kraemer's avatar
Pierre Kraemer committed
134
135

template <typename MAP>
136
class TraversorW : public TraversorCell<MAP, VOLUME>
Pierre Kraemer's avatar
Pierre Kraemer committed
137
138
{
public:
Sylvain Thery's avatar
Sylvain Thery committed
139
	TraversorW(const MAP& m, unsigned int thread = 0) : TraversorCell<MAP, VOLUME>(m, false, thread)
140
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
141
};
Pierre Kraemer's avatar
Pierre Kraemer committed
142
143
144

} // namespace CGoGN

145
146
#include "Topology/generic/traversorCell.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
147
#endif