From 4c35b952200baf6b707590dafa8de7930e4cfed1 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Mon, 26 Mar 2012 16:28:33 +0200 Subject: [PATCH] start debug copyFrom --- include/Algo/MC/marchingcube.hpp | 6 ++-- include/Topology/generic/genericmap.h | 28 +++++++++---------- src/Container/attributeContainer.cpp | 2 -- src/Container/holeblockref.cpp | 8 ++---- src/Topology/generic/genericmap.cpp | 40 ++++++++++++--------------- 5 files changed, 37 insertions(+), 47 deletions(-) diff --git a/include/Algo/MC/marchingcube.hpp b/include/Algo/MC/marchingcube.hpp index 31e8311f..e318053f 100644 --- a/include/Algo/MC/marchingcube.hpp +++ b/include/Algo/MC/marchingcube.hpp @@ -1262,9 +1262,9 @@ void MarchingCube::recalPoints(const Geom::Vec3f& orig { typename PFP::VEC3& P = m_positions[i]; P -= m_fOrigin; - P[0] = (P[0]-0.5f) * m_fScal[0]; - P[1] = (P[1]-0.5f) * m_fScal[1]; - P[2] = (P[2]-0.5f) * m_fScal[2]; + P[0] = (P[0]+0.5f) * m_fScal[0]; + P[1] = (P[1]+0.5f) * m_fScal[1]; + P[2] = (P[2]+0.5f) * m_fScal[2]; P+=origin; } } diff --git a/include/Topology/generic/genericmap.h b/include/Topology/generic/genericmap.h index 6a1943d4..1219ceb1 100644 --- a/include/Topology/generic/genericmap.h +++ b/include/Topology/generic/genericmap.h @@ -428,7 +428,7 @@ protected: * @param name name of the relation * @return the attribute multi-vector pointer */ - AttributeMultiVector* getRelation(const std::string& name); + AttributeMultiVector* getRelation(const std::string& name) ; /**************************************** * THREAD MANAGEMENT * @@ -506,22 +506,22 @@ public: /** * copy from another map (of same type) */ - bool copyFrom(const GenericMap& map); + bool copyFrom(const GenericMap& map) ; /** * Dump attributes types and names per orbit */ - void dumpAttributesAndMarkers(); + void dumpAttributesAndMarkers() ; /** * 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 */ - void compact(); + void compact() ; /**************************************** * DARTS TRAVERSALS * @@ -531,13 +531,13 @@ public: * Begin of map * @return the first dart of the map */ - Dart begin() const; + Dart begin() const ; /** * End of map * @return the end iterator (next of last) of the map */ - Dart end() const; + Dart end() const ; /** * allow to go from a dart to the next @@ -590,39 +590,39 @@ public: protected: /// boundary marker - Mark m_boundaryMarker; + Mark m_boundaryMarker ; /** * mark a dart as belonging to boundary */ - void boundaryMark(Dart d); + void boundaryMark(Dart d) ; /** * unmark a dart from the boundary */ - void boundaryUnmark(Dart d); + void boundaryUnmark(Dart d) ; public: /** * test if a dart belong to the boundary */ - bool isBoundaryMarked(Dart d) const; + bool isBoundaryMarked(Dart d) const ; protected: /** * mark an orbit of dart as belonging to boundary */ - void boundaryMarkOrbit(unsigned int orbit, Dart d); + void boundaryMarkOrbit(unsigned int orbit, Dart d) ; /** * unmark an orbit of dart from the boundary */ - void boundaryUnmarkOrbit(unsigned int orbit, Dart d); + void boundaryUnmarkOrbit(unsigned int orbit, Dart d) ; /** * clear all boundary markers */ - void boundaryUnmarkAll(); + void boundaryUnmarkAll() ; } ; // diff --git a/src/Container/attributeContainer.cpp b/src/Container/attributeContainer.cpp index c80fabb9..19fecf88 100644 --- a/src/Container/attributeContainer.cpp +++ b/src/Container/attributeContainer.cpp @@ -690,7 +690,6 @@ bool AttributeContainer::loadBin(CGoGNistream& fs) return true; } - void AttributeContainer::copyFrom(const AttributeContainer& cont) { // clear is done from the map @@ -742,5 +741,4 @@ void AttributeContainer::copyFrom(const AttributeContainer& cont) } } - } diff --git a/src/Container/holeblockref.cpp b/src/Container/holeblockref.cpp index 677f300c..fa89073a 100644 --- a/src/Container/holeblockref.cpp +++ b/src/Container/holeblockref.cpp @@ -40,8 +40,7 @@ namespace CGoGN { -HoleBlockRef::HoleBlockRef(): -m_nbfree(0),m_nbref(0),m_nb(0) +HoleBlockRef::HoleBlockRef() : m_nbfree(0), m_nbref(0), m_nb(0) { m_tableFree = new unsigned int[_BLOCKSIZE_ + 10]; m_refCount = new unsigned int[_BLOCKSIZE_]; @@ -53,12 +52,11 @@ HoleBlockRef::HoleBlockRef(const HoleBlockRef& hb) m_nbref = hb.m_nbref; m_nb = hb.m_nb; - m_tableFree = new unsigned int[_BLOCKSIZE_ +10]; - memcpy(m_tableFree, hb.m_tableFree, (_BLOCKSIZE_+ 10) * sizeof(unsigned int)); + m_tableFree = new unsigned int[_BLOCKSIZE_ + 10]; + memcpy(m_tableFree, hb.m_tableFree, (_BLOCKSIZE_ + 10) * sizeof(unsigned int)); m_refCount = new unsigned int[_BLOCKSIZE_]; memcpy(m_refCount, hb.m_refCount, _BLOCKSIZE_ * sizeof(unsigned int)); - } HoleBlockRef::~HoleBlockRef() diff --git a/src/Topology/generic/genericmap.cpp b/src/Topology/generic/genericmap.cpp index 0c898e5b..bf74e5dc 100644 --- a/src/Topology/generic/genericmap.cpp +++ b/src/Topology/generic/genericmap.cpp @@ -578,20 +578,16 @@ bool GenericMap::loadMapBin(const std::string& filename) return true; } - - bool GenericMap::copyFrom(const GenericMap& map) { if (mapTypeName() != map.mapTypeName()) { - CGoGNerr <<"try to copy from incompatible type map" << CGoGNendl; + CGoGNerr << "try to copy from incompatible type map" << CGoGNendl; return false; } GenericMap::clear(true); - - // load attrib container for (unsigned int i = 0; i < NB_ORBITS; ++i) m_attribs[i].copyFrom(map.m_attribs[i]); @@ -601,13 +597,12 @@ bool GenericMap::copyFrom(const GenericMap& map) m_mrattribs.copyFrom(map.m_mrattribs); m_mrCurrentLevel = map.m_mrCurrentLevel; - unsigned int nb= map.m_mrNbDarts.size(); + unsigned int nb = map.m_mrNbDarts.size(); m_mrNbDarts.resize(nb); - for (unsigned int i=0; i 6) // thread number is >9 - thread = 10*thread + listeNames[i][6]-'0'; + thread = 10*thread + (listeNames[i][6]-'0'); AttributeMultiVector* amvMark = cont.getDataVector(i); m_markTables[orbit][thread] = amvMark ; @@ -682,34 +677,34 @@ void GenericMap::update_topo_shortcuts() { std::vector names; m_mrattribs.getAttributesNames(names); - m_mrDarts.resize(names.size()-1); - for (unsigned int i=0; i(i); - if (sub=="MRdart_") + if (sub == "MRdart_") { sub = names[i].substr(7); // compute number following MT_Dart_ - unsigned int idx=0; - for (unsigned int j=0; j < sub.length(); j++) - idx = 10*idx+(sub[j]-'0'); - if (idx < names.size()-1) + unsigned int idx = 0; + for (unsigned int j = 0; j < sub.length(); j++) + idx = 10*idx + (sub[j]-'0'); + if (idx < names.size() - 1) m_mrDarts[idx] = m_mrattribs.getDataVector(i); else - CGoGNerr<<"Warning problem updating MR_DARTS" << CGoGNendl; + CGoGNerr << "Warning problem updating MR_DARTS" << CGoGNendl; } } // check if all pointers are != NULL - for (unsigned int i=0; i oldnew; m_attribs[DART].compact(oldnew); - // update MR indices to attribs[DART] if (m_isMultiRes) { @@ -830,7 +824,7 @@ void GenericMap::compact() } } - // update topo relations from real map + // update topo relations from real map compactTopoRelations(oldnewMR); // dumpAttributesAndMarkers(); -- GitLab