1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 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 under
7 // the terms of the GNU Lesser General Public License 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 #include <BOPAlgo_PaveFiller.ixx>
17 #include <Bnd_Box.hxx>
19 #include <TopoDS_Edge.hxx>
20 #include <TopoDS_Vertex.hxx>
22 #include <BOPCol_NCVector.hxx>
23 #include <BOPCol_MapOfInteger.hxx>
24 #include <BOPCol_TBB.hxx>
26 #include <BOPDS_ShapeInfo.hxx>
27 #include <BOPDS_PaveBlock.hxx>
28 #include <BOPDS_Iterator.hxx>
29 #include <BOPDS_ListOfPaveBlock.hxx>
31 #include <BOPInt_ShrunkRange.hxx>
33 //=======================================================================
34 //class : BOPAlgo_ShrunkRange
36 //=======================================================================
37 class BOPAlgo_ShrunkRange : public BOPInt_ShrunkRange {
40 : BOPInt_ShrunkRange(),
44 virtual ~BOPAlgo_ShrunkRange() {
47 void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
51 Handle(BOPDS_PaveBlock)& PaveBlock() {
55 virtual void Perform() {
59 BOPInt_ShrunkRange::Perform();
65 Standard_Integer WarningStatus() const {
66 return myWarningStatus;
70 Standard_Integer myWarningStatus;
71 Handle(BOPDS_PaveBlock) myPB;
74 //=======================================================================
75 typedef BOPCol_NCVector
76 <BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
78 typedef BOPCol_TBBContextFunctor
80 BOPAlgo_VectorOfShrunkRange,
81 Handle(BOPInt_Context),
82 BOPInt_Context> BOPAlgo_ShrunkRangeFunctor;
84 typedef BOPCol_TBBContextCnt
85 <BOPAlgo_ShrunkRangeFunctor,
86 BOPAlgo_VectorOfShrunkRange,
87 Handle(BOPInt_Context)> BOPAlgo_ShrunkRangeCnt;
89 //=======================================================================
90 // function: FillShrunkData
92 //=======================================================================
93 void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
94 const TopAbs_ShapeEnum aType2)
96 Standard_Integer iSize;
101 myIterator->Initialize(aType1, aType2);
102 iSize=myIterator->ExpectedLength();
107 Standard_Boolean bJustAdd;
108 Standard_Integer i, iEnd, nS[2], nE, nV1, nV2, aNbVSD, k, iWrn;
109 Standard_Real aT1, aT2, aTS1, aTS2;
110 BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
111 BOPCol_MapOfInteger aMI;
112 BOPAlgo_VectorOfShrunkRange aVSD;
114 iEnd=(aType2==TopAbs_EDGE) ? 2 : 1;
116 for (; myIterator->More(); myIterator->Next()) {
117 myIterator->Value(nS[0], nS[1], bJustAdd);
122 for (i=0; i<iEnd; ++i) {
128 const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
133 BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
134 aItLPB.Initialize(aLPB);
135 for (; aItLPB.More(); aItLPB.Next()) {
136 const Handle(BOPDS_PaveBlock)& aPB=aItLPB.ChangeValue();
137 if (aPB->HasShrunkData()) {
141 // FillShrunkData(aPB);
142 aPB->Indices(nV1, nV2);
143 aPB->Range(aT1, aT2);
145 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
147 const TopoDS_Vertex& aV1=
148 (*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
150 const TopoDS_Vertex& aV2=
151 (*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
153 BOPAlgo_ShrunkRange& aSD=aVSD.Append1();
155 aSD.SetPaveBlock(aPB);
156 aSD.SetData(aE, aT1, aT2, aV1, aV2);
161 aNbVSD=aVSD.Extent();
162 //=============================================================
163 BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
164 //=============================================================
166 for (k=0; k < aNbVSD; ++k) {
167 BOPAlgo_ShrunkRange& aSD=aVSD(k);
168 iWrn=aSD.WarningStatus();
173 Handle(BOPDS_PaveBlock)& aPB=aSD.PaveBlock();
174 aSD.ShrunkRange(aTS1, aTS2);
175 const Bnd_Box& aBox=aSD.BndBox();
177 aPB->SetShrunkData(aTS1, aTS2, aBox);