0024624: Lost word in license statement in source files
[occt.git] / src / BOPAlgo / BOPAlgo_Builder_2Cnt.hxx
CommitLineData
acccace3 1// Created by: Peter KURNEV
2// Copyright (c) 1999-2013 OPEN CASCADE SAS
3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
acccace3 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 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.
acccace3 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
acccace3 14
15#ifndef BOPAlgo_Builder_2Cnt_HeaderFile
16#define BOPAlgo_Builder_2Cnt_HeaderFile
17
19941687 18#include <NCollection_IndexedDataMap.hxx>
19
20#include <TopoDS_Shape.hxx>
21#include <TopoDS_Face.hxx>
acccace3 22
acccace3 23#include <BOPCol_TBB.hxx>
19941687 24#include <BOPCol_NCVector.hxx>
acccace3 25
19941687 26#include <BOPTools_Set.hxx>
27#include <BOPTools_SetMapHasher.hxx>
28#include <BOPTools_AlgoTools.hxx>
29
30#include <BOPInt_Context.hxx>
31
32#include <BOPAlgo_BuilderFace.hxx>
30ecd5f8 33#include <BOPAlgo_BuilderSolid.hxx>
acccace3 34
acccace3 35typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
36//
37//=======================================================================
38//class : BOPAlgo_BuilderFaceFunctor
30ecd5f8 39//purpose : The class provides the interface and implementation
40// of the parallel computations
acccace3 41//=======================================================================
42class BOPAlgo_BuilderFaceFunctor {
43 protected:
44 BOPAlgo_VectorOfBuilderFace* myPVBF;
45 //
46 public:
47 //
48 BOPAlgo_BuilderFaceFunctor(BOPAlgo_VectorOfBuilderFace& aVBF)
49 : myPVBF(&aVBF) {
50 }
51 //
96a95605
DB
52 void operator()( const flexible_range<Standard_Integer>& aBR ) const{
53 Standard_Integer i, iBeg, iEnd;
acccace3 54 //
55 BOPAlgo_VectorOfBuilderFace& aVBF=*myPVBF;
56 //
57 iBeg=aBR.begin();
58 iEnd=aBR.end();
59 for(i=iBeg; i!=iEnd; ++i) {
96a95605 60 BOPAlgo_BuilderFace& aBF=aVBF(i);
acccace3 61 //
62 aBF.Perform();
63 }
64 }
65};
66//=======================================================================
67//class : BOPAlgo_BuilderFaceCnt
30ecd5f8 68//purpose : The class provides the interface and implementation
69// of the parallel computations
acccace3 70//=======================================================================
71class BOPAlgo_BuilderFaceCnt {
72 public:
73 //-------------------------------
74 // Perform
75 Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
76 BOPAlgo_VectorOfBuilderFace& aVBF) {
77 //
78 BOPAlgo_BuilderFaceFunctor aBFF(aVBF);
96a95605 79 Standard_Integer aNbBF=aVBF.Extent();
acccace3 80 //
81 if (bRunParallel) {
96a95605 82 flexible_for(flexible_range<Standard_Integer>(0,aNbBF), aBFF);
acccace3 83 }
84 else {
96a95605 85 aBFF.operator()(flexible_range<Standard_Integer>(0,aNbBF));
acccace3 86 }
87 }
88 //
89};
19941687 90//
19941687 91typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
30ecd5f8 92//
93typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
94 BOPAlgo_VectorOfVectorOfShape;
95//
19941687 96typedef NCollection_IndexedDataMap\
97 <BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
98 BOPAlgo_IndexedDataMapOfSetInteger;
99//
100//=======================================================================
101//class : BOPAlgo_PairOfShapeBoolean
102//purpose :
103//=======================================================================
104class BOPAlgo_PairOfShapeBoolean {
105 public:
106 BOPAlgo_PairOfShapeBoolean()
107 : myFlag(Standard_False) {
108 }
109 //
110 TopoDS_Shape& Shape1() {
111 return myShape1;
112 }
113 //
114 TopoDS_Shape& Shape2() {
115 return myShape2;
116 }
117 //
118 Standard_Boolean& Flag() {
119 return myFlag;
120 }
121 //
122 protected:
123 Standard_Boolean myFlag;
124 TopoDS_Shape myShape1;
125 TopoDS_Shape myShape2;
126};
19941687 127//
30ecd5f8 128typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
129 BOPAlgo_VectorOfPairOfShapeBoolean;
130//
19941687 131//=======================================================================
132//function : BOPAlgo_BuilderSDFaceFunctor
30ecd5f8 133//purpose : The class provides the interface and implementation
134// of the parallel computations
19941687 135//=======================================================================
136class BOPAlgo_BuilderSDFaceFunctor {
137 protected:
138 BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
139
140 public:
141 //
142 BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
143 : myPVPSB(&aVPSB){
144 }
145 //
146 void operator()( const flexible_range<Standard_Integer>& aBR ) const {
147 Standard_Boolean bFlag;
148 Standard_Integer i, iBeg, iEnd;
149 Handle(BOPInt_Context) aContext;
150 //
151 aContext=new BOPInt_Context;
152 //
153 BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
154 //
155 iBeg=aBR.begin();
156 iEnd=aBR.end();
157 for(i=iBeg; i!=iEnd; ++i) {
158 BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
159 const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
160 const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
161 bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
162 if (bFlag) {
163 aPSB.Flag()=bFlag;
164 }
165 }
166 }
167};
168//
169//=======================================================================
170//function : BOPAlgo_BuilderSDFaceCnt
30ecd5f8 171//purpose : The class provides the interface and implementation
172// of the parallel computations
19941687 173//=======================================================================
174class BOPAlgo_BuilderSDFaceCnt {
175 public:
176 //-------------------------------
177 // Perform
178 Standard_EXPORT static
179 void Perform(const Standard_Boolean bRunParallel,
180 BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
181 Standard_Integer aNbVPSB;
182 //
183 aNbVPSB=aVPSB.Extent();
184 BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
185 //
186 if (bRunParallel) {
187 flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
188 }
189 else {
190 aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
191 }
192 }
193 //
194};
30ecd5f8 195//
196typedef BOPCol_NCVector<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
197//
198//=======================================================================
199//class : BOPAlgo_BuilderSolidFunctor
200//purpose : The class provides the interface and implementation
201// of the parallel computations
202//=======================================================================
203class BOPAlgo_BuilderSolidFunctor {
204 protected:
205 BOPAlgo_VectorOfBuilderSolid* myPVBS;
206 //
207 public:
208 //
209 BOPAlgo_BuilderSolidFunctor(BOPAlgo_VectorOfBuilderSolid& aVBS)
210 : myPVBS(&aVBS) {
211 }
212 //
213 void operator()( const flexible_range<Standard_Integer>& aBR ) const{
214 Standard_Integer i, iBeg, iEnd;
215 //
216 BOPAlgo_VectorOfBuilderSolid& aVBS=*myPVBS;
217 //
218 iBeg=aBR.begin();
219 iEnd=aBR.end();
220 for(i=iBeg; i!=iEnd; ++i) {
221 BOPAlgo_BuilderSolid& aBS=aVBS(i);
222 //
223 aBS.Perform();
224 }
225 }
226};
227//=======================================================================
228//class : BOPAlgo_BuilderSolidCnt
229//purpose : The class provides the interface and implementation
230// of the parallel computations
231//=======================================================================
232class BOPAlgo_BuilderSolidCnt {
233 public:
234 //-------------------------------
235 // Perform
236 Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
237 BOPAlgo_VectorOfBuilderSolid& aVBS) {
238
96a95605 239 Standard_Integer aNbBS=aVBS.Extent();
30ecd5f8 240 BOPAlgo_BuilderSolidFunctor aBSF(aVBS);
241 //
242 if (bRunParallel) {
243 flexible_for(flexible_range<Standard_Integer>(0,aNbBS), aBSF);
244 }
245 else {
246 aBSF.operator()(flexible_range<Standard_Integer>(0,aNbBS));
247 }
248 }
249 //
250};
acccace3 251
252#endif