ihm3.h 6.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg                *
*                                                                              *
* 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.           *
*                                                                              *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/                              *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __IMPLICIT_HIERARCHICAL_MAP3__
#define __IMPLICIT_HIERARCHICAL_MAP3__

#include "Topology/map/map3.h"
#include "Topology/generic/embeddedMap3.h"

namespace CGoGN
{

namespace Algo
{

untereiner's avatar
untereiner committed
37
namespace IHM
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
{

class ImplicitHierarchicalMap3 : public EmbeddedMap3<Map3>
{

public:
	unsigned int m_curLevel ;
	unsigned int m_maxLevel ;
	unsigned int m_edgeIdCount ;
	unsigned int m_faceIdCount;

	AttributeHandler<unsigned int> m_dartLevel ;
	AttributeHandler<unsigned int> m_edgeId ;
	AttributeHandler<unsigned int> m_faceId ;

53
	AttributeMultiVector<unsigned int>* m_nextLevelCell[NB_ORBITS] ;
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

public:
	ImplicitHierarchicalMap3() ;

	~ImplicitHierarchicalMap3() ;

	void init() ;

	/***************************************************
	 *                 MAP TRAVERSAL                   *
	 ***************************************************/

	virtual Dart newDart() ;

	Dart phi1(Dart d) ;

	Dart phi_1(Dart d) ;

72 73
	Dart phi2(Dart d) ;

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
private:
	Dart phi2bis(Dart d) ;

public:
	Dart phi3(Dart d);

	Dart alpha0(Dart d);

	Dart alpha1(Dart d);

	Dart alpha2(Dart d);

	Dart alpha_2(Dart d);

	virtual Dart begin() ;

	virtual Dart end() ;

	virtual void next(Dart& d) ;

	virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f) ;

	virtual bool foreach_dart_of_edge(Dart d, FunctorType& f) ;

	bool foreach_dart_of_oriented_face(Dart d, FunctorType& f);
	virtual bool foreach_dart_of_face(Dart d, FunctorType& f) ;

	bool foreach_dart_of_oriented_volume(Dart d, FunctorType& f);
	virtual bool foreach_dart_of_volume(Dart d, FunctorType& f) ;

	virtual bool foreach_dart_of_cc(Dart d, FunctorType& f) ;

	/***************************************************
	 *              LEVELS MANAGEMENT                  *
	 ***************************************************/

	unsigned int getCurrentLevel() ;

	void setCurrentLevel(unsigned int l) ;

	unsigned int getMaxLevel() ;

	unsigned int getDartLevel(Dart d) ;

	void setDartLevel(Dart d, unsigned int i) ;

	/***************************************************
	 *             EDGE ID MANAGEMENT                  *
	 ***************************************************/

	/**
	 * Give a new unique id to all the edges of the map
	 */
	void initEdgeId() ;

	/**
	 * Return the next available edge id
	 */
	unsigned int getNewEdgeId() ;

134 135 136
	/**
	 * Return the id of the edge of d
	 */
137 138
	unsigned int getEdgeId(Dart d) ;

139 140 141 142
	/**
	 * Set an edge id to all darts from an orbit of d
	 */
	//TODO changer l'ordre des parametres
143 144 145 146 147
	void setEdgeId(Dart d, unsigned int i, unsigned int orbit);

	/***************************************************
	 *             FACE ID MANAGEMENT                  *
	 ***************************************************/
148 149 150 151

	/**
	 * Give a new unique id to all the faces of the map
	 */
152 153 154 155 156 157 158
	void initFaceId() ;

	/**
	 * Return the next available face id
	 */
	unsigned int getNewFaceId() ;

159 160 161
	/**
	 * Return the id of the face of d
	 */
162 163
	unsigned int getFaceId(Dart d) ;

164 165 166 167
	/**
	 * Set a face id to all darts from an orbit of d
	 */
	//TODO changer l'ordre des parametres
168 169
	void setFaceId(Dart d, unsigned int i, unsigned int orbit);

170 171
	void setFaceId(unsigned int orbit, Dart d);

172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
	/***************************************************
	 *               CELLS INFORMATION                 *
	 ***************************************************/

	/**
	 * Return the level of insertion of the vertex of d
	 */
	unsigned int vertexInsertionLevel(Dart d) ;

	/**
	 * Return the level of the edge of d in the current level map
	 */
	unsigned int edgeLevel(Dart d) ;

	/**
187
	 * Return the level of the face of d in the current level map
188 189 190 191
	 */
	unsigned int faceLevel(Dart d);

	/**
192
	 * Return the level of the volume of d in the current level map
193 194 195 196
	 */
	unsigned int volumeLevel(Dart d);

	/**
197
	 * Return the oldest dart of the face of d in the current level map
198 199 200 201
	 */
	Dart faceOldestDart(Dart d);

	/**
202
	 * Return the oldest dart of the volume of d in the current level map
203 204 205 206 207 208 209 210 211 212
	 */
	Dart volumeOldestDart(Dart d);

	/**
	 * Return true if the edge of d in the current level map
	 * has already been subdivided to the next level
	 */
	bool edgeIsSubdivided(Dart d) ;

	/**
213 214
	 * Return true if the face of d in the current level map
	 * has already been subdivided to the next level
215 216 217 218
	 */
	bool faceIsSubdivided(Dart d) ;

	/**
219 220
	 * Return true if the volume of d in the current level map
	 * has already been subdivided to the next level
221 222 223 224 225 226 227 228 229 230 231 232 233 234
	 */
	bool volumeIsSubdivided(Dart d);
} ;


} //namespace IHM

} //namespace Algo

} //namespace CGoGN

#include "Algo/ImplicitHierarchicalMesh/ihm3.hpp"

#endif