Commit 4c35b952 authored by Pierre Kraemer's avatar Pierre Kraemer

start debug copyFrom

parent 359cf623
...@@ -1262,9 +1262,9 @@ void MarchingCube<DataType, Windowing, PFP>::recalPoints(const Geom::Vec3f& orig ...@@ -1262,9 +1262,9 @@ void MarchingCube<DataType, Windowing, PFP>::recalPoints(const Geom::Vec3f& orig
{ {
typename PFP::VEC3& P = m_positions[i]; typename PFP::VEC3& P = m_positions[i];
P -= m_fOrigin; P -= m_fOrigin;
P[0] = (P[0]-0.5f) * m_fScal[0]; P[0] = (P[0]+0.5f) * m_fScal[0];
P[1] = (P[1]-0.5f) * m_fScal[1]; P[1] = (P[1]+0.5f) * m_fScal[1];
P[2] = (P[2]-0.5f) * m_fScal[2]; P[2] = (P[2]+0.5f) * m_fScal[2];
P+=origin; P+=origin;
} }
} }
......
...@@ -428,7 +428,7 @@ protected: ...@@ -428,7 +428,7 @@ protected:
* @param name name of the relation * @param name name of the relation
* @return the attribute multi-vector pointer * @return the attribute multi-vector pointer
*/ */
AttributeMultiVector<Dart>* getRelation(const std::string& name); AttributeMultiVector<Dart>* getRelation(const std::string& name) ;
/**************************************** /****************************************
* THREAD MANAGEMENT * * THREAD MANAGEMENT *
...@@ -506,22 +506,22 @@ public: ...@@ -506,22 +506,22 @@ public:
/** /**
* copy from another map (of same type) * copy from another map (of same type)
*/ */
bool copyFrom(const GenericMap& map); bool copyFrom(const GenericMap& map) ;
/** /**
* Dump attributes types and names per orbit * Dump attributes types and names per orbit
*/ */
void dumpAttributesAndMarkers(); void dumpAttributesAndMarkers() ;
/** /**
* update topo relation after compacting the container: * update topo relation after compacting the container:
*/ */
virtual void compactTopoRelations(const std::vector<unsigned int>& oldnew) = 0; virtual void compactTopoRelations(const std::vector<unsigned int>& oldnew) = 0 ;
/** /**
* compact the map * compact the map
*/ */
void compact(); void compact() ;
/**************************************** /****************************************
* DARTS TRAVERSALS * * DARTS TRAVERSALS *
...@@ -531,13 +531,13 @@ public: ...@@ -531,13 +531,13 @@ public:
* Begin of map * Begin of map
* @return the first dart of the map * @return the first dart of the map
*/ */
Dart begin() const; Dart begin() const ;
/** /**
* End of map * End of map
* @return the end iterator (next of last) of the 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 * allow to go from a dart to the next
...@@ -590,39 +590,39 @@ public: ...@@ -590,39 +590,39 @@ public:
protected: protected:
/// boundary marker /// boundary marker
Mark m_boundaryMarker; Mark m_boundaryMarker ;
/** /**
* mark a dart as belonging to boundary * mark a dart as belonging to boundary
*/ */
void boundaryMark(Dart d); void boundaryMark(Dart d) ;
/** /**
* unmark a dart from the boundary * unmark a dart from the boundary
*/ */
void boundaryUnmark(Dart d); void boundaryUnmark(Dart d) ;
public: public:
/** /**
* test if a dart belong to the boundary * test if a dart belong to the boundary
*/ */
bool isBoundaryMarked(Dart d) const; bool isBoundaryMarked(Dart d) const ;
protected: protected:
/** /**
* mark an orbit of dart as belonging to boundary * 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 * 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 * clear all boundary markers
*/ */
void boundaryUnmarkAll(); void boundaryUnmarkAll() ;
} ; } ;
// //
......
...@@ -690,7 +690,6 @@ bool AttributeContainer::loadBin(CGoGNistream& fs) ...@@ -690,7 +690,6 @@ bool AttributeContainer::loadBin(CGoGNistream& fs)
return true; return true;
} }
void AttributeContainer::copyFrom(const AttributeContainer& cont) void AttributeContainer::copyFrom(const AttributeContainer& cont)
{ {
// clear is done from the map // clear is done from the map
...@@ -742,5 +741,4 @@ void AttributeContainer::copyFrom(const AttributeContainer& cont) ...@@ -742,5 +741,4 @@ void AttributeContainer::copyFrom(const AttributeContainer& cont)
} }
} }
} }
...@@ -40,8 +40,7 @@ ...@@ -40,8 +40,7 @@
namespace CGoGN namespace CGoGN
{ {
HoleBlockRef::HoleBlockRef(): HoleBlockRef::HoleBlockRef() : m_nbfree(0), m_nbref(0), m_nb(0)
m_nbfree(0),m_nbref(0),m_nb(0)
{ {
m_tableFree = new unsigned int[_BLOCKSIZE_ + 10]; m_tableFree = new unsigned int[_BLOCKSIZE_ + 10];
m_refCount = new unsigned int[_BLOCKSIZE_]; m_refCount = new unsigned int[_BLOCKSIZE_];
...@@ -53,12 +52,11 @@ HoleBlockRef::HoleBlockRef(const HoleBlockRef& hb) ...@@ -53,12 +52,11 @@ HoleBlockRef::HoleBlockRef(const HoleBlockRef& hb)
m_nbref = hb.m_nbref; m_nbref = hb.m_nbref;
m_nb = hb.m_nb; m_nb = hb.m_nb;
m_tableFree = new unsigned int[_BLOCKSIZE_ +10]; m_tableFree = new unsigned int[_BLOCKSIZE_ + 10];
memcpy(m_tableFree, hb.m_tableFree, (_BLOCKSIZE_+ 10) * sizeof(unsigned int)); memcpy(m_tableFree, hb.m_tableFree, (_BLOCKSIZE_ + 10) * sizeof(unsigned int));
m_refCount = new unsigned int[_BLOCKSIZE_]; m_refCount = new unsigned int[_BLOCKSIZE_];
memcpy(m_refCount, hb.m_refCount, _BLOCKSIZE_ * sizeof(unsigned int)); memcpy(m_refCount, hb.m_refCount, _BLOCKSIZE_ * sizeof(unsigned int));
} }
HoleBlockRef::~HoleBlockRef() HoleBlockRef::~HoleBlockRef()
......
...@@ -578,20 +578,16 @@ bool GenericMap::loadMapBin(const std::string& filename) ...@@ -578,20 +578,16 @@ bool GenericMap::loadMapBin(const std::string& filename)
return true; return true;
} }
bool GenericMap::copyFrom(const GenericMap& map) bool GenericMap::copyFrom(const GenericMap& map)
{ {
if (mapTypeName() != map.mapTypeName()) if (mapTypeName() != map.mapTypeName())
{ {
CGoGNerr <<"try to copy from incompatible type map" << CGoGNendl; CGoGNerr << "try to copy from incompatible type map" << CGoGNendl;
return false; return false;
} }
GenericMap::clear(true); GenericMap::clear(true);
// load attrib container // load attrib container
for (unsigned int i = 0; i < NB_ORBITS; ++i) for (unsigned int i = 0; i < NB_ORBITS; ++i)
m_attribs[i].copyFrom(map.m_attribs[i]); m_attribs[i].copyFrom(map.m_attribs[i]);
...@@ -601,13 +597,12 @@ bool GenericMap::copyFrom(const GenericMap& map) ...@@ -601,13 +597,12 @@ bool GenericMap::copyFrom(const GenericMap& map)
m_mrattribs.copyFrom(map.m_mrattribs); m_mrattribs.copyFrom(map.m_mrattribs);
m_mrCurrentLevel = map.m_mrCurrentLevel; m_mrCurrentLevel = map.m_mrCurrentLevel;
unsigned int nb= map.m_mrNbDarts.size(); unsigned int nb = map.m_mrNbDarts.size();
m_mrNbDarts.resize(nb); m_mrNbDarts.resize(nb);
for (unsigned int i=0; i<nb; ++i) for (unsigned int i = 0; i < nb; ++i)
m_mrNbDarts[i] = map.m_mrNbDarts[i]; m_mrNbDarts[i] = map.m_mrNbDarts[i];
} }
// retrieve m_embeddings (from m_attribs) // retrieve m_embeddings (from m_attribs)
update_m_emb_afterLoad(); update_m_emb_afterLoad();
...@@ -657,7 +652,7 @@ void GenericMap::update_topo_shortcuts() ...@@ -657,7 +652,7 @@ void GenericMap::update_topo_shortcuts()
// get thread number // get thread number
unsigned int thread = listeNames[i][5]-'0'; 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'; thread = 10*thread + (listeNames[i][6]-'0');
AttributeMultiVector<Mark>* amvMark = cont.getDataVector<Mark>(i); AttributeMultiVector<Mark>* amvMark = cont.getDataVector<Mark>(i);
m_markTables[orbit][thread] = amvMark ; m_markTables[orbit][thread] = amvMark ;
...@@ -682,34 +677,34 @@ void GenericMap::update_topo_shortcuts() ...@@ -682,34 +677,34 @@ void GenericMap::update_topo_shortcuts()
{ {
std::vector<std::string> names; std::vector<std::string> names;
m_mrattribs.getAttributesNames(names); m_mrattribs.getAttributesNames(names);
m_mrDarts.resize(names.size()-1); m_mrDarts.resize(names.size() - 1);
for (unsigned int i=0; i<m_mrDarts.size(); ++i) for (unsigned int i = 0; i < m_mrDarts.size(); ++i)
m_mrDarts[i] = NULL; m_mrDarts[i] = NULL;
for (unsigned int i = 0; i < names.size(); ++i) for (unsigned int i = 0; i < names.size(); ++i)
{ {
std::string sub = names[i].substr(0, 7); std::string sub = names[i].substr(0, 7);
if (sub=="MRLevel") if (sub == "MRLevel")
m_mrLevels = m_mrattribs.getDataVector<unsigned int>(i); m_mrLevels = m_mrattribs.getDataVector<unsigned int>(i);
if (sub=="MRdart_") if (sub == "MRdart_")
{ {
sub = names[i].substr(7); // compute number following MT_Dart_ sub = names[i].substr(7); // compute number following MT_Dart_
unsigned int idx=0; unsigned int idx = 0;
for (unsigned int j=0; j < sub.length(); j++) for (unsigned int j = 0; j < sub.length(); j++)
idx = 10*idx+(sub[j]-'0'); idx = 10*idx + (sub[j]-'0');
if (idx < names.size()-1) if (idx < names.size() - 1)
m_mrDarts[idx] = m_mrattribs.getDataVector<unsigned int>(i); m_mrDarts[idx] = m_mrattribs.getDataVector<unsigned int>(i);
else else
CGoGNerr<<"Warning problem updating MR_DARTS" << CGoGNendl; CGoGNerr << "Warning problem updating MR_DARTS" << CGoGNendl;
} }
} }
// check if all pointers are != NULL // check if all pointers are != NULL
for (unsigned int i=0; i<m_mrDarts.size(); ++i) for (unsigned int i = 0; i < m_mrDarts.size(); ++i)
{ {
if (m_mrDarts[i] == NULL) if (m_mrDarts[i] == NULL)
CGoGNerr<<"Warning problem MR_DARTS = NULL" << CGoGNendl; CGoGNerr << "Warning problem MR_DARTS = NULL" << CGoGNendl;
} }
} }
} }
...@@ -804,17 +799,16 @@ void GenericMap::compact() ...@@ -804,17 +799,16 @@ void GenericMap::compact()
} }
} }
} }
// delete allocated vectors // delete allocated vectors
for (unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit) for (unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
if ((orbit != DART) && (isOrbitEmbedded(orbit))) if ((orbit != DART) && (isOrbitEmbedded(orbit)))
delete[] oldnews[orbit]; delete[] oldnews[orbit];
//compacting the topo //compacting the topo
std::vector<unsigned int> oldnew; std::vector<unsigned int> oldnew;
m_attribs[DART].compact(oldnew); m_attribs[DART].compact(oldnew);
// update MR indices to attribs[DART] // update MR indices to attribs[DART]
if (m_isMultiRes) if (m_isMultiRes)
{ {
...@@ -830,7 +824,7 @@ void GenericMap::compact() ...@@ -830,7 +824,7 @@ void GenericMap::compact()
} }
} }
// update topo relations from real map // update topo relations from real map
compactTopoRelations(oldnewMR); compactTopoRelations(oldnewMR);
// dumpAttributesAndMarkers(); // dumpAttributesAndMarkers();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment