aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
- const Handle(BOPDS_PaveBlock)& aPBR=aPB->RealPaveBlock();
+ const Handle(BOPDS_PaveBlock)& aPBR=myDS->RealPaveBlock(aPB);
//
nSpR=aPBR->Edge();
const TopoDS_Shape& aSpR=myDS->Shape(nSpR);
aLS.Append(aSpR);
myOrigins.Bind(aSpR, aE);
//
- if (aPB->IsCommonBlockOnEdge()) {
+ if (myDS->IsCommonBlockOnEdge(aPB)) {
nSp=aPB->Edge();
const TopoDS_Shape& aSp=myDS->Shape(nSp);
myShapesSD.Bind(aSp, aSpR);
//=========================================
// post treatment
//=========================================
- BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator);
+ BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator, myDS);
PerformVerticesEE(aMVCPB, aAllocator);
//-----------------------------------------------------scope t
aMPBLPB.Clear();
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
// 3
- if (!aPB->IsCommonBlock()) {
+ if (!myDS->IsCommonBlock(aPB)) {
myDS->UpdatePaveBlock(aPB);
}
else {
- const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
+ const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
myDS->UpdateCommonBlock(aCB);
}
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB=aIt.ChangeValue();
//
- const Handle(BOPDS_PaveBlock) aPBR=aPB->RealPaveBlock();
+ const Handle(BOPDS_PaveBlock) aPBR=myDS->RealPaveBlock(aPB);
if (aMPBF.Contains(aPBR)) {
continue;
}
//=========================================
// post treatment
//=========================================
- BOPAlgo_Tools::PerformCommonBlocks(aMPBLI, aAllocator);
+ BOPAlgo_Tools::PerformCommonBlocks(aMPBLI, aAllocator, myDS);
PerformVerticesEF(aMVCPB, aAllocator);
//
// Update FaceInfoIn for all faces having EF common parts
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
// 3
- if (!aPB->IsCommonBlock()) {
+ if (!myDS->IsCommonBlock(aPB)) {
myDS->UpdatePaveBlock(aPB);
}
else {
- const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
+ const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
myDS->UpdateCommonBlock(aCB);
}
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
if (bExist) {
if (aMPBAdd.Add(aPBOut)) {
Standard_Boolean bInBothFaces = Standard_True;
- if (!aPBOut->IsCommonBlock()) {
+ if (!myDS->IsCommonBlock(aPBOut)) {
Standard_Integer nE;
Standard_Real aTolE;
//
}
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
- const Handle(BOPDS_PaveBlock) aPBRx=aPBx->RealPaveBlock();
+ const Handle(BOPDS_PaveBlock) aPBRx=aPDS->RealPaveBlock(aPBx);
//
// update vertices of paves
aPave[0]=aPBx->Pave1();
BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn();
//
// remove old pave blocks
- const Handle(BOPDS_CommonBlock)& aCB1 = aPBf->CommonBlock();
+ const Handle(BOPDS_CommonBlock)& aCB1 = myDS->CommonBlock(aPBf);
bCB = !aCB1.IsNull();
BOPDS_ListOfPaveBlock aLPB1;
//
aPB2n->SetEdge(aPB->Edge());
aPB2n->SetOriginalEdge(nE);
aCB->AddPaveBlock(aPB2n);
- aPB2n->SetCommonBlock(aCB);
+ myDS->SetCommonBlock(aPB2n, aCB);
myDS->ChangePaveBlocks(nE).Append(aPB2n);
}
aCB->AddFaces(aFaces);
Standard_Boolean bCom = BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
if (bCom) {
if (bCB) {
- aCB = aPB->CommonBlock();
+ aCB = myDS->CommonBlock(aPB);
aCB->AddFace(nF);
} else {
aCB = new BOPDS_CommonBlock;
aCB->AddFace(nF1);
aCB->AddFace(nF2);
//
- aPB->SetCommonBlock(aCB);
+ myDS->SetCommonBlock(aPB, aCB);
}
aMPB.Add(aPB);
}
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
- const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
+ const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
bCB=!aCB.IsNull();
if (bCB) {
myDS->SortPaveBlocks(aCB);
aItMPB.Initialize(aMPBOn);
for(; aItMPB.More(); aItMPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
- if (aPB->IsCommonBlockOnEdge()) {
+ if (myDS->IsCommonBlockOnEdge(aPB)) {
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
bV2=myDS->IsNewShape(nV2);
//
if (!(bV1 || bV2)) {
- if (!aPB->IsCommonBlock()) {
+ if (!myDS->IsCommonBlock(aPB)) {
// the PB seems to be untouced
aLPB.Clear();
continue;
BaseAllocator from BOPCol,
IndexedDataMapOfIntegerListOfInteger from BOPCol,
DataMapOfIntegerListOfInteger from BOPCol,
+ PDS from BOPDS,
PaveBlock from BOPDS,
IndexedDataMapOfPaveBlockListOfInteger from BOPDS,
IndexedDataMapOfPaveBlockListOfPaveBlock from BOPDS,
PerformCommonBlocks(myclass;
theMBlocks :out IndexedDataMapOfPaveBlockListOfPaveBlock from BOPDS;
- theAllocator:out BaseAllocator from BOPCol);
+ theAllocator:out BaseAllocator from BOPCol;
+ pDS: out PDS from BOPDS);
FillMap(myclass;
tneN1:Integer from Standard;
PerformCommonBlocks(myclass;
theMBlocks :IndexedDataMapOfPaveBlockListOfInteger from BOPDS;
- theAllocator:out BaseAllocator from BOPCol);
+ theAllocator:out BaseAllocator from BOPCol;
+ pDS: out PDS from BOPDS);
--fields
end Tools;
// and conditions governing the rights and limitations under the License.
#include <BOPAlgo_Tools.ixx>
+#include <BOPDS_DS.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_IndexedMapOfPaveBlock.hxx>
#include <BOPDS_CommonBlock.hxx>
//purpose :
//=======================================================================
void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
- Handle(NCollection_BaseAllocator)& aAllocator)
+ Handle(NCollection_BaseAllocator)& aAllocator,
+ BOPDS_PDS& pDS)
{
Standard_Integer aNbCB;
//
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
- aPBx->SetCommonBlock(aCB);
+ pDS->SetCommonBlock(aPBx, aCB);
}
}//if (aNbPB>1) {
}
//purpose :
//=======================================================================
void BOPAlgo_Tools::PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
- Handle(NCollection_BaseAllocator)& )//aAllocator)
+ Handle(NCollection_BaseAllocator)& ,//aAllocator
+ BOPDS_PDS& pDS)
{
Standard_Integer nF, i, aNb;
BOPCol_ListIteratorOfListOfInteger aItLI;
aNb=aMPBLI.Extent();
for (i=1; i<=aNb; ++i) {
aPB=aMPBLI.FindKey(i);
- if (aPB->IsCommonBlock()) {
- aCB=aPB->CommonBlock();
+ if (pDS->IsCommonBlock(aPB)) {
+ aCB=pDS->CommonBlock(aPB);
}
else {
aCB=new BOPDS_CommonBlock;
nF=aItLI.Value();
aCB->AddFace(nF);
}
- aPB->SetCommonBlock(aCB);
+ pDS->SetCommonBlock(aPB, aCB);
}
}
imported IndexedMapOfPaveBlock from BOPDS;
imported IndexedDataMapOfPaveBlockListOfInteger from BOPDS;
imported IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
+ imported DataMapOfPaveBlockCommonBlock from BOPDS;
--
imported Interf from BOPDS;
imported InterfVV from BOPDS;
VectorOfFaceInfo from BOPDS,
FaceInfo from BOPDS,
--
- MapOfPassKey from BOPDS,
+ MapOfPassKey from BOPDS,
+ DataMapOfPaveBlockCommonBlock from BOPDS,
--
VectorOfInterfVV from BOPDS,
VectorOfInterfVE from BOPDS,
UpdateCommonBlock(me:out;
theCB:CommonBlock from BOPDS);
---Purpose:
- --- Update the common block theCB
+ --- Update the common block theCB
+
+ IsCommonBlock(me;
+ thePB:PaveBlock from BOPDS)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Query
+ --- Returns true if the pave block is common block
+
+ CommonBlock(me;
+ thePB:PaveBlock from BOPDS)
+ returns CommonBlock from BOPDS;
+ ---C++: return const &
+ ---Purpose:
+ --- Selector
+ --- Returns the common block
+
+ SetCommonBlock(me:out;
+ thePB:PaveBlock from BOPDS;
+ theCB:CommonBlock from BOPDS);
+ ---Purpose:
+ --- Modifier
+ --- Sets the common block <theCB>
+
+ RealPaveBlock(me;
+ thePB:PaveBlock from BOPDS)
+ returns PaveBlock from BOPDS;
+ ---Purpose:
+ --- Selector
+ --- Returns the real first pave block
+
+ IsCommonBlockOnEdge(me;
+ thePB:PaveBlock from BOPDS)
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Query
+ --- Returns true if common block contains more then one pave block
+
--
-- face info
--
myLines : VectorOfShapeInfo from BOPDS is protected;
myMapShapeIndex : DataMapOfShapeInteger from BOPCol is protected;
--
- myPaveBlocksPool : VectorOfListOfPaveBlock from BOPDS is protected;
+ myPaveBlocksPool : VectorOfListOfPaveBlock from BOPDS is protected;
+ myMapPBCB : DataMapOfPaveBlockCommonBlock from BOPDS is protected;
myFaceInfoPool : VectorOfFaceInfo from BOPDS is protected;
--
--same domain shapes
myPaveBlocksPool(myAllocator),
myFaceInfoPool(myAllocator),
myShapesSD(100, myAllocator),
+ myMapPBCB(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myPaveBlocksPool(myAllocator),
myFaceInfoPool(myAllocator),
myShapesSD(100, myAllocator),
+ myMapPBCB(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myPaveBlocksPool.Clear();
myFaceInfoPool.Clear();
myShapesSD.Clear();
+ myMapPBCB.Clear();
myInterfTB.Clear();
myInterfVV.Clear();
myInterfVE.Clear();
aItPB.Initialize(aLPBxN);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.ChangeValue();
- aPB->SetCommonBlock(aCBx);
+ SetCommonBlock(aPB, aCBx);
}
}
}
}
+
+//=======================================================================
+// function: RealPaveBlock
+// purpose:
+//=======================================================================
+ Handle(BOPDS_PaveBlock) BOPDS_DS::RealPaveBlock
+ (const Handle(BOPDS_PaveBlock)& thePB) const
+{
+ if (IsCommonBlock(thePB)) {
+ const Handle(BOPDS_CommonBlock)& aCB = CommonBlock(thePB);
+ const Handle(BOPDS_PaveBlock)& aPB = aCB->PaveBlock1();
+ return aPB;
+ }
+ return thePB;
+}
+
+//=======================================================================
+// function: IsCommonBlockOnEdge
+// purpose:
+//=======================================================================
+ Standard_Boolean BOPDS_DS::IsCommonBlockOnEdge
+ (const Handle(BOPDS_PaveBlock)& thePB) const
+{
+ if (IsCommonBlock(thePB)) {
+ const Handle(BOPDS_CommonBlock)& aCB = CommonBlock(thePB);
+ return aCB->PaveBlocks().Extent()>1;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : IsCommonBlock
+//purpose :
+//=======================================================================
+ Standard_Boolean BOPDS_DS::IsCommonBlock
+ (const Handle(BOPDS_PaveBlock)& thePB) const
+{
+ return myMapPBCB.IsBound(thePB);
+}
+
+//=======================================================================
+//function : CommonBlock
+//purpose :
+//=======================================================================
+ const Handle(BOPDS_CommonBlock)& BOPDS_DS::CommonBlock
+ (const Handle(BOPDS_PaveBlock)& thePB) const
+{
+ Handle(BOPDS_CommonBlock) aNullCB;
+ //
+ const Handle(BOPDS_CommonBlock)& aCB =
+ IsCommonBlock(thePB) ? myMapPBCB.Find(thePB) : aNullCB;
+ //
+ return aCB;
+}
+
+//=======================================================================
+//function : SetCommonBlock
+//purpose :
+//=======================================================================
+ void BOPDS_DS::SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB,
+ const Handle(BOPDS_CommonBlock)& theCB)
+{
+ if (IsCommonBlock(thePB)) {
+ Handle(BOPDS_CommonBlock)& aCB = myMapPBCB.ChangeFind(thePB);
+ aCB=theCB;
+ }
+ else {
+ myMapPBCB.Bind(thePB, theCB);
+ }
+}
+
//
// FaceInfo
//
aPB->Indices(nV1, nV2);
theMI.Add(nV1);
theMI.Add(nV2);
- if (aPB->IsCommonBlock()) {
- const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
- const Handle(BOPDS_PaveBlock)& aPB1=aCB->PaveBlock1();
- theMPB.Add(aPB1);
- }
- else {
- theMPB.Add(aPB);
- }
+ Handle(BOPDS_PaveBlock) aPBR=RealPaveBlock(aPB);
+ theMPB.Add(aPBR);
}
}//if (aSIE.ShapeType()==TopAbs_EDGE)
else {
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
- if (aPB->IsCommonBlock()) {
- const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
+ if (IsCommonBlock(aPB)) {
+ const Handle(BOPDS_CommonBlock)& aCB=CommonBlock(aPB);
if (aCB->Contains(theF)) {
const Handle(BOPDS_PaveBlock)& aPB1=aCB->PaveBlock1();
theMPB.Add(aPB1);
else {
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
- const Handle(BOPDS_PaveBlock) aPB=aItLPB.Value()->RealPaveBlock();
+ const Handle(BOPDS_PaveBlock) aPB=RealPaveBlock(aItLPB.Value());
nSp=aPB->Edge();
aMI.Add(nSp);
}
else {
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
- const Handle(BOPDS_PaveBlock) aPB=aItLPB.Value()->RealPaveBlock();
+ const Handle(BOPDS_PaveBlock) aPB=RealPaveBlock(aItLPB.Value());
nSp=aPB->Edge();
if (aMI.Contains(nSp)) {
theLI.Append(nSp);
--- /dev/null
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2012-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#ifndef BOPDS_DataMapOfPaveBlockCommonBlock_HeaderFile
+#define BOPDS_DataMapOfPaveBlockCommonBlock_HeaderFile
+
+#define _NCollection_MapHasher
+#include <NCollection_DataMap.hxx>
+#include <TColStd_MapTransientHasher.hxx>
+#include <BOPDS_CommonBlock.hxx>
+
+typedef NCollection_DataMap<Handle(BOPDS_PaveBlock), Handle(BOPDS_CommonBlock), TColStd_MapTransientHasher> BOPDS_DataMapOfPaveBlockCommonBlock;
+typedef BOPDS_DataMapOfPaveBlockCommonBlock::Iterator BOPDS_DataMapIteratorOfDataMapOfPaveBlockCommonBlock;
+
+#undef _NCollection_MapHasher
+
+
+#endif
MapOfInteger from BOPCol,
Pave from BOPDS,
ListOfPave from BOPDS,
- ListOfPaveBlock from BOPDS,
- CommonBlock from BOPDS
+ ListOfPaveBlock from BOPDS
--raises
--- Returns true if the extra paves contain the pave
--- with given value of the parameter <thePrm>
--- <theTol> - the value of the tolerance to compare
-
- --
- -- common block
- --
- SetCommonBlock(me:mutable;
- theCB:CommonBlock from BOPDS);
- ---Purpose:
- --- Modifier
- --- Sets the common block <theCB>
-
- CommonBlock(me)
- returns CommonBlock from BOPDS;
- ---C++: return const &
- ---Purpose:
- --- Selector
- --- Returns the common block
-
- IsCommonBlock(me)
- returns Boolean from Standard;
- ---Purpose:
- --- Query
- --- Returns true if the pave block is common block
-
- IsCommonBlockOnEdge(me)
- returns Boolean from Standard;
- ---Purpose:
- --- Query
- --- Returns true if the pave block is common block
- --- that contains at least one pave block
-
- RealPaveBlock(me)
- returns PaveBlock from BOPDS;
- ---Purpose:
- --- Selector
- --- Returns the real common block
+
--
-- shrunk data
--
myPave2 : Pave from BOPDS is protected;
--extras
myExtPaves : ListOfPave from BOPDS is protected;
- --common block
- myCommonBlock : CommonBlock from BOPDS is protected;
--shrunk data
myTS1 : Real from Standard is protected;
myTS2 : Real from Standard is protected;
}//for (i=0; i<nd; ++i)
}//while (1)
}
-//
-// Common block
-//
-//=======================================================================
-//function : SetCommonBlock
-//purpose :
-//=======================================================================
- void BOPDS_PaveBlock::SetCommonBlock(const Handle(BOPDS_CommonBlock)& theCB)
-{
- myCommonBlock=theCB;
-}
-//=======================================================================
-//function : CommonBlock
-//purpose :
-//=======================================================================
- const Handle(BOPDS_CommonBlock)& BOPDS_PaveBlock::CommonBlock()const
-{
- return myCommonBlock;
-}
-//=======================================================================
-//function : IsCommonBlock
-//purpose :
-//=======================================================================
- Standard_Boolean BOPDS_PaveBlock::IsCommonBlock()const
-{
- return (!myCommonBlock.IsNull());
-}
-//=======================================================================
-//function : IsCommonBlockOnEdge
-//purpose :
-//=======================================================================
- Standard_Boolean BOPDS_PaveBlock::IsCommonBlockOnEdge()const
-{
- if (!myCommonBlock.IsNull()) {
- return (myCommonBlock->PaveBlocks().Extent()>1);
- }
- return Standard_False;
-}
-//=======================================================================
-//function : RealPaveBlock
-//purpose :
-//=======================================================================
- Handle(BOPDS_PaveBlock) BOPDS_PaveBlock::RealPaveBlock()const
-{
- if (IsCommonBlock()) {
- const Handle(BOPDS_PaveBlock)& aPB1=myCommonBlock->PaveBlock1();
- return aPB1;
- }
- return this;
-}
+
// ShrunkData
//=======================================================================
//function : HasShrunkData
myPave2.Dump();
printf(" }");
}
-
BOPDS_DataMapOfIntegerListOfPaveBlock.hxx
BOPDS_IndexedMapOfPaveBlock.hxx
BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx
-BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx
\ No newline at end of file
+BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx
+BOPDS_DataMapOfPaveBlockCommonBlock.hxx
\ No newline at end of file
}
const Handle(BOPDS_PaveBlock)& aPB1 = aLPB1.First();
- const Handle(BOPDS_CommonBlock)& aCB=aPB1->CommonBlock();
+ const Handle(BOPDS_CommonBlock)& aCB=pDS->CommonBlock(aPB1);
if (aCB.IsNull()) {
return Standard_False;
}
# Problem of Memory Leak
######################################################
-puts "TODO ?#23901 ALL: Memory leak detected"
-puts "TODO ?#23901 ALL: TEST INCOMPLETE"
-
#
# Result is Null shape
#
bopcut r
lappend listmem [meminfo h]
- if { [checktrend $listmem 0 1 "Memory leak detected"] } {
+ if { [checktrend $listmem 0 100 "Memory leak detected"] } {
puts "No memory leak, $i iterations"
break
}
checkshape shape
restore [locate_data_file pro19422d.brep] tool
checkshape tool
+explode tool
+bfuse tool tool_1 tool_2
bcut result shape tool
-set square 2369.43
+set square 2282.26
set 2dviewer 0