Commit aaf269c0 authored by Thery Sylvain's avatar Thery Sylvain

add and use DIMENSION static const def in maps

parent a77997e2
......@@ -110,7 +110,7 @@ void MyQT::createMap()
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{
CGoGNout << "Dart "<< d;
if (myMap.isBoundaryMarkedCurrent(d))
if (myMap.isBoundaryMarked<PFP::MAP::DIMENSION>(d))
CGoGNout << " is a boundary dart (implicitly added)"<< CGoGNendl;
else
{
......
......@@ -32,7 +32,8 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace IHM
{
......@@ -57,6 +58,8 @@ public:
~ImplicitHierarchicalMap() ;
static const unsigned int DIMENSION = 2 ;
void init() ;
/***************************************************
......@@ -239,7 +242,7 @@ public:
} ;
} //namespace IHM
} // Surface
} //namespace Algo
} //namespace CGoGN
......
......@@ -28,6 +28,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace IHM
{
......@@ -395,7 +398,7 @@ const T& AttributeHandler_IHM<T, ORBIT>::operator[](Dart d) const
}
} //namespace IHM
} // Surface
} //namespace Algo
} //namespace CGoGN
......@@ -33,6 +33,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace IHM
{
......@@ -66,6 +69,7 @@ public:
~ImplicitHierarchicalMap3() ;
static const unsigned int DIMENSION = 3 ;
//!
/*!
......@@ -410,16 +414,16 @@ public:
} ;
template <typename T>
class VertexAttribute_IHM : public Algo::IHM::AttributeHandler_IHM<T, VERTEX>
class VertexAttribute_IHM : public IHM::AttributeHandler_IHM<T, VERTEX>
{
public:
VertexAttribute_IHM() : Algo::IHM::AttributeHandler_IHM<T, VERTEX>() {}
VertexAttribute_IHM(const Algo::IHM::AttributeHandler_IHM<T, VERTEX>& ah) : Algo::IHM::AttributeHandler_IHM<T, VERTEX>(ah) {}
VertexAttribute_IHM<T>& operator=(const Algo::IHM::AttributeHandler_IHM<T, VERTEX>& ah) { this->Algo::IHM::AttributeHandler_IHM<T, VERTEX>::operator=(ah); return *this; }
VertexAttribute_IHM() : IHM::AttributeHandler_IHM<T, VERTEX>() {}
VertexAttribute_IHM(const IHM::AttributeHandler_IHM<T, VERTEX>& ah) : IHM::AttributeHandler_IHM<T, VERTEX>(ah) {}
VertexAttribute_IHM<T>& operator=(const IHM::AttributeHandler_IHM<T, VERTEX>& ah) { this->IHM::AttributeHandler_IHM<T, VERTEX>::operator=(ah); return *this; }
};
} //namespace IHM
} // Volume
} //namespace Algo
} //namespace CGoGN
......
......@@ -28,6 +28,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace IHM
{
......@@ -662,7 +665,6 @@ const T& AttributeHandler_IHM<T, ORBIT>::operator[](Dart d) const
}
} //namespace IHM
} // Volume
} //namespace Algo
} //namespace CGoGN
......@@ -31,6 +31,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace IHM
{
......@@ -47,9 +50,8 @@ template <typename PFP>
void coarsenFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position) ;
} //namespace IHM
} // Surface
} //namespace Algo
} //namespace CGoGN
#include "Algo/ImplicitHierarchicalMesh/subdivision.hpp"
......
......@@ -28,6 +28,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace IHM
{
......@@ -77,7 +80,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
++degree ;
p += position[it] ;
if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
it = map.phi1(it) ;
} while(it != old) ;
p /= typename PFP::REAL(degree) ;
......@@ -204,7 +207,6 @@ void coarsenFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::V
}
} //namespace IHM
} // Surface
} //namespace Algo
} //namespace CGoGN
......@@ -32,6 +32,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace IHM
{
......@@ -94,9 +97,8 @@ void splitVolume(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::
} //namespace IHM
} // Volume
} //namespace Algo
} //namespace CGoGN
#include "Algo/ImplicitHierarchicalMesh/subdivision3.hpp"
......
......@@ -32,6 +32,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace IHM
{
......@@ -91,7 +94,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
// //std::cout << "vLevel courant = " << map.volumeLevel(oldit) << std::endl;
//
// if(((vLevel+1) - map.volumeLevel(oldit)) > 1)
// Algo::IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// }
unsigned int degree = 0 ;
......@@ -104,7 +107,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
p += position[it] ;
if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
}
p /= typename PFP::REAL(degree) ;
......@@ -113,7 +116,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
Dart res;
if(degree == 3 && sType == Algo::IHM::S_TRI) //subdiviser une face triangulaire
if(degree == 3 && sType == IHM::S_TRI) //subdiviser une face triangulaire
{
Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ;
......@@ -206,7 +209,7 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, AttributeHandler<typ
// {
// Dart oldit = map.volumeOldestDart(dit);
// if(((vLevel+1) - map.volumeLevel(oldit)) > 1)
// Algo::IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// }
/*
......@@ -277,7 +280,7 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, AttributeHandler<typ
//if needed subdivide face
if(!map.faceIsSubdivided(d))
Algo::IHM::subdivideFace<PFP>(map, d, position, Algo::IHM::S_QUAD);
IHM::subdivideFace<PFP>(map, d, position, IHM::S_QUAD);
//save a dart from the subdivided face
unsigned int cur = map.getCurrentLevel() ;
......@@ -471,7 +474,7 @@ void coarsenFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::
do
{
if(map.edgeCanBeCoarsened(fit))
Algo::IHM::coarsenEdge<PFP>(map, fit, position) ;
IHM::coarsenEdge<PFP>(map, fit, position) ;
fit = map.phi1(fit) ;
} while(fit != d) ;
}
......@@ -499,7 +502,7 @@ void coarsenVolume(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
for(Dart dit = trav3WF.begin() ; dit != trav3WF.end() ; dit = trav3WF.next())
{
if(map.faceCanBeCoarsened(dit))
Algo::IHM::coarsenFace<PFP>(map, dit, position, Algo::IHM::S_QUAD);
IHM::coarsenFace<PFP>(map, dit, position, IHM::S_QUAD);
}
}
......@@ -550,7 +553,7 @@ Dart subdivideVolumeClassic2(typename PFP::MAP& map, Dart d, AttributeHandler<ty
{
//if needed subdivide face
if(!map.faceIsSubdivided(dit))
Algo::IHM::subdivideFace<PFP>(map, dit, position, Algo::IHM::S_QUAD);
IHM::subdivideFace<PFP>(map, dit, position, IHM::S_QUAD);
//save darts from the central vertex of each subdivided face
unsigned int cur = map.getCurrentLevel() ;
......@@ -682,7 +685,7 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
{
//if needed subdivide face
if(!map.faceIsSubdivided(dit))
Algo::IHM::subdivideFace<PFP>(map, dit, position, Algo::IHM::S_TRI);
IHM::subdivideFace<PFP>(map, dit, position, IHM::S_TRI);
//save a dart from the subdivided face
unsigned int cur = map.getCurrentLevel() ;
......@@ -928,7 +931,7 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, AttributeHandler<typename P
//if needed subdivide face
if(!map.faceIsSubdivided(d))
Algo::IHM::subdivideFace<PFP>(map, d, position);
IHM::subdivideFace<PFP>(map, d, position);
//save a dart from the subdivided face
......@@ -1490,7 +1493,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, AttributeHandler<typenam
//if needed subdivide face
if(!map.faceIsSubdivided(d))
Algo::IHM::subdivideFace<PFP>(map, d, position);
IHM::subdivideFace<PFP>(map, d, position);
//save a dart from the subdivided face
......@@ -1885,7 +1888,7 @@ void splitVolume(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::
do
{
if(!map.edgeIsSubdivided(map.phi1(map.phi2(t))))
Algo::IHM::subdivideEdge<PFP>(map, map.phi1(map.phi2(t)), position) ;
IHM::subdivideEdge<PFP>(map, map.phi1(map.phi2(t)), position) ;
t = map.phi1(t);
}
while(t != d);
......@@ -1940,9 +1943,8 @@ void splitVolume(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::
}
} //namespace IHM
} //Volume
} //namespace Algo
} //namespace CGoGN
......
......@@ -134,7 +134,6 @@ Dart createPrism(typename PFP::MAP& map, unsigned int n)
template <typename PFP>
Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides)
{
Dart dres = Dart::nil();
std::vector<Dart> m_tableVertDarts;
......
......@@ -446,7 +446,7 @@ void swapGen3To2(typename PFP::MAP& map, Dart d)
template <typename PFP>
void swapGen2To3(typename PFP::MAP& map, Dart d)
{
unsigned int n = map.edgeDegree(d);
// unsigned int n = map.edgeDegree(d);
//- a single 2-3 swap, followed by n − 3 3-2 swaps, or
//- a single 4-4 swap, followed by n − 4 3-2 swaps.
......
......@@ -204,7 +204,7 @@ void foreach_cell(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& funcs, bool n
unsigned int nb = 0;
while ((d != map.end()) && (nb < nbth*SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!cmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!cmark->isMarked(d)))
{
cmark->mark(d);
vd[nb%nbth].push_back(d);
......@@ -220,7 +220,7 @@ void foreach_cell(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& funcs, bool n
unsigned int nb = 0;
while ((d != map.end()) && (nb < nbth*SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!dmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!dmark->isMarked(d)))
{
dmark->markOrbit<ORBIT>(d);
vd[nb%nbth].push_back(d);
......@@ -292,7 +292,7 @@ void foreach_cell(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& funcs, bool n
unsigned int nb = 0;
while ((d != map.end()) && (nb < nbth*SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!cmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!cmark->isMarked(d)))
{
cmark->mark(d);
tempo[nb%nbth].push_back(d);
......@@ -315,7 +315,7 @@ void foreach_cell(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& funcs, bool n
unsigned int nb = 0;
while ((d != map.end()) && (nb < nbth*SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!dmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!dmark->isMarked(d)))
{
dmark->markOrbit<ORBIT>(d);
tempo[nb%nbth].push_back(d);
......@@ -704,7 +704,7 @@ void foreach_cell_all_thread(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& fu
unsigned int nb=0;
while ((d != map.end()) && (nb < SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!cmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!cmark->isMarked(d)))
{
cmark->mark(d);
vd.push_back(d);
......@@ -720,7 +720,7 @@ void foreach_cell_all_thread(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& fu
unsigned int nb=0;
while ((d != map.end()) && (nb < SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!dmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!dmark->isMarked(d)))
{
dmark->markOrbit<ORBIT>(d);
vd.push_back(d);
......@@ -778,7 +778,7 @@ void foreach_cell_all_thread(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& fu
unsigned int nb=0;
while ((d != map.end()) && (nb < SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!cmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!cmark->isMarked(d)))
{
cmark->mark(d);
tempo.push_back(d);
......@@ -799,7 +799,7 @@ void foreach_cell_all_thread(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& fu
unsigned int nb=0;
while ((d != map.end()) && (nb < SIZE_BUFFER_THREAD) )
{
if (good(d) && (!map.isBoundaryMarkedCurrent(d)) && (!dmark->isMarked(d)))
if (good(d) && (!map.template isBoundaryMarked<MAP::DIMENSION>(d)) && (!dmark->isMarked(d)))
{
dmark->markOrbit<ORBIT>(d);
tempo.push_back(d);
......
......@@ -336,7 +336,7 @@ void MapRender::initTrianglesOptimized(typename PFP::MAP& map, const FunctorSele
{
std::list<Dart> bound;
if (good(dd) && !map.isBoundaryMarkedCurrent(dd))
if (good(dd) && !map.template isBoundaryMarked<PFP::MAP::DIMENSION>(dd))
{
if(position == NULL)
addTri<PFP>(map, dd, tableIndices);
......@@ -362,7 +362,7 @@ void MapRender::initTrianglesOptimized(typename PFP::MAP& map, const FunctorSele
{
if (!m.isMarked(f))
{
if (good(f) && !map.isBoundaryMarkedCurrent(f))
if (good(f) && !map.template isBoundaryMarked<PFP::MAP::DIMENSION>(f))
{
if(position == NULL)
addTri<PFP>(map, f, tableIndices);
......
......@@ -157,7 +157,7 @@ protected:
MAP& m_map;
public:
SelectorDartBoundary(MAP& m): m_map(m) {}
bool operator()(Dart d) const { return m_map.isBoundaryMarkedCurrent(d); }
bool operator()(Dart d) const { return m_map.template isBoundaryMarked<MAP::DIMENSION>(d); }
FunctorSelect* copy() const { return new SelectorDartBoundary(m_map);}
};
......@@ -173,7 +173,7 @@ protected:
MAP& m_map;
public:
SelectorDartNoBoundary(MAP& m): m_map(m) {}
bool operator()(Dart d) const { return !m_map.isBoundaryMarkedCurrent(d); }
bool operator()(Dart d) const { return !m_map.template isBoundaryMarked<MAP::DIMENSION>(d); }
FunctorSelect* copy() const { return new SelectorDartNoBoundary(m_map);}
};
......@@ -378,7 +378,7 @@ public:
FunctorStoreNotBoundary(MAP& map, std::vector<Dart>& vec) : FunctorMap<MAP>(map), m_vec(vec) {}
bool operator()(Dart d)
{
if (!this->m_map.isBoundaryMarkedCurrent(d))
if (!this->m_map.template isBoundaryMarked<MAP::DIMENSION>(d))
m_vec.push_back(d);
return false;
}
......
......@@ -168,6 +168,7 @@ public:
virtual unsigned int dimension() const = 0 ;
static const unsigned int DIMENSION = 0 ;
/**
* Clear the map
* @param removeAttrib
......@@ -740,7 +741,6 @@ public:
bool isBoundaryMarked2(Dart d) const ;
bool isBoundaryMarked3(Dart d) const ;
bool isBoundaryMarkedCurrent(Dart d) const ;
protected:
/**
......
......@@ -704,12 +704,6 @@ inline bool GenericMap::isBoundaryMarked(Dart d) const
return m_markTables[DART][0]->operator[](dartIndex(d)).testMark(m_boundaryMarkers[D-2]);
}
inline bool GenericMap::isBoundaryMarkedCurrent(Dart d) const
{
return m_markTables[DART][0]->operator[](dartIndex(d)).testMark(m_boundaryMarkers[this->dimension()-2]);
}
inline void GenericMap::boundaryMark2(Dart d)
{
......
......@@ -76,7 +76,7 @@ Dart TraversorCell<MAP, ORBIT>::begin()
}
current = m.begin() ;
while(current != m.end() && (m.isBoundaryMarkedCurrent(current) || !m_good(current)))
while(current != m.end() && (m.template isBoundaryMarked<MAP::DIMENSION>(current) || !m_good(current)))
m.next(current) ;
if(current == m.end())
......@@ -116,7 +116,7 @@ Dart TraversorCell<MAP, ORBIT>::next()
if(dmark)
{
bool ismarked = dmark->isMarked(current) ;
while(current != NIL && (ismarked || m.isBoundaryMarkedCurrent(current) || !m_good(current)))
while(current != NIL && (ismarked || m.template isBoundaryMarked<MAP::DIMENSION>(current) || !m_good(current)))
{
m.next(current) ;
if(current == m.end())
......@@ -130,7 +130,7 @@ Dart TraversorCell<MAP, ORBIT>::next()
else
{
bool ismarked = cmark->isMarked(current) ;
while(current != NIL && (ismarked || m.isBoundaryMarkedCurrent(current) || !m_good(current)))
while(current != NIL && (ismarked || m.template isBoundaryMarked<MAP::DIMENSION>(current) || !m_good(current)))
{
m.next(current) ;
if(current == m.end())
......
......@@ -39,6 +39,8 @@ class EmbeddedGMap2 : public GMap2
public:
typedef GMap2 TOPO_MAP;
static const unsigned int DIMENSION = 2 ;
/**
* create a new face with managed embeddings
*/
......
......@@ -39,6 +39,8 @@ class EmbeddedGMap3 : public GMap3
public:
typedef GMap3 TOPO_MAP;
static const unsigned int DIMENSION = 3 ;
/*!
*
*/
......
......@@ -45,6 +45,7 @@ protected:
public:
GMap0();
static const unsigned int DIMENSION = 0 ;
virtual std::string mapTypeName() const;
......
......@@ -43,6 +43,10 @@ protected:
public:
typedef GMap0 ParentMap;
static const unsigned int DIMENSION = 1 ;
GMap1();
virtual std::string mapTypeName() const;
......
......@@ -50,6 +50,8 @@ public:
static const unsigned int VERTEX_OF_PARENT = VERTEX+5;
static const unsigned int EDGE_OF_PARENT = EDGE+5;
static const unsigned int DIMENSION = 2 ;
GMap2();
virtual std::string mapTypeName() const;
......
......@@ -56,6 +56,9 @@ public:
static const unsigned int VERTEX_OF_PARENT2 = VERTEX+5;
static const unsigned int EDGE_OF_PARENT2 = EDGE+5;
static const unsigned int DIMENSION = 3 ;
// enum { DIMENSION = 3 } ;
GMap3();
virtual std::string mapTypeName() const;
......
......@@ -39,6 +39,8 @@ class EmbeddedMap2 : public Map2
public:
typedef Map2 TOPO_MAP;
static const unsigned int DIMENSION = 2 ;
/*
*
*/
......
......@@ -37,6 +37,10 @@ class EmbeddedMap3 : public Map3
public:
typedef Map3 TOPO_MAP;
static const unsigned int DIMENSION = 3 ;
//!
/*!
*
......
......@@ -51,6 +51,8 @@ protected:
public:
Map1();
static const unsigned int DIMENSION = 1 ;
virtual std::string mapTypeName() const;
virtual unsigned int dimension() const;
......
......@@ -58,6 +58,7 @@ public:
inline static unsigned int ORBIT_IN_PARENT(unsigned int o) { return o+5; }
static const unsigned int IN_PARENT = 5 ;
static const unsigned int DIMENSION = 2 ;
static const unsigned int VERTEX_OF_PARENT = VERTEX+5;
static const unsigned int EDGE_OF_PARENT = EDGE+5;
......
......@@ -70,6 +70,10 @@ public:
static const unsigned int VERTEX_OF_PARENT2 = VERTEX+5;
static const unsigned int EDGE_OF_PARENT2 = EDGE+5;
static const unsigned int DIMENSION = 3 ;
Map3();
virtual std::string mapTypeName() const;
......
......@@ -31,6 +31,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace IHM
{
......@@ -297,7 +300,6 @@ bool ImplicitHierarchicalMap::faceIsSubdividedOnce(Dart d)
}
} //namespace IHM
} // Surface