mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0024826: Wrapping of parallelisation algorithms
Simple primitives to parallelize loops type "for" and "foreach" were implemented. The primitives encapsulates complete logic for creating and managing parallel context of loops. Moreover the primitives may be a wrapper for some primitives from 3rd-party library - TBB. To use it is necessary to implement TBB like interface which is based on functors. For example: Class Functor { public: void operator() ([proccesing instance]) const { //... } }; In the body of the operator () should be implemented thread-safe logic of computations that can be performed in parallel context. If parallelized loop iterates on the collections with direct access by index (such as Vector, Array), it is more efficient to use the primitive ParallelFor (because it has no critical section). All parts of OCC code which are using tbb were changed on new primitives. 0024826: Wrapping of parallelisation algorithms Small fix.
This commit is contained in:
@@ -21,11 +21,6 @@
|
||||
#include <BRepMesh_WireChecker.hxx>
|
||||
#include <BRepMesh_Status.hxx>
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
// paralleling using Intel TBB
|
||||
#include <tbb/blocked_range.h>
|
||||
#endif
|
||||
|
||||
//! Auxilary class implementing functionality for
|
||||
//! checking interference between two discretized wires.
|
||||
class BRepMesh_WireInterferenceChecker
|
||||
@@ -43,7 +38,6 @@ public:
|
||||
Same
|
||||
};
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
//! Constructor
|
||||
//! @param theWires wires that should be checked.
|
||||
//! @param theStatus shared flag to set status of the check.
|
||||
@@ -51,19 +45,7 @@ public:
|
||||
BRepMesh_WireInterferenceChecker(
|
||||
const BRepMesh::Array1OfSegmentsTree& theWires,
|
||||
BRepMesh_Status* theStatus,
|
||||
Standard_Mutex* theMutex);
|
||||
|
||||
//! Checker's body.
|
||||
//! @param theWireRange range of wires to be checked.
|
||||
void operator ()(const tbb::blocked_range<Standard_Integer>& theWireRange) const;
|
||||
#else
|
||||
//! Constructor
|
||||
//! @param theWires wires that should be checked.
|
||||
//! @param theStatus shared flag to set status of the check.
|
||||
BRepMesh_WireInterferenceChecker(
|
||||
const BRepMesh::Array1OfSegmentsTree& theWires,
|
||||
BRepMesh_Status* theStatus);
|
||||
#endif
|
||||
Standard_Mutex* theMutex = NULL);
|
||||
|
||||
//! Checker's body.
|
||||
//! @param theWireId Id of discretized wire to be checked.
|
||||
@@ -79,10 +61,7 @@ private:
|
||||
private:
|
||||
const BRepMesh::Array1OfSegmentsTree& myWires;
|
||||
BRepMesh_Status* myStatus;
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
Standard_Mutex* myMutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user