Commit 954ab76a authored by Pierre Kraemer's avatar Pierre Kraemer

newDart with MR duplicate

parent dfdc8a9f
...@@ -86,10 +86,22 @@ inline Dart GenericMap::newDart() ...@@ -86,10 +86,22 @@ inline Dart GenericMap::newDart()
{ {
unsigned int mrdi = m_mrattribs.insertLine() ; unsigned int mrdi = m_mrattribs.insertLine() ;
m_mrLevels->operator[](mrdi) = m_mrCurrentLevel ; m_mrLevels->operator[](mrdi) = m_mrCurrentLevel ;
for(unsigned int i = 0; i < m_mrCurrentLevel; ++i) for(unsigned int i = 0; i < m_mrCurrentLevel; ++i)
m_mrDarts[i]->operator[](mrdi) = MRNULL ; m_mrDarts[i]->operator[](mrdi) = MRNULL ;
for(unsigned int i = m_mrCurrentLevel; i < m_mrDarts.size(); ++i)
m_mrDarts[i]->operator[](mrdi) = di ; m_mrDarts[m_mrCurrentLevel]->operator[](mrdi) = di ;
for(unsigned int i = m_mrCurrentLevel + 1; i < m_mrDarts.size(); ++i)
{
unsigned int dj = m_attribs[DART].insertLine();
for(unsigned int o = 0; o < NB_ORBITS; ++o)
{
if (m_embeddings[o])
(*m_embeddings[o])[dj] = EMBNULL ;
}
m_mrDarts[i]->operator[](mrdi) = dj ;
}
return Dart::create(mrdi) ; return Dart::create(mrdi) ;
} }
return Dart::create(di) ; return Dart::create(di) ;
......
...@@ -69,9 +69,21 @@ inline void Map1::update_topo_shortcuts() ...@@ -69,9 +69,21 @@ inline void Map1::update_topo_shortcuts()
inline Dart Map1::newDart() inline Dart Map1::newDart()
{ {
Dart d = GenericMap::newDart() ; Dart d = GenericMap::newDart() ;
unsigned int d_index = dartIndex(d); unsigned int d_index = dartIndex(d) ;
(*m_phi1)[d_index] = d ; (*m_phi1)[d_index] = d ;
(*m_phi_1)[d_index] = d ; (*m_phi_1)[d_index] = d ;
if(m_isMultiRes)
{
pushLevel() ;
for(unsigned int i = m_mrCurrentLevel + 1; i < m_mrDarts.size(); ++i)
{
setCurrentLevel(i) ;
unsigned int d_index = dartIndex(d) ;
(*m_phi1)[d_index] = d ;
(*m_phi_1)[d_index] = d ;
}
popLevel() ;
}
return d ; return d ;
} }
......
...@@ -68,6 +68,16 @@ inline Dart Map2::newDart() ...@@ -68,6 +68,16 @@ inline Dart Map2::newDart()
{ {
Dart d = Map1::newDart() ; Dart d = Map1::newDart() ;
(*m_phi2)[dartIndex(d)] = d ; (*m_phi2)[dartIndex(d)] = d ;
if(m_isMultiRes)
{
pushLevel() ;
for(unsigned int i = m_mrCurrentLevel + 1; i < m_mrDarts.size(); ++i)
{
setCurrentLevel(i) ;
(*m_phi2)[dartIndex(d)] = d ;
}
popLevel() ;
}
return d ; return d ;
} }
......
...@@ -65,8 +65,17 @@ inline void Map3::update_topo_shortcuts() ...@@ -65,8 +65,17 @@ inline void Map3::update_topo_shortcuts()
inline Dart Map3::newDart() inline Dart Map3::newDart()
{ {
Dart d = Map2::newDart() ; Dart d = Map2::newDart() ;
unsigned int d_index = dartIndex(d); (*m_phi3)[dartIndex(d)] = d ;
(*m_phi3)[d_index] = d ; if(m_isMultiRes)
{
pushLevel() ;
for(unsigned int i = m_mrCurrentLevel + 1; i < m_mrDarts.size(); ++i)
{
setCurrentLevel(i) ;
(*m_phi3)[dartIndex(d)] = d ;
}
popLevel() ;
}
return d ; return d ;
} }
......
...@@ -177,20 +177,6 @@ void GenericMap::addLevel() ...@@ -177,20 +177,6 @@ void GenericMap::addLevel()
m_mrDarts.push_back(amvMR) ; m_mrDarts.push_back(amvMR) ;
// copy the darts pointers of the previous level
if(m_mrDarts.size() > 1)
m_mrattribs.copyAttribute(amvMR->getIndex(), m_mrDarts[m_mrDarts.size() - 2]->getIndex()) ;
}
void GenericMap::addLevelDuplicate()
{
unsigned int newLevel = m_mrDarts.size() ;
std::stringstream ss ;
ss << "MRdart_"<< newLevel ;
AttributeMultiVector<unsigned int>* amvMR = m_mrattribs.addAttribute<unsigned int>(ss.str()) ;
m_mrDarts.push_back(amvMR) ;
// copy the darts pointers of the previous level // copy the darts pointers of the previous level
if(m_mrDarts.size() > 1) if(m_mrDarts.size() > 1)
m_mrattribs.copyAttribute(amvMR->getIndex(), m_mrDarts[newLevel - 1]->getIndex()) ; m_mrattribs.copyAttribute(amvMR->getIndex(), m_mrDarts[newLevel - 1]->getIndex()) ;
......
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