traversor3.h 10.5 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*******************************************************************************
* 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 __TRAVERSOR3_H__
#define __TRAVERSOR3_H__

#include "Topology/generic/dart.h"
29
#include "Topology/generic/traversorCell.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
30
31
32

namespace CGoGN
{
33
34
35
36
/**
 * class Marker for Traversor usefull to combine
 * several TraversorXY
 */
37
template <typename MAP>
38
class MarkerForTraversor
Pierre Kraemer's avatar
Pierre Kraemer committed
39
40
{
private:
41
42
43
	MAP& m_map ;
	DartMarkerStore* m_dmark ;
	CellMarkerStore* m_cmark ;
44
	unsigned int m_orbit;
Pierre Kraemer's avatar
Pierre Kraemer committed
45
public:
46
	MarkerForTraversor(MAP& map, unsigned int orbit, bool forceDartMarker = false, unsigned int thread = 0) ;
47
48
49
50
51
52
53
	~MarkerForTraversor();
	DartMarkerStore* dmark();
	CellMarkerStore* cmark();
	void mark(Dart d);
	void unmark(Dart d);
	bool isMarked(Dart d);
} ;
Pierre Kraemer's avatar
Pierre Kraemer committed
54

55
56
57
58
/**
 * Generic class Traversor (do not use directly)
 * Traverse all Y incident to X
 */
59
template <typename MAP>
60
61
62
63
64
65
66
67
class Traversor3XY
{
private:
	MAP& m_map ;
	DartMarkerStore* m_dmark ;
	CellMarkerStore* m_cmark ;
	Dart m_current ;
	TraversorDartsOfOrbit<MAP> m_tradoo;
68
69
	unsigned int m_orbx;
	unsigned int m_orby;
70
	bool m_allocated;
71
	bool m_first;
72
public:
73
74
	Traversor3XY(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY, bool forceDartMarker = false, unsigned int thread = 0) ;
	Traversor3XY(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY, MarkerForTraversor<MAP>& tmo, bool forceDartMarker = false, unsigned int thread = 0) ;
75
	~Traversor3XY();
Pierre Kraemer's avatar
Pierre Kraemer committed
76
77
78
79
80
	Dart begin() ;
	Dart end() ;
	Dart next() ;
} ;

81
82
83
84
85

/**
 * Generic class Traversor (do not use directly)
 * Traverse all X adjacent to X by an Y
 */
86
template <typename MAP>
87
class Traversor3XXaY
Pierre Kraemer's avatar
Pierre Kraemer committed
88
89
{
private:
90
91
92
93
	MAP& m_map ;
	std::vector<Dart> m_vecDarts;
	std::vector<Dart>::iterator m_iter;
public:
94
	Traversor3XXaY(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY, bool forceDartMarker = false, unsigned int thread = 0);
95
96

	Dart begin();
Pierre Kraemer's avatar
Pierre Kraemer committed
97

98
99
100
101
102
103
104
105
106
107
108
109
	Dart end();

	Dart next();
};




/**
 * Traverse vertices incident to volume
 */
template <typename MAP>
110
class Traversor3WV: public Traversor3XY<MAP>
111
{
Pierre Kraemer's avatar
Pierre Kraemer committed
112
public:
113
	Traversor3WV(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,VOLUME,VERTEX,forceDartMarker, thread)	{}
114
};
Pierre Kraemer's avatar
Pierre Kraemer committed
115

116
117
118
119
/**
 * Traverse edges incident to volume
 */
template <typename MAP>
120
class Traversor3WE: public Traversor3XY<MAP>
121
122
{
public:
123
	Traversor3WE(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,VOLUME,EDGE, forceDartMarker, thread)	{}
124
};
Pierre Kraemer's avatar
Pierre Kraemer committed
125

126
127
128
/**
 * Traverse faces incident to volume
 */
Pierre Kraemer's avatar
Pierre Kraemer committed
129
template <typename MAP>
130
class Traversor3WF: public Traversor3XY<MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
131
{
132
public:
133
	Traversor3WF(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,VOLUME,FACE, forceDartMarker, thread) {}
134
135
};

Pierre Kraemer's avatar
Pierre Kraemer committed
136

137
138
139
140
/**
 * Traverse vertices incident to face
 */
template <typename MAP>
141
class Traversor3FV: public Traversor3XY<MAP>
142
{
Pierre Kraemer's avatar
Pierre Kraemer committed
143
public:
144
	Traversor3FV(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,FACE,VERTEX, forceDartMarker, thread)	{}
145
};
Pierre Kraemer's avatar
Pierre Kraemer committed
146

147
148
149
150
/**
 * Traverse edges incident to face
 */
template <typename MAP>
151
class Traversor3FE: public Traversor3XY<MAP>
152
153
{
public:
154
	Traversor3FE(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,FACE,EDGE, forceDartMarker, thread)	{}
155
};
Pierre Kraemer's avatar
Pierre Kraemer committed
156

157
158
159
160
/**
 * Traverse volumes incident to face
 */
template <typename MAP>
161
class Traversor3FW: public Traversor3XY<MAP>
162
163
{
public:
164
	Traversor3FW(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,FACE,VOLUME, forceDartMarker, thread)	{}
165
};
Pierre Kraemer's avatar
Pierre Kraemer committed
166
167


168
169
170
171
/**
 * Traverse vertices incident to edge
 */
template <typename MAP>
172
class Traversor3EV: public Traversor3XY<MAP>
173
174
{
public:
175
	Traversor3EV(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,EDGE,VERTEX, forceDartMarker, thread)	{}
176
};
Pierre Kraemer's avatar
Pierre Kraemer committed
177

178
179
180
181
/**
 * Traverse faces incident to edge
 */
template <typename MAP>
182
class Traversor3EF: public Traversor3XY<MAP>
183
184
{
public:
185
	Traversor3EF(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,EDGE,FACE, forceDartMarker, thread)	{}
186
};
Pierre Kraemer's avatar
Pierre Kraemer committed
187

188
189
190
191
/**
 * Traverse volumes incident to edge
 */
template <typename MAP>
192
class Traversor3EW: public Traversor3XY<MAP>
193
194
{
public:
195
	Traversor3EW(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,EDGE,VOLUME, forceDartMarker, thread)	{}
196
};
Pierre Kraemer's avatar
Pierre Kraemer committed
197
198


199
200
201
202
203

/**
 * Traverse edges incident to vertex
 */
template <typename MAP>
204
class Traversor3VE: public Traversor3XY<MAP>
205
{
206
public:
207
	Traversor3VE(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,VERTEX,EDGE, forceDartMarker, thread)	{}
208
};
209

210
211
212
213
/**
 * Traverse faces incident to vertex
 */
template <typename MAP>
214
class Traversor3VF: public Traversor3XY<MAP>
215
{
216
public:
217
	Traversor3VF(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,VERTEX,FACE, forceDartMarker, thread)	{}
218
};
219

220
221
222
223
/**
 * Traverse volumes incident to vertex
 */
template <typename MAP>
224
class Traversor3VW: public Traversor3XY<MAP>
225
226
{
public:
227
	Traversor3VW(MAP& m, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XY<MAP>(m, dart,VERTEX,VOLUME, forceDartMarker, thread)	{}
228
229
230
231
232
233
234
235
};



/**
 * Traverse vertices adjacent to a vertex by an edge
 */
template <typename MAP>
236
class Traversor3VVaE: public Traversor3XXaY<MAP>
237
238
{
public:
239
	Traversor3VVaE(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,VERTEX,EDGE, forceDartMarker, thread)	{}
240
241
242
243
244
245
};

/**
 * Traverse vertices adjacent to a vertex by a face
 */
template <typename MAP>
246
class Traversor3VVaF: public Traversor3XXaY<MAP>
247
248
{
public:
249
	Traversor3VVaF(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,VERTEX,FACE, forceDartMarker, thread)	{}
250
251
252
253
254
255
};

/**
 * Traverse vertices adjacent to a vertex by a volume
 */
template <typename MAP>
256
class Traversor3VVaW: public Traversor3XXaY<MAP>
257
258
{
public:
259
	Traversor3VVaW(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,VERTEX,VOLUME, forceDartMarker, thread)	{}
260
261
262
263
264
265
266
};


/**
 * Traverse edges adjacent to an egde by a vertex
 */
template <typename MAP>
267
class Traversor3EEaV: public Traversor3XXaY<MAP>
268
269
{
public:
270
	Traversor3EEaV(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,EDGE,VERTEX, forceDartMarker, thread)	{}
271
272
273
274
275
276
};

/**
 * Traverse edges adjacent to an egde by a face
 */
template <typename MAP>
277
class Traversor3EEaF: public Traversor3XXaY<MAP>
278
279
{
public:
280
	Traversor3EEaF(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,EDGE,FACE, forceDartMarker, thread)	{}
281
282
283
284
285
286
};

/**
 * Traverse edges adjacent to an egde by a volume
 */
template <typename MAP>
287
class Traversor3EEaW: public Traversor3XXaY<MAP>
288
289
{
public:
290
	Traversor3EEaW(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,EDGE,VOLUME, forceDartMarker, thread)	{}
291
292
293
294
295
296
297
};


/**
 * Traverse faces adjacent to a face by a vertex
 */
template <typename MAP>
298
class Traversor3FFaV: public Traversor3XXaY<MAP>
299
300
{
public:
301
	Traversor3FFaV(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,FACE,VERTEX, forceDartMarker, thread)	{}
302
303
304
305
306
307
};

/**
 * Traverse faces adjacent to a face by an edge
 */
template <typename MAP>
308
class Traversor3FFaE: public Traversor3XXaY<MAP>
309
310
{
public:
311
	Traversor3FFaE(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,FACE,EDGE, forceDartMarker, thread)	{}
312
313
314
315
316
317
};

/**
 * Traverse faces adjacent to a face by a volume
 */
template <typename MAP>
318
class Traversor3FFaW: public Traversor3XXaY<MAP>
319
320
{
public:
321
	Traversor3FFaW(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,FACE,VOLUME, forceDartMarker, thread)	{}
322
};
Pierre Kraemer's avatar
Pierre Kraemer committed
323
324


325
326
327
/**
 * Traverse volumes adjacent to a volumee by a vertex
 */
328
template <typename MAP>
329
class Traversor3WWaV: public Traversor3XXaY<MAP>
330
331
{
public:
332
	Traversor3WWaV(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,VOLUME,VERTEX, forceDartMarker, thread)	{}
333
334
};

335
336
337
/**
 * Traverse volumes adjacent to a volumee by an edge
 */
338
template <typename MAP>
339
class Traversor3WWaE: public Traversor3XXaY<MAP>
340
341
{
public:
342
	Traversor3WWaE(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,VOLUME,EDGE, forceDartMarker, thread)	{}
343
344
};

345
346
347
/**
 * Traverse volumes adjacent to a volumee by a face
 */
348
template <typename MAP>
349
class Traversor3WWaF: public Traversor3XXaY<MAP>
350
351
{
public:
352
	Traversor3WWaF(MAP& m, Dart d, bool forceDartMarker = false, unsigned int thread = 0) : Traversor3XXaY<MAP>(m, d,VOLUME,FACE, forceDartMarker, thread)	{}
353
354
};

Pierre Kraemer's avatar
Pierre Kraemer committed
355
356
357
358
359
360

} // namespace CGoGN

#include "Topology/generic/traversor3.hpp"

#endif