Commit ee8d7368 authored by Sylvain Thery's avatar Sylvain Thery

finish traversor optimization

parent fe862269
......@@ -95,38 +95,6 @@ public:
} ;
//template <typename MAP>
//class TraversorV : public TraversorCell<MAP, VERTEX>
//{
//public:
// TraversorV(MAP& m, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, VERTEX>(m, forceDartMarker, thread)
// {}
//};
//template <typename MAP>
//class TraversorE : public TraversorCell<MAP, EDGE>
//{
//public:
// TraversorE(MAP& m, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, EDGE>(m, forceDartMarker, thread)
// {}
//};
//template <typename MAP>
//class TraversorF : public TraversorCell<MAP, FACE>
//{
//public:
// TraversorF(MAP& m, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, FACE>(m, forceDartMarker, thread)
// {}
//};
//template <typename MAP>
//class TraversorW : public TraversorCell<MAP, VOLUME>
//{
//public:
// TraversorW(MAP& m, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP, VOLUME>(m, forceDartMarker, thread)
// {}
//};
template <typename MAP>
class TraversorV : public TraversorCell<MAP, VERTEX>
{
......
......@@ -32,7 +32,7 @@ namespace CGoGN
{
template <typename MAP, unsigned int ORBIT>
class TraversorDartsOfOrbit : public Traversor<MAP>
class TraversorDartsOfOrbit //: public Traversor<MAP>
{
private:
std::vector<Dart>::iterator m_current ;
......@@ -48,6 +48,27 @@ public:
Dart next() ;
} ;
template <typename MAP, unsigned int ORBIT>
class VTraversorDartsOfOrbit : public Traversor<MAP>
{
private:
std::vector<Dart>::iterator m_current ;
std::vector<Dart> m_vd ;
public:
VTraversorDartsOfOrbit(MAP& map, Dart d, unsigned int thread = 0) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
} // namespace CGoGN
#include "Topology/generic/traversorDoO.hpp"
......
......@@ -58,4 +58,39 @@ Dart TraversorDartsOfOrbit<MAP, ORBIT>::next()
return *m_current;
}
template <typename MAP, unsigned int ORBIT>
VTraversorDartsOfOrbit<MAP, ORBIT>::VTraversorDartsOfOrbit(MAP& map, Dart d, unsigned int thread)
{
m_vd.reserve(16);
FunctorStoreNotBoundary<MAP> fs(map, m_vd);
map.template foreach_dart_of_orbit<ORBIT>(d, fs, thread);
m_vd.push_back(NIL);
}
template <typename MAP, unsigned int ORBIT>
Dart VTraversorDartsOfOrbit<MAP, ORBIT>::begin()
{
m_current = m_vd.begin();
return *m_current;
}
template <typename MAP, unsigned int ORBIT>
Dart VTraversorDartsOfOrbit<MAP, ORBIT>::end()
{
return NIL;
}
template <typename MAP, unsigned int ORBIT>
Dart VTraversorDartsOfOrbit<MAP, ORBIT>::next()
{
if (*m_current != NIL)
m_current++;
return *m_current;
}
} // namespace CGoGN
......@@ -238,34 +238,34 @@ Traversor<MAP>* TraversorFactory<MAP>::createDartsOfOrbits(MAP& map, Dart dart,
switch(orb)
{
case VERTEX:
return new TraversorDartsOfOrbit<MAP,VERTEX>(map,dart);
return new VTraversorDartsOfOrbit<MAP,VERTEX>(map,dart);
break;
case EDGE:
return new TraversorDartsOfOrbit<MAP,EDGE>(map,dart);
return new VTraversorDartsOfOrbit<MAP,EDGE>(map,dart);
break;
case FACE:
return new TraversorDartsOfOrbit<MAP,FACE>(map,dart);
return new VTraversorDartsOfOrbit<MAP,FACE>(map,dart);
break;
case VOLUME:
return new TraversorDartsOfOrbit<MAP,VOLUME>(map,dart);
return new VTraversorDartsOfOrbit<MAP,VOLUME>(map,dart);
break;
case CC:
return new TraversorDartsOfOrbit<MAP,CC>(map,dart);
return new VTraversorDartsOfOrbit<MAP,CC>(map,dart);
break;
case VERTEX1:
return new TraversorDartsOfOrbit<MAP,VERTEX1>(map,dart);
return new VTraversorDartsOfOrbit<MAP,VERTEX1>(map,dart);
break;
case EDGE1:
return new TraversorDartsOfOrbit<MAP,EDGE1>(map,dart);
return new VTraversorDartsOfOrbit<MAP,EDGE1>(map,dart);
break;
case VERTEX2:
return new TraversorDartsOfOrbit<MAP,VERTEX2>(map,dart);
return new VTraversorDartsOfOrbit<MAP,VERTEX2>(map,dart);
break;
case EDGE2:
return new TraversorDartsOfOrbit<MAP,EDGE2>(map,dart);
return new VTraversorDartsOfOrbit<MAP,EDGE2>(map,dart);
break;
case FACE2:
return new TraversorDartsOfOrbit<MAP,FACE2>(map,dart);
return new VTraversorDartsOfOrbit<MAP,FACE2>(map,dart);
break;
default:
return NULL;
......
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