Changing OCCT version to 6.7.1 and define OCC_VERSION_DEVELOPMENT to "dev"
[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//
973c2be1 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.
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>
acccace3 33
acccace3 34//=======================================================================
35//class : BOPAlgo_VectorOfBuilderFace
36//purpose :
37//=======================================================================
38typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
39//
40//=======================================================================
41//class : BOPAlgo_BuilderFaceFunctor
42//purpose :
43//=======================================================================
44class BOPAlgo_BuilderFaceFunctor {
45 protected:
46 BOPAlgo_VectorOfBuilderFace* myPVBF;
47 //
48 public:
49 //
50 BOPAlgo_BuilderFaceFunctor(BOPAlgo_VectorOfBuilderFace& aVBF)
51 : myPVBF(&aVBF) {
52 }
53 //
54 void operator()( const flexible_range<Standard_Size>& aBR ) const{
55 Standard_Size i, iBeg, iEnd;
56 //
57 BOPAlgo_VectorOfBuilderFace& aVBF=*myPVBF;
58 //
59 iBeg=aBR.begin();
60 iEnd=aBR.end();
61 for(i=iBeg; i!=iEnd; ++i) {
37e640d5 62 BOPAlgo_BuilderFace& aBF=aVBF((Standard_Integer)i);
acccace3 63 //
64 aBF.Perform();
65 }
66 }
67};
68//=======================================================================
69//class : BOPAlgo_BuilderFaceCnt
70//purpose :
71//=======================================================================
72class BOPAlgo_BuilderFaceCnt {
73 public:
74 //-------------------------------
75 // Perform
76 Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
77 BOPAlgo_VectorOfBuilderFace& aVBF) {
78 //
79 BOPAlgo_BuilderFaceFunctor aBFF(aVBF);
80 Standard_Size aNbBF=aVBF.Extent();
81 //
82 if (bRunParallel) {
83 flexible_for(flexible_range<Standard_Size>(0,aNbBF), aBFF);
84 }
85 else {
86 aBFF.operator()(flexible_range<Standard_Size>(0,aNbBF));
87 }
88 }
89 //
90};
19941687 91//
92//-------------------------------------------------------------------------
93typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
94typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> BOPAlgo_VectorOfVectorOfShape;
95
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};
127
128typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> BOPAlgo_VectorOfPairOfShapeBoolean;
129//
130
131//=======================================================================
132//function : BOPAlgo_BuilderSDFaceFunctor
133//purpose :
134//=======================================================================
135class BOPAlgo_BuilderSDFaceFunctor {
136 protected:
137 BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
138
139 public:
140 //
141 BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
142 : myPVPSB(&aVPSB){
143 }
144 //
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;
149 //
150 aContext=new BOPInt_Context;
151 //
152 BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
153 //
154 iBeg=aBR.begin();
155 iEnd=aBR.end();
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);
161 if (bFlag) {
162 aPSB.Flag()=bFlag;
163 }
164 }
165 }
166};
167//
168//=======================================================================
169//function : BOPAlgo_BuilderSDFaceCnt
170//purpose :
171//=======================================================================
172class BOPAlgo_BuilderSDFaceCnt {
173 public:
174 //-------------------------------
175 // Perform
176 Standard_EXPORT static
177 void Perform(const Standard_Boolean bRunParallel,
178 BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
179 Standard_Integer aNbVPSB;
180 //
181 aNbVPSB=aVPSB.Extent();
182 BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
183 //
184 if (bRunParallel) {
185 flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
186 }
187 else {
188 aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
189 }
190 }
191 //
192};
193
acccace3 194
195#endif