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
#include "Topology/generic/traversorGen.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
25 26 27 28 29

#ifndef __TRAVERSOR_CELL_H__
#define __TRAVERSOR_CELL_H__

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

namespace CGoGN
{

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

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

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

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

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

	~TraversorCell() ;

	Dart begin() ;

	Dart end() ;

	Dart next() ;

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

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

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

untereiner's avatar
untereiner committed
83

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

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

100

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

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

	Dart begin() ;

	Dart end() ;

	Dart next() ;
} ;

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

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

Pierre Kraemer's avatar
Pierre Kraemer committed
122
#endif