Commit 35e4aa3e authored by Pierre Kraemer's avatar Pierre Kraemer

quick traversal fixes

parent 8425dfda
...@@ -214,6 +214,8 @@ void Viewer::importMesh(std::string& filename) ...@@ -214,6 +214,8 @@ void Viewer::importMesh(std::string& filename)
position = myMap.getAttribute<PFP::VEC3, VERTEX>(attrNames[0]) ; position = myMap.getAttribute<PFP::VEC3, VERTEX>(attrNames[0]) ;
} }
myMap.enableQuickTraversal<VERTEX>() ;
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ;
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ;
......
...@@ -371,13 +371,15 @@ inline void GenericMap::enableQuickTraversal() ...@@ -371,13 +371,15 @@ inline void GenericMap::enableQuickTraversal()
template <unsigned int ORBIT> template <unsigned int ORBIT>
inline void GenericMap::updateQuickTraversal() inline void GenericMap::updateQuickTraversal()
{ {
CellMarker<ORBIT> cm ; assert(m_quickTraversal[ORBIT] != NULL || !"updateQuickTraversal on a disabled orbit") ;
CellMarker<ORBIT> cm(*this) ;
for(Dart d = begin(); d != end(); next(d)) for(Dart d = begin(); d != end(); next(d))
{ {
if(!cm.isMarked(d)) if(!cm.isMarked(d))
{ {
cm.mark(d) ; cm.mark(d) ;
(*m_quickTraversal[ORBIT])[d.index] = d ; (*m_quickTraversal[ORBIT])[getEmbedding<ORBIT>(d)] = d ;
} }
} }
} }
......
...@@ -37,7 +37,9 @@ class TraversorCell ...@@ -37,7 +37,9 @@ class TraversorCell
{ {
private: private:
MAP& m ; MAP& m ;
AttributeContainer* cont ; AttributeContainer* cont ;
unsigned int qCurrent ;
DartMarker* dmark ; DartMarker* dmark ;
CellMarker<ORBIT>* cmark ; CellMarker<ORBIT>* cmark ;
......
...@@ -60,7 +60,8 @@ Dart TraversorCell<MAP, ORBIT>::begin() ...@@ -60,7 +60,8 @@ Dart TraversorCell<MAP, ORBIT>::begin()
{ {
if(quickTraversal != NULL) if(quickTraversal != NULL)
{ {
current = (*quickTraversal)[cont->begin()] ; qCurrent = cont->begin() ;
current = (*quickTraversal)[qCurrent] ;
} }
else else
{ {
...@@ -103,32 +104,40 @@ Dart TraversorCell<MAP, ORBIT>::next() ...@@ -103,32 +104,40 @@ Dart TraversorCell<MAP, ORBIT>::next()
{ {
if(current != NIL) if(current != NIL)
{ {
bool ismarked ; if(quickTraversal != NULL)
if(dmark) {
ismarked = dmark->isMarked(current) ; cont->next(qCurrent) ;
current = (*quickTraversal)[qCurrent] ;
}
else else
ismarked = cmark->isMarked(current) ;
while(current != NIL && (ismarked || m.isBoundaryMarked(current) || !m_good(current)))
{ {
m.next(current) ; bool ismarked ;
if(current == m.end()) if(dmark)
current = NIL ; ismarked = dmark->isMarked(current) ;
else else
ismarked = cmark->isMarked(current) ;
while(current != NIL && (ismarked || m.isBoundaryMarked(current) || !m_good(current)))
{ {
if(dmark) m.next(current) ;
ismarked = dmark->isMarked(current) ; if(current == m.end())
current = NIL ;
else else
ismarked = cmark->isMarked(current) ; {
if(dmark)
ismarked = dmark->isMarked(current) ;
else
ismarked = cmark->isMarked(current) ;
}
} }
}
if(current != NIL) if(current != NIL)
{ {
if(dmark) if(dmark)
dmark->markOrbit<ORBIT>(current) ; dmark->markOrbit<ORBIT>(current) ;
else else
cmark->mark(current) ; cmark->mark(current) ;
}
} }
} }
return current ; return current ;
......
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