I have a mesh with huge number of segments, I want to apply filter and fill std::set set_
, which is private member of class A
. There is function called fill_vec()
which is going to fill the vector using a for
loop:
fill_set()
{
for(mesh::SegIterator it = A.beginSeg(); it != A.endSeg(); ++it )
{
mesh::Segment Seg_ = *it;
int SignP = 0;
int SignN = 0;
for(mesh::PointIterator itp = Seg_.beginPoint(); itp != Seg_.endPoint(); ++itp )
{
double old_, new_;
...
...
if( old_ > 0.0 && new_ > 0.0 )
SignP++;
if( old_ < 0.0 && new_ < 0.0 )
SignN++;
}
if( (SignP == 1 && SignN == 1) || (SignP == 1 && SignN == 2) )
{
set_.insert(Seg_);
}
}
I am trying peform above code in parallel using OpenMP and C++03. I saw some solutions like as this. Any other safe and neat solution?