Commit 781c9c5a authored by Lionel Untereiner's avatar Lionel Untereiner

modifs sur les IHM3 + correction attributs

parent 6e1d2b03
......@@ -407,7 +407,7 @@ int main(int argc, char **argv)
{
*/
if(extension == std::string(".map"))
if(extension == std::string(".mapbin"))
{
myMap.loadMapBin(filename);
position = myMap.getAttribute<VEC3, VERTEX,MAP>("position") ;
......
......@@ -78,7 +78,7 @@ IF(WIN32)
ELSE(WIN32)
find_package(SuiteSparse REQUIRED)
SET (COMMON_INCLUDES ${COMMON_INCLUDES} ${SUITESPARSE_INCLUDE_DIRS})
SET (COMMON_LIBS ${COMMON_LIBS} ${SUITESPARSE_LIBRARIES})
SET (COMMON_LIBS ${SUITESPARSE_LIBRARIES} lapack blas ${COMMON_LIBS})
ENDIF(WIN32)
......
......@@ -996,7 +996,7 @@ bool exportChoupi(typename PFP::MAP& map, const VertexAttribute<typename PFP::VE
return false ;
}
out << map.template getNbOrbits<VERTEX>() << " " << map.template getNbOrbits<EDGE>() << std::endl;
out << Algo::Topo::getNbOrbits<VERTEX>(map) << " " << Algo::Topo::getNbOrbits<EDGE>(map) << std::endl;
TraversorV<MAP> travV(map);
for(Dart dit = travV.begin() ; dit != travV.end() ; dit = travV.next())
......
......@@ -103,7 +103,7 @@ public:
EarTriangulation(MAP& map) : m_map(map), m_dartEars(map)
{
m_position = map.template getAttribute<VEC3, VERTEX>("position");
m_position = map.template getAttribute<VEC3, VERTEX, MAP>("position");
}
// void trianguleFace(Dart d, DartMarker& mark);
......
......@@ -351,8 +351,6 @@ unsigned int IHM2<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffere
unsigned int fLevel = faceLevel(d) ;
Dart old = faceOldestDart(d) ;
//std::cout << "faceLevel = " << fLevel << std::endl;
unsigned int cur = m_map.getCurrentLevel() ;
m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
......
......@@ -137,7 +137,7 @@ protected:
/***************************************************
* SUBDIVISION *
***************************************************/
public:
/**
* subdivide the edge of d to the next level
*/
......@@ -158,11 +158,11 @@ protected:
*/
void coarsenFace(Dart d) ;
public:
//! Subdivide the volume of d to hexahedral cells
/*! @param d Dart from the volume
*/
unsigned int subdivideVolume(Dart d, bool triQuad = true, bool OneLevelDifference = true);
Dart subdivideVolume(Dart d, bool triQuad = true, bool OneLevelDifference = true);
/*!
* \brief subdivideHexa
......@@ -179,6 +179,8 @@ public:
*/
void subdivideVolumeTetOcta(Dart d) ;
void coarsenVolume(Dart d) ;
/**
* vertices attributes management
*/
......@@ -201,6 +203,6 @@ public:
} // namespace CGoGN
#include "Algo/Multiresolution/IHM2/ihm2_PrimalAdapt.hpp"
#include "Algo/Multiresolution/IHM3/ihm3_PrimalAdapt.hpp"
#endif
......@@ -23,6 +23,7 @@
*******************************************************************************/
#include "Algo/Multiresolution/IHM3/ihm3_PrimalAdapt.h"
#include "Topology/generic/traversor/traversor2.h"
namespace CGoGN
{
......@@ -43,8 +44,8 @@ namespace Adaptive
{
template <typename PFP>
IHM3<PFP>::IHM3(m_map& m_map) :
m_m_map(m_map),
IHM3<PFP>::IHM3(MAP& map) :
m_map(map),
shareVertexEmbeddings(true),
vertexVertexFunctor(NULL),
edgeVertexFunctor(NULL),
......@@ -60,35 +61,24 @@ IHM3<PFP>::IHM3(m_map& m_map) :
template <typename PFP>
unsigned int IHM3<PFP>::edgeLevel(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
// the level of an edge is the maximum of the
// insertion levels of its darts
// the level of an edge is the maximum of the
// insertion levels of its darts
// unsigned int r = 0;
unsigned int ld = m_map.getDartLevel(d) ;
unsigned int ldd = m_map.getDartLevel(m_map.phi2(d)) ;
unsigned int max = ld > ldd ? ld : ldd;
// Dart e = d;
// do
// {
unsigned int ld = m_map.getDartLevel(e) ;
unsigned int ldd = m_map.getDartLevel(map.phi2(e)) ;
unsigned int max = ld > ldd ? ld : ldd;
// r = r < temp ? temp : r ;
// e = alpha2(e);
// } while(e != d);
// return r;
return max;
return max;
}
template <typename PFP>
unsigned int IHM3<PFP>::faceLevel(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"faceLevel : called with a dart inserted after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"faceLevel : called with a dart inserted after current level") ;
if(map.getCurrentLevel() == 0)
if(m_map.getCurrentLevel() == 0)
return 0 ;
Dart it = d ;
......@@ -107,7 +97,7 @@ unsigned int IHM3<PFP>::faceLevel(Dart d)
unsigned int l = edgeLevel(it) ; // is the minimum of the levels
fLevel = l < fLevel ? l : fLevel ; // of its edges
} while(it != d) ;
/*
unsigned int cur = m_map.getCurrentLevel() ;
m_map.setCurrentLevel(fLevel) ;
......@@ -118,7 +108,7 @@ unsigned int IHM3<PFP>::faceLevel(Dart d)
{ // but not the face itself
++nbSubd ; // is treated here
it = m_map.phi1(it) ;
} while(map.getEdgeId(it) == eId) ;
} while(m_map.getEdgeId(it) == eId) ;
while(nbSubd > 1)
{
......@@ -127,22 +117,37 @@ unsigned int IHM3<PFP>::faceLevel(Dart d)
}
m_map.setCurrentLevel(cur) ;
*/
return fLevel ;
}
template <typename PFP>
unsigned int IHM3<PFP>::volumeLevel(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
if(map.getCurrentLevel() == 0)
if(m_map.getCurrentLevel() == 0)
return 0 ;
Dart oldest = d ;
unsigned int vLevel = std::numeric_limits<unsigned int>::max(); //hook sioux
//First : the level of a volume is the minimum of the levels of its faces
Traversor3WF<typename PFP::MAP> travF(m_map, d);
for (Dart dit = travF.begin(); dit != travF.end(); dit = travF.next())
{
// in a first time, the level of a face
//the level of the volume is the minimum of the
//levels of its faces
unsigned int fLevel = faceLevel(dit);
vLevel = fLevel < vLevel ? fLevel : vLevel ;
}
/*
//First : the level of a volume is the
//minimum of the levels of its faces
DartMarkerStore<m_map3> mark(*this); // Lock a marker
DartMarkerStore<MAP> mark(m_map); // Lock a marker
std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(512);
......@@ -155,7 +160,7 @@ unsigned int IHM3<PFP>::volumeLevel(Dart d)
//parcours les faces du volume au niveau courant
//on cherche le brin de niveau le plus bas de la hierarchie
//on note le niveau le plus bas de la hierarchie
mark.markOrbit<FACE>(d) ;
mark.markOrbit(Face(d)) ;
for(unsigned int i = 0; i < visitedFaces.size(); ++i)
{
Dart e = visitedFaces[i] ;
......@@ -174,7 +179,7 @@ unsigned int IHM3<PFP>::volumeLevel(Dart d)
unsigned int fLevel = edgeLevel(it) ;
do
{
it = phi1(it) ;
it = m_map.phi1(it) ;
unsigned int dl = m_map.getDartLevel(it) ;
if(dl < l_old) // compute the oldest dart of the face
{ // in the same time
......@@ -215,7 +220,7 @@ unsigned int IHM3<PFP>::volumeLevel(Dart d)
// compute the oldest dart from the volume
// if the oldest dart from this face is oldest than the oldest saved dart
//
if(map.getDartLevel(old) < m_map.getDartLevel(oldest))
if(m_map.getDartLevel(old) < m_map.getDartLevel(oldest))
oldest = old ;
//
......@@ -227,11 +232,12 @@ unsigned int IHM3<PFP>::volumeLevel(Dart d)
if(!mark.isMarked(ee)) // not already marked
{
visitedFaces.push_back(ee) ;
mark.markOrbit<FACE>(ee) ;
mark.markOrbit(Face(ee)) ;
}
e = m_map.phi1(e) ;
} while(e != visitedFaces[i]) ;
}
*/
//Second : the case of all faces regularly subdivided but not the volume itself
......@@ -246,7 +252,7 @@ unsigned int IHM3<PFP>::volumeLevel(Dart d)
{
++nbSubd ;
it = m_map.phi1(it) ;
} while(map.getEdgeId(it) == eId) ;
} while(m_map.getEdgeId(it) == eId) ;
while(nbSubd > 1)
......@@ -263,7 +269,7 @@ unsigned int IHM3<PFP>::volumeLevel(Dart d)
template <typename PFP>
Dart IHM3<PFP>::faceOldestDart(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
Dart it = d ;
Dart oldest = it ;
unsigned int l_old = m_map.getDartLevel(oldest) ;
......@@ -286,12 +292,12 @@ Dart IHM3<PFP>::faceOldestDart(Dart d)
template <typename PFP>
Dart IHM3<PFP>::volumeOldestDart(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
Dart oldest = d;
unsigned int l_old = m_map.getDartLevel(oldest);
Traversor3WF<ImplicitHierarchicalm_map3> trav3WF(*this, oldest);
Traversor3WF<typename PFP::MAP> trav3WF(m_map, oldest);
for(Dart dit = trav3WF.begin() ; dit != trav3WF.end() ; dit = trav3WF.next())
{
Dart old = faceOldestDart(dit);
......@@ -309,16 +315,14 @@ Dart IHM3<PFP>::volumeOldestDart(Dart d)
template <typename PFP>
bool IHM3<PFP>::edgeIsSubdivided(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
//Dart d2 = phi2(d) ;
Dart d1 = m_map.phi1(d) ;
++m_curLevel ;
//Dart d2_l = phi2(d) ;
Dart d1_l = m_map.phi1(d) ;
--m_curLevel ;
//if(d2 != d2_l)
if(d1 != d1_l)
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
//TODO replace by phi1
Dart d2 = m_map.phi2(d) ;
m_map.incCurrentLevel();
Dart d2_l = m_map.phi2(d) ;
m_map.decCurrentLevel() ;
if(d2 != d2_l)
return true ;
else
return false ;
......@@ -327,7 +331,7 @@ bool IHM3<PFP>::edgeIsSubdivided(Dart d)
template <typename PFP>
bool IHM3<PFP>::edgeCanBeCoarsened(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
bool subd = false ;
bool subdOnce = true ;
......@@ -338,7 +342,7 @@ bool IHM3<PFP>::edgeCanBeCoarsened(Dart d)
subd = true ;
m_map.incCurrentLevel() ;
if(map.vertexDegree(map.phi1(d)) == 2)
if(m_map.vertexDegree(m_map.phi1(d)) == 2)
{
degree2 = true ;
if(edgeIsSubdivided(d))
......@@ -352,16 +356,20 @@ bool IHM3<PFP>::edgeCanBeCoarsened(Dart d)
template <typename PFP>
bool IHM3<PFP>::faceIsSubdivided(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
unsigned int fLevel = faceLevel(d) ;
if(fLevel < m_map.getCurrentLevel())
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
// if(m_map.getCurrentLevel() == m_map.getMaxLevel())
// return false ;
unsigned int fLevel = faceLevel(d) ;
if(fLevel < m_map.getCurrentLevel())
return false ;
bool subd = false ;
m_map.incCurrentLevel() ;
if(map.getDartLevel(map.phi1(d)) == m_map.getCurrentLevel() && m_map.getEdgeId(m_map.phi1(d)) != m_map.getEdgeId(d))
m_map.incCurrentLevel();
if(m_map.getDartLevel(m_map.phi1(d)) == m_map.getCurrentLevel() && m_map.getEdgeId(m_map.phi1(d)) != m_map.getEdgeId(d))
subd = true ;
m_map.decCurrentLevel() ;
m_map.decCurrentLevel();
return subd ;
}
......@@ -369,7 +377,7 @@ bool IHM3<PFP>::faceIsSubdivided(Dart d)
template <typename PFP>
bool IHM3<PFP>::faceCanBeCoarsened(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
bool subd = false;
bool subdOnce = true;
......@@ -384,8 +392,9 @@ bool IHM3<PFP>::faceCanBeCoarsened(Dart d)
if(d3 != d && volumeIsSubdivided(d3))
subdNeighborhood = true;
m_map.incCurrentLevel() ;
//tester si la face subdivise a des faces subdivise
unsigned int cur = m_map.getCurrentLevel();
m_map.setCurrentLevel(cur + 1) ;
//tester si la face subdivise a des faces subdivise
Dart cf = m_map.phi1(d);
do
......@@ -393,12 +402,12 @@ bool IHM3<PFP>::faceCanBeCoarsened(Dart d)
if(faceIsSubdivided(cf))
subdOnce = false;
cf = m_map.phi2(map.phi1(cf));
cf = m_map.phi2(m_map.phi1(cf));
}
while(subdOnce && cf != m_map.phi1(d));
--m_curLevel;
}
m_map.setCurrentLevel(cur) ;
}
return subd && !subdNeighborhood && subdOnce;
}
......@@ -406,47 +415,52 @@ bool IHM3<PFP>::faceCanBeCoarsened(Dart d)
template <typename PFP>
bool IHM3<PFP>::volumeIsSubdivided(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
unsigned int vLevel = volumeLevel(d);
if(vLevel < m_map.getCurrentLevel())
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
unsigned int vLevel = volumeLevel(d);
if(vLevel < m_map.getCurrentLevel())
return false;
bool subd = false;
// bool subd = false;
m_map.incCurrentLevel() ;
if(map.getDartLevel(map.phi2(map.phi1(map.phi1(d)))) == m_map.getCurrentLevel() && m_map.getFaceId(map.phi2(map.phi1(map.phi1(d)))) != m_map.getFaceId(d))
subd = true;
m_map.decCurrentLevel() ;
// unsigned int cur = m_map.getCurrentLevel();
// m_map.setCurrentLevel(cur + 1) ;
// if(m_map.getDartLevel(m_map.phi2(m_map.phi1(m_map.phi1(d)))) == m_map.getCurrentLevel() && m_map.getFaceId(m_map.phi2(m_map.phi1(m_map.phi1(d)))) != m_map.getFaceId(d))
// subd = true;
// m_map.setCurrentLevel(cur) ;
return subd;
// std::cout << "volume is subdivided ? " << ( subd ? "true" : "false" ) << std::endl;
// //bool facesAreSubdivided = faceIsSubdivided(d) ;
// bool facesAreSubdivided = true ;
//
// Traversor3WF<ImplicitHierarchicalm_map3> trav3WF(*this, d);
// for(Dart dit = trav3WF.begin() ; dit != trav3WF.end() ; dit = trav3WF.next())
// {
// // in a first time, the level of a face
// //the level of the volume is the minimum of the
// //levels of its faces
//
// facesAreSubdivided &= faceIsSubdivided(dit) ;
// }
//
// //but not the volume itself
// bool subd = false;
// ++m_curLevel;
// if(facesAreSubdivided && m_dartLevel[phi2(phi1(phi1(d)))] == m_curLevel && m_faceId[phi2(phi1(phi1(d)))] != m_faceId[d])
// subd = true;
// --m_curLevel;
//
// return subd;
bool facesAreSubdivided = faceIsSubdivided(d) ;
//bool facesAreSubdivided = true ;
Traversor3WF<MAP> trav3WF(m_map, d);
for(Dart dit = trav3WF.begin() ; dit != trav3WF.end() ; dit = trav3WF.next())
{
// in a first time, the level of a face
//the level of the volume is the minimum of the
//levels of its faces
facesAreSubdivided &= faceIsSubdivided(dit) ;
}
//but not the volume itself
bool subd = false;
m_map.incCurrentLevel() ;
if(facesAreSubdivided && m_map.getDartLevel(m_map.phi2(m_map.phi1(m_map.phi1(d)))) == m_map.getCurrentLevel() && m_map.getFaceId(m_map.phi2(m_map.phi1(m_map.phi1(d)))) != m_map.getFaceId(d))
subd = true;
m_map.decCurrentLevel() ;
return subd;
}
template <typename PFP>
bool IHM3<PFP>::volumeIsSubdividedOnce(Dart d)
{
assert(map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
unsigned int vLevel = volumeLevel(d);
if(vLevel < m_map.getCurrentLevel())
return false;
......@@ -455,15 +469,15 @@ bool IHM3<PFP>::volumeIsSubdividedOnce(Dart d)
bool subdOnce = true ;
m_map.incCurrentLevel() ;
if(map.getDartLevel(map.phi2(map.phi1(map.phi1(d)))) == m_map.getCurrentLevel() && m_map.getFaceId(map.phi2(map.phi1(map.phi1(d)))) != m_map.getFaceId(d))
if(m_map.getDartLevel(m_map.phi2(m_map.phi1(m_map.phi1(d)))) == m_map.getCurrentLevel() && m_map.getFaceId(m_map.phi2(m_map.phi1(m_map.phi1(d)))) != m_map.getFaceId(d))
{
subd = true;
m_map.incCurrentLevel() ;
Dart dcenter = phi_1(phi2(phi1(d)));
Traversor3VW<ImplicitHierarchicalm_map3> trav3(*this, dcenter);
Dart dcenter = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
Traversor3VW<ImplicitHierarchicalMap3> trav3(m_map, dcenter);
for(Dart dit = trav3.begin() ; subdOnce && dit != trav3.end() && subdOnce; dit = trav3.next())
{
if(map.getDartLevel(map.phi2(map.phi1(map.phi1(dit)))) == m_map.getCurrentLevel() && m_map.getFaceId(map.phi2(map.phi1(map.phi1(dit)))) != m_map.getFaceId(dit))
if(m_map.getDartLevel(m_map.phi2(m_map.phi1(m_map.phi1(dit)))) == m_map.getCurrentLevel() && m_map.getFaceId(m_map.phi2(m_map.phi1(m_map.phi1(dit)))) != m_map.getFaceId(dit))
subdOnce = false;
}
m_map.decCurrentLevel() ;
......@@ -474,7 +488,7 @@ bool IHM3<PFP>::volumeIsSubdividedOnce(Dart d)
// //si le volume est subdivise
//
// //test si toutes les faces sont subdivisee
// DartMarkerStore mark(*this); // Lock a marker
// DartMarkerStore<MAP> mark(m_map); // Lock a marker
//
// std::vector<Dart> visitedFaces; // Faces that are traversed
// visitedFaces.reserve(512);
......@@ -519,8 +533,7 @@ template <typename PFP>
void IHM3<PFP>::subdivideEdge(Dart d)
{
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!m_map.edgeIsSubdivided(d) || !"Trying to subdivide an already subdivided edge") ;
assert(!m_map.isBoundaryMarked3(d) || !"Trying to subdivide a dart marked boundary");
assert(!edgeIsSubdivided(d) || !"Trying to subdivide an already subdivided edge") ;
unsigned int eLevel = edgeLevel(d) ;
......@@ -533,8 +546,8 @@ void IHM3<PFP>::subdivideEdge(Dart d)
m_map.cutEdge(d) ;
unsigned int eId = m_map.getEdgeId(d) ;
m_map.setEdgeId(m_map.phi1(d), eId, EDGE) ; //mise a jour de l'id d'arrete sur chaque moitie d'arete
m_map.setEdgeId(m_map.phi1(dd), eId, EDGE) ;
m_map.setEdgeId(m_map.phi1(d), eId) ; //mise a jour de l'id d'arrete sur chaque moitie d'arete
m_map.setEdgeId(m_map.phi1(dd), eId) ;
m_map.setFaceId(EDGE, d) ; //mise a jour de l'id de face sur chaque brin de chaque moitie d'arete
m_map.setFaceId(EDGE, dd) ;
......@@ -560,8 +573,7 @@ template <typename PFP>
unsigned int IHM3<PFP>::subdivideFace(Dart d, bool triQuad)
{
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!m_map.faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
assert(!m_map.isBoundaryMarked3(d) || !"Trying to subdivide a dart marked boundary");
assert(!faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
unsigned int fLevel = faceLevel(d) ;
Dart old = faceOldestDart(d) ;
......@@ -569,42 +581,29 @@ unsigned int IHM3<PFP>::subdivideFace(Dart d, bool triQuad)
unsigned int cur = m_map.getCurrentLevel() ;
m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
//one level of subdivision in the neighbordhood
// unsigned int vLevel = m_map.volumeLevel(old);
// Traversor3VW<typename PFP::m_map> trav3EW(m_map, old);
// for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next())
// {
// Dart oldit = m_map.volumeOldestDart(dit);
//
// //std::cout << "vLevel courant = " << m_map.volumeLevel(oldit) << std::endl;
//
// if(((vLevel+1) - m_map.volumeLevel(oldit)) > 1)
// IHM::subdivideVolumeClassic<PFP>(m_map, oldit, position);
// }
unsigned int degree = 0 ;
Traversor2FE<typename PFP::m_map> travE(m_map, old);
Traversor3FE<typename PFP::MAP> travE(m_map, old);
for(Dart it = travE.begin(); it != travE.end() ; it = travE.next())
{
++degree ; // compute the degree of the face
if(!m_map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
IHM::subdivideEdge<PFP>(m_map, it, position) ; // and compute the degree of the face
if(!edgeIsSubdivided(it)) // first cut the edges (if they are not already)
subdivideEdge(it) ; // and compute the degree of the face
}
m_map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision
if((degree == 3) && triQuad) // if subdividing a triangle
{
Dart dd = m_map.phi1(old) ;
Dart e = m_map.phi1(dd) ;
(*vertexVertexFunctor)(e) ;
Dart e = m_map.phi1(e) ;
e = m_map.phi1(e) ;
m_map.splitFace(dd, e) ; // insert a new edge
unsigned int id = m_map.getNewEdgeId() ;
m_map.setEdgeId(m_map.phi_1(dd), id, EDGE) ; // set the edge id of the inserted edge to the next available id
//unsigned int id = m_map.getNewEdgeId() ;
unsigned int id = m_map.triRefinementEdgeId(m_map.phi_1(dd));
m_map.setEdgeId(m_map.phi_1(dd), id) ; // set the edge id of the inserted edge to the next available id
unsigned int idface = m_map.getFaceId(old);
m_map.setFaceId(dd, idface, FACE) ;
......@@ -615,8 +614,9 @@ unsigned int IHM3<PFP>::subdivideFace(Dart d, bool triQuad)
(*vertexVertexFunctor)(e) ;
e = m_map.phi1(dd);
m_map.splitFace(dd, e) ;
id = m_map.getNewEdgeId() ;
m_map.setEdgeId(m_map.phi_1(dd), id, EDGE) ;
//id = m_map.getNewEdgeId() ;
id = m_map.triRefinementEdgeId(m_map.phi_1(dd));
m_map.setEdgeId(m_map.phi_1(dd), id) ;
m_map.setFaceId(dd, idface, FACE) ;
m_map.setFaceId(e, idface, FACE) ;
......@@ -626,12 +626,12 @@ unsigned int IHM3<PFP>::subdivideFace(Dart d, bool triQuad)
(*vertexVertexFunctor)(e) ;
e = m_map.phi1(dd);
m_map.splitFace(dd, e) ;
id = m_map.getNewEdgeId() ;
m_map.setEdgeId(m_map.phi_1(dd), id, EDGE) ;
//id = m_map.getNewEdgeId() ;
id = m_map.triRefinementEdgeId(m_map.phi_1(dd));
m_map.setEdgeId(m_map.phi_1(dd), id) ;
m_map.setFaceId(dd, idface, FACE) ;
m_map.setFaceId(e, idface, FACE) ;
}
else
{
......@@ -640,30 +640,30 @@ unsigned int IHM3<PFP>::subdivideFace(Dart d, bool triQuad)
(*vertexVertexFunctor)(next) ;
next = m_map.phi1(next);
m_map.splitFace(dd, next) ;
Dart ne = m_map.phi2(m_map.phi_1(dd));
Dart ne2 = m_map.phi2(ne);
m_map.cutEdge(ne) ;
unsigned int id = m_map.getNewEdgeId() ;
m_map.setEdgeId(ne, id, EDGE) ;
id = m_map.getNewEdgeId() ;
m_map.setEdgeId(ne2, id, EDGE) ;
dd = m_map.phi1(ne) ;
//unsigned int id = m_map.getNewEdgeId() ;
unsigned int id = m_map.getQuadRefinementEdgeId(m_map.phi2(ne));
m_map.setEdgeId(ne, id) ;
//id = m_map.getNewEdgeId() ;
id = m_map.getQuadRefinementEdgeId(m_map.phi2(ne2));
m_map.setEdgeId(ne2, id) ;
dd = m_map.phi1(next) ;
(*vertexVertexFunctor)(dd) ;
dd = m_map.phi1(m_map.phi1(dd));
dd = m_map.phi1(dd);
while(dd != ne)
{
Dart next = m_map.phi1(m_map.phi1(dd)) ;
{
m_map.splitFace(m_map.phi1(ne), dd) ;
(*vertexVertexFunctor)(m_map.phi1(dd)) ;
Dart nne = m_map.phi2(m_map.phi_1(dd)) ;
id = m_map.getNewEdgeId() ;
m_map.setEdgeId(nne, id, EDGE) ;
dd = next ;
//id = m_map.getNewEdgeId() ;
id = m_map.getQuadRefinementEdgeId(m_map.phi2(nne));
m_map.setEdgeId(nne, id) ;
dd = m_map.phi1(dd) ;
(*vertexVertexFunctor)(dd) ;
dd = m_map.phi1(dd) ;
}
unsigned int idface = m_map.getFaceId(old);
......@@ -676,10 +676,7 @@ unsigned int IHM3<PFP>::subdivideFace(Dart d, bool triQuad)
}
while(dd != ne);
(*faceVertexFunctor)(m_map.phi1(ne)) ;
(*faceVertexFunctor)(m_map.phi1(ne)) ;
}
m_map.setCurrentLevel(cur) ;
......@@ -739,11 +736,10 @@ void IHM3<PFP>::coarsenFace(Dart d)
}
template <typename PFP>
unsigned int IHM3<PFP>::subdivideVolume(Dart d, bool triQuad, bool OneLevelDifference)
Dart IHM3<PFP>::subdivideVolume(Dart d, bool triQuad, bool OneLevelDifference)
{
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!volumeIsSubdivided(d) || !"Trying to subdivide an already subdivided volume") ;
assert(!m_map.isBoundaryMarked(d,3) || !"Trying to subdivide a dart marked boundary");
unsigned int vLevel = volumeLevel(d);
Dart old = volumeOldestDart(d);
......@@ -751,106 +747,73 @@ unsigned int IHM3<PFP>::subdivideVolume(Dart d, bool triQuad, bool OneLevelDiffe
unsigned int cur = m_map.getCurrentLevel();
m_map.setCurrentLevel(vLevel);
// //one level of subdivision in the neighbordhood
// Traversor3VW<typename PFP::m_map> trav3EW(m_map, old);
// for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next())
// {
// Dart oldit = m_map.volumeOldestDart(dit);
// if(((vLevel+1) - m_map.volumeLevel(oldit)) > 1)
// IHM::subdivideVolumeClassic<PFP>(m_map, oldit, position);
// }