traversorCell.h 4.02 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

25
#include "Topology/generic/traversorGen.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
26 27 28 29 30

#ifndef __TRAVERSOR_CELL_H__
#define __TRAVERSOR_CELL_H__

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

namespace CGoGN
{

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

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

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

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

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

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

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

template <typename MAP>
69
class TraversorV : public TraversorCell<MAP, VERTEX>
Pierre Kraemer's avatar
Pierre Kraemer committed
70 71
{
public:
72
	TraversorV(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, VERTEX>(m, good, forceDartMarker, thread)
73
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
74
};
Pierre Kraemer's avatar
Pierre Kraemer committed
75 76

template <typename MAP>
77
class TraversorE : public TraversorCell<MAP, EDGE>
Pierre Kraemer's avatar
Pierre Kraemer committed
78 79
{
public:
80
	TraversorE(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, EDGE>(m, good, forceDartMarker, thread)
81
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
82
};
Pierre Kraemer's avatar
Pierre Kraemer committed
83

untereiner's avatar
untereiner committed
84

Pierre Kraemer's avatar
Pierre Kraemer committed
85
template <typename MAP>
86
class TraversorF : public TraversorCell<MAP, FACE>
Pierre Kraemer's avatar
Pierre Kraemer committed
87 88
{
public:
89
	TraversorF(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, FACE>(m, good, forceDartMarker, thread)
90
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
91
};
Pierre Kraemer's avatar
Pierre Kraemer committed
92 93

template <typename MAP>
94
class TraversorW : public TraversorCell<MAP, VOLUME>
Pierre Kraemer's avatar
Pierre Kraemer committed
95 96
{
public:
97
	TraversorW(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, VOLUME>(m, good, forceDartMarker, thread)
98
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
99
};
Pierre Kraemer's avatar
Pierre Kraemer committed
100

101

102
template <typename MAP, unsigned int ORBIT>
103
class TraversorDartsOfOrbit : public Traversor<MAP>
104 105
{
private:
Pierre Kraemer's avatar
Pierre Kraemer committed
106 107
	std::vector<Dart>::iterator m_current ;
	std::vector<Dart> m_vd ;
108 109

public:
110
	TraversorDartsOfOrbit(MAP& map, Dart d, unsigned int thread = 0) ;
111 112 113 114 115 116 117 118

	Dart begin() ;

	Dart end() ;

	Dart next() ;
} ;

Pierre Kraemer's avatar
Pierre Kraemer committed
119 120
} // namespace CGoGN

121 122
#include "Topology/generic/traversorCell.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
123
#endif