traversorCell.h 3.82 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
{

Sylvain Thery's avatar
Sylvain Thery committed
35
template <typename MAP>
Pierre Kraemer's avatar
Pierre Kraemer committed
36 37 38 39
class TraversorCell
{
private:
	MAP& m ;
40
	unsigned int m_orbit ;
41 42
	DartMarker* dmark ;
	CellMarker* cmark ;
Pierre Kraemer's avatar
Pierre Kraemer committed
43
	Dart current ;
44
	bool firstTraversal ;
Pierre Kraemer's avatar
Pierre Kraemer committed
45
	const FunctorSelect& m_good ;
Pierre Kraemer's avatar
Pierre Kraemer committed
46 47

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

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

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

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

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

untereiner's avatar
untereiner committed
77

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

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

94 95 96 97 98

template <typename MAP>
class TraversorDartsOfOrbit
{
private:
Pierre Kraemer's avatar
Pierre Kraemer committed
99 100
	std::vector<Dart>::iterator m_current ;
	std::vector<Dart> m_vd ;
101 102 103 104 105 106 107 108 109 110 111

public:
	TraversorDartsOfOrbit(MAP& map, unsigned int orbit, Dart d, unsigned int thread = 0) ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;
} ;

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

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

Pierre Kraemer's avatar
Pierre Kraemer committed
116
#endif