Commit ba596b91 authored by Pierre Kraemer's avatar Pierre Kraemer

start template the ORBIT parameter

parent 04072a3b
......@@ -877,8 +877,8 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
MAP& m = this->m_map ;
Dart dd = m.phi2(d) ;
unsigned int v1 = m.getEmbedding(VERTEX, d) ;
unsigned int v2 = m.getEmbedding(VERTEX, dd) ;
unsigned int v1 = m.getEmbedding<VERTEX>(d) ;
unsigned int v2 = m.getEmbedding<VERTEX>(dd) ;
m_positionApproximator->approximate(d) ;
......
......@@ -220,8 +220,8 @@ void Approximator_MidEdge<PFP>::approximate(Dart d)
// vertex split to reset the initial connectivity and embeddings
m.insertTrianglePair(d, d2, dd2) ;
m.embedOrbit(VERTEX, d, m.getEmbedding(VERTEX, d)) ;
m.embedOrbit(VERTEX, dd, m.getEmbedding(VERTEX, dd)) ;
m.embedOrbit(VERTEX, d, m.getEmbedding<VERTEX>(d)) ;
m.embedOrbit(VERTEX, dd, m.getEmbedding<VERTEX>(dd)) ;
}
}
......@@ -268,8 +268,8 @@ void Approximator_HalfCollapse<PFP>::approximate(Dart d)
// vertex split to reset the initial connectivity and embeddings
m.insertTrianglePair(d, d2, dd2) ;
m.embedOrbit(VERTEX, d, m.getEmbedding(VERTEX, d)) ;
m.embedOrbit(VERTEX, dd, m.getEmbedding(VERTEX, dd)) ;
m.embedOrbit(VERTEX, d, m.getEmbedding<VERTEX>(d)) ;
m.embedOrbit(VERTEX, dd, m.getEmbedding<VERTEX>(dd)) ;
}
}
......
......@@ -78,7 +78,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
++degree ;
unsigned int vNum = map.getEmbedding(VERTEX, it) ;
unsigned int vNum = map.getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it))
{
markV.mark(it) ;
......@@ -205,7 +205,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
++degree ;
unsigned int vNum = map.getEmbedding(VERTEX, it) ;
unsigned int vNum = map.getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it))
{
markV.mark(it) ;
......@@ -353,7 +353,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
++degree ;
unsigned int vNum = map.getEmbedding(VERTEX, it) ;
unsigned int vNum = map.getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it))
{
markV.mark(it) ;
......@@ -427,7 +427,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
{
markV.mark(it);
tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding(VERTEX, it));
vertices.push_back(map.getEmbedding<VERTEX>(it));
}
face.push_back(tableVertLab[it]);
}
......@@ -569,7 +569,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
{
markV.mark(it);
tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding(VERTEX, it));
vertices.push_back(map.getEmbedding<VERTEX>(it));
}
face.push_back(tableVertLab[it]);
}
......@@ -702,7 +702,7 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p
{
markV.mark(it);
tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding(VERTEX, it));
vertices.push_back(map.getEmbedding<VERTEX>(it));
}
face.push_back(tableVertLab[it]);
}
......@@ -842,7 +842,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
{
markV.mark(it);
tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding(VERTEX, it));
vertices.push_back(map.getEmbedding<VERTEX>(it));
}
face.push_back(tableVertLab[it]);
}
......
......@@ -115,7 +115,7 @@ void export3MeshPlainSmooth(std::ofstream& out, typename PFP::MAP& map, typename
Dart dd = d ;
do
{
unsigned int vNum = map.getEmbedding(VERTEX, dd) ;
unsigned int vNum = map.getEmbedding<VERTEX>(dd) ;
if(!markV.isMarked(dd))
{
markV.mark(dd) ;
......
......@@ -690,7 +690,7 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
}while(f != x);
}
map.embedOrbit(VERTEX, centralDart, map.getEmbedding(VERTEX, centralDart));
map.embedOrbit(VERTEX, centralDart, map.getEmbedding<VERTEX>(centralDart));
//Third step : 3-sew internal faces
for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
......@@ -1435,7 +1435,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
//
// if(map.phi3(map.phi2(f1)) == map.phi2(f1) && map.phi3(map.phi2(f2)) == map.phi2(f2))
// {
// if(map.getEmbedding(VERTEX, map.phi_1(map.phi2(f2))) == map.getEmbedding(VERTEX, map.phi_1(map.phi2(f1))))
// if(map.getEmbedding<VERTEX>(map.phi_1(map.phi2(f2))) == map.getEmbedding<VERTEX>(map.phi_1(map.phi2(f1))))
// {
// map.Map3::sewVolumes(map.phi2(f2), map.phi2(f1));
// }
......
......@@ -90,11 +90,11 @@ public:
do
{
Dart next = map.phi1(it) ;
unsigned int emb = map.getEmbedding(VERTEX, it) ;
unsigned int emb = map.getEmbedding<VERTEX>(it) ;
unsigned int idx = emb == v0 ? 0 : emb == v1 ? 1 : 2 ;
map.incCurrentLevel() ;
Dart dd = map.phi1(next) ;
unsigned int oldEmb = map.getEmbedding(VERTEX, dd) ;
unsigned int oldEmb = map.getEmbedding<VERTEX>(dd) ;
unsigned int newEmb = vID[children[0]->indices[idx]] ;
if(oldEmb == EMBNULL)
{
......@@ -120,7 +120,7 @@ public:
do
{
unsigned int emb = map.getEmbedding(VERTEX, it) ;
unsigned int emb = map.getEmbedding<VERTEX>(it) ;
unsigned int idx = emb == v0 ? 0 : emb == v1 ? 1 : 2 ;
map.incCurrentLevel() ;
children[idx+1]->embed<PFP>(map, it, vID) ;
......
......@@ -223,11 +223,11 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
// darts incident to end vertex of edge
std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)] ;
unsigned int embd = map.getEmbedding(VERTEX, d) ;
unsigned int embd = map.getEmbedding<VERTEX>(d) ;
Dart good_dart = NIL ;
for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if (map.getEmbedding(VERTEX, map.phi1(*it)) == embd)
if (map.getEmbedding<VERTEX>(map.phi1(*it)) == embd)
good_dart = *it ;
}
......
......@@ -98,11 +98,11 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
// darts incident to end vertex of edge
std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)];
unsigned int embd = map.getEmbedding(VERTEX, d);
unsigned int embd = map.getEmbedding<VERTEX>(d);
Dart good_dart = NIL;
for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if (map.getEmbedding(VERTEX, map.phi1(*it)) == embd)
if (map.getEmbedding<VERTEX>(map.phi1(*it)) == embd)
good_dart = *it;
}
......@@ -212,11 +212,11 @@ bool importMeshSToV(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts, float d
// darts incident to end vertex of edge
std::vector<Dart>& vec = vecDartsPerVertex[map.phi1(d)];
unsigned int embd = map.getEmbedding(VERTEX, d);
unsigned int embd = map.getEmbedding<VERTEX>(d);
Dart good_dart = NIL;
for (typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if (map.getEmbedding(VERTEX, map.phi1(*it)) == embd)
if (map.getEmbedding<VERTEX>(map.phi1(*it)) == embd)
good_dart = *it;
}
......
......@@ -210,9 +210,9 @@ bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenam
Dart good_dart = NIL;
for(typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if(map.getEmbedding(VERTEX, map.phi1(*it)) == map.getEmbedding(VERTEX, d) &&
map.getEmbedding(VERTEX, map.phi_1(*it)) == map.getEmbedding(VERTEX, map.phi_1(d)) /*&&
map.getEmbedding(VERTEX, *it) == map.getEmbedding(VERTEX, map.phi1(d)) */)
if(map.getEmbedding<VERTEX>(map.phi1(*it)) == map.getEmbedding<VERTEX>(d) &&
map.getEmbedding<VERTEX>(map.phi_1(*it)) == map.getEmbedding<VERTEX>(map.phi_1(d)) /*&&
map.getEmbedding<VERTEX>(*it) == map.getEmbedding<VERTEX>(map.phi1(d)) */)
{
good_dart = *it ;
}
......
......@@ -205,9 +205,9 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename
Dart good_dart = NIL;
for(typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if(map.getEmbedding(VERTEX, map.phi1(*it)) == map.getEmbedding(VERTEX, d) &&
map.getEmbedding(VERTEX, map.phi_1(*it)) == map.getEmbedding(VERTEX, map.phi_1(d)) /*&&
map.getEmbedding(VERTEX, *it) == map.getEmbedding(VERTEX, map.phi1(d)) */)
if(map.getEmbedding<VERTEX>(map.phi1(*it)) == map.getEmbedding<VERTEX>(d) &&
map.getEmbedding<VERTEX>(map.phi_1(*it)) == map.getEmbedding<VERTEX>(map.phi_1(d)) /*&&
map.getEmbedding<VERTEX>(*it) == map.getEmbedding<VERTEX>(map.phi1(d)) */)
{
good_dart = *it ;
}
......
......@@ -174,9 +174,9 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
Dart good_dart = NIL;
for(typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if(map.getEmbedding(VERTEX, map.phi1(*it)) == map.getEmbedding(VERTEX, d) &&
map.getEmbedding(VERTEX, map.phi_1(*it)) == map.getEmbedding(VERTEX, map.phi_1(d)) /*&&
map.getEmbedding(VERTEX, *it) == map.getEmbedding(VERTEX, map.phi1(d)) */)
if(map.getEmbedding<VERTEX>(map.phi1(*it)) == map.getEmbedding<VERTEX>(d) &&
map.getEmbedding<VERTEX>(map.phi_1(*it)) == map.getEmbedding<VERTEX>(map.phi_1(d)) /*&&
map.getEmbedding<VERTEX>(*it) == map.getEmbedding<VERTEX>(map.phi1(d)) */)
{
good_dart = *it ;
}
......
......@@ -181,9 +181,9 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
Dart good_dart = NIL;
for(typename std::vector<Dart>::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it)
{
if(map.getEmbedding(VERTEX, map.phi1(*it)) == map.getEmbedding(VERTEX, d) &&
map.getEmbedding(VERTEX, map.phi_1(*it)) == map.getEmbedding(VERTEX, map.phi_1(d)) /*&&
map.getEmbedding(VERTEX, *it) == map.getEmbedding(VERTEX, map.phi1(d)) */)
if(map.getEmbedding<VERTEX>(map.phi1(*it)) == map.getEmbedding<VERTEX>(d) &&
map.getEmbedding<VERTEX>(map.phi_1(*it)) == map.getEmbedding<VERTEX>(map.phi_1(d)) /*&&
map.getEmbedding<VERTEX>(*it) == map.getEmbedding<VERTEX>(map.phi1(d)) */)
{
good_dart = *it ;
}
......
......@@ -450,7 +450,7 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
// if(phi3(f1) == f1 && phi3(f2) == f2)
// sewVolumes(f1, f2, false);
// }
// embedOrbit(VERTEX, centralDart, getEmbedding(VERTEX, centralDart));
// embedOrbit(VERTEX, centralDart, getEmbedding<VERTEX>(centralDart));
//attributs[map.phi1(ne)] = attBary[*it];
//
// setCurrentLevel(getMaxLevel() - 1) ;
......@@ -461,13 +461,13 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
// TraversorE<typename PFP::MAP> travE2(map);
// for (Dart d = travE2.begin(); d != travE2.end(); d = travE2.next())
// {
// map.embedOrbit(VERTEX, map.phi1(d), map.getEmbedding(VERTEX, map.phi1(d)));
// map.embedOrbit(VERTEX, map.phi1(d), map.getEmbedding<VERTEX>(map.phi1(d)));
// }
//
// TraversorF<typename PFP::MAP> travF2(map) ;
// for (Dart d = travF2.begin(); d != travF2.end(); d = travF2.next())
// {
// map.embedOrbit(VERTEX, map.phi2(map.phi1(d)), map.getEmbedding(VERTEX, map.phi2(map.phi1(d))));
// map.embedOrbit(VERTEX, map.phi2(map.phi1(d)), map.getEmbedding<VERTEX>(map.phi2(map.phi1(d))));
// }
......
......@@ -98,8 +98,8 @@ Dart linkIntoEdge(typename PFP::MAP& map, Dart d, Dart e)
map.sewFaces(e2,d3);
map.sewFaces(e,d);
map.setDartEmbedding(VERTEX, d, map.getEmbedding(VERTEX, e2)) ;
map.setDartEmbedding(VERTEX, d3, map.getEmbedding(VERTEX, e)) ;
map.setDartEmbedding(VERTEX, d, map.getEmbedding<VERTEX>(e2)) ;
map.setDartEmbedding(VERTEX, d3, map.getEmbedding<VERTEX>(e)) ;
return e2;
}
......@@ -115,14 +115,14 @@ void unlinkFromEdge(typename PFP::MAP& map, Dart d)
// //Si la face n'est pas libre en phi2
// if(map.phi2(d) != d && map.phi2(d3) != d3)
// {
// unsigned int dVEmb = map.getEmbedding(VERTEX, d) ;
// unsigned int dVEmb = map.getEmbedding<VERTEX>(d) ;
// if(dVEmb != EMBNULL)
// {
// map.embedOrbit(VERTEX, d, dVEmb) ;
// map.setDartEmbedding(VERTEX, d, EMBNULL) ;
// }
//
// unsigned int d3VEmb = map.getEmbedding(VERTEX, d3) ;
// unsigned int d3VEmb = map.getEmbedding<VERTEX>(d3) ;
// if(d3VEmb != EMBNULL)
// {
// map.embedOrbit(VERTEX, d3, d3VEmb) ;
......@@ -169,8 +169,8 @@ void insertFace(typename PFP::MAP& map, Dart d, Dart nF)
map.sewFaces(dd,nFd);
map.sewFaces(d2,map.phi3(nFd));
map.setDartEmbedding(VERTEX, nFd, map.getEmbedding(VERTEX, d2)) ;
map.setDartEmbedding(VERTEX, map.phi3(nFd), map.getEmbedding(VERTEX, dd)) ;
map.setDartEmbedding(VERTEX, nFd, map.getEmbedding<VERTEX>(d2)) ;
map.setDartEmbedding(VERTEX, map.phi3(nFd), map.getEmbedding<VERTEX>(dd)) ;
dd = map.phi_1(map.phi2(map.phi_1(dd)));
nFd = map.phi1(nFd);
......@@ -196,14 +196,14 @@ void swap2To2(typename PFP::MAP& map, Dart d)
map.flipEdge(r);
Dart e = map.phi2(r);
unsigned int dVEmb = map.getEmbedding(VERTEX, r) ;
unsigned int dVEmb = map.getEmbedding<VERTEX>(r) ;
if(dVEmb != EMBNULL)
{
map.setDartEmbedding(VERTEX, map.phi_1(r), dVEmb) ;
map.setDartEmbedding(VERTEX, r, EMBNULL) ;
}
unsigned int eVEmb = map.getEmbedding(VERTEX, e) ;
unsigned int eVEmb = map.getEmbedding<VERTEX>(e) ;
if(eVEmb != EMBNULL)
{
map.setDartEmbedding(VERTEX, map.phi_1(e), eVEmb) ;
......@@ -218,8 +218,8 @@ void swap2To2(typename PFP::MAP& map, Dart d)
Dart e = map.phi2(dd);
Dart e2= map.phi2(map.phi3(dd));
map.setDartEmbedding(VERTEX, dd, map.getEmbedding(VERTEX, e2)) ;
map.setDartEmbedding(VERTEX, map.phi3(dd), map.getEmbedding(VERTEX, e)) ;
map.setDartEmbedding(VERTEX, dd, map.getEmbedding<VERTEX>(e2)) ;
map.setDartEmbedding(VERTEX, map.phi3(dd), map.getEmbedding<VERTEX>(e)) ;
dd = map.phi1(dd);
......@@ -305,8 +305,8 @@ void swap3To2(typename PFP::MAP& map, Dart d)
do {
Dart e = map.phi2(map.phi3(map.phi2(dd)));
unsigned int eVEmb = map.getEmbedding(VERTEX, e) ;
unsigned int ddVEmb = map.getEmbedding(VERTEX, dd) ;
unsigned int eVEmb = map.getEmbedding<VERTEX>(e) ;
unsigned int ddVEmb = map.getEmbedding<VERTEX>(dd) ;
map.setDartEmbedding(VERTEX, map.phi2(dd), eVEmb) ;
map.setDartEmbedding(VERTEX, map.phi2(e), ddVEmb) ;
......@@ -323,8 +323,8 @@ Dart swap2To3(typename PFP::MAP& map, Dart d)
{
Dart e = map.phi1(map.phi2(map.phi3(d)));
unsigned int p1 = map.getEmbedding(VERTEX, map.phi_1(map.phi2(d))) ;
unsigned int p2 = map.getEmbedding(VERTEX, map.phi2(map.phi1(map.phi2(map.phi3(d))))) ;
unsigned int p1 = map.getEmbedding<VERTEX>(map.phi_1(map.phi2(d))) ;
unsigned int p2 = map.getEmbedding<VERTEX>(map.phi2(map.phi1(map.phi2(map.phi3(d))))) ;
//détachement des demi-faces du milieu
//garde la relation volumique qui les lies
......
......@@ -258,8 +258,8 @@ void ProgressiveMesh<PFP>::refine()
Dart d1 = m_map.phi2(d2) ;
Dart dd1 = m_map.phi2(dd2) ;
unsigned int v1 = m_map.getEmbedding(VERTEX, d) ; // get the embedding
unsigned int v2 = m_map.getEmbedding(VERTEX, dd) ; // of the new vertices
unsigned int v1 = m_map.getEmbedding<VERTEX>(d) ; // get the embedding
unsigned int v2 = m_map.getEmbedding<VERTEX>(dd) ; // of the new vertices
unsigned int e1 = m_map.getEmbedding(EDGE, m_map.phi1(d)) ;
unsigned int e2 = m_map.getEmbedding(EDGE, m_map.phi_1(d)) ; // and new edges
unsigned int e3 = m_map.getEmbedding(EDGE, m_map.phi1(dd)) ;
......
......@@ -195,12 +195,12 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vector<GLu
Dart c = map.phi1(b);
do
{
typename PFP::VEC3 P1 = position[map.getEmbedding(VERTEX, a)];
typename PFP::VEC3 P2 = position[map.getEmbedding(VERTEX, b)];
typename PFP::VEC3 P3 = position[map.getEmbedding(VERTEX, c)];
typename PFP::VEC3 P1 = position[map.getEmbedding<VERTEX>(a)];
typename PFP::VEC3 P2 = position[map.getEmbedding<VERTEX>(b)];
typename PFP::VEC3 P3 = position[map.getEmbedding<VERTEX>(c)];
float val = computeEarAngle<PFP>(P1, P2, P3, normalPoly);
VertexPoly* vp = new VertexPoly(map.getEmbedding(VERTEX, b), val, (P3-P1).norm2(), vpp);
VertexPoly* vp = new VertexPoly(map.getEmbedding<VERTEX>(b), val, (P3-P1).norm2(), vpp);
if (vp->value < 5.0f)
nbe++;
......@@ -288,9 +288,9 @@ inline void MapRender::addTri(typename PFP::MAP& map, Dart d, std::vector<GLuint
// loop to cut a polygon in triangle on the fly (works only with convex faces)
do
{
tableIndices.push_back(map.getEmbedding(VERTEX, d));
tableIndices.push_back(map.getEmbedding(VERTEX, b));
tableIndices.push_back(map.getEmbedding(VERTEX, c));
tableIndices.push_back(map.getEmbedding<VERTEX>(d));
tableIndices.push_back(map.getEmbedding<VERTEX>(b));
tableIndices.push_back(map.getEmbedding<VERTEX>(c));
b = c;
c = map.phi1(b);
} while (c != d);
......@@ -404,8 +404,8 @@ void MapRender::initLines(typename PFP::MAP& map, const FunctorSelect& good, std
TraversorE<typename PFP::MAP> trav(map, good, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
tableIndices.push_back(map.getEmbedding(VERTEX, d));
tableIndices.push_back(map.getEmbedding(VERTEX, map.phi1(d)));
tableIndices.push_back(map.getEmbedding<VERTEX>(d));
tableIndices.push_back(map.getEmbedding<VERTEX>(map.phi1(d)));
}
}
......@@ -419,8 +419,8 @@ void MapRender::initBoundaries(typename PFP::MAP& map, const FunctorSelect& good
{
if (map.isBoundaryEdge(d))
{
tableIndices.push_back(map.getEmbedding(VERTEX, d));
tableIndices.push_back(map.getEmbedding(VERTEX, map.phi1(d)));
tableIndices.push_back(map.getEmbedding<VERTEX>(d));
tableIndices.push_back(map.getEmbedding<VERTEX>(map.phi1(d)));
}
}
}
......@@ -451,9 +451,9 @@ void MapRender::initLinesOptimized(typename PFP::MAP& map, const FunctorSelect&
if (!m.isMarked(ee))
{
if(good(ee))
tableIndices.push_back(map.getEmbedding(VERTEX, ee));
tableIndices.push_back(map.getEmbedding<VERTEX>(ee));
if(good(f))
tableIndices.push_back(map.getEmbedding(VERTEX, map.phi1(ee)));
tableIndices.push_back(map.getEmbedding<VERTEX>(map.phi1(ee)));
m.markOrbit(EDGE, f);
bound.push_back(f);
......@@ -481,7 +481,7 @@ void MapRender::initPoints(typename PFP::MAP& map, const FunctorSelect& good, st
TraversorV<typename PFP::MAP> trav(map, good, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
tableIndices.push_back(map.getEmbedding(VERTEX, d));
tableIndices.push_back(map.getEmbedding<VERTEX>(d));
}
template<typename PFP>
......
......@@ -34,7 +34,7 @@ namespace CGoGN
class AttribMap : public GenericMap
{
private:
template<typename T> friend class AutoAttributeHandler ;
template<typename T, unsigned int ORBIT> friend class AutoAttributeHandler ;
void init() ;
......@@ -52,41 +52,39 @@ public:
/**
* Create an attribute for a given orbit
* @param orbit
* @param nameAttr attribute name
* @return an AttributeHandler
*/
template <typename T>
AttributeHandler<T> addAttribute(unsigned int orbit, const std::string& nameAttr) ;
template <typename T, unsigned int ORBIT>
AttributeHandler<T, ORBIT> addAttribute(const std::string& nameAttr) ;
/**
* remove an attribute
* @param attr a handler to the attribute to remove
* @return true if remove succeed else false
*/
template <typename T>
bool removeAttribute(AttributeHandler<T>& attr) ;
template <typename T, unsigned int ORBIT>
bool removeAttribute(AttributeHandler<T, ORBIT>& attr) ;
/**
* search an attribute for a given orbit
* @param orbit
* @param nameAttr attribute name
* @return an AttributeHandler
*/
template <typename T>
AttributeHandler<T> getAttribute(unsigned int orbit, const std::string& nameAttr) ;
template <typename T, unsigned int ORBIT>
AttributeHandler<T, ORBIT> getAttribute(const std::string& nameAttr) ;
/**
* swap the content of two attributes (efficient, only swap pointers)
*/
template <typename T>
bool swapAttributes(AttributeHandler<T>& attr1, AttributeHandler<T>& attr2) ;
template <typename T, unsigned int ORBIT>
bool swapAttributes(AttributeHandler<T, ORBIT>& attr1, AttributeHandler<T, ORBIT>& attr2) ;
/**
* copy the content of src attribute to dst attribute
*/
template <typename T>
bool copyAttribute(AttributeHandler<T>& dst, AttributeHandler<T>& src) ;
template <typename T, unsigned int ORBIT>
bool copyAttribute(AttributeHandler<T, ORBIT>& dst, AttributeHandler<T, ORBIT>& src) ;
/**
* get the number of cell in the attribute container of an orbit
......@@ -104,12 +102,14 @@ public:
* use the given attribute to store the indices of the cells of the corresponding orbit
* @return the number of cells of the orbit
*/
unsigned int computeIndexCells(AttributeHandler<unsigned int>& idx) ;
template <unsigned int ORBIT>
unsigned int computeIndexCells(AttributeHandler<unsigned int, ORBIT>& idx) ;
/**
* ensure that each orbit as one embedding and that each embedding is handle by only one orbit
*/
void bijectiveOrbitEmbedding(unsigned int orbit);
template <unsigned int ORBIT>
void bijectiveOrbitEmbedding();
} ;
......
......@@ -25,17 +25,17 @@
namespace CGoGN
{
template <typename T>
inline AttributeHandler<T> AttribMap::addAttribute(unsigned int orbit, const std::string& nameAttr)
template <typename T, unsigned int ORBIT>
inline AttributeHandler<T, ORBIT> AttribMap::addAttribute(const std::string& nameAttr)
{
if(!isOrbitEmbedded(orbit))
addEmbedding(orbit) ;
AttributeMultiVector<T>* amv = m_attribs[orbit].addAttribute<T>(nameAttr) ;
return AttributeHandler<T>(this, amv) ;
if(!isOrbitEmbedded(ORBIT))
addEmbedding(ORBIT) ;
AttributeMultiVector<T>* amv = m_attribs[ORBIT].addAttribute<T>(nameAttr) ;
return AttributeHandler<T, ORBIT>(this, amv) ;
}
template <typename T>
inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr)
template <typename T, unsigned int ORBIT>
inline bool AttribMap::removeAttribute(AttributeHandler<T, ORBIT>& attr)
{
assert(attr.isValid() || !"Invalid attribute handler") ;
if(m_attribs[attr.getOrbit()].removeAttribute<T>(attr.getIndex()))
......@@ -50,36 +50,36 @@ inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr)
return false ;
}
template <typename T>
inline AttributeHandler<T> AttribMap::getAttribute(unsigned int orbit, const std::string& nameAttr)
template <typename T, unsigned int ORBIT>
inline AttributeHandler<T ,ORBIT> AttribMap::getAttribute(const std::string& nameAttr)
{
AttributeMultiVector<T>* amv = m_attribs[orbit].getDataVector<T>(nameAttr) ;
return AttributeHandler<T>(this, amv) ;
AttributeMultiVector<T>* amv = m_attribs[ORBIT].getDataVector<T>(nameAttr) ;
return AttributeHandler<T, ORBIT>(this, amv) ;
}
template <typename T>
inline bool AttribMap::swapAttributes(AttributeHandler<T>& attr1, AttributeHandler<T>& attr2)
template <typename T, unsigned int ORBIT>
inline bool AttribMap::swapAttributes(AttributeHandler<T, ORBIT>& attr1, AttributeHandler<T, ORBIT>& attr2)
{
assert((attr1.isValid() && attr2.isValid()) || !"Invalid attribute handler") ;
assert(attr1.getOrbit() == attr2.getOrbit() || !"Cannot swap attributes of different orbits") ;
unsigned int orbit = attr1.getOrbit() ;
// assert(attr1.getOrbit() == attr2.getOrbit() || !"Cannot swap attributes of different orbits") ;
// unsigned int orbit = attr1.getOrbit() ;
unsigned int index1 = attr1.getIndex() ;
unsigned int index2 = attr2.getIndex() ;
if(index1 != index2)
return m_attribs[orbit].swapAttributes(index1, index2) ;
return m_attribs[ORBIT].swapAttributes(index1, index2) ;
return false ;
}
template <typename T>
inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler<T>& src)
template <typename T, unsigned int ORBIT>
inline bool AttribMap::copyAttribute(AttributeHandler<T, ORBIT>& dst, AttributeHandler<T, ORBIT>& src)
{