if (myInParallel)
{
#ifdef HAVE_TBB
+ CreateMutexesForSubShapes(theShape, TopAbs_EDGE);
// mesh faces in parallel threads using TBB
tbb::parallel_for_each (aFaces.begin(), aFaces.end(), *this);
#else
for (std::vector<TopoDS_Face>::iterator it(aFaces.begin()); it != aFaces.end(); it++)
Process (*it);
#endif
+ RemoveAllMutexes();
}
else
{
if ( GetFaceAttribute (theFace, fattribute) )
{
BRepMesh_FastDiscretFace aTool (GetAngle(), WithShare());
- aTool.Add (theFace, fattribute, GetMapOfDefEdge());
+ aTool.Add (theFace, fattribute, GetMapOfDefEdge(), myMutexProvider);
}
//cout << "END face " << theFace.TShape().operator->() << endl << flush;
}
if(myMapattrib.IsBound(theFace))
myMapattrib.UnBind(theFace);
}
+
+//=======================================================================
+//function : CreateMutexesForSubShapes
+//purpose :
+//=======================================================================
+void BRepMesh_FastDiscret::CreateMutexesForSubShapes(const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum theType)
+{
+ myMutexProvider.CreateMutexesForSubShapes(theShape, theType);
+}
+
+//=======================================================================
+//function : RemoveAllMutexes
+//purpose :
+//=======================================================================
+void BRepMesh_FastDiscret::RemoveAllMutexes()
+{
+ myMutexProvider.RemoveAllMutexes();
+}
\ No newline at end of file