traversorCell.h 3.83 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 ;
40
	DartMarker* dmark ;
41
	CellMarker<ORBIT>* cmark ;
Pierre Kraemer's avatar
Pierre Kraemer committed
42
	Dart current ;
43
	bool firstTraversal ;
Pierre Kraemer's avatar
Pierre Kraemer committed
44
	const FunctorSelect& m_good ;
Pierre Kraemer's avatar
Pierre Kraemer committed
45 46

public:
47
	TraversorCell(MAP& map, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) ;
48 49 50 51 52 53 54 55 56

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

57
	void skip(Dart d);
Pierre Kraemer's avatar
Pierre Kraemer committed
58 59 60
} ;

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

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

untereiner's avatar
untereiner committed
76

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

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

93

94
template <typename MAP, unsigned int ORBIT>
95 96 97
class TraversorDartsOfOrbit
{
private:
Pierre Kraemer's avatar
Pierre Kraemer committed
98 99
	std::vector<Dart>::iterator m_current ;
	std::vector<Dart> m_vd ;
100 101

public:
102
	TraversorDartsOfOrbit(MAP& map, Dart d, unsigned int thread = 0) ;
103 104 105 106 107 108 109 110

	Dart begin() ;

	Dart end() ;

	Dart next() ;
} ;

Pierre Kraemer's avatar
Pierre Kraemer committed
111 112
} // namespace CGoGN

113 114
#include "Topology/generic/traversorCell.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
115
#endif