1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2013 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and / or modify it
7 // under the terms of the GNU Lesser General Public version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef BOPAlgo_Builder_2Cnt_HeaderFile
16 #define BOPAlgo_Builder_2Cnt_HeaderFile
18 #include <NCollection_IndexedDataMap.hxx>
20 #include <TopoDS_Shape.hxx>
21 #include <TopoDS_Face.hxx>
23 #include <BOPCol_TBB.hxx>
24 #include <BOPCol_NCVector.hxx>
26 #include <BOPTools_Set.hxx>
27 #include <BOPTools_SetMapHasher.hxx>
28 #include <BOPTools_AlgoTools.hxx>
30 #include <BOPInt_Context.hxx>
32 #include <BOPAlgo_BuilderFace.hxx>
34 //=======================================================================
35 //class : BOPAlgo_VectorOfBuilderFace
37 //=======================================================================
38 typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
40 //=======================================================================
41 //class : BOPAlgo_BuilderFaceFunctor
43 //=======================================================================
44 class BOPAlgo_BuilderFaceFunctor {
46 BOPAlgo_VectorOfBuilderFace* myPVBF;
50 BOPAlgo_BuilderFaceFunctor(BOPAlgo_VectorOfBuilderFace& aVBF)
54 void operator()( const flexible_range<Standard_Size>& aBR ) const{
55 Standard_Size i, iBeg, iEnd;
57 BOPAlgo_VectorOfBuilderFace& aVBF=*myPVBF;
61 for(i=iBeg; i!=iEnd; ++i) {
62 BOPAlgo_BuilderFace& aBF=aVBF((Standard_Integer)i);
68 //=======================================================================
69 //class : BOPAlgo_BuilderFaceCnt
71 //=======================================================================
72 class BOPAlgo_BuilderFaceCnt {
74 //-------------------------------
76 Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
77 BOPAlgo_VectorOfBuilderFace& aVBF) {
79 BOPAlgo_BuilderFaceFunctor aBFF(aVBF);
80 Standard_Size aNbBF=aVBF.Extent();
83 flexible_for(flexible_range<Standard_Size>(0,aNbBF), aBFF);
86 aBFF.operator()(flexible_range<Standard_Size>(0,aNbBF));
92 //-------------------------------------------------------------------------
93 typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
94 typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> BOPAlgo_VectorOfVectorOfShape;
96 typedef NCollection_IndexedDataMap\
97 <BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
98 BOPAlgo_IndexedDataMapOfSetInteger;
100 //=======================================================================
101 //class : BOPAlgo_PairOfShapeBoolean
103 //=======================================================================
104 class BOPAlgo_PairOfShapeBoolean {
106 BOPAlgo_PairOfShapeBoolean()
107 : myFlag(Standard_False) {
110 TopoDS_Shape& Shape1() {
114 TopoDS_Shape& Shape2() {
118 Standard_Boolean& Flag() {
123 Standard_Boolean myFlag;
124 TopoDS_Shape myShape1;
125 TopoDS_Shape myShape2;
128 typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> BOPAlgo_VectorOfPairOfShapeBoolean;
131 //=======================================================================
132 //function : BOPAlgo_BuilderSDFaceFunctor
134 //=======================================================================
135 class BOPAlgo_BuilderSDFaceFunctor {
137 BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
141 BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
145 void operator()( const flexible_range<Standard_Integer>& aBR ) const {
146 Standard_Boolean bFlag;
147 Standard_Integer i, iBeg, iEnd;
148 Handle(BOPInt_Context) aContext;
150 aContext=new BOPInt_Context;
152 BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
156 for(i=iBeg; i!=iEnd; ++i) {
157 BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
158 const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
159 const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
160 bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
168 //=======================================================================
169 //function : BOPAlgo_BuilderSDFaceCnt
171 //=======================================================================
172 class BOPAlgo_BuilderSDFaceCnt {
174 //-------------------------------
176 Standard_EXPORT static
177 void Perform(const Standard_Boolean bRunParallel,
178 BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
179 Standard_Integer aNbVPSB;
181 aNbVPSB=aVPSB.Extent();
182 BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
185 flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
188 aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));