OSD_Parallel::ToUseOcctThreads() - new flag allowing to use OCCT threads implementation even when compiled with TBB (for testing).
Added new command dparallel for managing default Thread Pool.
OSD_Parallel::For() now avoid creation of universal iterator in simplest case.
BOPTools_Parallel - eliminated redundant typedefs/explicit instantiations of templates.
Added functor using array of per-thread context instead of a map.
Handle(IntTools_Context) myContext;
};
//
-typedef NCollection_Vector<BOPAlgo_PairOfShapeBoolean> \
- BOPAlgo_VectorOfPairOfShapeBoolean;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_PairOfShapeBoolean,
- BOPAlgo_VectorOfPairOfShapeBoolean,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_BuilderSDFaceFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_BuilderSDFaceFunctor,
- BOPAlgo_VectorOfPairOfShapeBoolean,
- Handle(IntTools_Context)> BOPAlgo_BuilderSDFaceCnt;
-//
+typedef NCollection_Vector<BOPAlgo_PairOfShapeBoolean> BOPAlgo_VectorOfPairOfShapeBoolean;
+
//=======================================================================
// BuilderFace
//
typedef NCollection_Vector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
-//
-typedef BOPTools_Functor
- <BOPAlgo_BuilderFace,
- BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_BuilderFaceFunctor,
- BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceCnt;
-//
+
//=======================================================================
//class : BOPAlgo_VFI
//purpose :
};
//
typedef NCollection_Vector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_VFI,
- BOPAlgo_VectorOfVFI,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_VFIFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_VFIFunctor,
- BOPAlgo_VectorOfVFI,
- Handle(IntTools_Context)> BOPAlgo_VFICnt;
-//
+
//=======================================================================
//function : FillImagesFaces
//purpose :
}// for (i=0; i<aNbS; ++i) {
//
//===================================================
- BOPAlgo_BuilderFaceCnt::Perform(myRunParallel, aVBF);
+ BOPTools_Parallel::Perform (myRunParallel, aVBF);
//===================================================
//
Standard_Integer aNbBF = aVBF.Length();
//================================================================
// Perform analysis
- BOPAlgo_BuilderSDFaceCnt::Perform(myRunParallel, aVPSB, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVPSB, myContext);
//================================================================
NCollection_List<TopTools_ListOfShape> aMBlocks(aAllocator);
// Perform classification
//================================================================
- BOPAlgo_VFICnt::Perform(myRunParallel, aVVFI, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVVFI, myContext);
//================================================================
Standard_Integer aNbVFI = aVVFI.Length();
// Vector of Solid Builders
typedef NCollection_Vector<BOPAlgo_SplitSolid> BOPAlgo_VectorOfBuilderSolid;
-// Functors to split solids
-typedef BOPTools_Functor<BOPAlgo_SplitSolid,
- BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidFunctor;
-//
-typedef BOPTools_Cnt<BOPAlgo_BuilderSolidFunctor,
- BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidCnt;
-//=======================================================================
//=======================================================================
//function : BuildSplitSolids
aNbBS=aVBS.Length();
//
//===================================================
- BOPAlgo_BuilderSolidCnt::Perform(myRunParallel, aVBS);
+ BOPTools_Parallel::Perform (myRunParallel, aVBS);
//===================================================
//
for (k = 0; k < aNbBS; ++k)
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_FaceSelfIntersect> BOPAlgo_VectorOfFaceSelfIntersect;
-//
-typedef BOPTools_Functor
- <BOPAlgo_FaceSelfIntersect,
- BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_FaceSelfIntersectFunctor,
- BOPAlgo_VectorOfFaceSelfIntersect> BOPAlgo_FaceSelfIntersectCnt;
-
+typedef NCollection_Vector<BOPAlgo_FaceSelfIntersect> BOPAlgo_VectorOfFaceSelfIntersect;
//=======================================================================
//function :
Standard_Integer aNbFace = aVFace.Length();
//======================================================
- BOPAlgo_FaceSelfIntersectCnt::Perform(myRunParallel, aVFace);
+ BOPTools_Parallel::Perform (myRunParallel, aVFace);
//======================================================
//
for (Standard_Integer k = 0; k < aNbFace; k++)
Handle(IntTools_Context) myContext;
};
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_VertexSolid,
- BOPAlgo_VectorOfVertexSolid,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_VertexSolidFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_VertexSolidFunctor,
- BOPAlgo_VectorOfVertexSolid,
- Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
+typedef NCollection_Vector<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
+
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_ShapeSolid
BOPDS_DS* myDS;
};
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
-//
-typedef BOPTools_Functor
- <BOPAlgo_ShapeSolid,
- BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_ShapeSolidFunctor,
- BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
-//
+typedef NCollection_Vector<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
+
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_SolidSolid
};
};
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
-//
-typedef BOPTools_Functor
- <BOPAlgo_SolidSolid,
- BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_SolidSolidFunctor,
- BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
-//
-/////////////////////////////////////////////////////////////////////////
+typedef NCollection_Vector<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
//=======================================================================
//function : PerformVZ
//
aNbVVS=aVVS.Length();
//=============================================================
- BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVVS, myContext);
//=============================================================
for (k=0; k < aNbVVS; ++k) {
const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
//
aNbSolidSolid=aVSolidSolid.Length();
//======================================================
- BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
+ BOPTools_Parallel::Perform (myRunParallel, aVSolidSolid);
//======================================================
//
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
//
aNbShapeSolid=aVShapeSolid.Length();
//======================================================
- BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
+ BOPTools_Parallel::Perform (myRunParallel, aVShapeSolid);
//======================================================
//
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
Handle(BOPDS_PaveBlock) myPB;
};
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_VertexEdge,
- BOPAlgo_VectorOfVertexEdge,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_VertexEdgeFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_VertexEdgeFunctor,
- BOPAlgo_VectorOfVertexEdge,
- Handle(IntTools_Context)> BOPAlgo_VertexEdgeCnt;
-//
+typedef NCollection_Vector<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
+
//=======================================================================
// function: PerformVE
// purpose:
//
// Perform intersection
//=============================================================
- BOPAlgo_VertexEdgeCnt::Perform(myRunParallel, aVVE, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVVE, myContext);
//=============================================================
//
// Keep the modified edges for further update
};
//
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
-//
-typedef BOPTools_Functor
- <BOPAlgo_EdgeEdge,
- BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_EdgeEdgeFunctor,
- BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
-//
-/////////////////////////////////////////////////////////////////////////
+typedef NCollection_Vector<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
+
//=======================================================================
// function: PerformEE
// purpose:
//
aNbEdgeEdge=aVEdgeEdge.Length();
//======================================================
- BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
+ BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge);
//======================================================
//
for (k = 0; k < aNbEdgeEdge; ++k) {
anAlloc->Reset();
// Perform intersection of the found pairs
- BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
+ BOPTools_Parallel::Perform (myRunParallel, aVEdgeEdge);
BOPDS_VectorOfInterfEE& aEEs = myDS->InterfEE();
if (aEEs.IsEmpty())
Handle(IntTools_Context) myContext;
};
//=======================================================================
-typedef NCollection_Vector<BOPAlgo_VertexFace>
- BOPAlgo_VectorOfVertexFace;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_VertexFace,
- BOPAlgo_VectorOfVertexFace,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_VertexFaceFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_VertexFaceFunctor,
- BOPAlgo_VectorOfVertexFace,
- Handle(IntTools_Context)> BOPAlgo_VertexFaceCnt;
-//
+typedef NCollection_Vector<BOPAlgo_VertexFace> BOPAlgo_VectorOfVertexFace;
+
//=======================================================================
// function: PerformVF
// purpose:
//
aNbVF=aVVF.Length();
//================================================================
- BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVVF, myContext);
//================================================================
//
for (k=0; k < aNbVF; ++k) {
//
//=======================================================================
typedef NCollection_Vector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_EdgeFace,
- BOPAlgo_VectorOfEdgeFace,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_EdgeFaceFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_EdgeFaceFunctor,
- BOPAlgo_VectorOfEdgeFace,
- Handle(IntTools_Context)> BOPAlgo_EdgeFaceCnt;
-//
+
//=======================================================================
//function : PerformEF
//purpose :
//
aNbEdgeFace=aVEdgeFace.Length();
//=================================================================
- BOPAlgo_EdgeFaceCnt::Perform(myRunParallel, aVEdgeFace, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext);
//=================================================================
//
for (k=0; k < aNbEdgeFace; ++k) {
anAlloc->Reset();
// Perform intersection of the found pairs
- BOPAlgo_EdgeFaceCnt::Perform(myRunParallel, aVEdgeFace, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVEdgeFace, myContext);
BOPDS_VectorOfInterfEF& aEFs = myDS->InterfEF();
if (theAddInterf && aEFs.IsEmpty())
};
//
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_FaceFace> BOPAlgo_VectorOfFaceFace;
-//
-typedef BOPTools_Functor
- <BOPAlgo_FaceFace,
- BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_FaceFaceFunctor,
- BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceCnt;
+typedef NCollection_Vector<BOPAlgo_FaceFace> BOPAlgo_VectorOfFaceFace;
+
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//function : PerformFF
//
//======================================================
// Perform intersection
- BOPAlgo_FaceFaceCnt::Perform(myRunParallel, aVFaceFace);
+ BOPTools_Parallel::Perform (myRunParallel, aVFaceFace);
//======================================================
// Treatment of the results
Standard_Integer k, aNbFaceFace = aVFaceFace.Length();
};
//
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_SplitEdge,
- BOPAlgo_VectorOfSplitEdge,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_SplitEdgeFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_SplitEdgeFunctor,
- BOPAlgo_VectorOfSplitEdge,
- Handle(IntTools_Context)> BOPAlgo_SplitEdgeCnt;
-//
+typedef NCollection_Vector<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
+
//=======================================================================
//class : BOPAlgo_MPC
//purpose :
};
//
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_MPC,
- BOPAlgo_VectorOfMPC,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_MPCFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_MPCFunctor,
- BOPAlgo_VectorOfMPC,
- Handle(IntTools_Context)> BOPAlgo_MPCCnt;
-//
+typedef NCollection_Vector<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
+
//=======================================================================
//class : BOPAlgo_BPC
//purpose :
Standard_Boolean myToUpdate;
};
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
-//
-typedef BOPTools_Functor
- <BOPAlgo_BPC,
- BOPAlgo_VectorOfBPC> BOPAlgo_BPCFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_BPCFunctor,
- BOPAlgo_VectorOfBPC> BOPAlgo_BPCCnt;
-//
-//
+typedef NCollection_Vector<BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
+
//=======================================================================
// function: MakeSplitEdges
// purpose:
//
aNbVBSE=aVBSE.Length();
//======================================================
- BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVBSE, myContext);
//======================================================
//
for (k=0; k < aNbVBSE; ++k) {
}//if (bPCurveOnS1 || bPCurveOnS2 ) {
//
//======================================================
- BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVMPC, myContext);
//======================================================
// Add warnings of the failed projections and update edges with new pcurves
}
//
//======================================================
- BOPAlgo_BPCCnt::Perform(myRunParallel, aVBPC);
+ BOPTools_Parallel::Perform (myRunParallel, aVBPC);
//======================================================
// pcurves are built, and now update edges
};
//
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_ShrunkRange,
- BOPAlgo_VectorOfShrunkRange,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_ShrunkRangeFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_ShrunkRangeFunctor,
- BOPAlgo_VectorOfShrunkRange,
- Handle(IntTools_Context)> BOPAlgo_ShrunkRangeCnt;
-//
+typedef NCollection_Vector<BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
+
//=======================================================================
// function: FillShrunkData
// purpose:
//
aNbVSD=aVSD.Length();
//=============================================================
- BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVSD, myContext);
//=============================================================
//
for (k=0; k < aNbVSD; ++k) {
typedef NCollection_Vector<FillGap> VectorOfFillGap;
-typedef BOPTools_Functor <FillGap, VectorOfFillGap> FillGapFunctor;
-
-typedef BOPTools_Cnt <FillGapFunctor, VectorOfFillGap> FillGapCnt;
-
-//=======================================================================
-
//=======================================================================
// function: RemoveFeatures
// purpose: Remove features by filling the gaps by extension of the
}
// Perform the reconstruction of the adjacent faces
- FillGapCnt::Perform(myRunParallel, aVFG);
+ BOPTools_Parallel::Perform (myRunParallel, aVFG);
// Even if the history is not requested, it is necessary to track:
// - The solids modification after each feature removal to find
BOPTools_ConnexityBlock *myPCB;
};
//=======================================================================
-typedef NCollection_Vector
- <BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
-//
-typedef BOPTools_Functor
- <BOPAlgo_CBK,
- BOPAlgo_VectorOfCBK> BOPAlgo_CBKFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_CBKFunctor,
- BOPAlgo_VectorOfCBK> BOPAlgo_CBKCnt;
-//
+typedef NCollection_Vector<BOPAlgo_CBK> BOPAlgo_VectorOfCBK;
+
//=======================================================================
//function :
//purpose :
//
aNbVCBK=aVCBK.Length();
//===================================================
- BOPAlgo_CBKCnt::Perform(myRunParallel, aVCBK);
+ BOPTools_Parallel::Perform (myRunParallel, aVCBK);
//===================================================
for (k=0; k<aNbVCBK; ++k) {
BOPAlgo_CBK& aCBK=aVCBK(k);
//purpose :
//=======================================================================
class BOPAlgo_TNV;
-typedef NCollection_Vector
- <BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
-//
-typedef BOPTools_Functor
- <BOPAlgo_TNV,
- BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
-//
-typedef BOPTools_Cnt
- <BOPAlgo_TNVFunctor,
- BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
+typedef NCollection_Vector<BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
+
//=======================================================================
class BOPAlgo_TNV : public BOPTools_BoxBndTreeSelector{
public:
aTreeFiller.Fill();
//
// Perform intersection
- BOPAlgo_TNVCnt::Perform(theRunParallel, aVTNV);
+ BOPTools_Parallel::Perform (theRunParallel, aVTNV);
//
// Fence map
TColStd_MapOfInteger aMFence;
// Vector of solid classifiers
typedef NCollection_Vector<BOPAlgo_FillIn3DParts> BOPAlgo_VectorOfFillIn3DParts;
-// Functors to perform classification
-typedef BOPTools_ContextFunctor<BOPAlgo_FillIn3DParts,
- BOPAlgo_VectorOfFillIn3DParts,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_FillIn3DPartsFunctor;
-
-typedef BOPTools_ContextCnt<BOPAlgo_FillIn3DPartsFunctor,
- BOPAlgo_VectorOfFillIn3DParts,
- Handle(IntTools_Context)> BOPAlgo_FillIn3DPartsCnt;
-
//=======================================================================
//function : ClassifyFaces
//purpose :
// Perform classification
//================================================================
- BOPAlgo_FillIn3DPartsCnt::Perform(theRunParallel, aVFIP, theContext);
+ BOPTools_Parallel::Perform (theRunParallel, aVFIP, theContext);
//================================================================
// Analyze the results and fill the resulting map
Handle(IntTools_Context) myContext;
};
-typedef NCollection_Vector<BOPAlgo_WS_ConnexityBlock> \
- BOPAlgo_VectorOfConnexityBlock;
-//
-typedef BOPTools_ContextFunctor
- <BOPAlgo_WS_ConnexityBlock,
- BOPAlgo_VectorOfConnexityBlock,
- Handle(IntTools_Context),
- IntTools_Context> BOPAlgo_SplitBlockFunctor;
-//
-typedef BOPTools_ContextCnt
- <BOPAlgo_SplitBlockFunctor,
- BOPAlgo_VectorOfConnexityBlock,
- Handle(IntTools_Context)> BOPAlgo_SplitBlockCnt;
+typedef NCollection_Vector<BOPAlgo_WS_ConnexityBlock> BOPAlgo_VectorOfConnexityBlock;
//=======================================================================
//function : MakeWires
}
}
//===================================================
- BOPAlgo_SplitBlockCnt::Perform(myRunParallel, aVCB, myContext);
+ BOPTools_Parallel::Perform (myRunParallel, aVCB, myContext);
//===================================================
aNbVCB=aVCB.Length();
for (k=0; k<aNbVCB; ++k) {
};
//
//=======================================================================
-typedef NCollection_Vector <BOPDS_TSR> BOPDS_VectorOfTSR;
-typedef BOPTools_Functor <BOPDS_TSR,BOPDS_VectorOfTSR> BOPDS_TSRFunctor;
-typedef BOPTools_Cnt <BOPDS_TSRFunctor, BOPDS_VectorOfTSR> BOPDS_TSRCnt;
+typedef NCollection_Vector<BOPDS_TSR> BOPDS_VectorOfTSR;
/////////////////////////////////////////////////////////////////////////
aTreeFiller.Fill();
//
//===========================================
- BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
+ BOPTools_Parallel::Perform (myRunParallel, aVTSR);
//===========================================
//
BOPDS_MapOfPair aMPFence;
}
// Perform selection
- BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
+ BOPTools_Parallel::Perform (myRunParallel, aVTSR);
// Treat selections
//
//=======================================================================
typedef NCollection_Vector<BOPTools_CPC> BOPTools_VectorOfCPC;
-//
-typedef BOPTools_Functor
- <BOPTools_CPC,
- BOPTools_VectorOfCPC> BOPTools_CPCFunctor;
-//
-typedef BOPTools_Cnt
- <BOPTools_CPCFunctor,
- BOPTools_VectorOfCPC> BOPTools_CPCCnt;
-//
+
//=======================================================================
//class : BOPTools_CWT
//purpose :
};
//=======================================================================
typedef NCollection_Vector<BOPTools_CWT> BOPTools_VectorOfCWT;
-//
-typedef BOPTools_Functor
- <BOPTools_CWT,
- BOPTools_VectorOfCWT> BOPTools_CWTFunctor;
-//
-typedef BOPTools_Cnt
- <BOPTools_CWTFunctor,
- BOPTools_VectorOfCWT> BOPTools_CWTCnt;
-//
+
//=======================================================================
//class : BOPTools_CDT
//purpose :
};
//=======================================================================
typedef NCollection_Vector<BOPTools_CDT> BOPTools_VectorOfCDT;
-//
-typedef BOPTools_Functor
- <BOPTools_CDT,
- BOPTools_VectorOfCDT> BOPTools_CDTFunctor;
-//
-typedef BOPTools_Cnt
- <BOPTools_CDTFunctor,
- BOPTools_VectorOfCDT> BOPTools_CDTCnt;
-//
+
//=======================================================================
//class : BOPTools_CVT
//purpose :
//
//=======================================================================
typedef NCollection_Vector<BOPTools_CVT> BOPTools_VectorOfCVT;
-//
-typedef BOPTools_Functor
- <BOPTools_CVT,
- BOPTools_VectorOfCVT> BOPTools_CVTFunctor;
-//
-typedef BOPTools_Cnt
- <BOPTools_CVTFunctor,
- BOPTools_VectorOfCVT> BOPTools_CVTCnt;
-//
+
//=======================================================================
//class : BOPTools_CET
//purpose :
};
//=======================================================================
typedef NCollection_Vector<BOPTools_CET> BOPTools_VectorOfCET;
-//
-typedef BOPTools_Functor
- <BOPTools_CET,
- BOPTools_VectorOfCET> BOPTools_CETFunctor;
-//
-typedef BOPTools_Cnt
- <BOPTools_CETFunctor,
- BOPTools_VectorOfCET> BOPTools_CETCnt;
-//
-//
-//=======================================================================
- //
+
//=======================================================================
// Function : CorrectTolerances
// purpose :
}
//
//======================================================
- BOPTools_CPCCnt::Perform(bRunParallel, aVCPC);
+ BOPTools_Parallel::Perform (bRunParallel, aVCPC);
//======================================================
}
//=======================================================================
}
//
//======================================================
- BOPTools_CWTCnt::Perform(bRunParallel, aVCWT);
+ BOPTools_Parallel::Perform (bRunParallel, aVCWT);
//======================================================
- BOPTools_CDTCnt::Perform(bRunParallel, aVCDT);
+ BOPTools_Parallel::Perform (bRunParallel, aVCDT);
//======================================================
}
//=======================================================================
}
//
//======================================================
- BOPTools_CVTCnt::Perform(bRunParallel, aVCVT);
+ BOPTools_Parallel::Perform (bRunParallel, aVCVT);
//======================================================
//
aExp.Init(aShape, TopAbs_FACE);
}
//
//======================================================
- BOPTools_CETCnt::Perform(bRunParallel, aVCET);
+ BOPTools_Parallel::Perform (bRunParallel, aVCET);
//======================================================
}
//
#include <Standard_Macro.hxx>
#include <Standard_NotImplemented.hxx>
#include <OSD_Parallel.hxx>
+#include <OSD_ThreadPool.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Mutex.hxx>
#include <OSD_Thread.hxx>
-//
-// 1. Implementation of Functors/Starters
-//
-// 1.1. Pure version
-//
-
-//=======================================================================
-//class : BOPTools_Functor
-//purpose :
-//=======================================================================
-template <class TypeSolver, class TypeSolverVector>
-class BOPTools_Functor
+//! Implementation of Functors/Starters
+class BOPTools_Parallel
{
-public:
- //! Constructor.
- explicit BOPTools_Functor(TypeSolverVector& theSolverVec)
- : mySolvers(theSolverVec) {}
-
- //! Defines functor interface.
- void operator() (const Standard_Integer theIndex) const
+ template<class TypeSolverVector>
+ class Functor
{
- TypeSolver& aSolver = mySolvers(theIndex);
- aSolver.Perform();
- }
-
-private:
- BOPTools_Functor(const BOPTools_Functor&);
- BOPTools_Functor& operator= (const BOPTools_Functor&);
+ public:
+ //! Constructor.
+ explicit Functor(TypeSolverVector& theSolverVec) : mySolvers (theSolverVec) {}
-private:
- TypeSolverVector& mySolvers;
-};
+ //! Defines functor interface.
+ void operator() (const Standard_Integer theIndex) const
+ {
+ typename TypeSolverVector::value_type& aSolver = mySolvers[theIndex];
+ aSolver.Perform();
+ }
-//=======================================================================
-//class : BOPTools_Cnt
-//purpose :
-//=======================================================================
-template <class TypeFunctor, class TypeSolverVector>
-class BOPTools_Cnt
-{
-public:
- static void Perform( const Standard_Boolean isRunParallel,
- TypeSolverVector& theSolverVector )
- {
- TypeFunctor aFunctor(theSolverVector);
- OSD_Parallel::For(0, theSolverVector.Length(), aFunctor, !isRunParallel);
- }
-};
+ private:
+ Functor(const Functor&);
+ Functor& operator= (const Functor&);
-//
-// 1.2. Context dependent version
-//
+ private:
+ TypeSolverVector& mySolvers;
+ };
-//=======================================================================
-//class : BOPTools_ContextFunctor
-//purpose :
-//=======================================================================
-template <class TypeSolver, class TypeSolverVector,
- class TypeContext, typename TN>
-class BOPTools_ContextFunctor
-{
- //! Auxiliary thread ID hasher.
- struct Hasher
+ //! Functor storing map of thread id -> algorithm context
+ template<class TypeSolverVector, class TypeContext>
+ class ContextFunctor
{
- static Standard_Integer HashCode(const Standard_ThreadId theKey,
- const Standard_Integer Upper)
+ //! Auxiliary thread ID hasher.
+ struct Hasher
+ {
+ static Standard_Integer HashCode(const Standard_ThreadId theKey,
+ const Standard_Integer Upper)
+ {
+ return ::HashCode((Standard_Size)theKey, Upper);
+ }
+
+ static Standard_Boolean IsEqual(const Standard_ThreadId theKey1,
+ const Standard_ThreadId theKey2)
+ {
+ return theKey1 == theKey2;
+ }
+ };
+
+ public:
+
+ //! Constructor
+ explicit ContextFunctor (TypeSolverVector& theVector) : mySolverVector(theVector) {}
+
+ //! Binds main thread context
+ void SetContext (const opencascade::handle<TypeContext>& theContext)
{
- return ::HashCode((Standard_Size)theKey, Upper);
+ myContextMap.Bind (OSD_Thread::Current(), theContext);
}
- static Standard_Boolean IsEqual(const Standard_ThreadId theKey1,
- const Standard_ThreadId theKey2)
+ //! Returns current thread context
+ const opencascade::handle<TypeContext>& GetThreadContext() const
{
- return theKey1 == theKey2;
+ const Standard_ThreadId aThreadID = OSD_Thread::Current();
+ if (const opencascade::handle<TypeContext>* aContextPtr = myContextMap.Seek (aThreadID))
+ {
+ if (!aContextPtr->IsNull())
+ {
+ return *aContextPtr;
+ }
+ }
+
+ // Create new context
+ opencascade::handle<TypeContext> aContext = new TypeContext (NCollection_BaseAllocator::CommonBaseAllocator());
+
+ Standard_Mutex::Sentry aLocker (myMutex);
+ myContextMap.Bind (aThreadID, aContext);
+ return myContextMap (aThreadID);
}
- };
- typedef NCollection_DataMap<Standard_ThreadId, TypeContext, Hasher> ContextMap;
+ //! Defines functor interface
+ void operator()( const Standard_Integer theIndex ) const
+ {
+ const opencascade::handle<TypeContext>& aContext = GetThreadContext();
+ typename TypeSolverVector::value_type& aSolver = mySolverVector[theIndex];
-public:
+ aSolver.SetContext(aContext);
+ aSolver.Perform();
+ }
- //! Constructor
- explicit BOPTools_ContextFunctor( TypeSolverVector& theVector )
- : mySolverVector(theVector) {}
+ private:
+ ContextFunctor(const ContextFunctor&);
+ ContextFunctor& operator= (const ContextFunctor&);
- //! Binds main thread context
- void SetContext( TypeContext& theContext )
- {
- myContexts.Bind(OSD_Thread::Current(), theContext);
- }
+ private:
+ TypeSolverVector& mySolverVector;
+ mutable NCollection_DataMap<Standard_ThreadId, opencascade::handle<TypeContext>, Hasher> myContextMap;
+ mutable Standard_Mutex myMutex;
+ };
- //! Returns current thread context
- TypeContext& GetThreadContext() const
+ //! Functor storing array of algorithm contexts per thread in pool
+ template<class TypeSolverVector, class TypeContext>
+ class ContextFunctor2
{
- const Standard_ThreadId aThreadID = OSD_Thread::Current();
- if ( myContexts.IsBound(aThreadID) )
+ public:
+
+ //! Constructor
+ explicit ContextFunctor2 (TypeSolverVector& theVector, const OSD_ThreadPool::Launcher& thePoolLauncher)
+ : mySolverVector(theVector),
+ myContextArray (thePoolLauncher.LowerThreadIndex(), thePoolLauncher.UpperThreadIndex()) {}
+
+ //! Binds main thread context
+ void SetContext (const opencascade::handle<TypeContext>& theContext)
{
- TypeContext& aContext = myContexts(aThreadID);
- if ( aContext.IsNull() == Standard_False )
- return aContext;
+ myContextArray.ChangeLast() = theContext; // OSD_ThreadPool::Launcher::UpperThreadIndex() is reserved for a main thread
}
- // Create new context
- TypeContext aContext = new TN
- ( NCollection_BaseAllocator::CommonBaseAllocator() );
+ //! Defines functor interface with serialized thread index.
+ void operator() (int theThreadIndex,
+ int theIndex) const
+ {
+ opencascade::handle<TypeContext>& aContext = myContextArray.ChangeValue (theThreadIndex);
+ if (aContext.IsNull())
+ {
+ aContext = new TypeContext (NCollection_BaseAllocator::CommonBaseAllocator());
+ }
+ typename TypeSolverVector::value_type& aSolver = mySolverVector[theIndex];
+ aSolver.SetContext (aContext);
+ aSolver.Perform();
+ }
- Standard_Mutex::Sentry aLocker(myMutex);
- myContexts.Bind(aThreadID, aContext);
+ private:
+ ContextFunctor2(const ContextFunctor2&);
+ ContextFunctor2& operator= (const ContextFunctor2&);
- return myContexts(aThreadID);
- }
+ private:
+ TypeSolverVector& mySolverVector;
+ mutable NCollection_Array1< opencascade::handle<TypeContext> > myContextArray;
+ };
- //! Defines functor interface
- void operator()( const Standard_Integer theIndex ) const
- {
- TypeContext& aContext = GetThreadContext();
- TypeSolver& aSolver = mySolverVector(theIndex);
+public:
- aSolver.SetContext(aContext);
- aSolver.Perform();
+ //! Pure version
+ template<class TypeSolverVector>
+ static void Perform (Standard_Boolean theIsRunParallel,
+ TypeSolverVector& theSolverVector)
+ {
+ Functor<TypeSolverVector> aFunctor (theSolverVector);
+ OSD_Parallel::For (0, theSolverVector.Length(), aFunctor, !theIsRunParallel);
}
-private:
- BOPTools_ContextFunctor(const BOPTools_ContextFunctor&);
- BOPTools_ContextFunctor& operator= (const BOPTools_ContextFunctor&);
-
-private:
- TypeSolverVector& mySolverVector;
- mutable ContextMap myContexts;
- mutable Standard_Mutex myMutex;
-};
-
-//=======================================================================
-//class : BOPTools_ContextCnt
-//purpose :
-//=======================================================================
-template <class TypeFunctor, class TypeSolverVector, class TypeContext>
-class BOPTools_ContextCnt
-{
-public:
- static void Perform( const Standard_Boolean isRunParallel,
- TypeSolverVector& theSolverVector,
- TypeContext& theContext )
+ //! Context dependent version
+ template<class TypeSolverVector, class TypeContext>
+ static void Perform (Standard_Boolean theIsRunParallel,
+ TypeSolverVector& theSolverVector,
+ opencascade::handle<TypeContext>& theContext)
{
- TypeFunctor aFunctor(theSolverVector);
- aFunctor.SetContext(theContext);
-
- OSD_Parallel::For(0, theSolverVector.Length(), aFunctor, !isRunParallel);
+ if (OSD_Parallel::ToUseOcctThreads())
+ {
+ const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
+ OSD_ThreadPool::Launcher aPoolLauncher (*aThreadPool, theIsRunParallel ? theSolverVector.Length() : 0);
+ ContextFunctor2<TypeSolverVector, TypeContext> aFunctor (theSolverVector, aPoolLauncher);
+ aFunctor.SetContext (theContext);
+ aPoolLauncher.Perform (0, theSolverVector.Length(), aFunctor);
+ }
+ else
+ {
+ ContextFunctor<TypeSolverVector, TypeContext> aFunctor (theSolverVector);
+ aFunctor.SetContext (theContext);
+ OSD_Parallel::For (0, theSolverVector.Length(), aFunctor, !theIsRunParallel);
+ }
}
};
#include <OSD_Exception_CTRL_BREAK.hxx>
#include <OSD_MAllocHook.hxx>
#include <OSD_MemInfo.hxx>
+#include <OSD_Parallel.hxx>
+#include <OSD_ThreadPool.hxx>
#include <Standard_Macro.hxx>
#include <Standard_SStream.hxx>
#include <Standard_Stream.hxx>
return 0;
}
+//==============================================================================
+//function : dparallel
+//purpose :
+//==============================================================================
+static int dparallel (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ const Handle(OSD_ThreadPool)& aDefPool = OSD_ThreadPool::DefaultPool();
+ if (theArgNb <= 1)
+ {
+ theDI << "NbLogicalProcessors: " << OSD_Parallel::NbLogicalProcessors() << "\n"
+ << "NbThreads: " << aDefPool->NbThreads() << "\n"
+ << "NbDefThreads: " << aDefPool->NbDefaultThreadsToLaunch() << "\n"
+ << "UseOcct: " << (OSD_Parallel::ToUseOcctThreads() ? 1 : 0);
+ return 0;
+ }
+
+ for (Standard_Integer anIter = 1; anIter < theArgNb; ++anIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anIter]);
+ anArg.LowerCase();
+ if (anIter + 1 < theArgNb
+ && (anArg == "-nbthreads"
+ || anArg == "-threads"))
+ {
+ const Standard_Integer aVal = Draw::Atoi (theArgVec[++anIter]);
+ aDefPool->Init (aVal);
+ }
+ else if (anIter + 1 < theArgNb
+ && (anArg == "-nbdefthreads"
+ || anArg == "-defthreads"
+ || anArg == "-nbmaxdefthreads"
+ || anArg == "-maxdefthreads"))
+ {
+ const Standard_Integer aVal = Draw::Atoi (theArgVec[++anIter]);
+ if (aVal <= 0 || aVal > aDefPool->NbThreads())
+ {
+ std::cout << "Syntax error: maximum number of threads to use should be <= of threads in the pool\n";
+ return 1;
+ }
+ aDefPool->SetNbDefaultThreadsToLaunch (aVal);
+ }
+ else if (anIter + 1 < theArgNb
+ && (anArg == "-useocct"
+ || anArg == "-touseocct"
+ || anArg == "-occt"))
+ {
+ const Standard_Integer aVal = Draw::Atoi (theArgVec[++anIter]);
+ OSD_Parallel::SetUseOcctThreads (aVal == 1);
+ if (OSD_Parallel::ToUseOcctThreads() != (aVal == 1))
+ {
+ std::cout << "Warning: unable to switch threads library - no options available\n";
+ }
+ }
+ else if (anIter + 1 < theArgNb
+ && (anArg == "-usetbb"
+ || anArg == "-tousetbb"
+ || anArg == "-tbb"))
+ {
+ const Standard_Integer aVal = Draw::Atoi (theArgVec[++anIter]);
+ OSD_Parallel::SetUseOcctThreads (aVal == 0);
+ if (OSD_Parallel::ToUseOcctThreads() != (aVal == 0))
+ {
+ std::cout << "Warning: unable to switch threads library - no options available\n";
+ }
+ }
+ else
+ {
+ std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
+ return 1;
+ }
+ }
+ return 0;
+}
+
//==============================================================================
//function : dperf
//purpose :
theCommands.Add("dsetsignal","dsetsignal [fpe=0] -- set OSD signal handler, with FPE option if argument is given",
__FILE__,dsetsignal,g);
+ theCommands.Add("dparallel",
+ "dparallel [-occt {0|1}] [-nbThreads Count] [-nbDefThreads Count]"
+ "\n\t\t: Manages global parallelization parameters:"
+ "\n\t\t: -occt use OCCT implementation or external library (if available)"
+ "\n\t\t: -nbThreads specify the number of threads in default thread pool"
+ "\n\t\t: -nbDefThreads specify the upper limit of threads to be used for default thread pool"
+ "\n\t\t: within single parallelization call (should be <= of overall number of threads),"
+ "\n\t\t: so that nested algorithm can also use this pool",
+ __FILE__,dparallel,g);
+
// Logging commands; note that their names are hard-coded in the code
// of Draw_Interpretor, thus should not be changed without update of that code!
theCommands.Add("dlog", "manage logging of commands and output; run without args to get help",
}
#endif
+ static Standard_Boolean OSD_Parallel_ToUseOcctThreads =
+ #ifdef HAVE_TBB
+ Standard_False;
+ #else
+ Standard_True;
+ #endif
+}
+
+//=======================================================================
+//function : ToUseOcctThreads
+//purpose :
+//=======================================================================
+Standard_Boolean OSD_Parallel::ToUseOcctThreads()
+{
+ return OSD_Parallel_ToUseOcctThreads;
+}
+
+//=======================================================================
+//function : SetUseOcctThreads
+//purpose :
+//=======================================================================
+void OSD_Parallel::SetUseOcctThreads (Standard_Boolean theToUseOcct)
+{
+#ifdef HAVE_TBB
+ OSD_Parallel_ToUseOcctThreads = theToUseOcct;
+#else
+ (void )theToUseOcct;
+#endif
}
//=======================================================================
#ifndef OSD_Parallel_HeaderFile
#define OSD_Parallel_HeaderFile
+#include <OSD_ThreadPool.hxx>
#include <Standard_Type.hxx>
#include <memory>
#include <type_traits>
const Functor& myFunctor;
};
+ //! Wrapper redirecting functor taking element index to functor taking also thread index.
+ template<class Functor>
+ class FunctorWrapperForThreadPool
+ {
+ public:
+ FunctorWrapperForThreadPool (const Functor& theFunctor) : myFunctor(theFunctor) {}
+
+ void operator() (int theThreadIndex, int theElemIndex) const
+ {
+ (void )theThreadIndex;
+ myFunctor (theElemIndex);
+ }
+ private:
+ FunctorWrapperForThreadPool (const FunctorWrapperForThreadPool&);
+ void operator= (const FunctorWrapperForThreadPool&);
+ const Functor& myFunctor;
+ };
+
private:
//! Simple primitive for parallelization of "foreach" loops, e.g.:
//! @endcode
//! Implementation of framework-dependent functionality should be provided by
//! forEach_impl function defined in opencascade::parallel namespace.
- //! @param theBegin the first index (incusive)
+ //! @param theBegin the first index (inclusive)
//! @param theEnd the last index (exclusive)
//! @param theFunctor functor providing an interface "void operator(InputIterator theIter){}"
//! performing task for the specified iterator position
//! @param theNbItems number of items passed by iterator, -1 if unknown
- Standard_EXPORT static void forEach (UniversalIterator& theBegin,
- UniversalIterator& theEnd,
- const FunctorInterface& theFunctor,
- Standard_Integer theNbItems);
+ Standard_EXPORT static void forEachOcct (UniversalIterator& theBegin,
+ UniversalIterator& theEnd,
+ const FunctorInterface& theFunctor,
+ Standard_Integer theNbItems);
+
+ //! Same as forEachOcct() but can be implemented using external threads library.
+ Standard_EXPORT static void forEachExternal (UniversalIterator& theBegin,
+ UniversalIterator& theEnd,
+ const FunctorInterface& theFunctor,
+ Standard_Integer theNbItems);
public: //! @name public methods
- //! Returns number of logical proccesrs.
+ //! Returns TRUE if OCCT threads should be used instead of auxiliary threads library;
+ //! default value is FALSE if alternative library has been enabled while OCCT building and TRUE otherwise.
+ Standard_EXPORT static Standard_Boolean ToUseOcctThreads();
+
+ //! Sets if OCCT threads should be used instead of auxiliary threads library.
+ //! Has no effect if OCCT has been built with no auxiliary threads library.
+ Standard_EXPORT static void SetUseOcctThreads (Standard_Boolean theToUseOcct);
+
+ //! Returns number of logical processors.
Standard_EXPORT static Standard_Integer NbLogicalProcessors();
//! Simple primitive for parallelization of "foreach" loops, equivalent to:
//! theFunctor(*anIter);
//! }
//! @endcode
- //! @param theBegin the first index (incusive)
+ //! @param theBegin the first index (inclusive)
//! @param theEnd the last index (exclusive)
//! @param theFunctor functor providing an interface "void operator(InputIterator theIter){}"
//! performing task for specified iterator position
UniversalIterator aBegin(new IteratorWrapper<InputIterator>(theBegin));
UniversalIterator aEnd (new IteratorWrapper<InputIterator>(theEnd));
FunctorWrapperIter<InputIterator,Functor> aFunctor (theFunctor);
- forEach(aBegin, aEnd, aFunctor, theNbItems);
+ if (ToUseOcctThreads())
+ {
+ forEachOcct (aBegin, aEnd, aFunctor, theNbItems);
+ }
+ else
+ {
+ forEachExternal (aBegin, aEnd, aFunctor, theNbItems);
+ }
}
}
//! theFunctor(anIter);
//! }
//! @endcode
- //! @param theBegin the first index (incusive)
+ //! @param theBegin the first index (inclusive)
//! @param theEnd the last index (exclusive)
//! @param theFunctor functor providing an interface "void operator(int theIndex){}"
//! performing task for specified index
const Functor& theFunctor,
const Standard_Boolean isForceSingleThreadExecution = Standard_False)
{
- if (isForceSingleThreadExecution || (theEnd - theBegin) == 1)
+ const Standard_Integer aRange = theEnd - theBegin;
+ if (isForceSingleThreadExecution || aRange == 1)
{
for (Standard_Integer it (theBegin); it != theEnd; ++it)
theFunctor(it);
}
+ else if (ToUseOcctThreads())
+ {
+ const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
+ OSD_ThreadPool::Launcher aPoolLauncher (*aThreadPool, aRange);
+ FunctorWrapperForThreadPool<Functor> aFunctor (theFunctor);
+ aPoolLauncher.Perform (theBegin, theEnd, aFunctor);
+ }
else
{
UniversalIterator aBegin(new IteratorWrapper<Standard_Integer>(theBegin));
UniversalIterator aEnd (new IteratorWrapper<Standard_Integer>(theEnd));
FunctorWrapperInt<Functor> aFunctor (theFunctor);
- forEach(aBegin, aEnd, aFunctor, theEnd - theBegin);
+ forEachExternal (aBegin, aEnd, aFunctor, aRange);
}
}
#include <tbb/task_scheduler_init.h>
//=======================================================================
-//function : forEach
+//function : forEachExternal
//purpose :
//=======================================================================
-void OSD_Parallel::forEach (UniversalIterator& theBegin,
- UniversalIterator& theEnd,
- const FunctorInterface& theFunctor,
- Standard_Integer theNbItems)
+void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
+ UniversalIterator& theEnd,
+ const FunctorInterface& theFunctor,
+ Standard_Integer theNbItems)
{
try
{
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// Version of parallel executor used when TBB is not available
-#ifndef HAVE_TBB
-
#include <OSD_Parallel.hxx>
#include <OSD_ThreadPool.hxx>
}
//=======================================================================
-//function : forEach
-//purpose :
+//function : forEachOcct
+//purpose :
//=======================================================================
-void OSD_Parallel::forEach (UniversalIterator& theBegin,
- UniversalIterator& theEnd,
- const FunctorInterface& theFunctor,
- Standard_Integer theNbItems)
+void OSD_Parallel::forEachOcct (UniversalIterator& theBegin,
+ UniversalIterator& theEnd,
+ const FunctorInterface& theFunctor,
+ Standard_Integer theNbItems)
{
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
const Standard_Integer aNbThreads = theNbItems != -1 ? Min (theNbItems, aThreadPool->NbDefaultThreadsToLaunch()) : -1;
aLauncher.Perform (theBegin, theEnd, theFunctor);
}
+// Version of parallel executor used when TBB is not available
+#ifndef HAVE_TBB
+//=======================================================================
+//function : forEachExternal
+//purpose :
+//=======================================================================
+void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
+ UniversalIterator& theEnd,
+ const FunctorInterface& theFunctor,
+ Standard_Integer theNbItems)
+{
+ forEachOcct (theBegin, theEnd, theFunctor, theNbItems);
+}
+
#endif /* ! HAVE_TBB */
#include <OSD_ThreadPool.hxx>
#include <OSD.hxx>
+#include <OSD_Parallel.hxx>
#include <Standard_Atomic.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Array1.hxx>
#include <OSD_Thread.hxx>
-#include <OSD_Parallel.hxx>
#include <Standard_Atomic.hxx>
#include <Standard_Condition.hxx>
#include <Standard_Mutex.hxx>