1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0024157: Parallelization of assembly part of BO

Patch 06

I.1. class Bnd_Box2d
- method:
inline Standard_Real Bnd_Box2d::SquareExtent() const
has been added.
Purpose : The method returns the squared diagonal of the bounding box.

I.3. class BOPCol_BoxBndTree
has been added.
Purpose : The class is the instantiation of the algorithm of unbalanced binary tree
of overlapped bounding boxes 3D.

I.4. class BOPCol_Box2DBndTree
has been added.
Purpose : The class is the instantiation of the algorithm of unbalanced binary tree
of overlapped bounding boxes 2D.

I.5. class BOPAlgo_Algo
- method:
void BOPAlgo_Algo::SetRunParallel(const Standard_Boolean theFlag)
has been added.
Purpose: Set the flag of parallel processing
     if <theFlag> is true  the parallel processing is switched on
     if <theFlag> is false the parallel processing is switched off

- method:
Standard_Boolean BOPAlgo_Algo::RunParallel()const
has been added
Purpose: Returns the flag of parallel processing

II.1. class BOPAlgo_Builder
- method:
void BOPAlgo_Builder::SetRunParallel(const Standard_Boolean theFlag)
has been removed due to I.5.

- method:
Standard_Boolean BOPAlgo_Builder::RunParallel()const
has been removed due to I.5

II.2. class BOPDS_BoxBndTree
has been removed due to I.3

II.3. classes
BOPDS_Iterator,
BOPDS_IteratorSI,
BOPDS_SubIterator
BOPAlgo_PaveFiller,
BOPAlgo_Builder
the calls to BOPDS_BoxBndTree have been changed to
the calls to BOPCol_BoxBndTree
due to I.3

II.4. class BOPAlgo_BuilderFace
- method:
void BOPAlgo_BuilderFace::PerformLoops()
the changes that provide parallel run the  WireSplitter algorithm have been done.

- method:
void BOPAlgo_BuilderFace::PerformAreas()
the classification the grows and holes has been done using
the algorithm of unbalanced binary tree of overlapped bounding boxes

II.5. class BOPAlgo_WireSplitter
- method:
void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
			          BOPTools_ConnexityBlock& aCB)
the method is transferred to the static, the signature of the method have been changed

- method:
void BOPAlgo_WireSplitter::MakeWires()
the changes to provide parallel run the SplitBlock algorithm have been done
This commit is contained in:
pkv 2014-01-10 08:29:02 +04:00 committed by bugmaster
parent 15cea4ef7a
commit db8e4b9aa6
24 changed files with 667 additions and 295 deletions

View File

@ -49,10 +49,20 @@ is
Allocator(me)
returns BaseAllocator from BOPCol;
---C++: return const &
SetRunParallel(me:out;
theFlag:Boolean from Standard);
---Purpose: Set the flag of parallel processing
-- if <theFlag> is true the parallel processing is switched on
-- if <theFlag> is false the parallel processing is switched off
--
RunParallel(me)
returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing
fields
myAllocator : BaseAllocator from BOPCol is protected;
myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected;
myRunParallel : Boolean from Standard is protected;
end Algo;

View File

@ -23,35 +23,38 @@
// function:
// purpose:
//=======================================================================
BOPAlgo_Algo::BOPAlgo_Algo()
BOPAlgo_Algo::BOPAlgo_Algo()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myErrorStatus(1),
myWarningStatus(0)
myWarningStatus(0),
myRunParallel(Standard_False)
{}
//=======================================================================
// function:
// purpose:
//=======================================================================
BOPAlgo_Algo::BOPAlgo_Algo(const Handle(NCollection_BaseAllocator)& theAllocator)
BOPAlgo_Algo::BOPAlgo_Algo
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myErrorStatus(1),
myWarningStatus(0)
myWarningStatus(0),
myRunParallel(Standard_False)
{}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BOPAlgo_Algo::~BOPAlgo_Algo()
BOPAlgo_Algo::~BOPAlgo_Algo()
{
}
//=======================================================================
//function : Allocator
//purpose :
//=======================================================================
const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const
const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const
{
return myAllocator;
}
@ -59,7 +62,7 @@
// function: CheckData
// purpose:
//=======================================================================
void BOPAlgo_Algo::CheckData()
void BOPAlgo_Algo::CheckData()
{
myErrorStatus=0;
}
@ -67,7 +70,7 @@
// function: CheckResult
// purpose:
//=======================================================================
void BOPAlgo_Algo::CheckResult()
void BOPAlgo_Algo::CheckResult()
{
myErrorStatus=0;
}
@ -75,7 +78,7 @@
// function: ErrorStatus
// purpose:
//=======================================================================
Standard_Integer BOPAlgo_Algo::ErrorStatus()const
Standard_Integer BOPAlgo_Algo::ErrorStatus()const
{
return myErrorStatus;
}
@ -83,10 +86,26 @@
// function: WarningStatus
// purpose:
//=======================================================================
Standard_Integer BOPAlgo_Algo::WarningStatus()const
Standard_Integer BOPAlgo_Algo::WarningStatus()const
{
return myWarningStatus;
}
//=======================================================================
//function : SetRunParallel
//purpose :
//=======================================================================
void BOPAlgo_Algo::SetRunParallel(const Standard_Boolean theFlag)
{
myRunParallel=theFlag;
}
//=======================================================================
//function : RunParallel
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_Algo::RunParallel()const
{
return myRunParallel;
}
// myErrorStatus
//
// 1 - object is just initialized

View File

@ -102,16 +102,6 @@ is
---Purpose: Returns true if the shape theS has been deleted.
returns Boolean from Standard
is redefined;
SetRunParallel(me:out;
theFlag:Boolean from Standard);
---Purpose: Set the flag of parallel processing
-- if <theFlag> is true the parallel processing is switched on
-- if <theFlag> is false the parallel processing is switched off
--
RunParallel(me)
returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing
--
-- Debug
--
@ -241,8 +231,6 @@ fields
--
mySplits : DataMapOfShapeListOfShape from BOPCol is protected;
myOrigins : DataMapOfShapeShape from BOPCol is protected;
--
myRunParallel : Boolean from Standard is protected;
--
end Builder;

View File

@ -36,13 +36,11 @@ BOPAlgo_Builder::BOPAlgo_Builder()
myMapFence(100, myAllocator),
myPaveFiller(NULL),
myDS(NULL),
//myContext(NULL),
myEntryPoint(0),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myRunParallel(Standard_False)
myOrigins(100, myAllocator)
{
}
//=======================================================================
@ -57,13 +55,11 @@ BOPAlgo_Builder::BOPAlgo_Builder
myMapFence(100, myAllocator),
myPaveFiller(NULL),
myDS(NULL),
//myContext(NULL),
myEntryPoint(0),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myRunParallel(Standard_False)
myOrigins(100, myAllocator)
{
}
//=======================================================================
@ -93,22 +89,6 @@ void BOPAlgo_Builder::Clear()
myOrigins.Clear();
}
//=======================================================================
//function : SetRunParallel
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetRunParallel(const Standard_Boolean theFlag)
{
myRunParallel=theFlag;
}
//=======================================================================
//function : RunParallel
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_Builder::RunParallel()const
{
return myRunParallel;
}
//=======================================================================
//function : AddArgument
//purpose :
//=======================================================================

View File

@ -1,19 +1,23 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2014 OPEN CASCADE SAS
// Copyright (c) 2010-2012 OPEN CASCADE SAS
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This file is part of Open CASCADE Technology software library.
// 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.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// 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.
#include <BOPAlgo_BuilderFace.ixx>
@ -70,12 +74,72 @@ static
static
void MakeInternalWires(const BOPCol_MapOfShape& ,
BOPCol_ListOfShape& );
static
void GetWire(const TopoDS_Shape& ,
TopoDS_Shape& );
//
#include <NCollection_UBTreeFiller.hxx>
#include <BOPCol_Box2DBndTree.hxx>
#include <BRepTools.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <NCollection_DataMap.hxx>
//
//=======================================================================
//class : BOPAlgo_ShapeBox2D
//purpose : Auxiliary class
//=======================================================================
class BOPAlgo_ShapeBox2D {
public:
BOPAlgo_ShapeBox2D() {
myIsHole=Standard_False;
};
//
~BOPAlgo_ShapeBox2D() {
};
//
void SetShape(const TopoDS_Shape& aS) {
myShape=aS;
};
//
const TopoDS_Shape& Shape()const {
return myShape;
};
//
void SetBox2D(const Bnd_Box2d& aBox2D) {
myBox2D=aBox2D;
};
//
const Bnd_Box2d& Box2D()const {
return myBox2D;
};
//
void SetIsHole(const Standard_Boolean bFlag) {
myIsHole=bFlag;
};
//
Standard_Boolean IsHole()const {
return myIsHole;
};
//
protected:
Standard_Boolean myIsHole;
TopoDS_Shape myShape;
Bnd_Box2d myBox2D;
};
//
typedef NCollection_DataMap\
<Standard_Integer, BOPAlgo_ShapeBox2D, TColStd_MapIntegerHasher> \
BOPAlgo_DataMapOfIntegerShapeBox2D;
//
typedef BOPAlgo_DataMapOfIntegerShapeBox2D::Iterator \
BOPAlgo_DataMapIteratorOfDataMapOfIntegerShapeBox2D;
//
//
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_BuilderFace::BOPAlgo_BuilderFace()
BOPAlgo_BuilderFace::BOPAlgo_BuilderFace()
:
BOPAlgo_BuilderArea()
{
@ -85,7 +149,8 @@ static
//function :
//purpose :
//=======================================================================
BOPAlgo_BuilderFace::BOPAlgo_BuilderFace(const Handle(NCollection_BaseAllocator)& theAllocator)
BOPAlgo_BuilderFace::BOPAlgo_BuilderFace
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_BuilderArea(theAllocator)
{
@ -102,7 +167,7 @@ static
//function : SetFace
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::SetFace(const TopoDS_Face& theFace)
void BOPAlgo_BuilderFace::SetFace(const TopoDS_Face& theFace)
{
myOrientation=theFace.Orientation();
myFace=theFace;
@ -120,7 +185,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
//function : Face
//purpose :
//=======================================================================
const TopoDS_Face& BOPAlgo_BuilderFace::Face()const
const TopoDS_Face& BOPAlgo_BuilderFace::Face()const
{
return myFace;
}
@ -128,26 +193,23 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
//function : CheckData
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::CheckData()
void BOPAlgo_BuilderFace::CheckData()
{
myErrorStatus=0;
//
if (myContext.IsNull()) {
//myErrorStatus=11;// Null Context
//return;
myContext = new BOPInt_Context;
}
//
if (myFace.IsNull()) {
myErrorStatus=12;// Null face generix
return;
}
if (myContext.IsNull()) {
myContext = new BOPInt_Context;
}
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::Perform()
void BOPAlgo_BuilderFace::Perform()
{
myErrorStatus=0;
//
@ -180,7 +242,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
//function :PerformShapesToAvoid
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::PerformShapesToAvoid()
void BOPAlgo_BuilderFace::PerformShapesToAvoid()
{
Standard_Boolean bFound;
Standard_Integer i, iCnt, aNbV, aNbE;
@ -256,7 +318,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
//function : PerformLoops
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::PerformLoops()
void BOPAlgo_BuilderFace::PerformLoops()
{
myErrorStatus=0;
//
@ -284,6 +346,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
}
//
aWSp.SetWES(aWES);
aWSp.SetRunParallel(myRunParallel);
aWSp.Perform();
iErr=aWSp.ErrorStatus();
if (iErr) {
@ -372,127 +435,173 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
myLoopsInternal.Append(aW);
}//for (; aItM.More(); aItM.Next()) {
}
//
//=======================================================================
//function : PerformAreas
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::PerformAreas()
void BOPAlgo_BuilderFace::PerformAreas()
{
myErrorStatus=0;
//
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer k,aNbHoles;
Standard_Real aTol;
TopoDS_Shape anInfinitePointShape;
//
BOPCol_ListOfShape aNewFaces, aHoleWires;
BOPCol_DataMapOfShapeShape aInOutMap;
BOPCol_DataMapOfShapeListOfShape aMSH;
BOPCol_IndexedMapOfShape aMHE;
BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
BOPCol_ListIteratorOfListOfShape aIt1, aIt2;
BRep_Builder aBB;
Handle(Geom_Surface) aS;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
BRep_Builder aBB;
TopoDS_Face aFace;
//
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_IndexedMapOfShape aMHE;
BOPCol_DataMapOfShapeShape aInOutMap;
BOPCol_DataMapIteratorOfDataMapOfShapeShape aItDMSS;
BOPCol_DataMapOfShapeListOfShape aMSH;
BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
BOPCol_ListIteratorOfListOfShape aIt1;
BOPAlgo_DataMapOfIntegerShapeBox2D aDMISB(100);
BOPAlgo_DataMapIteratorOfDataMapOfIntegerShapeBox2D aItDMISB;
//
BOPCol_Box2DBndTreeSelector aSelector;
BOPCol_Box2DBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
//
myErrorStatus=0;
//
aTol=BRep_Tool::Tolerance(myFace);
aS=BRep_Tool::Surface(myFace, aLoc);
//
myAreas.Clear();
//
// Draft faces [aNewFaces]
// 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D]
aIt1.Initialize(myLoops);
for ( ; aIt1.More(); aIt1.Next()) {
for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {
Bnd_Box2d aBox2D;
//
const TopoDS_Shape& aWire=aIt1.Value();
//
aBB.MakeFace(aFace, aS, aLoc, aTol);
aBB.Add (aFace, aWire);
BRepTools::AddUVBounds(aFace, aBox2D);
//
bIsGrowth=IsGrowthWire(aWire, aMHE);
if (bIsGrowth) {
// make a growth face from a wire
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
aBB.Add (aFace, aWire);
//
aNewFaces.Append (aFace);
bIsHole=Standard_False;
}
else{
// check if a wire is a hole
//XX
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
aBB.Add (aFace, aWire);
//
IntTools_FClass2d& aClsf=myContext->FClass2d(aFace);
aClsf.Init(aFace, aTol);
//
bIsHole=aClsf.IsHole();
//
//bIsHole=BOPTools_AlgoTools::IsHole(aWire, myFace);
//XX
if (bIsHole) {
aHoleWires.Append(aWire);
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
//
bIsHole=Standard_True;
}
else {
// make a growth face from a wire
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
aBB.Add (aFace, aWire);
//
aNewFaces.Append (aFace);
bIsHole=Standard_False;
}
}
//
BOPAlgo_ShapeBox2D aSB2D;
//
aSB2D.SetShape(aFace);
aSB2D.SetBox2D(aBox2D);
aSB2D.SetIsHole(bIsHole);
//
aDMISB.Bind(k, aSB2D);
}
//
// 2. Prepare TreeFiller
aItDMISB.Initialize(aDMISB);
for (; aItDMISB.More(); aItDMISB.Next()) {
k=aItDMISB.Key();
const BOPAlgo_ShapeBox2D& aSB2D=aItDMISB.Value();
//
bIsHole=aSB2D.IsHole();
if (bIsHole) {
const Bnd_Box2d& aBox2D=aSB2D.Box2D();
aTreeFiller.Add(k, aBox2D);
}
}
//
// 2. Find outer growth shell that is most close to each hole shell
aIt2.Initialize(aHoleWires);
for (; aIt2.More(); aIt2.Next()) {
const TopoDS_Shape& aHole = aIt2.Value();
// 3. Shake TreeFiller
aTreeFiller.Fill();
//
// 4. Find outer growth shell that is most close
// to each hole shell
aItDMISB.Initialize(aDMISB);
for (; aItDMISB.More(); aItDMISB.Next()) {
k=aItDMISB.Key();
const BOPAlgo_ShapeBox2D& aSB2D=aItDMISB.Value();
bIsHole=aSB2D.IsHole();
if (bIsHole) {
continue;
}
//
aIt1.Initialize(aNewFaces);
for ( ; aIt1.More(); aIt1.Next()) {
const TopoDS_Shape& aF=aIt1.Value();
const Bnd_Box2d& aBox2DF=aSB2D.Box2D();
const TopoDS_Shape aF=aSB2D.Shape();
//
aSelector.Clear();
aSelector.SetBox(aBox2DF);
//
aNbHoles=aBBTree.Select(aSelector);
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
k=aItLI.Value();
const BOPAlgo_ShapeBox2D& aSB2Dk=aDMISB.Find(k);
const TopoDS_Shape& aHole=aSB2Dk.Shape();
//
if (!IsInside(aHole, aF, myContext)){
continue;
}
//
if ( aInOutMap.IsBound (aHole)){
const TopoDS_Shape& aF2=aInOutMap(aHole);
if (IsInside(aF, aF2, myContext)) {
if (aInOutMap.IsBound (aHole)){
const TopoDS_Shape& aF2=aInOutMap(aHole);
if (IsInside(aF, aF2, myContext)) {
aInOutMap.UnBind(aHole);
aInOutMap.Bind (aHole, aF);
}
}
else{
aInOutMap.Bind (aHole, aF);
aInOutMap.Bind(aHole, aF);
}
}
//
// Add aHole to a map Face/ListOfHoles [aMSH]
if (aInOutMap.IsBound(aHole)){
const TopoDS_Shape& aF=aInOutMap(aHole);
if (aMSH.IsBound(aF)) {
BOPCol_ListOfShape& aLH=aMSH.ChangeFind(aF);
aLH.Append(aHole);
}
else {
BOPCol_ListOfShape aLH;
aLH.Append(aHole);
aMSH.Bind(aF, aLH);
}
}
}// for (; aIt2.More(); aIt2.Next())
}
//
// 3. Add aHoles to Faces
// 5. Map [Face/Holes] -> aMSH
aItDMSS.Initialize(aInOutMap);
for (; aItDMSS.More(); aItDMSS.Next()) {
const TopoDS_Shape& aHole=aItDMSS.Key();
const TopoDS_Shape& aF=aItDMSS.Value();
//
if (aMSH.IsBound(aF)) {
BOPCol_ListOfShape& aLH=aMSH.ChangeFind(aF);
aLH.Append(aHole);
}
else {
BOPCol_ListOfShape aLH;
aLH.Append(aHole);
aMSH.Bind(aF, aLH);
}
}
//
// 6. Add aHoles to Faces,
aItMSH.Initialize(aMSH);
for (; aItMSH.More(); aItMSH.Next()) {
TopoDS_Face aF=(*(TopoDS_Face *)(&aItMSH.Key()));
//
const BOPCol_ListOfShape& aLH=aItMSH.Value();
aIt2.Initialize(aLH);
for (; aIt2.More(); aIt2.Next()) {
const TopoDS_Shape& aHole = aIt2.Value();
aBB.Add (aF, aHole);
aIt1.Initialize(aLH);
for (; aIt1.More(); aIt1.Next()) {
TopoDS_Shape aWHole;
//
const TopoDS_Shape& aFHole=aIt1.Value();
GetWire(aFHole, aWHole);
aBB.Add (aF, aWHole);
}
//
// update classifier
@ -501,20 +610,38 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const
aClsf.Init(aF, aTol);
}
//
// These aNewFaces are draft faces that
// do not contain any internal shapes
// 7. Fill myAreas
// NB:These aNewFaces are draft faces that
// do not contain any internal shapes
aItDMISB.Initialize(aDMISB);
for (; aItDMISB.More(); aItDMISB.Next()) {
const BOPAlgo_ShapeBox2D& aSB2D=aItDMISB.Value();
bIsHole=aSB2D.IsHole();
if (!bIsHole) {
const TopoDS_Shape aF=aSB2D.Shape();
myAreas.Append(aF);
}
}
}
//=======================================================================
//function : GetWire
//purpose :
//=======================================================================
void GetWire(const TopoDS_Shape& aF, TopoDS_Shape& aW)
{
TopoDS_Shape aWx;
TopoDS_Iterator aIt;
//
aIt1.Initialize(aNewFaces);
for ( ; aIt1.More(); aIt1.Next()) {
const TopoDS_Shape& aF=aIt1.Value();
myAreas.Append(aF);
aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()) {
aW=aIt.Value();
}
}
//=======================================================================
//function : PerformInternalShapes
//purpose :
//=======================================================================
void BOPAlgo_BuilderFace::PerformInternalShapes()
void BOPAlgo_BuilderFace::PerformInternalShapes()
{
myErrorStatus=0;
//

View File

@ -252,6 +252,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
BOPAlgo_BuilderFace& aBF=aVBF.Append1();
aBF.SetFace(aF);
aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel);
//
}// for (i=0; i<aNbS; ++i) {
//

View File

@ -18,7 +18,9 @@
#include <BOPAlgo_Builder.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <Bnd_Box.hxx>
#include <TopAbs_State.hxx>
#include <TopoDS.hxx>
@ -38,31 +40,27 @@
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepBndLib.hxx>
//
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx>
//
#include <BOPInt_Context.hxx>
//
#include <BOPDS_DS.hxx>
#include <BOPDS_ShapeInfo.hxx>
//
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
//
#include <BOPTools_MapOfSet.hxx>
#include <BOPTools_Set.hxx>
//
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <BOPDS_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPInt_Context.hxx>
#include <BOPAlgo_Builder_2Cnt.hxx>
@ -218,7 +216,7 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts
}//for (i=0; i<aNbS; ++i) {
//
// 1.2. Prepare TreeFiller
BOPDS_BoxBndTree aBBTree;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aItDMISB.Initialize(aDMISB);
@ -250,7 +248,7 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts
BOPCol_ListOfShape aLIF(aAlr1);
BOPCol_IndexedMapOfShape aMF(100, aAlr1);
BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, aAlr1);
BOPDS_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTreeSelector aSelector;
Bnd_Box aBoxS;
//
const TopoDS_Shape& aS=aSI.Shape();

View File

@ -23,6 +23,8 @@
#include <Bnd_Box.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
@ -42,6 +44,7 @@
#include <BOPCol_DataMapOfShapeInteger.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
#include <BOPCol_BoxBndTree.hxx>
//
#include <BOPInt_Context.hxx>
#include <BOPInt_ShrunkRange.hxx>
@ -56,16 +59,15 @@
#include <BOPDS_VectorOfInterfEE.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Pave.hxx>
#include <BOPDS_BoxBndTree.hxx>
//
#include <BOPAlgo_Tools.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
//=======================================================================
// function: PerformEE
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PerformEE()
void BOPAlgo_PaveFiller::PerformEE()
{
Standard_Boolean bJustAdd, bOrder;
Standard_Integer i, iX, iSize, nE1, nE2, aDiscretize;
@ -385,9 +387,9 @@
//function : PerformVertices
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
Handle(NCollection_BaseAllocator)& theAllocator)
Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
Handle(NCollection_BaseAllocator)& theAllocator)
{
Standard_Integer aNbV, iRet;
//
@ -520,9 +522,9 @@
//function : TreatNewVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::TreatNewVertices(
const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
void BOPAlgo_PaveFiller::TreatNewVertices
(const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
{
Standard_Integer j, i, aNbV, aNbVSD;
Standard_Real aTol;
@ -535,8 +537,8 @@
BOPCol_DataMapOfIntegerShape aMIS;
BOPCol_IndexedDataMapOfShapeBox aMSB;
//
BOPDS_BoxBndTreeSelector aSelector;
BOPDS_BoxBndTree aBBTree;
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aNbV = aMapVI.Extent();
@ -658,7 +660,7 @@
//function : FillShrunkData
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
{
Standard_Integer nE, nV1, nV2, iErr;
Standard_Real aT1, aT2, aTS1, aTS2;

View File

@ -1,16 +1,20 @@
-- Created by: Peter KURNEV
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
-- 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.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
-- 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.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- 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.
class WireSplitter from BOPAlgo
inherits Algo from BOPAlgo
@ -19,6 +23,7 @@ class WireSplitter from BOPAlgo
uses
Wire from TopoDS,
Face from TopoDS,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
WireEdgeSet from BOPAlgo,
@ -60,12 +65,12 @@ is
is protected;
MakeWires(me:out)
is protected;
SplitBlock(me:out;
theCB:out ConnexityBlock from BOPTools)
is protected;
is protected;
SplitBlock(myclass;
theF :Face from TopoDS;
theCB:out ConnexityBlock from BOPTools);
fields
myWES : PWireEdgeSet from BOPAlgo is protected;
myLCB : ListOfConnexityBlock from BOPTools is protected;

View File

@ -1,16 +1,21 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
// 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.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// 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.
#include <BOPAlgo_WireSplitter.ixx>
@ -27,6 +32,8 @@
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPTools.hxx>
@ -35,7 +42,7 @@
//function :
//purpose :
//=======================================================================
BOPAlgo_WireSplitter::BOPAlgo_WireSplitter()
BOPAlgo_WireSplitter::BOPAlgo_WireSplitter()
:
BOPAlgo_Algo(),
myWES(NULL),
@ -46,7 +53,8 @@
//function :
//purpose :
//=======================================================================
BOPAlgo_WireSplitter::BOPAlgo_WireSplitter(const Handle(NCollection_BaseAllocator)& theAllocator)
BOPAlgo_WireSplitter::BOPAlgo_WireSplitter
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator),
myWES(NULL),
@ -57,14 +65,14 @@
//function : ~
//purpose :
//=======================================================================
BOPAlgo_WireSplitter::~BOPAlgo_WireSplitter()
BOPAlgo_WireSplitter::~BOPAlgo_WireSplitter()
{
}
//=======================================================================
//function : SetWES
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::SetWES(const BOPAlgo_WireEdgeSet& theWES)
void BOPAlgo_WireSplitter::SetWES(const BOPAlgo_WireEdgeSet& theWES)
{
myWES=(BOPAlgo_WireEdgeSet*)&theWES;
}
@ -72,7 +80,7 @@
//function : WES
//purpose :
//=======================================================================
BOPAlgo_WireEdgeSet& BOPAlgo_WireSplitter::WES()
BOPAlgo_WireEdgeSet& BOPAlgo_WireSplitter::WES()
{
return *myWES;
}
@ -80,7 +88,7 @@
// function: CheckData
// purpose:
//=======================================================================
void BOPAlgo_WireSplitter::CheckData()
void BOPAlgo_WireSplitter::CheckData()
{
myErrorStatus=0;
if (!myWES) {
@ -92,7 +100,7 @@
//function : Perform
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::Perform()
void BOPAlgo_WireSplitter::Perform()
{
myErrorStatus=0;
//
@ -104,43 +112,12 @@
MakeConnexityBlocks();
MakeWires();
}
//=======================================================================
//function : MakeWires
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::MakeWires()
{
Standard_Boolean bIsRegular;
TopoDS_Wire aW;
BOPTools_ListIteratorOfListOfConnexityBlock aItCB;
BOPCol_ListIteratorOfListOfShape aIt;
//
aItCB.Initialize(myLCB);
for (; aItCB.More(); aItCB.Next()) {
BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue();
bIsRegular=aCB.IsRegular();
if (bIsRegular) {
BOPCol_ListOfShape& aLE=aCB.ChangeShapes();
BOPAlgo_WireSplitter::MakeWire(aLE, aW);
myWES->AddShape(aW);
}
else {
SplitBlock(aCB);
//
const BOPCol_ListOfShape& aLW=aCB.Loops();
aIt.Initialize(aLW);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aWx=aIt.Value();
myWES->AddShape(aWx);
}
}
}
}
//=======================================================================
//function : MakeConnexityBlocks
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::MakeConnexityBlocks()
void BOPAlgo_WireSplitter::MakeConnexityBlocks()
{
Standard_Boolean bRegular, bClosed;
Standard_Integer i, j, aNbV, aNbVS, aNbVP, k;
@ -280,3 +257,105 @@
myLCB.Append(aCB);
}
}
/////////////////////////////////////////////////////////////////////////
typedef BOPCol_NCVector<BOPTools_ConnexityBlock> \
BOPTools_VectorOfConnexityBlock;
//=======================================================================
//class : WireSplitterFunctor
//purpose :
//=======================================================================
class BOPAlgo_WireSplitterFunctor {
protected:
TopoDS_Face myFace;
BOPTools_VectorOfConnexityBlock* myPVCB;
//
public:
//
BOPAlgo_WireSplitterFunctor(const TopoDS_Face& aF,
BOPTools_VectorOfConnexityBlock& aVCB)
: myFace(aF), myPVCB(&aVCB) {
}
//
void operator()( const flexible_range<Standard_Size>& aBR ) const{
Standard_Size i, iBeg, iEnd;
//
BOPTools_VectorOfConnexityBlock& aVCB=*myPVCB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPTools_ConnexityBlock& aCB=aVCB((Standard_Integer)i);
//
BOPAlgo_WireSplitter::SplitBlock(myFace, aCB);
}
}
};
//=======================================================================
//class : BOPAlgo_WireSplitterCnt
//purpose :
//=======================================================================
class BOPAlgo_WireSplitterCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
const TopoDS_Face& aF,
BOPTools_VectorOfConnexityBlock& aVCB) {
//
BOPAlgo_WireSplitterFunctor aWSF(aF, aVCB);
Standard_Size aNbVCB=aVCB.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Size>(0,aNbVCB), aWSF);
}
else {
aWSF.operator()(flexible_range<Standard_Size>(0,aNbVCB));
}
}
//
};
//=======================================================================
//function : MakeWires
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::MakeWires()
{
Standard_Boolean bIsRegular;
Standard_Integer aNbVCB, k;
TopoDS_Wire aW;
BOPTools_ListIteratorOfListOfConnexityBlock aItCB;
BOPCol_ListIteratorOfListOfShape aIt;
BOPTools_VectorOfConnexityBlock aVCB;
//
aItCB.Initialize(myLCB);
for (; aItCB.More(); aItCB.Next()) {
BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue();
bIsRegular=aCB.IsRegular();
if (bIsRegular) {
BOPCol_ListOfShape& aLE=aCB.ChangeShapes();
BOPAlgo_WireSplitter::MakeWire(aLE, aW);
myWES->AddShape(aW);
}
else {
aVCB.Append(aCB);
}
}
//
aNbVCB=aVCB.Extent();
const TopoDS_Face& aF=myWES->Face();
//===================================================
BOPAlgo_WireSplitterCnt::Perform(myRunParallel, aF, aVCB);
//===================================================
for (k=0; k<aNbVCB; ++k) {
const BOPTools_ConnexityBlock& aCB=aVCB(k);
const BOPCol_ListOfShape& aLW=aCB.Loops();
aIt.Initialize(aLW);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aWx=aIt.Value();
myWES->AddShape(aWx);
}
}
}

View File

@ -133,7 +133,8 @@ static
//function : SplitBlock
//purpose :
//=======================================================================
void BOPAlgo_WireSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace,
BOPTools_ConnexityBlock& aCB)
{
Standard_Boolean bNothingToDo;
Standard_Integer aIx, aNb, i, aCntIn, aCntOut;
@ -144,9 +145,8 @@ static
BOPCol_ListIteratorOfListOfShape aIt;
BOPAlgo_ListIteratorOfListOfEdgeInfo aItLEI;
//
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo mySmartMap(100, myAllocator);
BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo mySmartMap(100);
//
const TopoDS_Face& myFace=myWES->Face();
const BOPCol_ListOfShape& myEdges=aCB.Shapes();
//
// 1.Filling mySmartMap
@ -164,7 +164,7 @@ static
const TopoDS_Shape& aV=aItS.Value();
aIx=mySmartMap.FindIndex(aV);
if (!aIx) {
BOPAlgo_ListOfEdgeInfo aLEIx(myAllocator);
BOPAlgo_ListOfEdgeInfo aLEIx;
aIx=mySmartMap.Add(aV, aLEIx);
}
//
@ -214,14 +214,14 @@ static
Standard_Integer aNbE, aNbMapEE;
Standard_Boolean bFlag;
//
BOPCol_IndexedDataMapOfShapeListOfShape aMapEE(100, myAllocator);
BOPCol_IndexedDataMapOfShapeListOfShape aMapEE(100);
aNbE=myEdges.Extent();
//
aIt.Initialize(myEdges);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aE = aIt.Value();
if (!aMapEE.Contains(aE)) {
BOPCol_ListOfShape aLEx(myAllocator);
BOPCol_ListOfShape aLEx;
aLEx.Append(aE);
aMapEE.Add(aE, aLEx);
}
@ -262,7 +262,6 @@ static
BOPCol_ListOfShape& aLoops=aCB.ChangeLoops();
aLoops.Append(aW);
//
myErrorStatus=0;
return;
}
//

View File

@ -14,5 +14,5 @@ BOPAlgo_BOP_1.cxx
BOPAlgo_WireSplitter_1.cxx
BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_Builder_2Cnt.hxx
BOPAlgo_CheckerSI_1.cxx

View File

@ -0,0 +1,85 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2012 OPEN CASCADE SAS
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// 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.
#include <BOPCol_Box2DBndTree.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPCol_Box2DBndTreeSelector::BOPCol_Box2DBndTreeSelector()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
BOPCol_Box2DBndTreeSelector::~BOPCol_Box2DBndTreeSelector()
{
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean BOPCol_Box2DBndTreeSelector::Reject
(const Bnd_Box2d& aBox2D) const
{
return myBox2D.IsOut(aBox2D);
}
//=======================================================================
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean BOPCol_Box2DBndTreeSelector::Accept
(const Standard_Integer& aIndex)
{
Standard_Boolean bRet=Standard_False;
//
myIndices.Append(aIndex);
bRet=!bRet;
//}
return bRet;
}
//=======================================================================
//function : SetBox
//purpose :
//=======================================================================
void BOPCol_Box2DBndTreeSelector::SetBox(const Bnd_Box2d& aBox2D)
{
myBox2D=aBox2D;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPCol_Box2DBndTreeSelector::Clear()
{
myIndices.Clear();
}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
const BOPCol_ListOfInteger& BOPCol_Box2DBndTreeSelector::Indices() const
{
return myIndices;
}

View File

@ -0,0 +1,52 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2012 OPEN CASCADE SAS
// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// 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 BOPCol_Box2DBndTree_HeaderFile
#define BOPCol_Box2DBndTree_HeaderFile
#include <NCollection_UBTree.hxx>
#include <Bnd_Box2d.hxx>
#include <BOPCol_ListOfInteger.hxx>
/**
* The instantiation of the algorithm of unbalanced binary tree
* of overlapped bounding boxes 2D.
*
*/
typedef NCollection_UBTree <Standard_Integer , Bnd_Box2d> BOPCol_Box2DBndTree;
class BOPCol_Box2DBndTreeSelector : public BOPCol_Box2DBndTree::Selector {
public:
Standard_EXPORT BOPCol_Box2DBndTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box2d&) const;
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
Standard_EXPORT virtual ~BOPCol_Box2DBndTreeSelector();
Standard_EXPORT void Clear();
Standard_EXPORT void SetBox(const Bnd_Box2d&);
Standard_EXPORT const BOPCol_ListOfInteger& Indices() const;
protected:
Bnd_Box2d myBox2D;
BOPCol_ListOfInteger myIndices;
};
#endif

View File

@ -15,26 +15,27 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPDS_BoxBndTree.hxx>
#include <BOPCol_BoxBndTree.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPDS_BoxBndTreeSelector::BOPDS_BoxBndTreeSelector()
BOPCol_BoxBndTreeSelector::BOPCol_BoxBndTreeSelector()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
BOPDS_BoxBndTreeSelector::~BOPDS_BoxBndTreeSelector()
BOPCol_BoxBndTreeSelector::~BOPCol_BoxBndTreeSelector()
{
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean BOPDS_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
Standard_Boolean BOPCol_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const
{
return myBox.IsOut(aBox);
}
@ -42,21 +43,19 @@
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean BOPDS_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
Standard_Boolean BOPCol_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex)
{
Standard_Boolean bRet=Standard_False;
//
//if (myFence.Add(aIndex)) {
myIndices.Append(aIndex);
bRet=!bRet;
//}
return bRet;
}
//=======================================================================
//function : SetBox
//purpose :
//=======================================================================
void BOPDS_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
void BOPCol_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox)
{
myBox=aBox;
}
@ -64,16 +63,15 @@
//function : Clear
//purpose :
//=======================================================================
void BOPDS_BoxBndTreeSelector::Clear()
void BOPCol_BoxBndTreeSelector::Clear()
{
//myFence.Clear();
myIndices.Clear();
}
//=======================================================================
//function : Indices
//purpose :
//=======================================================================
const BOPCol_ListOfInteger& BOPDS_BoxBndTreeSelector::Indices() const
const BOPCol_ListOfInteger& BOPCol_BoxBndTreeSelector::Indices() const
{
return myIndices;
}

View File

@ -26,14 +26,14 @@
* of overlapped bounding boxes.
*
*/
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> BOPDS_BoxBndTree;
typedef NCollection_UBTree <Standard_Integer , Bnd_Box> BOPCol_BoxBndTree;
class BOPDS_BoxBndTreeSelector : public BOPDS_BoxBndTree::Selector {
class BOPCol_BoxBndTreeSelector : public BOPCol_BoxBndTree::Selector {
public:
Standard_EXPORT BOPDS_BoxBndTreeSelector();
Standard_EXPORT BOPCol_BoxBndTreeSelector();
Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box&) const;
Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
Standard_EXPORT virtual ~BOPDS_BoxBndTreeSelector();
Standard_EXPORT virtual ~BOPCol_BoxBndTreeSelector();
Standard_EXPORT void Clear();
Standard_EXPORT void SetBox(const Bnd_Box&);

View File

@ -23,10 +23,11 @@
#endif
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer, TopoDS_Shape, TColStd_MapIntegerHasher> BOPCol_DataMapOfIntegerShape;
typedef BOPCol_DataMapOfIntegerShape::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerShape;

View File

@ -29,6 +29,10 @@ BOPCol_SequenceOfReal.hxx
BOPCol_DataMapOfIntegerShape.hxx
BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx
BOPCol_IndexedDataMapOfShapeInteger.hxx
BOPCol_TBB.hxx
BOPCol_NCVector.hxx
BOPCol_BoxBndTree.hxx
BOPCol_BoxBndTree.cxx
BOPCol_Box2DBndTree.hxx
BOPCol_Box2DBndTree.cxx

View File

@ -31,7 +31,7 @@
#include <BOPCol_DataMapOfIntegerMapOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx>
//
#include <BOPDS_BoxBndTree.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_PassKeyBoolean.hxx>
#include <BOPDS_MapOfPassKeyBoolean.hxx>
@ -218,8 +218,8 @@ void BOPDS_Iterator::Intersect()
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
BOPDS_PassKeyBoolean aPKXB;
//
BOPDS_BoxBndTreeSelector aSelector;
BOPDS_BoxBndTree aBBTree;
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aNb=myDS->NbSourceShapes();

View File

@ -24,7 +24,7 @@
#include <BRep_Tool.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <BOPDS_BoxBndTree.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_PassKeyBoolean.hxx>
#include <BOPDS_MapOfPassKeyBoolean.hxx>
@ -103,8 +103,8 @@ void BOPDS_IteratorSI::Intersect()
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
BOPDS_PassKeyBoolean aPKXB;
//
BOPDS_BoxBndTreeSelector aSelector;
BOPDS_BoxBndTree aBBTree;
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
// myPairsAvoid, aMSI, aMSB

View File

@ -27,8 +27,8 @@
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerMapOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_BoxBndTree.hxx>
//
#include <BOPDS_BoxBndTree.hxx>
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_PassKeyBoolean.hxx>
#include <BOPDS_MapOfPassKeyBoolean.hxx>
@ -193,8 +193,8 @@
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
//
BOPDS_BoxBndTreeSelector aSelector;
BOPDS_BoxBndTree aBBTree;
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aIt1.Initialize(*mySubSet1);

View File

@ -1,8 +1,6 @@
BOPDS_VectorOfShapeInfo.hxx
BOPDS_VectorOfIndexRange.hxx
BOPDS_ListOfPassKeyBoolean.hxx
BOPDS_BoxBndTree.cxx
BOPDS_BoxBndTree.hxx
BOPDS_MapOfPassKeyBoolean.hxx
BOPDS_MapOfPassKey.hxx
BOPDS_ListIteratorOfListOfPassKeyBoolean.hxx
@ -16,6 +14,10 @@ BOPDS_VectorOfInterfVF.hxx
BOPDS_VectorOfInterfEE.hxx
BOPDS_VectorOfInterfEF.hxx
BOPDS_VectorOfInterfFF.hxx
BOPDS_VectorOfInterfVZ.hxx
BOPDS_VectorOfInterfEZ.hxx
BOPDS_VectorOfInterfFZ.hxx
BOPDS_VectorOfInterfZZ.hxx
BOPDS_Interf.hxx
BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx
BOPDS_MapOfPaveBlock.hxx
@ -35,7 +37,3 @@ BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx
BOPDS_DataMapOfPaveBlockCommonBlock.hxx
BOPDS_VectorOfInterfVZ.hxx
BOPDS_VectorOfInterfEZ.hxx
BOPDS_VectorOfInterfFZ.hxx
BOPDS_VectorOfInterfZZ.hxx

View File

@ -1,18 +1,24 @@
-- Created on: 1991-01-28
-- Created by: Remi Lequette
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
-- 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.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
-- 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.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- 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.
class Box2d from Bnd
@ -217,8 +223,12 @@ is
---Level: Public
---C++: inline
Dump(me) is static;
Dump(me) is static;
SquareExtent(me)
returns Real from Standard;
--- Purpose : Computes the squared diagonal of me.
---C++: inline
fields Xmin : Real;
Xmax : Real;

View File

@ -1,18 +1,23 @@
// Created on: 1997-11-27
// Created by: Christophe MARION
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
// 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.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// 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.
#define VoidMask 0x01
#define XminMask 0x02
@ -231,4 +236,15 @@ inline Standard_Boolean Bnd_Box2d::IsOut (const gp_Trsf2d& T1,
{
return Transformed(T1).IsOut (Other.Transformed(T2));
}
//=======================================================================
//function : SquareExtent
//purpose : Computes the squared diagonal
//=======================================================================
inline Standard_Real Bnd_Box2d::SquareExtent() const
{
if ( IsVoid() ) return 0.;
Standard_Real dx = Xmax-Xmin+Gap;
Standard_Real dy = Ymax-Ymin+Gap;
return dx*dx + dy*dy;
}