Commit b73e64da authored by Pierre Kraemer's avatar Pierre Kraemer

add initMR function to be called by MRmaps classes at construction

parent 366ba117
......@@ -113,22 +113,22 @@ protected:
#endif
/**
* container for mr-darts that store indices in attribs[DART] for each level
* container for multiresolution darts
*/
AttributeContainer m_mrattribs ;
/**
* pointer to indices mvectors (one for each level)
* pointers to attributes that store indices in m_attribs[DART] (one for each level)
*/
std::vector< AttributeMultiVector<unsigned int>* > m_mrDarts ;
/**
* pointers to mvector of levels
* pointer to attribute that stores darts insertion levels
*/
AttributeMultiVector<unsigned char>* m_mrLevels ;
AttributeMultiVector<unsigned int>* m_mrLevels ;
/**
* current level of multiresoltion
* current level in multiresolution map
*/
unsigned int m_mrCurrentLevel ;
......@@ -146,6 +146,11 @@ public:
virtual std::string mapTypeName() = 0 ;
/**
* initialize the multiresolution attribute container
*/
void initMR() ;
/**
* Clear the map
* @param removeAttrib
......
......@@ -67,7 +67,7 @@ inline unsigned int GenericMap::getMaxLevel()
inline unsigned int GenericMap::getDartLevel(Dart d)
{
return m_mrLevels->operator [](d.index) ;
return m_mrLevels->operator[](d.index) ;
}
/****************************************
......
......@@ -90,16 +90,6 @@ GenericMap::GenericMap() : m_nbThreads(1)
#ifndef CGoGN_FORCE_MR
m_isMultiRes = false;
#endif
if(m_isMultiRes)
{
m_mrDarts.reserve(16) ;
m_mrLevelStack.reserve(16) ;
m_mrLevels = m_mrattribs.addAttribute<unsigned char>("MRLevel") ;
addLevel() ;
setCurrentLevel(0) ;
}
}
GenericMap::~GenericMap()
......@@ -132,6 +122,21 @@ GenericMap::~GenericMap()
}
}
void GenericMap::initMR()
{
m_isMultiRes = true;
m_mrattribs.clear(true) ;
m_mrDarts.clear() ;
m_mrDarts.reserve(16) ;
m_mrLevelStack.clear() ;
m_mrLevelStack.reserve(16) ;
m_mrLevels = m_mrattribs.addAttribute<unsigned int>("MRLevel") ;
addLevel() ;
setCurrentLevel(0) ;
}
void GenericMap::clear(bool removeAttrib)
{
if (removeAttrib)
......@@ -154,15 +159,7 @@ void GenericMap::clear(bool removeAttrib)
}
if (m_isMultiRes)
{
m_mrattribs.clear(true) ;
m_mrDarts.clear() ;
m_mrLevels = m_mrattribs.addAttribute<unsigned char>("MRLevel") ;
addLevel() ;
setCurrentLevel(0) ;
m_mrLevelStack.clear() ;
}
initMR() ;
}
/****************************************
......@@ -551,7 +548,7 @@ void GenericMap::update_topo_shortcuts()
std::string sub = names[i].substr(0, 7);
if (sub=="MRLevel")
m_mrLevels = m_mrattribs.getDataVector<unsigned char>(i);
m_mrLevels = m_mrattribs.getDataVector<unsigned int>(i);
if (sub=="MRdart_")
{
......
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