traversorCell.h 3.9 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 24 25 26 27 28
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#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"
Pierre Kraemer's avatar
Pierre Kraemer committed
31 32 33 34

namespace CGoGN
{

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

42
	DartMarker* dmark ;
43
	CellMarker<ORBIT>* cmark ;
Pierre Kraemer's avatar
Pierre Kraemer committed
44 45
	AttributeMultiVector<Dart>* quickTraversal ;

Pierre Kraemer's avatar
Pierre Kraemer committed
46
	Dart current ;
47
	bool firstTraversal ;
Pierre Kraemer's avatar
Pierre Kraemer committed
48
	const FunctorSelect& m_good ;
Pierre Kraemer's avatar
Pierre Kraemer committed
49 50

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

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

61
	void skip(Dart d);
Pierre Kraemer's avatar
Pierre Kraemer committed
62 63 64
} ;

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

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

untereiner's avatar
untereiner committed
80

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

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

97

98
template <typename MAP, unsigned int ORBIT>
99 100 101
class TraversorDartsOfOrbit
{
private:
Pierre Kraemer's avatar
Pierre Kraemer committed
102 103
	std::vector<Dart>::iterator m_current ;
	std::vector<Dart> m_vd ;
104 105

public:
106
	TraversorDartsOfOrbit(MAP& map, Dart d, unsigned int thread = 0) ;
107 108 109 110 111 112 113 114

	Dart begin() ;

	Dart end() ;

	Dart next() ;
} ;

Pierre Kraemer's avatar
Pierre Kraemer committed
115 116
} // namespace CGoGN

117 118
#include "Topology/generic/traversorCell.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
119
#endif