Commit 5c8a97cf authored by Sylvain Thery's avatar Sylvain Thery

correctin bug, now can make multiple traverse with same traversor3

parent 26e238b1
...@@ -65,6 +65,7 @@ private: ...@@ -65,6 +65,7 @@ private:
Dart m_current ; Dart m_current ;
TraversorDartsOfOrbit<MAP> m_tradoo; TraversorDartsOfOrbit<MAP> m_tradoo;
bool m_allocated; bool m_allocated;
bool m_first;
public: public:
Traversor3XY(MAP& map, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) ; Traversor3XY(MAP& map, Dart dart, bool forceDartMarker = false, unsigned int thread = 0) ;
Traversor3XY(MAP& map, Dart dart, MarkerForTraversor<MAP,ORBIT_Y>& tmo, bool forceDartMarker = false, unsigned int thread = 0) ; Traversor3XY(MAP& map, Dart dart, MarkerForTraversor<MAP,ORBIT_Y>& tmo, bool forceDartMarker = false, unsigned int thread = 0) ;
......
...@@ -105,7 +105,8 @@ Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::Traversor3XY(MAP& map, Dart dart, bool forceD ...@@ -105,7 +105,8 @@ Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::Traversor3XY(MAP& map, Dart dart, bool forceD
m_dmark(NULL), m_dmark(NULL),
m_cmark(NULL), m_cmark(NULL),
m_tradoo(map,ORBIT_X,dart,thread), m_tradoo(map,ORBIT_X,dart,thread),
m_allocated(true) m_allocated(true),
m_first(true)
{ {
if(!forceDartMarker && map.isOrbitEmbedded(ORBIT_Y)) if(!forceDartMarker && map.isOrbitEmbedded(ORBIT_Y))
m_cmark = new CellMarkerStore(map, ORBIT_Y, thread) ; m_cmark = new CellMarkerStore(map, ORBIT_Y, thread) ;
...@@ -117,7 +118,8 @@ template <typename MAP, unsigned int ORBIT_X, unsigned int ORBIT_Y> ...@@ -117,7 +118,8 @@ template <typename MAP, unsigned int ORBIT_X, unsigned int ORBIT_Y>
Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::Traversor3XY(MAP& map, Dart dart, MarkerForTraversor<MAP,ORBIT_Y>& tmo, bool forceDartMarker, unsigned int thread) : Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::Traversor3XY(MAP& map, Dart dart, MarkerForTraversor<MAP,ORBIT_Y>& tmo, bool forceDartMarker, unsigned int thread) :
m_map(map), m_map(map),
m_tradoo(map,ORBIT_X,dart,thread), m_tradoo(map,ORBIT_X,dart,thread),
m_allocated(false) m_allocated(false),
m_first(true)
{ {
m_cmark = tmo.cmark(); m_cmark = tmo.cmark();
m_dmark = tmo.dmark(); m_dmark = tmo.dmark();
...@@ -138,8 +140,19 @@ Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::~Traversor3XY() ...@@ -138,8 +140,19 @@ Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::~Traversor3XY()
template <typename MAP, unsigned int ORBIT_X, unsigned int ORBIT_Y> template <typename MAP, unsigned int ORBIT_X, unsigned int ORBIT_Y>
Dart Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::begin() Dart Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::begin()
{ {
if (!m_first)
{
if (m_cmark)
m_cmark->unmarkAll();
else
m_dmark->unmarkAll();
}
m_first=false;
m_current = m_tradoo.begin() ; m_current = m_tradoo.begin() ;
// for the case of beginning with a given MarkerForTraversor // for the case of beginning with a given MarkerForTraversor
if (!m_allocated)
{
if (m_cmark) if (m_cmark)
{ {
while ((m_current != NIL) && m_cmark->isMarked(m_current)) while ((m_current != NIL) && m_cmark->isMarked(m_current))
...@@ -150,6 +163,7 @@ Dart Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::begin() ...@@ -150,6 +163,7 @@ Dart Traversor3XY<MAP,ORBIT_X,ORBIT_Y>::begin()
while ((m_current != NIL) && m_dmark->isMarked(m_current)) while ((m_current != NIL) && m_dmark->isMarked(m_current))
m_current = m_tradoo.next(); m_current = m_tradoo.next();
} }
}
return m_current; return m_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