diff --git a/apps/nexus/history.cpp b/apps/nexus/history.cpp index 4862aae6..77b7f239 100644 --- a/apps/nexus/history.cpp +++ b/apps/nexus/history.cpp @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2005/02/08 12:43:03 ponchio +Added copyright + ****************************************************************************/ @@ -325,7 +328,7 @@ bool History::UpdatesToQuick() { return LoadPointers(); } -void History::BuildLevels(map &levels) { +void History::BuildLevels(vector &levels) { levels.clear(); if(buffer) { //Saved in quick mode: @@ -336,7 +339,8 @@ void History::BuildLevels(map &levels) { if(node != nodes) { //not root Link *inlink = node->in_begin(); unsigned int p = inlink->begin()->patch; - assert(levels.count(p)); + assert(p < levels.size()); + assert(p >= 0); current = levels[p]+1; } for(l = node->out_begin(); l != node->out_end(); l++) { @@ -344,12 +348,12 @@ void History::BuildLevels(map &levels) { Link::iterator c; for(c = link.begin(); c != link.end(); c++) { unsigned int p = (*c).patch; + while(p >= levels.size()) levels.push_back(-1); levels[p] = current; } } } } else { - cerr << "updates.size: " << updates.size() << endl; //Saved in updates mode: for(unsigned int i = 0; i < updates.size(); i++) { Update &u = updates[i]; @@ -357,7 +361,9 @@ void History::BuildLevels(map &levels) { if(!u.erased.size()) current = 0; else current = levels[u.erased[0]] + 1; for(unsigned int i = 0; i < u.created.size(); i++) { - levels[u.created[i]] = current; + unsigned int p = u.created[i]; + while(p >= levels.size()) levels.push_back(-1); + levels[p] = current; } } } diff --git a/apps/nexus/history.h b/apps/nexus/history.h index fa5e3d76..b6bdfda0 100644 --- a/apps/nexus/history.h +++ b/apps/nexus/history.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2005/02/08 12:43:03 ponchio +Added copyright + ****************************************************************************/ @@ -113,7 +116,7 @@ namespace nxs { bool UpdatesToQuick(); bool IsQuick() { return buffer != NULL; } - void BuildLevels(std::map &levels); + void BuildLevels(std::vector &levels); int &quick() { return ((int *)buffer)[0]; } int &n_nodes() { return ((int *)buffer)[1]; } diff --git a/apps/nexus/nxsalgo.cpp b/apps/nexus/nxsalgo.cpp index 7f15a27d..8afadb0d 100644 --- a/apps/nexus/nxsalgo.cpp +++ b/apps/nexus/nxsalgo.cpp @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.17 2005/02/08 12:43:03 ponchio +Added copyright + ****************************************************************************/ @@ -81,7 +84,7 @@ void nxs::ComputeNormals(Nexus &nexus) { tmpb.Flush(); - map levels; + vector levels; nexus.history.BuildLevels(levels); //first step normals in the same patch. @@ -90,7 +93,7 @@ void nxs::ComputeNormals(Nexus &nexus) { vector normals; for(unsigned int p = 0; p < nexus.size(); p++) { - unsigned int current_level = levels[p]; + int current_level = levels[p]; report.Step(p); Patch &patch = nexus.GetPatch(p);