From 9e2ce59c41aa554ecec3de85d3bd0ced55929c37 Mon Sep 17 00:00:00 2001 From: untereiner Date: Thu, 15 Dec 2011 08:52:50 +0100 Subject: [PATCH] change subdiv algo for no_boundary --- include/Algo/ImplicitHierarchicalMesh/ihm3.h | 356 ++++++++----- .../Algo/ImplicitHierarchicalMesh/ihm3.hpp | 219 ++++---- .../ImplicitHierarchicalMesh/subdivision3.hpp | 479 ++++++++---------- include/Topology/gmap/embeddedGMap3.h | 5 + include/Topology/map/embeddedMap3.h | 32 +- include/Topology/map/map3.h | 2 +- src/Algo/ImplicitHierarchicalMesh/ihm3.cpp | 107 +++- src/Topology/gmap/embeddedGMap3.cpp | 13 + src/Topology/map/embeddedMap3.cpp | 4 +- src/Topology/map/map3.cpp | 31 +- 10 files changed, 688 insertions(+), 560 deletions(-) diff --git a/include/Algo/ImplicitHierarchicalMesh/ihm3.h b/include/Algo/ImplicitHierarchicalMesh/ihm3.h index 71666f18c..a50a4afc8 100644 --- a/include/Algo/ImplicitHierarchicalMesh/ihm3.h +++ b/include/Algo/ImplicitHierarchicalMesh/ihm3.h @@ -36,11 +36,11 @@ namespace Algo namespace IHM { -//template class AttributeHandler_IHM ; +template class AttributeHandler_IHM ; class ImplicitHierarchicalMap3 : public EmbeddedMap3 { - //template friend class AttributeHandler_IHM ; + template friend class AttributeHandler_IHM ; public: unsigned int m_curLevel ; @@ -59,23 +59,37 @@ public: ~ImplicitHierarchicalMap3() ; + //! + /*! + * + */ void init() ; - /*************************************************** - * ATTRIBUTES MANAGEMENT * - ***************************************************/ - - //template - //AttributeHandler_IHM addAttribute(unsigned int orbit, const std::string& nameAttr) ; + /*! @name Attributes Management + * To handles Attributes for each level of an implicit 3-map + *************************************************************************/ - //template - //AttributeHandler_IHM getAttribute(unsigned int orbit, const std::string& nameAttr) ; + //@{ + //! + /*! + * + */ + template + AttributeHandler_IHM addAttribute(unsigned int orbit, const std::string& nameAttr) ; + //! + /*! + * + */ + template + AttributeHandler_IHM getAttribute(unsigned int orbit, const std::string& nameAttr) ; + //@} - /*************************************************** - * MAP TRAVERSAL * - ***************************************************/ + /*! @name Basic Topological Operators + * Redefinition of the basic topological operators + *************************************************************************/ + //@{ virtual Dart newDart() ; Dart phi1(Dart d) ; @@ -97,214 +111,278 @@ public: Dart alpha2(Dart d); Dart alpha_2(Dart d); + //@} - virtual Dart begin() ; - - virtual Dart end() ; - - virtual void next(Dart& d) ; - - virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) ; - - virtual bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0) ; - - bool foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread = 0); - virtual bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread = 0) ; - - bool foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int thread = 0); - virtual bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread = 0) ; - - virtual bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0) ; - - - /*************************************************** - * LEVELS MANAGEMENT * - ***************************************************/ - +// /*! @name Topological Operators with Cells id management +// * Topological operations on Hierarchical Implicit 3-maps +// *************************************************************************/ +// +// //@{ +// //! +// /*! +// * +// */ +// virtual Dart cutEdge(Dart d); +// +// //! +// /*! +// * +// */ +// virtual bool uncutEdge(Dart d); +// +// //! +// /*! +// * +// */ +// virtual void splitFace(Dart d, Dart e); +// +// //! +// /*! +// * +// */ +// virtual void sewVolumes(Dart d, Dart e, bool withBoundary = true); +// +// //! +// /*! +// * +// */ +// virtual void splitVolume(std::vector& vd); +// //@} + + /*! @name Levels Management + * Operations to manage the levels of an Implicit Hierarchical 3-map + *************************************************************************/ + + //@{ + //! + /*! + * + */ unsigned int getCurrentLevel() ; + //! + /*! + * + */ void setCurrentLevel(unsigned int l) ; + //! + /*! + * + */ unsigned int getMaxLevel() ; + //! + /*! + * + */ unsigned int getDartLevel(Dart d) ; + //! + /*! + * + */ void setDartLevel(Dart d, unsigned int i) ; + //@} - /*************************************************** - * EDGE ID MANAGEMENT * - ***************************************************/ + /*! @name Id Management + * Operations to manage the ids of edges and faces + *************************************************************************/ - /** - * Give a new unique id to all the edges of the map + //@{ + //! Give a new unique id to all the edges of the map + /*! */ void initEdgeId() ; - /** - * Return the next available edge id + //! Return the next available edge id + /*! */ unsigned int getNewEdgeId() ; - /** - * Return the id of the edge of d + //! Return the id of the edge of d + /*! */ unsigned int getEdgeId(Dart d) ; - /** - * Set an edge id to all darts from an orbit of d + //! Set an edge id to all darts from an orbit of d + /*! */ - //TODO changer l'ordre des parametres - void setEdgeId(Dart d, unsigned int i, unsigned int orbit); + void setEdgeId(Dart d, unsigned int i, unsigned int orbit); //TODO a virer + void setEdgeId(Dart d, unsigned int i); - /*************************************************** - * FACE ID MANAGEMENT * - ***************************************************/ - - /** - * Give a new unique id to all the faces of the map + //! Give a new unique id to all the faces of the map + /*! */ void initFaceId() ; - /** - * Return the next available face id + //! Return the next available face id + /*! */ unsigned int getNewFaceId() ; - /** - * Return the id of the face of d + //! Return the id of the face of d + /*! */ unsigned int getFaceId(Dart d) ; - /** - * Set a face id to all darts from an orbit of d + //! Set a face id to all darts from an orbit of d + /*! */ - //TODO changer l'ordre des parametres - void setFaceId(Dart d, unsigned int i, unsigned int orbit); - + void setFaceId(Dart d, unsigned int i, unsigned int orbit); //TODO a virer void setFaceId(unsigned int orbit, Dart d); + //@} - /*************************************************** - * CELLS INFORMATION * - ***************************************************/ + /*! @name Cells Information + * Operations to manage the cells informations : + *************************************************************************/ - /** - * Return the level of insertion of the vertex of d + //@{ + //! Return the level of insertion of the vertex of d + /*! */ unsigned int vertexInsertionLevel(Dart d) ; - /** - * Return the level of the edge of d in the current level map + //! Return the level of the edge of d in the current level map + /*! */ unsigned int edgeLevel(Dart d) ; - /** - * Return the level of the face of d in the current level map + //! Return the level of the face of d in the current level map + /*! */ unsigned int faceLevel(Dart d); - /** - * Return the level of the volume of d in the current level map + //! Return the level of the volume of d in the current level map + /*! */ unsigned int volumeLevel(Dart d); - /** - * Return the oldest dart of the face of d in the current level map + //! Return the oldest dart of the face of d in the current level map + /*! */ Dart faceOldestDart(Dart d); - /** - * Return the oldest dart of the volume of d in the current level map + //! Return the oldest dart of the volume of d in the current level map + /*! */ Dart volumeOldestDart(Dart d); - /** - * Return true if the edge of d in the current level map - * has already been subdivided to the next level + //! Return true if the edge of d in the current level map + //! has already been subdivided to the next level + /*! */ bool edgeIsSubdivided(Dart d) ; - /** - * Return true if the face of d in the current level map - * has already been subdivided to the next level + //! Return true if the face of d in the current level map + //! has already been subdivided to the next level + /*! */ bool faceIsSubdivided(Dart d) ; - /** - * Return true if the volume of d in the current level map - * has already been subdivided to the next level + //! Return true if the volume of d in the current level map + //! has already been subdivided to the next level + /*! */ bool volumeIsSubdivided(Dart d); - /** - * Return true if the edge of d in the current level map - * is subdivided to the next level, - * none of its resulting edges is in turn subdivided to the next level - * and the middle vertex is of degree 2 + //! Return true if the edge of d in the current level map + //! is subdivided to the next level, + //! none of its resulting edges is in turn subdivided to the next level + //! and the middle vertex is of degree 2 + /*! */ bool edgeCanBeCoarsened(Dart d); - /** - * + //! + /*! */ bool faceCanBeCoarsened(Dart d); - /** - * + //! + /*! */ bool faceIsSubdividedOnce(Dart d); - /** - * + //! + /*! */ bool volumeIsSubdividedOnce(Dart d); - /** - * + //! + /*! */ bool neighborhoodLevelDiffersByOne(Dart d); - /** - * wired !!! + //! wired !!! + /*! */ bool coarsenNeighborhoodLevelDiffersByOne(Dart d); + //@} + + /*! @name Cell Functors + * Redefition of the 3-maps map traversor + *************************************************************************/ + + //@{ + virtual Dart begin() ; + + virtual Dart end() ; + + virtual void next(Dart& d) ; + + virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) ; + + virtual bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0) ; + + bool foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread = 0); + virtual bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread = 0) ; + + bool foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int thread = 0); + virtual bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread = 0) ; + + virtual bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0) ; + //@} + + } ; -//template -//class AttributeHandler_IHM : public AttributeHandler -//{ -//public: -// typedef T DATA_TYPE ; -// -// AttributeHandler_IHM() : AttributeHandler() -// {} -// -// AttributeHandler_IHM(GenericMap* m, AttributeMultiVector* amv) : AttributeHandler(m, amv) -// {} -// -// AttributeMultiVector* getDataVector() const -// { -// return AttributeHandler::getDataVector() ; -// } -// -// bool isValid() const -// { -// return AttributeHandler::isValid() ; -// } -// -// T& operator[](Dart d) ; -// -// const T& operator[](Dart d) const ; -// -// T& operator[](unsigned int a) -// { -// return AttributeHandler::operator[](a) ; -// } -// -// const T& operator[](unsigned int a) const -// { -// return AttributeHandler::operator[](a) ; -// } -//} ; +template +class AttributeHandler_IHM : public AttributeHandler +{ +public: + typedef T DATA_TYPE ; + + AttributeHandler_IHM() : AttributeHandler() + {} + + AttributeHandler_IHM(GenericMap* m, AttributeMultiVector* amv) : AttributeHandler(m, amv) + {} + + AttributeMultiVector* getDataVector() const + { + return AttributeHandler::getDataVector() ; + } + + bool isValid() const + { + return AttributeHandler::isValid() ; + } + + T& operator[](Dart d) ; + + const T& operator[](Dart d) const ; + + T& operator[](unsigned int a) + { + return AttributeHandler::operator[](a) ; + } + + const T& operator[](unsigned int a) const + { + return AttributeHandler::operator[](a) ; + } +} ; } //namespace IHM diff --git a/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp b/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp index 4432a02a6..a488d6e10 100644 --- a/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp +++ b/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp @@ -31,37 +31,37 @@ namespace Algo namespace IHM { -///*************************************************** -// * ATTRIBUTES MANAGEMENT * -// ***************************************************/ -// -//template -//AttributeHandler_IHM ImplicitHierarchicalMap3::addAttribute(unsigned int orbit, const std::string& nameAttr) -//{ -// bool addNextLevelCell = false ; -// if(!isOrbitEmbedded(orbit)) -// addNextLevelCell = true ; -// -// AttributeHandler h = Map3::addAttribute(orbit, nameAttr) ; -// -// if(addNextLevelCell) -// { -// AttributeContainer& cellCont = m_attribs[orbit] ; -// AttributeMultiVector* amv = cellCont.addAttribute("nextLevelCell") ; -// m_nextLevelCell[orbit] = amv ; -// for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i)) -// amv->operator[](i) = EMBNULL ; -// } -// -// return AttributeHandler_IHM(this, h.getDataVector()) ; -//} -// -//template -//AttributeHandler_IHM ImplicitHierarchicalMap3::getAttribute(unsigned int orbit, const std::string& nameAttr) -//{ -// AttributeHandler h = Map2::getAttribute(orbit, nameAttr) ; -// return AttributeHandler_IHM(this, h.getDataVector()) ; -//} +/*************************************************** + * ATTRIBUTES MANAGEMENT * + ***************************************************/ + +template +AttributeHandler_IHM ImplicitHierarchicalMap3::addAttribute(unsigned int orbit, const std::string& nameAttr) +{ + bool addNextLevelCell = false ; + if(!isOrbitEmbedded(orbit)) + addNextLevelCell = true ; + + AttributeHandler h = Map3::addAttribute(orbit, nameAttr) ; + + if(addNextLevelCell) + { + AttributeContainer& cellCont = m_attribs[orbit] ; + AttributeMultiVector* amv = cellCont.addAttribute("nextLevelCell") ; + m_nextLevelCell[orbit] = amv ; + for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i)) + amv->operator[](i) = EMBNULL ; + } + + return AttributeHandler_IHM(this, h.getDataVector()) ; +} + +template +AttributeHandler_IHM ImplicitHierarchicalMap3::getAttribute(unsigned int orbit, const std::string& nameAttr) +{ + AttributeHandler h = Map3::getAttribute(orbit, nameAttr) ; + return AttributeHandler_IHM(this, h.getDataVector()) ; +} /*************************************************** * MAP TRAVERSAL * @@ -171,50 +171,21 @@ inline Dart ImplicitHierarchicalMap3::alpha1(Dart d) { //assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; - return Map3::alpha1(d) ; + return phi3(phi_1(d)) ; } inline Dart ImplicitHierarchicalMap3::alpha2(Dart d) { assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; - Dart e = phi2(d); - Dart f = phi3(e); - - if (f != e) - return f; - - f = d; - e = phi3(f); - while (e != f) - { - f = phi2(e); - e = phi3(f); - } - return f; - - //return Map3::alpha2(d); + return phi3(phi2(d)); } inline Dart ImplicitHierarchicalMap3::alpha_2(Dart d) { assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; - Dart e = phi3(d); - - if (e != d) - return phi2(e); - - e = d; - Dart f = phi2(d); - while (phi3(f) != f) - { - e = phi3(f); - f = phi2(e); - } - return e; - - //return Map3::alpha_2(d); + return phi2(phi3(d)); } inline Dart ImplicitHierarchicalMap3::begin() @@ -521,67 +492,67 @@ inline unsigned int ImplicitHierarchicalMap3::edgeLevel(Dart d) return r; } -///*************************************************** -// * ATTRIBUTE HANDLER * -// ***************************************************/ -// -//template -//T& AttributeHandler_IHM::operator[](Dart d) -//{ -// ImplicitHierarchicalMap3* m = reinterpret_cast(this->m_map) ; -// assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; -// assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; -// -// unsigned int orbit = this->getOrbit() ; -// unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; -// unsigned int index = m->getEmbedding(orbit, d) ; -// -// if(index == EMBNULL) -// { -// index = m->embedNewCell(orbit, d) ; -// m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ; -// } -// -// AttributeContainer& cont = m->getAttributeContainer(orbit) ; -// unsigned int step = 0 ; -// while(step < nbSteps) -// { -// step++ ; -// unsigned int nextIdx = m->m_nextLevelCell[orbit]->operator[](index) ; -// if (nextIdx == EMBNULL) -// { -// nextIdx = m->newCell(orbit) ; -// m->copyCell(orbit, nextIdx, index) ; -// m->m_nextLevelCell[orbit]->operator[](index) = nextIdx ; -// m->m_nextLevelCell[orbit]->operator[](nextIdx) = EMBNULL ; -// cont.refLine(index) ; -// } -// index = nextIdx ; -// } -// return this->m_attrib->operator[](index); -//} -// -//template -//const T& AttributeHandler_IHM::operator[](Dart d) const -//{ -// ImplicitHierarchicalMap3* m = reinterpret_cast(this->m_map) ; -// assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; -// assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; -// -// unsigned int orbit = this->getOrbit() ; -// unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; -// unsigned int index = m->getEmbedding(orbit, d) ; -// -// unsigned int step = 0 ; -// while(step < nbSteps) -// { -// step++ ; -// unsigned int next = m->m_nextLevelCell[orbit]->operator[](index) ; -// if(next != EMBNULL) index = next ; -// else break ; -// } -// return this->m_attrib->operator[](index); -//} +/*************************************************** + * ATTRIBUTE HANDLER * + ***************************************************/ + +template +T& AttributeHandler_IHM::operator[](Dart d) +{ + ImplicitHierarchicalMap3* m = reinterpret_cast(this->m_map) ; + assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; + assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; + + unsigned int orbit = this->getOrbit() ; + unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; + unsigned int index = m->getEmbedding(orbit, d) ; + + if(index == EMBNULL) + { + index = m->embedNewCell(orbit, d) ; + m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ; + } + + AttributeContainer& cont = m->getAttributeContainer(orbit) ; + unsigned int step = 0 ; + while(step < nbSteps) + { + step++ ; + unsigned int nextIdx = m->m_nextLevelCell[orbit]->operator[](index) ; + if (nextIdx == EMBNULL) + { + nextIdx = m->newCell(orbit) ; + m->copyCell(orbit, nextIdx, index) ; + m->m_nextLevelCell[orbit]->operator[](index) = nextIdx ; + m->m_nextLevelCell[orbit]->operator[](nextIdx) = EMBNULL ; + cont.refLine(index) ; + } + index = nextIdx ; + } + return this->m_attrib->operator[](index); +} + +template +const T& AttributeHandler_IHM::operator[](Dart d) const +{ + ImplicitHierarchicalMap3* m = reinterpret_cast(this->m_map) ; + assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; + assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; + + unsigned int orbit = this->getOrbit() ; + unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; + unsigned int index = m->getEmbedding(orbit, d) ; + + unsigned int step = 0 ; + while(step < nbSteps) + { + step++ ; + unsigned int next = m->m_nextLevelCell[orbit]->operator[](index) ; + if(next != EMBNULL) index = next ; + else break ; + } + return this->m_attrib->operator[](index); +} } //namespace IHM diff --git a/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp b/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp index 29179deba..fd60935a1 100644 --- a/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp +++ b/include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp @@ -41,6 +41,7 @@ void subdivideEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position { assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ; assert(!map.edgeIsSubdivided(d) || !"Trying to subdivide an already subdivided edge") ; + assert(!map.isBoundaryMarked(d) || !"Trying to subdivide a dart marked boundary"); unsigned int eLevel = map.edgeLevel(d) ; @@ -73,6 +74,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position { assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ; assert(!map.faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ; + assert(!map.isBoundaryMarked(d) || !"Trying to subdivide a dart marked boundary"); unsigned int fLevel = map.faceLevel(d) ; Dart old = map.faceOldestDart(d) ; @@ -175,6 +177,7 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& { assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ; assert(!map.volumeIsSubdivided(d) || !"Trying to subdivide an already subdivided volume") ; + assert(!map.isBoundaryMarked(d) || !"Trying to subdivide a dart marked boundary"); unsigned int vLevel = map.volumeLevel(d); Dart old = map.volumeOldestDart(d); @@ -259,7 +262,6 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& unsigned int fLevel = map.faceLevel(d) + 1; //puisque dans tous les cas, la face est subdivisee map.setCurrentLevel(fLevel) ; - //le brin est forcement du niveau cur Dart cf = map.phi1(d); Dart e = cf; @@ -299,6 +301,9 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& Dart dd = map.phi1(map.phi1(old)) ; map.splitFace(old,dd) ; + unsigned int idface = map.getNewFaceId(); + map.setFaceId(dd,idface, FACE); + Dart ne = map.phi1(map.phi1(old)) ; map.cutEdge(ne); @@ -306,14 +311,18 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& newEdges.push_back(ne); newEdges.push_back(map.phi1(ne)); + unsigned int id = map.getNewEdgeId() ; + map.setEdgeId(ne, id, EDGE) ; + Dart stop = map.phi2(map.phi1(ne)); ne = map.phi2(ne); do { dd = map.phi1(map.phi1(map.phi1(ne))); - //A Verifier !! map.splitFace(ne, dd) ; + unsigned int idface = map.getNewFaceId(); + map.setFaceId(dd,idface, FACE); newEdges.push_back(map.phi1(dd)); @@ -326,63 +335,41 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front())))); -// for (std::vector::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge) -// { -// unsigned int newLevel = map.getCurrentLevel(); -// -// map.setCurrentLevel(cur); -// -// Dart d = *edge; -// Dart e = map.phi2(d); -// -// map.setCurrentLevel(newLevel); -// -// map.sewVolumes(map.phi2(map.phi1(d)), map.phi2(map.phi_1(map.phi2(e)))); -// std::cout << "first = " << map.phi2(map.phi1(d)) << std::endl; -// std::cout << "second = " << map.phi2(map.phi_1(map.phi2(e))) << std::endl; -// -// -// } + //Third step : 3-sew internal faces + for (std::vector >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it) + { + Dart f1 = (*it).first; + Dart f2 = (*it).second; -// //Third step : 3-sew internal faces -// for (std::vector >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it) -// { -// Dart f1 = (*it).first; -// Dart f2 = (*it).second; -// -// //if(map.isBoundaryFace(map.phi2(f1)) && map.isBoundaryFace(map.phi2(f2)))// map.phi3(map.phi2(f1)) == map.phi2(f1) && map.phi3(map.phi2(f2)) == map.phi2(f2)) -// //{ -// //id pour toutes les faces interieures -// // map.sewVolumes(map.phi2(f1), map.phi2(f2)); -// -// -// -// std::cout << "sewVolumes" << std::endl; -// -// //Fais a la couture !!!!! -// unsigned int idface = map.getNewFaceId(); -// map.setFaceId(map.phi2(f1),idface, FACE); -// //} -// -// //FAIS a la couture !!!!!!! -// //id pour toutes les aretes exterieurs des faces quadrangulees -// unsigned int idedge = map.getEdgeId(f1); -// map.setEdgeId(map.phi2(f1), idedge, DART); -// map.setEdgeId( map.phi2(f2), idedge, DART); -// } -// -// //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! -// //id pour les aretes interieurs : (i.e. 6 pour un hexa) -// DartMarker mne(map); -// for(unsigned int i = 0; i < newEdges.size(); ++i) -// { -// if(!mne.isMarked(newEdges[i])) -// { -// unsigned int idedge = map.getNewEdgeId(); -// map.setEdgeId(newEdges[i], idedge, EDGE); -// mne.markOrbit(EDGE, newEdges[i]); -// } -// } + if(map.isBoundaryFace(map.phi2(f1)) && map.isBoundaryFace(map.phi2(f2))) + { + //id pour toutes les faces interieures + map.sewVolumes(map.phi2(f1), map.phi2(f2)); + + //Fais a la couture !!!!! + unsigned int idface = map.getNewFaceId(); + map.setFaceId(map.phi2(f1),idface, FACE); + } + + //FAIS a la couture !!!!!!! + //id pour toutes les aretes exterieurs des faces quadrangulees + unsigned int idedge = map.getEdgeId(f1); + map.setEdgeId(map.phi2(f1), idedge, DART); + map.setEdgeId( map.phi2(f2), idedge, DART); + } + + //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! + //id pour les aretes interieurs : (i.e. 6 pour un hexa) + DartMarker mne(map); + for(unsigned int i = 0; i < newEdges.size(); ++i) + { + if(!mne.isMarked(newEdges[i])) + { + unsigned int idedge = map.getNewEdgeId(); + map.setEdgeId(newEdges[i], idedge, EDGE); + mne.markOrbit(EDGE, newEdges[i]); + } + } map.setCurrentLevel(cur) ; @@ -520,27 +507,22 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos //Second step : deconnect each corner, close each hole, subdivide each new face into 3 for (std::vector::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge) { - //std::vector::iterator edge = oldEdges.begin(); Dart e = *edge; - Dart f1 = map.phi1(*edge); - //Dart f2 = map.phi2(f1); + std::vector v ; do { if(map.phi1(map.phi1(map.phi1(e))) != e) - { - map.unsewFaces(map.phi1(map.phi1(e))); //remplacer par une boucle qui découd toute la face et non juste une face carre (jusqu'a phi_1(e)) - } - - map.unsewFaces(map.phi1(e)); + v.push_back(map.phi1(map.phi1(e))); //remplacer par une boucle qui découd toute la face et non juste une face carre (jusqu'a phi_1(e)) + v.push_back(map.phi1(e)); e = map.phi2(map.phi_1(e)); } while(e != *edge); - map.closeHole(f1); + map.splitVolume(v) ; //degree du sommet exterieur unsigned int cornerDegree = map.Map2::vertexDegree(*edge); @@ -652,6 +634,9 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos } + + + //std::cout << "1ere etape finished" << std::endl; CellMarker mtf(map, FACE); @@ -662,203 +647,189 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos Dart f1 = (*edges).first; Dart f2 = (*edges).second; -//Fonction isTetrahedron ?? -// //if(Algo::Modelisation::Tetrahedron::isTetrahedron(map,f2)) - if( (map.Map2::faceDegree(f2) == 3 && map.Map2::faceDegree(map.phi2(f2)) == 3 && - map.Map2::faceDegree(map.phi2(map.phi_1(f2))) == 3) && map.Map2::vertexDegree(f2) == 3) - { //cas du tetrahedre - - //std::cout << "ajout d'une face" << std::endl; - - if(map.phi3(map.phi2(f2)) == map.phi2(f2)) - { - Dart nf = map.newFace(3); - map.sewVolumes(map.phi2(f2),nf); - } - - if(map.phi2(map.phi3(map.phi2(f2))) == map.phi3(map.phi2(f2))) - { - map.sewFaces(map.phi3(map.phi2(f2)), f1); - } - } - else + //si ce n'est pas un tetrahedre + if( !( (map.Map2::faceDegree(f2) == 3 && map.Map2::faceDegree(map.phi2(f2)) == 3 && + map.Map2::faceDegree(map.phi2(map.phi_1(f2))) == 3) && map.Map2::vertexDegree(f2) == 3)) { - if(!mtf.isMarked(f1)) - { - mtf.mark(f1); - - map.closeHole(f1); - - if(map.Map2::faceDegree(map.phi2(f2)) == 3) - { - //std::cout << "ajout d'un tetraedre" << std::endl; - Dart x = Algo::Modelisation::trianguleFace(map, map.phi2(f1)); - position[x] = volCenter; - } - else - { - //std::cout << "ajout d'un prisme" << std::endl; - //Dart x = Algo::Modelisation::extrudeFace(map,position,map.phi2(f1),5.0); - Dart c = Algo::Modelisation::trianguleFace(map, map.phi2(f1)); - - Dart cc = c; - // cut edges - do - { - - typename PFP::VEC3 p1 = position[cc] ; - typename PFP::VEC3 p2 = position[map.phi1(cc)] ; - - map.cutEdge(cc); - - position[map.phi1(cc)] = (p1 + p2) * typename PFP::REAL(0.5) ; - - cc = map.phi2(map.phi_1(cc)); - }while (cc != c); - - // cut faces - do - { - Dart d1 = map.phi1(cc); - Dart d2 = map.phi_1(cc); - map.splitFace(d1,d2); - cc = map.phi2(map.phi_1(cc));//map.Map2::alpha1(cc); - }while (cc != c); - - //merge central faces by removing edges - bool notFinished=true; - do - { - Dart d1 = map.Map2::alpha1(cc); - if (d1 == cc) // last edge is pending edge inside of face - notFinished = false; - map.deleteFace(cc); - cc = d1; - } while (notFinished); + //map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front())))); - map.closeHole(map.phi1(map.phi1(map.phi2(f1)))); +// if(!mtf.isMarked(f1)) +// { +// mtf.mark(f1); +// +// map.closeHole(f1); +// +// if(map.Map2::faceDegree(map.phi2(f2)) == 3) +// { +// //std::cout << "ajout d'un tetraedre" << std::endl; +// Dart x = Algo::Modelisation::trianguleFace(map, map.phi2(f1)); +// position[x] = volCenter; +// } +// else +// { +// //std::cout << "ajout d'un prisme" << std::endl; +// //Dart x = Algo::Modelisation::extrudeFace(map,position,map.phi2(f1),5.0); +// Dart c = Algo::Modelisation::trianguleFace(map, map.phi2(f1)); +// +// Dart cc = c; +// // cut edges +// do +// { +// +// typename PFP::VEC3 p1 = position[cc] ; +// typename PFP::VEC3 p2 = position[map.phi1(cc)] ; +// +// map.cutEdge(cc); +// +// position[map.phi1(cc)] = (p1 + p2) * typename PFP::REAL(0.5) ; +// +// cc = map.phi2(map.phi_1(cc)); +// }while (cc != c); +// +// // cut faces +// do +// { +// Dart d1 = map.phi1(cc); +// Dart d2 = map.phi_1(cc); +// map.splitFace(d1,d2); +// cc = map.phi2(map.phi_1(cc));//map.Map2::alpha1(cc); +// }while (cc != c); +// +// //merge central faces by removing edges +// bool notFinished=true; +// do +// { +// Dart d1 = map.Map2::alpha1(cc); +// if (d1 == cc) // last edge is pending edge inside of face +// notFinished = false; +// map.deleteFace(cc); +// cc = d1; +// } while (notFinished); +// +// +// map.closeHole(map.phi1(map.phi1(map.phi2(f1)))); +// +// } +// } - } - } } - } //std::cout << "2e etape finished" << std::endl; - { - //Third step : 3-sew internal faces - for (std::vector >::iterator it = subdividedfacesT.begin(); it != subdividedfacesT.end(); ++it) - { - Dart f1 = (*it).first; - Dart f2 = (*it).second; - - - - 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)))) - { - map.Map3::sewVolumes(map.phi2(f2), map.phi2(f1)); - } - else - { - - //id pour toutes les faces interieures - map.sewVolumes(map.phi2(f2), map.phi2(f1)); - - - } - - //Fais a la couture !!!!! - unsigned int idface = map.getNewFaceId(); - map.setFaceId(map.phi2(f1),idface, FACE); - } - - - //FAIS a la couture !!!!!!! - //id pour toutes les aretes exterieurs des faces quadrangulees - unsigned int idedge = map.getEdgeId(f1); - map.setEdgeId(map.phi2(f1), idedge, DART); - map.setEdgeId( map.phi2(f2), idedge, DART); - - } - - //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! - //id pour les aretes interieurs : (i.e. 16 pour un octa) - DartMarker mne(map); - for(std::vector::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it) - { - if(!mne.isMarked(*it)) - { - unsigned int idedge = map.getNewEdgeId(); - map.setEdgeId(*it, idedge, EDGE); - mne.markOrbit(EDGE, *it); - } - } - } - - { - //Third step : 3-sew internal faces - for (std::vector >::iterator it = subdividedfacesQ.begin(); it != subdividedfacesQ.end(); ++it) - { - Dart f1 = (*it).first; - Dart f2 = (*it).second; - - if(map.phi3(map.phi2(f1)) == map.phi2(f1) && map.phi3(map.phi2(f2)) == map.phi2(f2)) - { - //id pour toutes les faces interieures - map.sewVolumes(map.phi2(f2), map.phi2(f1)); - - //Fais a la couture !!!!! - unsigned int idface = map.getNewFaceId(); - map.setFaceId(map.phi2(f1),idface, FACE); - } - - //FAIS a la couture !!!!!!! - //id pour toutes les aretes exterieurs des faces quadrangulees - unsigned int idedge = map.getEdgeId(f1); - map.setEdgeId(map.phi2(f1), idedge, DART); - map.setEdgeId( map.phi2(f2), idedge, DART); - } - //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! - //id pour les aretes interieurs : (i.e. 16 pour un octa) - DartMarker mne(map); - for(std::vector::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it) - { - if(!mne.isMarked(*it)) - { - unsigned int idedge = map.getNewEdgeId(); - map.setEdgeId(*it, idedge, EDGE); - mne.markOrbit(EDGE, *it); - } - } - } - - //cas tordu pour le prisme - for (std::vector >::iterator it = subdividedfacesT.begin(); it != subdividedfacesT.end(); ++it) - { - Dart f1 = (*it).first; - Dart f2 = (*it).second; - - if( !(map.Map2::faceDegree(f2) == 3 && map.Map2::faceDegree(map.phi2(f2)) == 3 && - map.Map2::faceDegree(map.phi2(map.phi1(f2))) == 3 && map.Map2::faceDegree(map.phi2(map.phi_1(f2))) == 3)) - { - - - if(map.phi2(map.phi1(map.phi1(map.phi2(f1)))) == map.phi3(map.phi2(map.phi1(map.phi1(map.phi2(f1))))) && - map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi2(map.phi1(map.phi1(map.phi2(f1))))))))))) == - map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi2(map.phi1(map.phi1(map.phi2(f1)))))))))))) - ) - { - map.sewVolumes(map.phi2(map.phi1(map.phi1(map.phi2(f1)))), - map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi1(map.phi1(map.phi2(f1)))))))))); - } - - } - } +// { +// //Third step : 3-sew internal faces +// for (std::vector >::iterator it = subdividedfacesT.begin(); it != subdividedfacesT.end(); ++it) +// { +// Dart f1 = (*it).first; +// Dart f2 = (*it).second; +// +// +// +// 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)))) +// { +// map.Map3::sewVolumes(map.phi2(f2), map.phi2(f1)); +// } +// else +// { +// +// //id pour toutes les faces interieures +// map.sewVolumes(map.phi2(f2), map.phi2(f1)); +// +// +// } +// +// //Fais a la couture !!!!! +// unsigned int idface = map.getNewFaceId(); +// map.setFaceId(map.phi2(f1),idface, FACE); +// } +// +// +// //FAIS a la couture !!!!!!! +// //id pour toutes les aretes exterieurs des faces quadrangulees +// unsigned int idedge = map.getEdgeId(f1); +// map.setEdgeId(map.phi2(f1), idedge, DART); +// map.setEdgeId( map.phi2(f2), idedge, DART); +// +// } +// +// //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! +// //id pour les aretes interieurs : (i.e. 16 pour un octa) +// DartMarker mne(map); +// for(std::vector::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it) +// { +// if(!mne.isMarked(*it)) +// { +// unsigned int idedge = map.getNewEdgeId(); +// map.setEdgeId(*it, idedge, EDGE); +// mne.markOrbit(EDGE, *it); +// } +// } +// } +// +// { +// //Third step : 3-sew internal faces +// for (std::vector >::iterator it = subdividedfacesQ.begin(); it != subdividedfacesQ.end(); ++it) +// { +// Dart f1 = (*it).first; +// Dart f2 = (*it).second; +// +// if(map.phi3(map.phi2(f1)) == map.phi2(f1) && map.phi3(map.phi2(f2)) == map.phi2(f2)) +// { +// //id pour toutes les faces interieures +// map.sewVolumes(map.phi2(f2), map.phi2(f1)); +// +// //Fais a la couture !!!!! +// unsigned int idface = map.getNewFaceId(); +// map.setFaceId(map.phi2(f1),idface, FACE); +// } +// +// //FAIS a la couture !!!!!!! +// //id pour toutes les aretes exterieurs des faces quadrangulees +// unsigned int idedge = map.getEdgeId(f1); +// map.setEdgeId(map.phi2(f1), idedge, DART); +// map.setEdgeId( map.phi2(f2), idedge, DART); +// } +// //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!! +// //id pour les aretes interieurs : (i.e. 16 pour un octa) +// DartMarker mne(map); +// for(std::vector::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it) +// { +// if(!mne.isMarked(*it)) +// { +// unsigned int idedge = map.getNewEdgeId(); +// map.setEdgeId(*it, idedge, EDGE); +// mne.markOrbit(EDGE, *it); +// } +// } +// } +// +// //cas tordu pour le prisme +// for (std::vector >::iterator it = subdividedfacesT.begin(); it != subdividedfacesT.end(); ++it) +// { +// Dart f1 = (*it).first; +// Dart f2 = (*it).second; +// +// if( !(map.Map2::faceDegree(f2) == 3 && map.Map2::faceDegree(map.phi2(f2)) == 3 && +// map.Map2::faceDegree(map.phi2(map.phi1(f2))) == 3 && map.Map2::faceDegree(map.phi2(map.phi_1(f2))) == 3)) +// { +// +// +// if(map.phi2(map.phi1(map.phi1(map.phi2(f1)))) == map.phi3(map.phi2(map.phi1(map.phi1(map.phi2(f1))))) && +// map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi2(map.phi1(map.phi1(map.phi2(f1))))))))))) == +// map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi2(map.phi1(map.phi1(map.phi2(f1)))))))))))) +// ) +// { +// map.sewVolumes(map.phi2(map.phi1(map.phi1(map.phi2(f1)))), +// map.phi2(map.phi3(map.phi2(map.phi3(map.phi2(map.phi3(map.phi1(map.phi1(map.phi2(f1)))))))))); +// } +// +// } +// } map.setCurrentLevel(cur) ; diff --git a/include/Topology/gmap/embeddedGMap3.h b/include/Topology/gmap/embeddedGMap3.h index c0a6d105d..665c36e18 100644 --- a/include/Topology/gmap/embeddedGMap3.h +++ b/include/Topology/gmap/embeddedGMap3.h @@ -54,6 +54,11 @@ public: */ virtual bool uncutEdge(Dart d); + //! + /*! + */ + virtual Dart deleteEdge(Dart d); + /*! * */ diff --git a/include/Topology/map/embeddedMap3.h b/include/Topology/map/embeddedMap3.h index d4a03ec4c..7864be263 100644 --- a/include/Topology/map/embeddedMap3.h +++ b/include/Topology/map/embeddedMap3.h @@ -37,69 +37,69 @@ class EmbeddedMap3 : public Map3 public: typedef Map3 TOPO_MAP; + //! /*! - * */ virtual Dart deleteVertex(Dart d); - /*! No attribute is attached to the new vertex - * The attributes attached to the old edge are duplicated on both resulting edges + //! No attribute is attached to the new vertex + /*! The attributes attached to the old edge are duplicated on both resulting edges * @param d a dart */ virtual Dart cutEdge(Dart d); - /*! The attributes attached to the edge of d are kept on the resulting edge - * @param d a dart of the edge to cut + //! The attributes attached to the edge of d are kept on the resulting edge + /*! @param d a dart of the edge to cut */ virtual bool uncutEdge(Dart d); + //! /*! - * */ virtual Dart deleteEdge(Dart d); + //! /*! - * */ bool edgeCanCollapse(Dart d); + //! /*! - * */ virtual Dart collapseEdge(Dart d, bool delDegenerateVolumes=true); + //! /*! - * */ virtual void splitFace(Dart d, Dart e); + //! /*! - * */ virtual void sewVolumes(Dart d, Dart e, bool withBoundary = true); + //! /*! - * */ virtual void unsewVolumes(Dart d); + //! /*! - * */ virtual bool mergeVolumes(Dart d); + //! /*! - * */ virtual void splitVolume(std::vector& vd); - /** - * No attribute is attached to the new volume + //! + /*! No attribute is attached to the new volume */ virtual unsigned int closeHole(Dart d, bool forboundary = true); + //! /*! - * */ virtual bool check(); } ; diff --git a/include/Topology/map/map3.h b/include/Topology/map/map3.h index e1f2dffcf..deba4a06f 100644 --- a/include/Topology/map/map3.h +++ b/include/Topology/map/map3.h @@ -169,7 +169,7 @@ public: * @param d a dart of the face * @return true if the collapse has been executed, false otherwise */ - virtual bool collapseDegeneretedVolume(Dart d); + bool collapseDegeneretedVolume(Dart d); //! Sew two oriented volumes along their faces. /*! The oriented faces should not be phi3-linked and have the same degree diff --git a/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp b/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp index c42d1bb16..d6ab8b2d2 100644 --- a/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp +++ b/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp @@ -68,6 +68,104 @@ void ImplicitHierarchicalMap3::init() } } +//Dart ImplicitHierarchicalMap3::cutEdge(Dart d) +//{ +// Dart resV = EmbeddedMap3::cutEdge(d); +// +// unsigned int eId = getEdgeId(d); +// Dart dit = d; +// do +// { +// //EdgeId +// m_edgeId[phi1(dit)] = eId; +// m_edgeId[phi3(dit)] = eId; +// +// //FaceId +// unsigned int fId = getFaceId(dit); +// m_faceId[phi1(dit)] = fId; +// m_edgeId[phi3(dit)] = fId; +// +// dit = alpha2(dit); +// } +// while(dit != d); +// +// return resV; +//} +// +//bool ImplicitHierarchicalMap3::uncutEdge(Dart d) +//{ +// return EmbeddedMap3::uncutEdge(d); +//} +// +//void ImplicitHierarchicalMap3::splitFace(Dart d, Dart e) +//{ +// EmbeddedMap3::splitFace(d,e); +// +// unsigned int eId = getNewEdgeId(); +// unsigned int fId = getFaceId(d); +// +// Dart ne = phi_1(d); +// Dart ne3 = phi3(ne); +// +// m_edgeId[ne] = eId; +// m_edgeId[phi2(ne)] = eId; +// m_edgeId[ne3] = eId; +// m_edgeId[phi2(ne3)] = eId; +// +// m_faceId[ne] = fId; +// m_faceId[phi2(ne)] = fId; +// m_faceId[ne3] = fId; +// m_faceId[phi2(ne3)] = fId; +//} +// +//void ImplicitHierarchicalMap3::sewVolumes(Dart d, Dart e, bool withBoundary) +//{ +// EmbeddedMap3::sewVolumes(d,e); +// +// unsigned int fId; +// +// if(m_faceId[d] < m_faceId[phi3(d)]) +// fId = m_faceId[d] ; +// else +// fId = m_edgeId[phi3(d)]; +// +// Dart dit = d; +// do +// { +// //EdgeId +//// if(m_edgeId[dit] < m_edgeId[phi3(dit)]) +//// m_edgeId[phi3(dit)] = m_edgeId[dit] ; +//// else +//// m_edgeId[dit] = m_edgeId[phi3(dit)]; +// +// //FaceId +// m_faceId[dit] = fId; +// m_faceId[phi3(dit)] = fId; +// +// dit = phi1(dit); +// } +// while(dit != d); +//} +// +//void ImplicitHierarchicalMap3::splitVolume(std::vector& vd) +//{ +// EmbeddedMap3::splitVolume(vd); +// +// unsigned int fId = getNewFaceId(); +// +// for(std::vector::iterator it = vd.begin() ; it != vd.end() ; ++it) +// { +// Dart dit = *it; +// +// //Edge Id +// m_edgeId[phi2(dit)] = m_edgeId[dit]; +// +// //Face Id +// m_faceId[phi2(dit)] = fId; +// } +//} + + void ImplicitHierarchicalMap3::initEdgeId() { DartMarker edgeMark(*this) ; @@ -106,11 +204,8 @@ void ImplicitHierarchicalMap3::initFaceId() faceMark.mark(e); Dart e3 = Map3::phi3(e); - if(e3 != e) - { - m_faceId[e3] = m_faceIdCount ; - faceMark.mark(e3); - } + m_faceId[e3] = m_faceIdCount ; + faceMark.mark(e3); e = Map3::phi1(e); } while(e != d); @@ -402,7 +497,7 @@ bool ImplicitHierarchicalMap3::volumeIsSubdivided(Dart d) std::vector::iterator face; - Dart old = d ; +// Dart old = d ; bool facesAreSubdivided = faceIsSubdivided(d) ; //parcours les faces du volume au niveau courant diff --git a/src/Topology/gmap/embeddedGMap3.cpp b/src/Topology/gmap/embeddedGMap3.cpp index c9ac888fd..75f87c301 100644 --- a/src/Topology/gmap/embeddedGMap3.cpp +++ b/src/Topology/gmap/embeddedGMap3.cpp @@ -108,6 +108,19 @@ bool EmbeddedGMap3::uncutEdge(Dart d) return false ; } +Dart EmbeddedGMap3::deleteEdge(Dart d) +{ + Dart v = GMap3::deleteEdge(d) ; + if(v != NIL) + { + if (isOrbitEmbedded(VOLUME)) + { + embedOrbit(VOLUME, v, getEmbedding(VOLUME, v)) ; + } + } + return v ; +} + void EmbeddedGMap3::splitFace(Dart d, Dart e) { Dart dd = beta1(beta3(d)); diff --git a/src/Topology/map/embeddedMap3.cpp b/src/Topology/map/embeddedMap3.cpp index 688c8c187..c529321bf 100644 --- a/src/Topology/map/embeddedMap3.cpp +++ b/src/Topology/map/embeddedMap3.cpp @@ -109,7 +109,7 @@ bool EmbeddedMap3::uncutEdge(Dart d) Dart EmbeddedMap3::deleteEdge(Dart d) { - Dart v = Map3::deleteVertex(d) ; + Dart v = Map3::deleteEdge(d) ; if(v != NIL) { if(isOrbitEmbedded(VOLUME)) @@ -125,7 +125,7 @@ bool EmbeddedMap3::edgeCanCollapse(Dart d) //Criteres sur le bord if(isBoundaryEdge(d)) { - //fusion de deux bord + //fusion de deux bords //deconnection du bord } diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index 495f38e95..bd7a73d1d 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -90,7 +90,7 @@ Dart Map3::deleteVertex(Dart d) FunctorStore fs(fstoretmp); foreach_dart_of_vertex(d, fs); - // just one dart per face + // just one dart per face std::vector fstore; fstore.reserve(128); DartMarker mf(*this); @@ -237,7 +237,7 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes) if(delDegenerateVolumes) { Map2::collapseEdge(e, true); - //collapseDegeneretedVolume(e); + collapseDegeneretedVolume(e); } else Map2::collapseEdge(e, false); @@ -247,10 +247,10 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes) } - }while(d != dit); - + return resV; +} @@ -304,8 +304,7 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes) // } // } - return resV; -} + void Map3::splitFace(Dart d, Dart e) { @@ -326,22 +325,18 @@ bool Map3::collapseDegeneretedVolume(Dart d) Dart e1 = phi2(d); Dart e2 = phi2(phi1(d)); - //Si l'une des faces est du bord - if(isBoundaryFace(e1) || isBoundaryFace(e2)) + //Si les deux faces ne sont pas du bord + if(!isBoundaryFace(e1) && !isBoundaryFace(e2)) { - //alors simple suppression du volume degenere + sewVolumes(phi3(e1),phi3(e2)); + deleteVolume(d); + return true; } else { - Dart e13 = e1; - Dart e23 = e2; - if(!isBoundaryFace(e1)) - e13 = phi3(e1); - - if(!isBoundaryFace(e2)) - e23 = phi3(e2); - - //if(faceDegree(e1) < faceDegree) + //alors simple suppression du volume degenere + deleteVolume(d); + return true; } return false; -- GitLab