Commit 85cd31be authored by Pierre Kraemer's avatar Pierre Kraemer

map2MR : la suite !map2MR : la suite !# Please enter the commit message for...

map2MR : la suite !map2MR : la suite !# Please enter the commit message for your changes. Lines starting
parent 4797d495
......@@ -147,34 +147,19 @@ public:
* MULTIRES *
****************************************/
unsigned int getCurrentLevel() { return m_mrCurrentLevel ; }
void setCurrentLevel(unsigned int l)
{
if(l < m_mrDarts.size())
m_mrCurrentLevel = l ;
else
CGoGNout << "try to access inexisting resolution level" << CGoGNendl ;
}
void pushLevel() { m_mrLevelStack.push_back(m_mrCurrentLevel) ; }
void popLevel() { m_mrCurrentLevel = m_mrLevelStack.back() ; m_mrLevelStack.pop_back() ; }
unsigned int getMaxLevel() { return m_mrDarts.size() - 1 ; }
void addLevel()
{
unsigned int level = m_mrDarts.size() ;
std::stringstream ss ;
ss << "MRdart_"<< level ;
AttributeMultiVector<unsigned int>* amvMR = m_mrattribs.addAttribute<unsigned int>(ss.str()) ;
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()) ;
}
unsigned int getCurrentLevel() ;
void setCurrentLevel(unsigned int l) ;
void pushLevel() ;
void popLevel() ;
unsigned int getMaxLevel() ;
void addLevel() ;
unsigned int getDartLevel(Dart d) ;
/****************************************
* DARTS MANAGEMENT *
......
......@@ -32,6 +32,57 @@ inline unsigned int GenericMap::dartIndex(Dart d)
return d.index;
}
/****************************************
* MULTIRES *
****************************************/
inline unsigned int GenericMap::getCurrentLevel()
{
return m_mrCurrentLevel ;
}
inline void GenericMap::setCurrentLevel(unsigned int l)
{
if(l < m_mrDarts.size())
m_mrCurrentLevel = l ;
else
CGoGNout << "try to access inexisting resolution level" << CGoGNendl ;
}
inline void GenericMap::pushLevel()
{
m_mrLevelStack.push_back(m_mrCurrentLevel) ;
}
inline void GenericMap::popLevel()
{
m_mrCurrentLevel = m_mrLevelStack.back() ;
m_mrLevelStack.pop_back() ;
}
inline unsigned int GenericMap::getMaxLevel()
{
return m_mrDarts.size() - 1 ;
}
inline void GenericMap::addLevel()
{
unsigned int level = m_mrDarts.size() ;
std::stringstream ss ;
ss << "MRdart_"<< level ;
AttributeMultiVector<unsigned int>* amvMR = m_mrattribs.addAttribute<unsigned int>(ss.str()) ;
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()) ;
}
inline unsigned int GenericMap::getDartLevel(Dart d)
{
return m_mrLevels->operator [](d.index) ;
}
/****************************************
* DARTS MANAGEMENT *
****************************************/
......
......@@ -124,14 +124,8 @@ inline void Map1::phi1sew(Dart d, Dart e)
Dart g = (*m_phi1)[e_index] ;
(*m_phi1)[d_index] = g ;
(*m_phi1)[e_index] = f ;
// unsigned int g_index = dartIndex(g);
// (*m_phi_1)[g_index] = d ;
(*m_phi_1)[dartIndex(g)] = d ;
// unsigned int f_index = dartIndex(f);
// (*m_phi_1)[f_index] = e ;
(*m_phi_1)[dartIndex(f)] = e ;
}
inline void Map1::phi1unsew(Dart d)
......@@ -142,7 +136,6 @@ inline void Map1::phi1unsew(Dart d)
Dart f = (*m_phi1)[e_index] ;
(*m_phi1)[d_index] = f ;
(*m_phi1)[e_index] = e ;
// unsigned int f_index = dartIndex(f);
(*m_phi_1)[dartIndex(f)] = d ;
(*m_phi_1)[e_index] = e ;
}
......
......@@ -32,6 +32,77 @@ namespace CGoGN
class Map2MR_Primal : protected Map2
{
public:
Map2MR_Primal() ;
/***************************************************
* CELLS INFORMATION *
***************************************************/
/**
* Return the level of insertion of the vertex of d
*/
unsigned int vertexInsertionLevel(Dart d) ;
/**
* Return the level of the edge of d in the current level map
*/
unsigned int edgeLevel(Dart d) ;
/**
* Return the level of the face of d in the current level map
*/
unsigned int faceLevel(Dart d) ;
/**
* Given the face of d in the current level map,
* return a level 0 dart of its origin face
*/
Dart faceOrigin(Dart d) ;
/**
* Return the oldest dart of the face of d in the current level map
*/
Dart faceOldestDart(Dart d) ;
/**
* Return true if the edge of d in the current level map
* has already been subdivided to the next level
*/
bool edgeIsSubdivided(Dart d) ;
/**
* Return true if the edge of d in the current level map
* is subdivided to the next level,
* none of its resulting edges is in turn subdivided to the next level
* and the middle vertex is of degree 2
*/
bool edgeCanBeCoarsened(Dart d) ;
/**
* Return true if the face of d in the current level map
* has already been subdivided to the next level
*/
bool faceIsSubdivided(Dart d) ;
/**
* Return true if the face of d in the current level map
* is subdivided to the next level
* and none of its resulting faces is in turn subdivided to the next level
*/
bool faceIsSubdividedOnce(Dart d) ;
/***************************************************
* SUBDIVISION *
***************************************************/
void subdivideEdge(Dart d) ;
void subdivideFace(Dart d) ;
void coarsenEdge(Dart d) ;
void coarsenFace(Dart d) ;
} ;
} // namespace CGoGN
......
......@@ -66,7 +66,6 @@ void Map2::rdfi(Dart t, DartMarker& m1, DartMarker& m2)
}
}
void Map2::compactTopoRelations(const std::vector<unsigned int>& oldnew)
{
for (unsigned int i = m_attribs[DART].begin(); i != m_attribs[DART].end(); m_attribs[DART].next(i))
......@@ -217,10 +216,10 @@ Dart Map2::deleteVertex(Dart d)
Dart Map2::cutEdge(Dart d)
{
Dart e = phi2(d);
phi2unsew(d); // remove old phi2 links
phi2unsew(d); // remove old phi2 links
Dart nd = Map1::cutEdge(d); // Cut the 1-edge of d
Dart ne = Map1::cutEdge(e); // Cut the 1-edge of phi2(d)
phi2sew(d, ne); // Correct the phi2 links
phi2sew(d, ne); // Correct the phi2 links
phi2sew(e, nd);
return nd;
}
......
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