Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

attribmap.cpp 3.44 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
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
/*******************************************************************************
* 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                                        *
*                                                                              *
*******************************************************************************/

#include "Topology/generic/attribmap.h"

namespace CGoGN
{

AttribMap::AttribMap() : GenericMap()
{
32
	AttributeContainer& dartCont = m_attribs[DART_ORBIT] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
33
	unsigned int mark_index = dartCont.addAttribute<Mark>("Mark") ;
34
	AttributeMultiVector<Mark>& amv = dartCont.getDataVector<Mark>(mark_index) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
35
36
37
38
39
40
41
42
43
44
45
46
	m_markerTables[DART_ORBIT] = &amv ;
}

/****************************************
 *   EMBEDDING ATTRIBUTES MANAGEMENT    *
 ****************************************/

void AttribMap::addEmbedding(unsigned int orbit)
{
	std::ostringstream oss;
	oss << "EMB_" << orbit;

47
	AttributeContainer& dartCont = m_attribs[DART_ORBIT] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
48
	unsigned int index = dartCont.addAttribute<unsigned int>(oss.str()) ;
49
	AttributeMultiVector<unsigned int>& amv = dartCont.getDataVector<unsigned int>(index) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
50
51
52
53
54
55
	m_embeddings[orbit] = &amv ;

	// 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 ;

56
	AttributeContainer& cellCont = m_attribs[orbit] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
57
	unsigned int mark_index = cellCont.addAttribute<Mark>("Mark") ;
58
	AttributeMultiVector<Mark>& amvMark = cellCont.getDataVector<Mark>(mark_index) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
59
60
61
62
63
64
65
66
67
	m_markerTables[orbit] = &amvMark ;
}

/****************************************
 *               UTILITIES              *
 ****************************************/

unsigned int AttribMap::computeIndexCells(AttributeHandler<unsigned int>& idx)
{
68
	AttributeContainer& cont = m_attribs[AttributeContainer::orbitAttr(idx.id())] ;
Pierre Kraemer's avatar
Pierre Kraemer committed
69
70
71
72
73
74
75
76
77
	unsigned int cpt = 0 ;
	for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
	{
		idx[i] = cpt++ ;
	}
	return cpt ;
}

} // namespace CGoGN