Commit d0555531 authored by Sylvain Thery's avatar Sylvain Thery

Made Collector thread safe

parent 9c4f8a7c
......@@ -53,6 +53,7 @@ protected:
typedef typename PFP::REAL REAL;
typename PFP::MAP& map;
unsigned int m_thread;
Dart centerDart;
......@@ -62,7 +63,7 @@ protected:
std::vector<Dart> border;
public:
Collector(typename PFP::MAP& m);
Collector(typename PFP::MAP& m, unsigned int thread =0);
inline void init(Dart d)
{
......@@ -122,9 +123,8 @@ template <typename PFP>
class Collector_OneRing : public Collector<PFP>
{
public:
Collector_OneRing(typename PFP::MAP& m) :
Collector<PFP>(m)
{}
Collector_OneRing(typename PFP::MAP& m, unsigned int thread=0):
Collector<PFP>(m, thread) {}
void collectAll(Dart d);
void collectBorder(Dart d);
};
......@@ -145,11 +145,10 @@ protected:
const VertexAttribute<typename PFP::VEC3>& position;
typename PFP::REAL radius;
typename PFP::REAL area;
unsigned int m_thread;
public:
Collector_WithinSphere(typename PFP::MAP& m, const VertexAttribute<typename PFP::VEC3>& p, typename PFP::REAL r = 0, unsigned int thread=0) :
Collector<PFP>(m),
Collector<PFP>(m, thread),
position(p),
radius(r),
area(0),
......@@ -188,8 +187,9 @@ public:
typename PFP::MAP& m,
const VertexAttribute<typename PFP::VEC3>& p,
const VertexAttribute<typename PFP::VEC3>& n,
typename PFP::REAL a
) : Collector<PFP>(m), position(p), normal(n), angleThreshold(a)
typename PFP::REAL a,
unsigned int thread=0
) : Collector<PFP>(m,thread), position(p), normal(n), angleThreshold(a)
{}
inline void setAngleThreshold(typename PFP::REAL a) { angleThreshold = a; }
inline typename PFP::REAL getAngleThreshold() const { return angleThreshold; }
......
......@@ -39,7 +39,7 @@ namespace Selection
*********************************************************/
template <typename PFP>
Collector<PFP>::Collector(typename PFP::MAP& m) : map(m)
Collector<PFP>::Collector(typename PFP::MAP& m, unsigned int thread) : map(m), m_thread(thread)
{}
template <typename PFP>
......@@ -295,9 +295,9 @@ void Collector_NormalAngle<PFP>::collectAll(Dart d)
this->insideFaces.reserve(32);
this->border.reserve(32);
CellMarkerStore<VERTEX> vm(this->map); // mark the collected inside-vertices
CellMarkerStore<EDGE> em(this->map); // mark the collected inside-edges + border-edges
CellMarkerStore<FACE> fm(this->map); // mark the collected inside-faces + border-faces
CellMarkerStore<VERTEX> vm(this->map, m_thread); // mark the collected inside-vertices
CellMarkerStore<EDGE> em(this->map, m_thread); // mark the collected inside-edges + border-edges
CellMarkerStore<FACE> fm(this->map, m_thread); // mark the collected inside-faces + border-faces
this->insideVertices.push_back(this->centerDart);
vm.mark(this->centerDart);
......@@ -360,8 +360,8 @@ void Collector_NormalAngle<PFP>::collectBorder(Dart d)
this->border.reserve(128);
this->insideVertices.reserve(128);
CellMarkerStore<VERTEX> vm(this->map); // mark the collected inside-vertices
CellMarkerStore<EDGE> em(this->map); // mark the collected inside-edges + border-edges
CellMarkerStore<VERTEX> vm(this->map, m_thread); // mark the collected inside-vertices
CellMarkerStore<EDGE> em(this->map, m_thread); // mark the collected inside-edges + border-edges
this->insideVertices.push_back(this->centerDart);
vm.mark(this->centerDart);
......
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