genericmap.hpp 14.2 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
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

25 26
#include "Topology/generic/dartmarker.h"
#include "Topology/generic/traversorCell.h"
27
#include "Topology/generic/traversorFactory.h"
28

Pierre Kraemer's avatar
Pierre Kraemer committed
29 30
namespace CGoGN
{
Pierre Kraemer's avatar
Pierre Kraemer committed
31

Pierre Kraemer's avatar
Pierre Kraemer committed
32 33 34 35 36 37
/****************************************
 *           DARTS MANAGEMENT           *
 ****************************************/

inline Dart GenericMap::newDart()
{
38
	unsigned int di = m_attribs[DART].insertLine();		// insert a new dart line
Pierre Kraemer's avatar
Pierre Kraemer committed
39
	for(unsigned int i = 0; i < NB_ORBITS; ++i)
Pierre Kraemer's avatar
Pierre Kraemer committed
40
	{
41 42
		if (m_embeddings[i])							// set all its embeddings
			(*m_embeddings[i])[di] = EMBNULL ;			// to EMBNULL
Pierre Kraemer's avatar
Pierre Kraemer committed
43
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
44

Pierre Kraemer's avatar
Pierre Kraemer committed
45
	return Dart::create(di) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
46 47
}

Pierre Kraemer's avatar
Pierre Kraemer committed
48 49 50 51 52
inline void GenericMap::deleteDartLine(unsigned int index)
{
	m_attribs[DART].removeLine(index) ;	// free the dart line

	for (unsigned int t = 0; t < m_nbThreads; ++t)	// clear markers of
53
		(*m_markTables[DART][t])[index].clear() ;	// the removed dart
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
54

Pierre Kraemer's avatar
Pierre Kraemer committed
55 56
	for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
57
		if (m_embeddings[orbit])									// for each embedded orbit
Pierre Kraemer's avatar
Pierre Kraemer committed
58
		{
Pierre Kraemer's avatar
Pierre Kraemer committed
59
			unsigned int emb = (*m_embeddings[orbit])[index] ;		// get the embedding of the dart
Pierre Kraemer's avatar
Pierre Kraemer committed
60
			if(emb != EMBNULL)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
61
			{
Pierre Kraemer's avatar
Pierre Kraemer committed
62
				if(m_attribs[orbit].unrefLine(emb))					// unref the pointed embedding line
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
63
				{
Pierre Kraemer's avatar
Pierre Kraemer committed
64
					for (unsigned int t = 0; t < m_nbThreads; ++t)	// and clear its markers if it was
65
						(*m_markTables[orbit][t])[emb].clear() ;	// its last unref (and was thus freed)
Pierre Kraemer's avatar
merge..  
Pierre Kraemer committed
66 67
				}
			}
Pierre Kraemer's avatar
Pierre Kraemer committed
68 69
		}
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
70
}
Pierre Kraemer's avatar
Pierre Kraemer committed
71

Pierre Kraemer's avatar
Pierre Kraemer committed
72
inline unsigned int GenericMap::copyDartLine(unsigned int index)
Pierre Kraemer's avatar
Pierre Kraemer committed
73
{
74 75
	unsigned int newindex = m_attribs[DART].insertLine() ;	// create a new dart line
	m_attribs[DART].copyLine(newindex, index) ;				// copy the given dart line
Pierre Kraemer's avatar
Pierre Kraemer committed
76 77
	for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
78 79 80 81 82 83
		if (m_embeddings[orbit])
		{
			unsigned int emb = (*m_embeddings[orbit])[newindex] ;	// add a ref to the cells pointed
			if(emb != EMBNULL)										// by the new dart line
				m_attribs[orbit].refLine(emb) ;
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
84 85
	}
	return newindex ;
Pierre Kraemer's avatar
Pierre Kraemer committed
86 87
}

88 89 90 91
//inline bool GenericMap::isDartValid(Dart d)
//{
//	return !d.isNil() && m_attribs[DART].used(dartIndex(d)) ;
//}
Pierre Kraemer's avatar
Pierre Kraemer committed
92

Pierre Kraemer's avatar
Pierre Kraemer committed
93 94 95 96
/****************************************
 *         EMBEDDING MANAGEMENT         *
 ****************************************/

97 98
template <unsigned int ORBIT>
inline bool GenericMap::isOrbitEmbedded() const
Pierre Kraemer's avatar
Pierre Kraemer committed
99
{
100
	return (ORBIT == DART) || (m_embeddings[ORBIT] != NULL) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
101 102
}

103
inline bool GenericMap::isOrbitEmbedded(unsigned int orbit) const
Pierre Kraemer's avatar
Pierre Kraemer committed
104
{
105
	return (orbit == DART) || (m_embeddings[orbit] != NULL) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
106 107
}

108 109
template <unsigned int ORBIT>
inline unsigned int GenericMap::newCell()
Pierre Kraemer's avatar
Pierre Kraemer committed
110
{
111
	assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
112
	return m_attribs[ORBIT].insertLine();
Pierre Kraemer's avatar
Pierre Kraemer committed
113 114
}

115 116
template <unsigned int ORBIT>
inline void GenericMap::copyCell(unsigned int i, unsigned int j)
Pierre Kraemer's avatar
Pierre Kraemer committed
117
{
118
	assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
119
	m_attribs[ORBIT].copyLine(i, j) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
120 121
}

122 123
template <unsigned int ORBIT>
inline void GenericMap::initCell(unsigned int i)
Pierre Kraemer's avatar
Pierre Kraemer committed
124
{
125
	assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
126
	m_attribs[ORBIT].initLine(i) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
127 128
}

Pierre Kraemer's avatar
Pierre Kraemer committed
129 130 131 132
/****************************************
 *     QUICK TRAVERSAL MANAGEMENT       *
 ****************************************/

Pierre Kraemer's avatar
Pierre Kraemer committed
133
template <typename MAP, unsigned int ORBIT>
Pierre Kraemer's avatar
Pierre Kraemer committed
134 135
inline void GenericMap::enableQuickTraversal()
{
Sylvain Thery's avatar
Sylvain Thery committed
136

Pierre Kraemer's avatar
Pierre Kraemer committed
137 138 139 140 141 142
	if(m_quickTraversal[ORBIT] == NULL)
	{
		if(!isOrbitEmbedded<ORBIT>())
			addEmbedding<ORBIT>() ;
		m_quickTraversal[ORBIT] = m_attribs[ORBIT].addAttribute<Dart>("quick_traversal") ;
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
143
	updateQuickTraversal<MAP, ORBIT>() ;
Pierre Kraemer's avatar
Pierre Kraemer committed
144 145
}

Pierre Kraemer's avatar
Pierre Kraemer committed
146
template <typename MAP, unsigned int ORBIT>
147
inline void GenericMap::updateQuickTraversal()
Pierre Kraemer's avatar
Pierre Kraemer committed
148
{
Pierre Kraemer's avatar
Pierre Kraemer committed
149 150
	assert(m_quickTraversal[ORBIT] != NULL || !"updateQuickTraversal on a disabled orbit") ;

Pierre Kraemer's avatar
Pierre Kraemer committed
151 152
	CellMarker<MAP, ORBIT> cm(*this) ;
	for(Dart d = begin(); d != end(); next(d))
Pierre Kraemer's avatar
Pierre Kraemer committed
153
	{
Pierre Kraemer's avatar
Pierre Kraemer committed
154 155 156 157 158
		if(!cm.isMarked(d))
		{
			cm.mark(d) ;
			(*m_quickTraversal[ORBIT])[MAP::getEmbedding<ORBIT>(d)] = d ;
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
159
	}
160 161 162 163

	// restore ptr
	m_quickTraversal[ORBIT] = qt;

Pierre Kraemer's avatar
Pierre Kraemer committed
164 165 166
}

template <unsigned int ORBIT>
Sylvain Thery's avatar
Sylvain Thery committed
167
inline const AttributeMultiVector<Dart>* GenericMap::getQuickTraversal() const
Pierre Kraemer's avatar
Pierre Kraemer committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181
{
	return m_quickTraversal[ORBIT] ;
}

template <unsigned int ORBIT>
inline void GenericMap::disableQuickTraversal()
{
	if(m_quickTraversal[ORBIT] != NULL)
	{
		m_attribs[ORBIT].removeAttribute<Dart>(m_quickTraversal[ORBIT]->getIndex()) ;
		m_quickTraversal[ORBIT] = NULL ;
	}
}

Sylvain Thery's avatar
Sylvain Thery committed
182
template <typename MAP, unsigned int ORBIT, unsigned int INCI>
Sylvain Thery's avatar
Sylvain Thery committed
183
inline void GenericMap::enableQuickIncidentTraversal()
Sylvain Thery's avatar
Sylvain Thery committed
184 185 186 187 188 189 190 191 192
{
	if(m_quickLocalIncidentTraversal[ORBIT][INCI] == NULL)
	{
		if(!isOrbitEmbedded<ORBIT>())
			addEmbedding<ORBIT>() ;
		std::stringstream ss;
		ss << "quickLocalIncidentTraversal_" << INCI;
		m_quickLocalIncidentTraversal[ORBIT][INCI] = m_attribs[ORBIT].addAttribute<NoTypeNameAttribute<std::vector<Dart> > >(ss.str()) ;
	}
Sylvain Thery's avatar
Sylvain Thery committed
193
	updateQuickIncidentTraversal<MAP,ORBIT,INCI>() ;
Sylvain Thery's avatar
Sylvain Thery committed
194 195 196
}

template <typename MAP, unsigned int ORBIT, unsigned int INCI>
Sylvain Thery's avatar
Sylvain Thery committed
197
inline void GenericMap::updateQuickIncidentTraversal()
Sylvain Thery's avatar
Sylvain Thery committed
198 199 200 201 202 203 204 205 206
{
	assert(m_quickLocalIncidentTraversal[ORBIT][INCI] != NULL || !"updateQuickTraversal on a disabled orbit") ;

	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* ptrVD = m_quickLocalIncidentTraversal[ORBIT][INCI];
	m_quickLocalIncidentTraversal[ORBIT][INCI] = NULL;

	std::vector<Dart> buffer;
	buffer.reserve(100);

Sylvain Thery's avatar
Sylvain Thery committed
207 208
	MAP& map = static_cast<MAP&>(*this);

Sylvain Thery's avatar
Sylvain Thery committed
209 210 211 212
	TraversorCell<MAP,ORBIT> tra_glob(map);
	for (Dart d = tra_glob.begin(); d != tra_glob.end(); d = tra_glob.next())
	{
		buffer.clear();
Sylvain Thery's avatar
Sylvain Thery committed
213
		Traversor* tra_loc = TraversorFactory<MAP>::createIncident(map, d, map.dimension(), ORBIT, INCI);
Sylvain Thery's avatar
Sylvain Thery committed
214
		for (Dart e = tra_loc->begin(); e != tra_loc->end(); e = tra_loc->next())
Sylvain Thery's avatar
Sylvain Thery committed
215
			buffer.push_back(e);
Sylvain Thery's avatar
Sylvain Thery committed
216
		delete tra_loc;
Sylvain Thery's avatar
Sylvain Thery committed
217
		buffer.push_back(NIL);
218
		std::vector<Dart>& vd = (*ptrVD)[MAP::getEmbedding<ORBIT>(d)];
Sylvain Thery's avatar
Sylvain Thery committed
219 220 221 222 223 224 225
		vd.reserve(buffer.size());
		vd.assign(buffer.begin(),buffer.end());
	}
	m_quickLocalIncidentTraversal[ORBIT][INCI] = ptrVD;
}

template <unsigned int ORBIT, unsigned int INCI>
Sylvain Thery's avatar
Sylvain Thery committed
226
inline const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* GenericMap::getQuickIncidentTraversal() const
Sylvain Thery's avatar
Sylvain Thery committed
227 228 229 230 231
{
	return m_quickLocalIncidentTraversal[ORBIT][INCI] ;
}

template <unsigned int ORBIT, unsigned int INCI>
Sylvain Thery's avatar
Sylvain Thery committed
232
inline void GenericMap::disableQuickIncidentTraversal()
Sylvain Thery's avatar
Sylvain Thery committed
233 234 235 236 237 238 239 240 241
{
	if(m_quickLocalIncidentTraversal[ORBIT][INCI] != NULL)
	{
		m_attribs[ORBIT].removeAttribute<Dart>(m_quickLocalIncidentTraversal[ORBIT][INCI]->getIndex()) ;
		m_quickLocalIncidentTraversal[ORBIT][INCI] = NULL ;
	}
}

template <typename MAP, unsigned int ORBIT, unsigned int ADJ>
Sylvain Thery's avatar
Sylvain Thery committed
242
inline void GenericMap::enableQuickAdjacentTraversal()
Sylvain Thery's avatar
Sylvain Thery committed
243 244 245 246 247 248
{
	if(m_quickLocalAdjacentTraversal[ORBIT][ADJ] == NULL)
	{
		if(!isOrbitEmbedded<ORBIT>())
			addEmbedding<ORBIT>() ;
		std::stringstream ss;
Sylvain Thery's avatar
Sylvain Thery committed
249
		ss << "quickLocalAdjacentTraversal" << ADJ;
Sylvain Thery's avatar
Sylvain Thery committed
250 251
		m_quickLocalAdjacentTraversal[ORBIT][ADJ] = m_attribs[ORBIT].addAttribute<NoTypeNameAttribute<std::vector<Dart> > >(ss.str()) ;
	}
Sylvain Thery's avatar
Sylvain Thery committed
252
	updateQuickAdjacentTraversal<MAP,ORBIT,ADJ>() ;
Sylvain Thery's avatar
Sylvain Thery committed
253 254 255
}

template <typename MAP, unsigned int ORBIT, unsigned int ADJ>
Sylvain Thery's avatar
Sylvain Thery committed
256
inline void GenericMap::updateQuickAdjacentTraversal()
Sylvain Thery's avatar
Sylvain Thery committed
257 258 259 260 261 262
{
	assert(m_quickLocalAdjacentTraversal[ORBIT][ADJ] != NULL || !"updateQuickTraversal on a disabled orbit") ;

	AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* ptrVD = m_quickLocalAdjacentTraversal[ORBIT][ADJ];
	m_quickLocalAdjacentTraversal[ORBIT][ADJ] = NULL;

Sylvain Thery's avatar
Sylvain Thery committed
263 264
	MAP& map = static_cast<MAP&>(*this);

Sylvain Thery's avatar
Sylvain Thery committed
265 266 267 268 269 270 271
	std::vector<Dart> buffer;
	buffer.reserve(100);

	TraversorCell<MAP,ORBIT> tra_glob(map);
	for (Dart d = tra_glob.begin(); d != tra_glob.end(); d = tra_glob.next())
	{
		buffer.clear();
Sylvain Thery's avatar
Sylvain Thery committed
272
		Traversor* tra_loc = TraversorFactory<MAP>::createAdjacent(map, d, map.dimension(), ORBIT, ADJ);
Sylvain Thery's avatar
Sylvain Thery committed
273
		for (Dart e = tra_loc->begin(); e != tra_loc->end(); e = tra_loc->next())
Sylvain Thery's avatar
Sylvain Thery committed
274 275
			buffer.push_back(e);
		buffer.push_back(NIL);
Sylvain Thery's avatar
Sylvain Thery committed
276
		delete tra_loc;
277
		std::vector<Dart>& vd = (*ptrVD)[MAP::getEmbedding<ORBIT>(d)];
Sylvain Thery's avatar
Sylvain Thery committed
278 279 280 281 282 283
		vd.reserve(buffer.size());
		vd.assign(buffer.begin(),buffer.end());
	}
	m_quickLocalAdjacentTraversal[ORBIT][ADJ] = ptrVD;
}

Sylvain Thery's avatar
Sylvain Thery committed
284
template <unsigned int ORBIT, unsigned int ADJ>
Sylvain Thery's avatar
Sylvain Thery committed
285
inline const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* GenericMap::getQuickAdjacentTraversal() const
Sylvain Thery's avatar
Sylvain Thery committed
286
{
Sylvain Thery's avatar
Sylvain Thery committed
287
	return m_quickLocalAdjacentTraversal[ORBIT][ADJ] ;
Sylvain Thery's avatar
Sylvain Thery committed
288 289 290
}

template <unsigned int ORBIT, unsigned int ADJ>
Sylvain Thery's avatar
Sylvain Thery committed
291
inline void GenericMap::disableQuickAdjacentTraversal()
Sylvain Thery's avatar
Sylvain Thery committed
292 293 294 295 296 297 298 299
{
	if(m_quickLocalAdjacentTraversal[ORBIT][ADJ] != NULL)
	{
		m_attribs[ORBIT].removeAttribute<Dart>(m_quickLocalAdjacentTraversal[ORBIT][ADJ]->getIndex()) ;
		m_quickLocalAdjacentTraversal[ORBIT][ADJ] = NULL ;
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
300 301 302 303
/****************************************
 *        ATTRIBUTES MANAGEMENT         *
 ****************************************/

304 305 306 307 308
inline unsigned int GenericMap::getNbCells(unsigned int orbit)
{
	return m_attribs[orbit].size() ;
}

309 310
template <unsigned int ORBIT>
inline AttributeContainer& GenericMap::getAttributeContainer()
Pierre Kraemer's avatar
Pierre Kraemer committed
311
{
312
	return m_attribs[ORBIT] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
313 314
}

Sylvain Thery's avatar
Sylvain Thery committed
315 316 317 318 319 320
template <unsigned int ORBIT>
inline const AttributeContainer& GenericMap::getAttributeContainer() const
{
	return m_attribs[ORBIT] ;
}

Pierre Kraemer's avatar
Pierre Kraemer committed
321 322 323 324 325
inline AttributeContainer& GenericMap::getAttributeContainer(unsigned int orbit)
{
	return m_attribs[orbit] ;
}

Sylvain Thery's avatar
Sylvain Thery committed
326 327 328 329 330 331
inline const AttributeContainer& GenericMap::getAttributeContainer(unsigned int orbit) const
{
	return m_attribs[orbit] ;
}


332 333
template <unsigned int ORBIT>
inline AttributeMultiVector<Mark>* GenericMap::getMarkVector(unsigned int thread)
Pierre Kraemer's avatar
Pierre Kraemer committed
334
{
335
	assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded") ;
336
	return m_markTables[ORBIT][thread] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
337 338
}

339 340
template <unsigned int ORBIT>
inline AttributeMultiVector<unsigned int>* GenericMap::getEmbeddingAttributeVector()
Pierre Kraemer's avatar
Pierre Kraemer committed
341
{
342
	return m_embeddings[ORBIT] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
343 344
}

345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
template <typename R>
bool GenericMap::registerAttribute(const std::string &nameType)
{
	RegisteredBaseAttribute* ra = new RegisteredAttribute<R>;
	if (ra == NULL)
	{
		CGoGNerr << "Erreur enregistrement attribut" << CGoGNendl;
		return false;
	}

	ra->setTypeName(nameType);

	m_attributes_registry_map->insert(std::pair<std::string, RegisteredBaseAttribute*>(nameType,ra));
	return true;
}

361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
/****************************************
 *   EMBEDDING ATTRIBUTES MANAGEMENT    *
 ****************************************/

template <unsigned int ORBIT>
void GenericMap::addEmbedding()
{
	assert(!isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit already embedded") ;

	std::ostringstream oss;
	oss << "EMB_" << ORBIT;

	AttributeContainer& dartCont = m_attribs[DART] ;
	AttributeMultiVector<unsigned int>* amv = dartCont.addAttribute<unsigned int>(oss.str()) ;
	m_embeddings[ORBIT] = amv ;

377 378 379
	// set new embedding to EMBNULL for all the darts of the map
	for(unsigned int i = dartCont.begin(); i < dartCont.end(); dartCont.next(i))
		(*amv)[i] = EMBNULL ;
380 381
}

Pierre Kraemer's avatar
Pierre Kraemer committed
382 383 384 385
/****************************************
 *           DARTS TRAVERSALS           *
 ****************************************/

386
template <unsigned int ORBIT>
Sylvain Thery's avatar
Sylvain Thery committed
387
bool GenericMap::foreach_dart_of_orbit(Dart d, FunctorType& f, unsigned int thread) const
388 389 390 391 392 393 394 395 396 397 398 399 400
{
	switch(ORBIT)
	{
		case DART:		return f(d);
		case VERTEX: 	return foreach_dart_of_vertex(d, f, thread);
		case EDGE: 		return foreach_dart_of_edge(d, f, thread);
		case FACE: 		return foreach_dart_of_face(d, f, thread);
		case VOLUME: 	return foreach_dart_of_volume(d, f, thread);
		case VERTEX1: 	return foreach_dart_of_vertex1(d, f, thread);
		case EDGE1: 	return foreach_dart_of_edge1(d, f, thread);
		case VERTEX2: 	return foreach_dart_of_vertex2(d, f, thread);
		case EDGE2:		return foreach_dart_of_edge2(d, f, thread);
		case FACE2:		return foreach_dart_of_face2(d, f, thread);
Pierre Kraemer's avatar
Pierre Kraemer committed
401
		default: 		assert(!"Cells of this dimension are not handled"); break;
402 403 404 405
	}
	return false;
}

Sylvain Thery's avatar
Sylvain Thery committed
406 407 408 409 410 411 412 413 414 415 416
/****************************************
 *  TOPOLOGICAL ATTRIBUTES MANAGEMENT   *
 ****************************************/

inline AttributeMultiVector<Dart>* GenericMap::addRelation(const std::string& name)
{
	AttributeContainer& cont = m_attribs[DART] ;
	AttributeMultiVector<Dart>* amv = cont.addAttribute<Dart>(name) ;

	// set new relation to fix point for all the darts of the map
	for(unsigned int i = cont.begin(); i < cont.end(); cont.next(i))
Pierre Kraemer's avatar
Pierre Kraemer committed
417
		(*amv)[i] = i ;
Sylvain Thery's avatar
Sylvain Thery committed
418 419 420 421

	return amv ;
}

Sylvain Thery's avatar
Sylvain Thery committed
422 423 424 425 426 427 428
inline AttributeMultiVector<Dart>* GenericMap::getRelation(const std::string& name)
{
	AttributeContainer& cont = m_attribs[DART] ;
	AttributeMultiVector<Dart>* amv = cont.getDataVector<Dart>(cont.getAttributeIndex(name)) ;
	return amv ;
}

Sylvain Thery's avatar
Sylvain Thery committed
429 430 431 432
/**************************
 *  BOUNDARY MANAGEMENT   *
 **************************/

Thery Sylvain's avatar
Thery Sylvain committed
433 434 435 436 437
template <unsigned int DIM>
void GenericMap::boundaryUnmarkAll()
{
	AttributeContainer& cont = getAttributeContainer<DART>() ;
	for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
Thery Sylvain's avatar
Thery Sylvain committed
438
		m_markTables[DART][0]->operator[](i).unsetMark(m_boundaryMarkers[DIM-2]);
Sylvain Thery's avatar
Sylvain Thery committed
439 440
}

Thery Sylvain's avatar
Thery Sylvain committed
441

Pierre Kraemer's avatar
Pierre Kraemer committed
442
} //namespace CGoGN