diff --git a/include/Topology/generic/genericmap.h b/include/Topology/generic/genericmap.h index d4c26cb9bd9149b8276bfcd924bcbbc1ab835689..2743e396365768adaf5308e97cc4633fa3b611b8 100644 --- a/include/Topology/generic/genericmap.h +++ b/include/Topology/generic/genericmap.h @@ -301,8 +301,8 @@ protected: AttributeMultiVector* addRelation(const std::string& name) ; /** - * Get attributeMultivector pointer of a relation attribute - * @param anem name of relation + * Get AttributeMultivector pointer of a relation attribute + * @param name name of the relation * @return the attribute multi-vector pointer */ AttributeMultiVector* getRelation(const std::string& name); @@ -388,7 +388,7 @@ public: /** * update topo relation after compacting the container: */ - virtual void compactTopoRelations(const std::vector& oldnew)=0; + virtual void compactTopoRelations(const std::vector& oldnew) = 0; /** * compact the map diff --git a/include/Topology/generic/genericmap.hpp b/include/Topology/generic/genericmap.hpp index d8d9bbfdcc87c0fbb3573ca82dbec8e501aa9703..94c7f8fcac0e141bbc515f5d1868145fc9af93cc 100644 --- a/include/Topology/generic/genericmap.hpp +++ b/include/Topology/generic/genericmap.hpp @@ -218,6 +218,4 @@ inline AttributeMultiVector* GenericMap::getRelation(const std::string& na return amv ; } - - } //namespace CGoGN diff --git a/include/Topology/map/map1.hpp b/include/Topology/map/map1.hpp index 029f6c73e7ab85c2fbd62e0d184d8acf7f167c58..a843ac7efac9359f57ecefd35a372d3a6895d4f1 100644 --- a/include/Topology/map/map1.hpp +++ b/include/Topology/map/map1.hpp @@ -62,8 +62,6 @@ inline void Map1::update_topo_shortcuts() m_phi_1 = getRelation("phi_1"); } - - /*! @name Basic Topological Operators * Access and Modification *************************************************************************/ diff --git a/include/Topology/map/map2.h b/include/Topology/map/map2.h index 2b7f2301d81a3486d9f11fdde8d1546ee25a28e7..72c8130f82bc1244c52dda047c783ffb82a3e92b 100644 --- a/include/Topology/map/map2.h +++ b/include/Topology/map/map2.h @@ -65,7 +65,7 @@ public: virtual void update_topo_shortcuts(); - virtual void compactTopoRelations( const std::vector& oldnew); + virtual void compactTopoRelations(const std::vector& oldnew); /*! @name Basic Topological Operators * Access and Modification diff --git a/include/Topology/map/map2.hpp b/include/Topology/map/map2.hpp index 7f752d43b0926392e2fd716190c8778f10a47950..b649f13a62469b7f52c24bab6bd420ccbdbdfa8b 100644 --- a/include/Topology/map/map2.hpp +++ b/include/Topology/map/map2.hpp @@ -54,7 +54,6 @@ inline void Map2::clear(bool removeAttrib) init() ; } - inline void Map2::update_topo_shortcuts() { Map1::update_topo_shortcuts(); diff --git a/include/Topology/map/map3.hpp b/include/Topology/map/map3.hpp index ed04e51bbf3ed3569796c80c6b73c1117951094d..246f4b0c8048fdda1de2bfd81e246102e7031390 100644 --- a/include/Topology/map/map3.hpp +++ b/include/Topology/map/map3.hpp @@ -52,7 +52,6 @@ inline void Map3::clear(bool removeAttrib) init() ; } - inline void Map3::update_topo_shortcuts() { Map2::update_topo_shortcuts(); diff --git a/src/Topology/generic/genericmap.cpp b/src/Topology/generic/genericmap.cpp index 723fc72f56c079599453260e0cabb0edce888672..da2393f93bafbac34495b5176dd6a7509dfdc6e8 100644 --- a/src/Topology/generic/genericmap.cpp +++ b/src/Topology/generic/genericmap.cpp @@ -305,8 +305,6 @@ void GenericMap::removeThreadMarker(unsigned int nb) * SAVE & LOAD * ****************************************/ - - bool GenericMap::saveMapBin(const std::string& filename) { CGoGNostream fs(filename.c_str(), std::ios::out|std::ios::binary); @@ -318,28 +316,25 @@ bool GenericMap::saveMapBin(const std::string& filename) // Entete char* buff = new char[256]; - for (int i=0; i< 256; ++i) + for (int i = 0; i < 256; ++i) buff[i] = char(255); const char* cgogn = "CGoGN_Map"; - memcpy(buff,cgogn,10); + memcpy(buff, cgogn, 10); std::string mt = mapTypeName(); const char* mtc = mt.c_str(); - memcpy(buff+32,mtc,mt.size()+1); - unsigned int *buffi = reinterpret_cast(buff+64); + memcpy(buff+32, mtc, mt.size()+1); + unsigned int *buffi = reinterpret_cast(buff + 64); *buffi = NB_ORBITS; fs.write(reinterpret_cast(buff), 256); delete buff; // save all attribs - for (unsigned int i=0; imapTypeName(); @@ -373,12 +368,12 @@ bool GenericMap::loadMapBin(const std::string& filename) if (fileType != localType) { - CGoGNerr << "Not possible to load "<< fileType<< " into "<< localType << " object"<(buff+64); + unsigned int *ptr_nbo = reinterpret_cast(buff + 64); unsigned int nbo = *ptr_nbo; if (nbo != NB_ORBITS) { @@ -387,7 +382,7 @@ bool GenericMap::loadMapBin(const std::string& filename) } // load attrib container - for (unsigned int i=0; i* amv = cont.getDataVector(i); m_embeddings[orb] = amv ; } } } - void GenericMap::update_topo_shortcuts() { - for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit) { AttributeContainer& cont = m_attribs[orbit]; @@ -440,32 +430,28 @@ void GenericMap::update_topo_shortcuts() for (unsigned int i = 0; i < listeNames.size(); ++i) { - std::string sub = listeNames[i].substr(0,5); + std::string sub = listeNames[i].substr(0, 5); if (sub == "Mark_") { // get thread number unsigned int thread = listeNames[i][5]-'0'; - if (listeNames[i].size()>6) // thread number is >9 + if (listeNames[i].size() > 6) // thread number is >9 thread = 10*thread + listeNames[i][6]-'0'; AttributeMultiVector* amvMark = cont.getDataVector(i); m_markTables[orbit][thread] = amvMark ; - if ((orbit == DART) && (thread==0)) // for Marker of dart of thread O keep the boundary marker + if ((orbit == DART) && (thread == 0)) // for Marker of dart of thread O keep the boundary marker { Mark m(m_boundaryMarker); m.invert(); - for (unsigned int i=cont.begin();i!= cont.end(); cont.next(i)) - { + for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i)) amvMark->operator[](i).unsetMark(m); - } } else // for others clear all { - for (unsigned int i=cont.begin();i!= cont.end(); cont.next(i)) - { + for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i)) amvMark->operator[](i).clear(); - } } } } @@ -474,38 +460,36 @@ void GenericMap::update_topo_shortcuts() void GenericMap::dumpAttributesAndMarkers() { - for (unsigned int i = 0; i names; - names.reserve(32); //just tp limit reallocation + names.reserve(32); //just to limit reallocation m_attribs[i].getAttributesNames(names); unsigned int nb = names.size(); - if (nb>0) + if (nb > 0) { - CGoGNout << "ORBIT "<< i<< CGoGNendl; + CGoGNout << "ORBIT "<< i << CGoGNendl; std::vector types; types.reserve(nb); m_attribs[i].getAttributesTypes(types); - for (unsigned int j=0; j oldnew; @@ -526,11 +509,11 @@ void GenericMap::compact() { m_attribs[orbit].compact(oldnew); - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) { unsigned int& idx = m_embeddings[orbit]->operator [](i); unsigned int jdx = oldnew[idx]; - if ((jdx != 0xffffffff) && (jdx!=idx)) + if ((jdx != 0xffffffff) && (jdx != idx)) idx = jdx; } } @@ -832,5 +815,3 @@ void GenericMap::boundaryUnmarkAll() // // return true ; //} - - diff --git a/src/Topology/gmap/gmap0.cpp b/src/Topology/gmap/gmap0.cpp index c29df7894009539700bd30ff97440ebf45f4982d..a2b300b341c133e6dc971291a9c71e73f31e58dc 100644 --- a/src/Topology/gmap/gmap0.cpp +++ b/src/Topology/gmap/gmap0.cpp @@ -27,6 +27,17 @@ namespace CGoGN { +void GMap0::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + Dart& d = m_beta0->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } +} + /*! @name Constructors and Destructors * To generate or delete edges in a 0-G-map *************************************************************************/ @@ -45,15 +56,4 @@ void GMap0::deleteEdge(Dart d) deleteDart(d); } -void GMap0::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - Dart& d = m_beta0->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } -} - } // namespace CGoGN diff --git a/src/Topology/gmap/gmap1.cpp b/src/Topology/gmap/gmap1.cpp index d33147500442960507ec27944f4070a1519024d3..a8550b84cd35740741eab39a8fd2bc7e0256fc10 100644 --- a/src/Topology/gmap/gmap1.cpp +++ b/src/Topology/gmap/gmap1.cpp @@ -27,6 +27,25 @@ namespace CGoGN { +void GMap1::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + { + Dart& d = m_beta0->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_beta1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + } +} + /*! @name Constructors and Destructors * To generate or delete faces in a 1-G-map *************************************************************************/ @@ -75,24 +94,4 @@ void GMap1::deleteFace(Dart d) deleteEdge(d); } -void GMap1::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - { - Dart& d = m_beta0->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_beta1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - } -} - } // namespace CGoGN - diff --git a/src/Topology/gmap/gmap2.cpp b/src/Topology/gmap/gmap2.cpp index c8536dbd228450681b30473fb333053a4d050d3b..a16648010bbd7834c4db39d900c68a8149293fb1 100644 --- a/src/Topology/gmap/gmap2.cpp +++ b/src/Topology/gmap/gmap2.cpp @@ -28,6 +28,31 @@ namespace CGoGN { +void GMap2::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + { + Dart& d = m_beta0->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_beta1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_beta2->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + } +} + /*! @name Generator and Deletor * To generate or delete faces in a 2-G-map *************************************************************************/ @@ -895,32 +920,4 @@ void GMap2::closeMap() } } - - -void GMap2::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - { - Dart& d = m_beta0->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_beta1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_beta2->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - } -} - - } // namespace CGoGN diff --git a/src/Topology/gmap/gmap3.cpp b/src/Topology/gmap/gmap3.cpp index 1bdfa72d1552c03953fa86574320b037078748c8..f628be3bd5d8302064370b4decb42b2201ec8e59 100644 --- a/src/Topology/gmap/gmap3.cpp +++ b/src/Topology/gmap/gmap3.cpp @@ -28,6 +28,37 @@ namespace CGoGN { +void GMap3::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + { + Dart& d = m_beta0->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_beta1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_beta2->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_beta3->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + } +} + /*! @name Generator and Deletor * To generate or delete volumes in a 3-G-map *************************************************************************/ @@ -916,36 +947,4 @@ void GMap3::closeMap() } } -inline void GMap3::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - { - Dart& d = m_beta0->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_beta1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_beta2->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_beta3->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - } -} - - } // namespace CGoGN diff --git a/src/Topology/map/map1.cpp b/src/Topology/map/map1.cpp index 8a868181d57caf3e27f7ab87a5b8eaab0f28588f..14bc10b62c54c013b7d2607e1b0055b0cea390c8 100644 --- a/src/Topology/map/map1.cpp +++ b/src/Topology/map/map1.cpp @@ -27,6 +27,25 @@ namespace CGoGN { +void Map1::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + { + Dart& d = m_phi1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_phi_1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + } +} + /*! @name Generator and Deletor * To generate or delete faces in a 1-map *************************************************************************/ @@ -84,25 +103,4 @@ void Map1::reverseCycle(Dart d) phi1sew(e, d) ; // Sew the last edge } - -void Map1::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - { - Dart& d = m_phi1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_phi_1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - } -} - - } // namespace CGoGN diff --git a/src/Topology/map/map2.cpp b/src/Topology/map/map2.cpp index 6991dfca359fdf361ab1b84a0fdacacad3366b8f..5eef91690db295cf61be82883722033939346a3d 100644 --- a/src/Topology/map/map2.cpp +++ b/src/Topology/map/map2.cpp @@ -28,6 +28,31 @@ namespace CGoGN { +void Map2::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + { + Dart& d = m_phi1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_phi_1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_phi2->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + } +} + /*! @name Generator and Deletor * To generate or delete faces in a 2-map *************************************************************************/ @@ -776,30 +801,4 @@ void Map2::closeMap() } } - -void Map2::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - { - Dart& d = m_phi1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_phi_1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_phi2->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - } -} - } // namespace CGoGN diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index a230bc3361614174ae7b1b672c16a6644b035a08..b3aaae350c62bcb6b08cd303ecf31e6112cb0299 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -27,6 +27,37 @@ namespace CGoGN { +void Map3::compactTopoRelations(const std::vector& oldnew) +{ + for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i)) + { + { + Dart& d = m_phi1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_phi_1->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_phi2->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + { + Dart& d = m_phi3->operator [](i); + Dart e = Dart(oldnew[d.index]); + if (d != e) + d = e; + } + } +} + /*! @name Generator and Deletor * To generate or delete volumes in a 3-map *************************************************************************/ @@ -878,36 +909,4 @@ void Map3::closeMap() } } - -void Map3::compactTopoRelations(const std::vector& oldnew) -{ - for (unsigned int i = m_attribs[DART].begin(); i!= m_attribs[DART].end(); m_attribs[DART].next(i)) - { - { - Dart& d = m_phi1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_phi_1->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_phi2->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - { - Dart& d = m_phi3->operator [](i); - Dart e = Dart(oldnew[d.index]); - if (d!=e) - d = e; - } - } -} - } // namespace CGoGN