void BOPAlgo_PaveFiller::PerformVV()
{
Standard_Boolean bWithSubShape;
- Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, iX, k, aNbBlocks;
+ Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, k, aNbBlocks;
Handle(NCollection_IncAllocator) aAllocator;
BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItMILI;
BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
aSIn.SetShapeType(TopAbs_VERTEX);
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
- aVVs.SetStartSize(aSize);
aVVs.SetIncrement(aSize);
- aVVs.Init();
//
//-----------------------------------------------------scope f
aAllocator=new NCollection_IncAllocator();
n2=aItLI2.Value();
//
myDS->AddInterf(n1, n2);
- iX=aVVs.Append()-1;
- BOPDS_InterfVV& aVV=aVVs(iX);
+ BOPDS_InterfVV& aVV=aVVs.Append1();
+ //
aVV.SetIndices(n1, n2);
aVV.SetIndexNew(n);
}
void BOPAlgo_PaveFiller::PerformVZ()
{
Standard_Boolean bJustAdd;
- Standard_Integer iSize, nV, nZ, i;
+ Standard_Integer iSize, nV, nZ;
Standard_Real aTol;
gp_Pnt aPV;
TopAbs_State aState;
}
//
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
- aVZs.SetStartSize(iSize);
aVZs.SetIncrement(iSize);
- aVZs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nZ, bJustAdd);
//
aState=aSC.State();
if (aState==TopAbs_IN) {
- i=aVZs.Append()-1;
- BOPDS_InterfVZ& aVZ=aVZs(i);
+ BOPDS_InterfVZ& aVZ=aVZs.Append1();
aVZ.SetIndices(nV, nZ);
//
myDS->AddInterf(nV, nZ);
//=======================================================================
void BOPAlgo_PaveFiller::PerformEZ()
{
- Standard_Boolean bJustAdd, bHasInterf;
- Standard_Integer iSize, nE, nZ, i;
+ Standard_Boolean bJustAdd, bHasInterf;
+ Standard_Integer iSize, nE, nZ;
//
myErrorStatus=0;
//
}
//
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
- aEZs.SetStartSize(iSize);
aEZs.SetIncrement(iSize);
- aEZs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nZ, bJustAdd);
continue;
}
//
- i=aEZs.Append()-1;
- BOPDS_InterfEZ& aEZ=aEZs(i);
+ BOPDS_InterfEZ& aEZ=aEZs.Append1();
aEZ.SetIndices(nE, nZ);
//
myDS->AddInterf(nE, nZ);
void BOPAlgo_PaveFiller::PerformFZ()
{
Standard_Boolean bJustAdd, bHasInterf;
- Standard_Integer iSize, nF, nZ, i;
+ Standard_Integer iSize, nF, nZ;
//
myErrorStatus=0;
//
}
//
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
- aFZs.SetStartSize(iSize);
aFZs.SetIncrement(iSize);
- aFZs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nF, nZ, bJustAdd);
continue;
}
//
- i=aFZs.Append()-1;
- BOPDS_InterfFZ& aFZ=aFZs(i);
+ BOPDS_InterfFZ& aFZ=aFZs.Append1();
aFZ.SetIndices(nF, nZ);
//
myDS->AddInterf(nF, nZ);
void BOPAlgo_PaveFiller::PerformZZ()
{
Standard_Boolean bJustAdd, bHasInterf, bFlag;
- Standard_Integer iSize, nZ1, nZ, i;
+ Standard_Integer iSize, nZ1, nZ;
//
myErrorStatus=0;
//
}
//
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
- aZZs.SetStartSize(iSize);
aZZs.SetIncrement(iSize);
- aZZs.Init();
//
bFlag=Standard_False;
//
continue;
}
//
- i=aZZs.Append()-1;
- BOPDS_InterfZZ& aZZ=aZZs(i);
+ BOPDS_InterfZZ& aZZ=aZZs.Append1();
aZZ.SetIndices(nZ1, nZ);
//
myDS->AddInterf(nZ1, nZ);
void BOPAlgo_PaveFiller::PerformVE()
{
Standard_Boolean bJustAdd;
- Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i, k, aNbVE;;
+ Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
Standard_Real aT, aTolE, aTolV;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
}
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
- aVEs.SetStartSize(iSize);
aVEs.SetIncrement(iSize);
- aVEs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nE, bJustAdd);
const TopoDS_Vertex& aV=aVESolver.Vertex();
const TopoDS_Edge& aE=aVESolver.Edge();
// 1
- i=aVEs.Append()-1;
- BOPDS_InterfVE& aVE=aVEs(i);
+ BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
// 2
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
- aEEs.SetStartSize(iSize);
aEEs.SetIncrement(iSize);
- aEEs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE1, nE2, bJustAdd);
continue;
}
}
-
+ //
// 1
- iX=aEEs.Append()-1;
- BOPDS_InterfEE& aEE=aEEs(iX);
+ BOPDS_InterfEE& aEE=aEEs.Append1();
+ iX=aEEs.Extent()-1;
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
break;
}
// 1
- iX=aEEs.Append()-1;
- BOPDS_InterfEE& aEE=aEEs(iX);
+ BOPDS_InterfEE& aEE=aEEs.Append1();
+ iX=aEEs.Extent()-1;
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
aNbPnt = aProjector.NbPoints();
if (aNbPnt) {
Standard_Real aT, aDist;
- Standard_Integer i;
+ //Standard_Integer i;
BRep_Builder aBB;
BOPDS_Pave aPave;
//
aT=aProjector.LowerDistanceParameter();
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
- if (aVEs.Extent() == 0) {
- aVEs.Init();
- }
- //
- i=aVEs.Append()-1;
- BOPDS_InterfVE& aVE=aVEs(i);
+ BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
//
void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
- Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i, aNbVF, k;
+ Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, aNbVF, k;
Standard_Real aT1, aT2, aTolF, aTolV;
BRep_Builder aBB;
BOPAlgo_VectorOfVertexFace aVVF;
if (iSize) {
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
- aVFs.SetStartSize(iSize);
aVFs.SetIncrement(iSize);
- aVFs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
const TopoDS_Vertex& aV=aVertexFace.Vertex();
const TopoDS_Face& aF=aVertexFace.Face();
// 1
- i=aVFs.Append()-1;
- BOPDS_InterfVF& aVF=aVFs(i);
+ BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
else {
iSize=10;
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
- aVFs.SetStartSize(iSize);
aVFs.SetIncrement(iSize);
- aVFs.Init();
}
//
TreatVerticesEE();
//=======================================================================
void BOPAlgo_PaveFiller::TreatVerticesEE()
{
- Standard_Integer i, aNbS, aNbEEs, nF, nV, iFlag;
+ Standard_Integer i, aNbS,aNbEEs, nF, nV, iFlag;
Standard_Real aT1, aT2;
BOPCol_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_IncAllocator) aAllocator;
iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
if (!iFlag) {
// 1
- i=aVFs.Append()-1;
- BOPDS_InterfVF& aVF=aVFs(i);
+ BOPDS_InterfVF& aVF=aVFs.Append1();
+ i=aVFs.Extent()-1;
aVF.SetIndices(nV, nF);
aVF.SetUV(aT1, aT2);
// 2
aDeflection=0.01;
//
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
- aEFs.SetStartSize(iSize);
aEFs.SetIncrement(iSize);
- aEFs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nF, bJustAdd);
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
bV[1]=CheckFacePaves(nV[1], aMIFOn, aMIFIn);
if (bV[0] && bV[1]) {
- iX=aEFs.Append()-1;
IntTools_CommonPrt aCP = aCPart;
aCP.SetType(TopAbs_EDGE);
- BOPDS_InterfEF& aEF=aEFs(iX);
+ BOPDS_InterfEF& aEF=aEFs.Append1();
+ iX=aEFs.Extent()-1;
aEF.SetIndices(nE, nF);
aEF.SetCommonPart(aCP);
myDS->AddInterf(nE, nF);
//
aMIEFC.Add(nF);
// 1
- iX=aEFs.Append()-1;
- BOPDS_InterfEF& aEF=aEFs(iX);
+ BOPDS_InterfEF& aEF=aEFs.Append1();
+ iX=aEFs.Extent()-1;
aEF.SetIndices(nE, nF);
aEF.SetCommonPart(aCPart);
// 2
aMIEFC.Add(nF);
//
// 1
- iX=aEFs.Append()-1;
- BOPDS_InterfEF& aEF=aEFs(iX);
+ BOPDS_InterfEF& aEF=aEFs.Append1();
+ iX=aEFs.Extent()-1;
aEF.SetIndices(nE, nF);
//
bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
gp_Pnt2d aP2d(U, V);
bRet = myContext->IsPointInFace (aF, aP2d);
if (bRet) {
- Standard_Integer i;
+ //Standard_Integer i;
BRep_Builder aBB;
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
- if (aVFs.Extent() == 0) {
- aVFs.Init();
- }
- //
- i=aVFs.Append()-1;
- BOPDS_InterfVF& aVF=aVFs(i);
+ BOPDS_InterfVF& aVF=aVFs.Append1();
aVF.SetIndices(nV, nF);
aVF.SetUV(U, V);
//
//
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bToSplit, bTangentFaces;
- Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP;
+ Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
Standard_Integer aNbFaceFace, k;
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
BRepAdaptor_Surface aBAS1, aBAS2;
BOPAlgo_VectorOfFaceFace aVFaceFace;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
- aFFs.SetStartSize(iSize);
aFFs.SetIncrement(iSize);
- aFFs.Init();
//
bApp=mySectionAttribute.Approximation();
bCompC2D1=mySectionAttribute.PCurveOnS1();
bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
myDS->AddInterf(nF1, nF2);
- iX=aFFs.Append()-1;
- BOPDS_InterfFF& aFF=aFFs(iX);
+ BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aFF.Init(0, 0);
continue;
myDS->AddInterf(nF1, nF2);
}
//
- iX=aFFs.Append()-1;
- BOPDS_InterfFF& aFF=aFFs(iX);
+ BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
//
aFF.SetTolR3D(aTolR3D);
const Handle(Geom_Curve)& aC3D= aIC.Curve();
bValid=IntTools_Tools::CheckCurve(aC3D, aTolR3D, aBox);
if (bValid) {
- iC=aVNC.Append()-1;
- BOPDS_Curve& aNC=aVNC(iC);
+ BOPDS_Curve& aNC=aVNC.Append1();
aNC.SetCurve(aIC);
aNC.SetBox(aBox);
}
const IntTools_PntOn2Faces& aPi=aPntsX(i);
const gp_Pnt& aP=aPi.P1().Pnt();
//
- iP=aVNP.Append()-1;
- BOPDS_Point& aNP=aVNP(iP);
+ BOPDS_Point& aNP=aVNP.Append1();
aNP.SetPnt(aP);
}
//}// if (aNbCs || aNbPs)
}// if (bIsDone) {
else {// 904/L1
- iX=aFFs.Append()-1;
- BOPDS_InterfFF& aFF=aFFs(iX);
+ BOPDS_InterfFF& aFF=aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aNbCurves=0;
aNbPoints=0;
BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_VectorOfCurve& aVC)
{
- Standard_Integer nV1, nV2;
+ Standard_Integer nV1, nV2, iC;
//
- Standard_Integer iC=aVC.Append()-1;
+ aVC.Append1();
+ iC=aVC.Extent()-1;
BOPDS_ListOfPaveBlock& aLPBC = aVC(iC).ChangePaveBlocks();
aLPBC.Append(aPB);
//
package BOPCol
- ---Purpose:
- -- The package contains collection classes
- -- that are used by
- -- partition and boolean operation algorithms
+ ---Purpose:
+ -- The package contains collection classes
+ -- that are used by
+ -- partition and boolean operation algorithms
uses
TCollection
imported DataMapOfShapeAddress from BOPCol;
imported DataMapOfTransientAddress from BOPCol;
imported PListOfInteger from BOPCol;
- imported VectorOfInteger from BOPCol;
imported MapOfShape from BOPCol;
imported DataMapOfShapeShape from BOPCol;
imported DataMapOfShapeListOfShape from BOPCol;
+++ /dev/null
-// Created by: Peter KURNEV
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef BOPCol_Array1_HeaderFile
-#define BOPCol_Array1_HeaderFile
-
-#include <NCollection_List.hxx>
-#include <Standard.hxx>
-#include <NCollection_BaseAllocator.hxx>
-
-/**
-* Class BOPCol_Array1 (dynamic array of objects)
-*
-* 1. The Array1 uses the allocator (in terms of NCollection_BaseAllocator)
-* to allocate the memory.
-* 2. The memory is allocated as a list of memory blocks. The size of the first
-* block is myStartSize. The size of the other blocks is myIncrement
-* 3 The Array1 is created with 0 length.
-* 4. The Array1 must be initiated by invoke the method Init().
-* Init() allocates the memory block for initial myStartSize elements.
-* 5. The elements can be added by the method Append(theElement). the method
-* Append(theElement) arranges theElement in
-* a) previously allocated memory block (if it is possible)
-* b) new allocated memory block (otherwise). The size of new blocks to
-* allocate can be set [once only] by the method SetIncrement(theSize).
-* 6. The contents of the element with index "i" can be queried or modified
-* by the methods
-* SetValue(i, theElement), Value(i), ChangeValue(i), operator()(i)
-*/
-
-//=======================================================================
-//class : MemBlock
-//
-//=======================================================================
-template <class Type> class BOPCol_MemBlock {
-
- public:
- // Ctor
- BOPCol_MemBlock(const Handle(NCollection_BaseAllocator)& theAllocator) {
- myI1=0;
- myI2=0;
- mySize=0;
- myData=NULL;
- myAllocator=theAllocator;
- myNext=NULL;
- }
- // ~
- ~BOPCol_MemBlock(){
- Clear();
- }
- // Clear
- void Clear() {
- if (myData) {
- //Standard_Integer i;
- Standard_Size i;
- //
- for (i=0; i<mySize; ++i) {
- myData[i].~Type();
- }
- myAllocator->Free(myData);
- //
- myData=NULL;
- mySize=0;
- myNext=NULL;
- }
- }
- // Allocate
- void Allocate(const Standard_Size theSize) {
- //Standard_Integer i;
- Standard_Size i;
- //
- Clear();
- mySize=theSize;
- myData=(Type*)myAllocator->Allocate(theSize*sizeof(Type));
- for (i=0; i<mySize; ++i) {
-#ifdef BOPCol_Array1_Use_Allocator
- new (myData+i) Type (myAllocator);
-#else
- new (myData+i) Type;
-#endif
- }
- }
- // SetRange
- void SetRange(const Standard_Integer theI1,
- const Standard_Integer theI2) {
- myI1=theI1;
- myI2=theI2;
- }
- // Range
- void Range(Standard_Integer& theI1,
- Standard_Integer& theI2) const {
- theI1=myI1;
- theI2=myI2;
- }
- // Contains
- Standard_Boolean Contains(const Standard_Integer theIndex)const {
- return (theIndex>=myI1 && theIndex<=myI2);
- }
- // SetValue
- void SetValue(const Standard_Integer theIndex,
- const Type& theValue) {
- *(myData+theIndex-myI1)=theValue;
- }
- // Value
- const Type& Value(const Standard_Integer theIndex)const {
- return *(myData+theIndex-myI1);
- }
- // ChangeValue
- Type& ChangeValue(const Standard_Integer theIndex) {
- return *(myData+theIndex-myI1);
- }
- // SetNext
- void SetNext(BOPCol_MemBlock<Type>* pNext) {
- myNext=pNext;
- }
- // Next
- BOPCol_MemBlock<Type>* Next() {
- return myNext;
- }
- //
- public:
- BOPCol_MemBlock<Type>* myNext;
- protected:
- Standard_Integer myI1;
- Standard_Integer myI2;
- Standard_Size mySize;
- Type *myData;
- Handle(NCollection_BaseAllocator) myAllocator;
-};
-
-//=======================================================================
-//class : BOPCol_Array1
-//
-//=======================================================================
-template <class Type> class BOPCol_Array1 {
-
- public:
- typedef BOPCol_MemBlock<Type>* BOPCol_PMemBlock;
- typedef BOPCol_MemBlock<Type> BOPCol_XMemBlock;
- //=========
- // Ctor
- BOPCol_Array1(const Handle(NCollection_BaseAllocator)& theAllocator=0L) {
- myStartSize=32;
- myIncrement=8;
- myExtent=0;
- myPBlock=NULL;
- myPBlock1=NULL;
- //
- if (theAllocator.IsNull()) {
- myAllocator = NCollection_BaseAllocator::CommonBaseAllocator();
- }
- else {
- myAllocator=theAllocator;
- }
- }
- // ~
- ~BOPCol_Array1() {
- Clear();
- }
- //===========
- // Clear
- void Clear() {
- BOPCol_PMemBlock pBlock, pNext;
- //
- pBlock=myPBlock1;
- while(pBlock) {
- pNext=pBlock->Next();
- //
- pBlock->~BOPCol_XMemBlock();
- myAllocator->Free(pBlock);
- //
- pBlock=pNext;
- }
- myPBlock1=NULL;
- myPBlock=NULL;
- myExtent=0;
- }
- // SetStartSize
- void SetStartSize(const Standard_Integer theSize) {
- if (theSize>0) {
- myStartSize=theSize;
- }
- }
- // SetIncrement
- void SetIncrement(const Standard_Integer theSize){
- if (theSize>0) {
- myIncrement=theSize;
- }
- }
- // Increment
- Standard_Integer Increment()const {
- return myIncrement;
- }
- // Extent
- Standard_Integer Extent()const {
- return myExtent;
- }
- // Size
- Standard_Integer Size()const {
- return myExtent;
- }
- // Size
- Standard_Integer Length()const {
- return myExtent;
- }
- // Init
- void Init();
- // Append(const Type& theValue)
- Standard_Integer Append(const Type& theValue);
- // Append()
- Standard_Integer Append();
- // SetValue
- void SetValue(const Standard_Integer theIndex,
- const Type& theValue);
- // Value
- const Type& operator()(const Standard_Integer theIndex)const;
- //
- const Type& Value(const Standard_Integer theIndex)const;
- // ChangeValue
- Type& operator()(const Standard_Integer theIndex);
- //
- Type& ChangeValue(const Standard_Integer theIndex);
- //
- // protected
- protected:
- //===========
- //FindBlock
- Standard_Boolean FindBlock(const Standard_Integer theIndex)const ;
- //Copy ctor
- BOPCol_Array1(const BOPCol_Array1&);
- //Assign operator
- BOPCol_Array1& operator =(const BOPCol_Array1& theOther);
- //==========
- // fields
- protected:
- Standard_Integer myStartSize;
- Standard_Integer myIncrement;
- Standard_Integer myExtent;
- Type myDfltItem;
- BOPCol_MemBlock<Type> * myPBlock;
- BOPCol_MemBlock<Type> * myPBlock1;
- Handle(NCollection_BaseAllocator) myAllocator;
-};
-//
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-template <class Type>
- void BOPCol_Array1<Type>::Init() {
- BOPCol_PMemBlock pBlock;
- //
- pBlock=(BOPCol_PMemBlock)myAllocator->Allocate(sizeof(BOPCol_MemBlock<Type>));
- new (pBlock) BOPCol_MemBlock<Type>(myAllocator);
- //
- pBlock->Allocate(myStartSize);
- pBlock->SetRange(0, myStartSize-1);
- myPBlock1=pBlock;
- myPBlock=pBlock;
- }
-//=======================================================================
-//function : Append
-//purpose :
-//=======================================================================
-template <class Type>
- Standard_Integer BOPCol_Array1<Type>::Append(const Type& theValue) {
- BOPCol_PMemBlock pBlock, pNext;
- //
- pBlock=myPBlock1;
- for(;;) {
- pNext=pBlock->myNext;
- if(!pNext) {
- myPBlock=pBlock;
- break;
- }
- pBlock=pNext;
- }
- //
- if (!myPBlock->Contains(myExtent)) {
- //
- pBlock=(BOPCol_PMemBlock)myAllocator->Allocate(sizeof(BOPCol_MemBlock<Type>));
- new (pBlock) BOPCol_MemBlock<Type>(myAllocator);
- //
- pBlock->Allocate(myIncrement);
- pBlock->SetRange(myExtent, myExtent+myIncrement-1);
- //
- myPBlock->myNext=pBlock;
- //
- myPBlock=pBlock;
- }
- //
- myPBlock->SetValue(myExtent, theValue);
- //
- ++myExtent;
- //
- return myExtent;
- }
-//=======================================================================
-//function : Append
-//purpose :
-//=======================================================================
-template <class Type>
- Standard_Integer BOPCol_Array1<Type>::Append() {
- BOPCol_PMemBlock pBlock, pNext;
- //
- pBlock=myPBlock1;
- for(;;) {
- pNext=pBlock->myNext;
- if(!pNext) {
- myPBlock=pBlock;
- break;
- }
- pBlock=pNext;
- }
- //
- if (!myPBlock->Contains(myExtent)) {
- //
- pBlock=(BOPCol_PMemBlock)myAllocator->Allocate(sizeof(BOPCol_MemBlock<Type>));
- new (pBlock) BOPCol_MemBlock<Type>(myAllocator);
- //
- pBlock->Allocate(myIncrement);
- pBlock->SetRange(myExtent, myExtent+myIncrement-1);
- //
- myPBlock->myNext=pBlock;
- //
- myPBlock=pBlock;
- }
- ++myExtent;
- //
- return myExtent;
- }
-//=======================================================================
-//function : SetValue
-//purpose :
-//=======================================================================
-template <class Type>
- void BOPCol_Array1<Type>::SetValue(const Standard_Integer theIndex,
- const Type& theValue) {
- if (FindBlock(theIndex)) {
- myPBlock->SetValue(theIndex, theValue);
- }
- }
-//=======================================================================
-//function : operator()
-//purpose :
-//=======================================================================
-template <class Type>
- const Type& BOPCol_Array1<Type>::operator()(const Standard_Integer theIndex)const {
- if (FindBlock(theIndex)) {
- return myPBlock->Value(theIndex);
- }
- return myDfltItem;
- }
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-template <class Type>
- const Type& BOPCol_Array1<Type>::Value(const Standard_Integer theIndex)const {
- return operator()(theIndex);
- }
-//=======================================================================
-//function : operator
-//purpose :
-//=======================================================================
-template <class Type>
- Type& BOPCol_Array1<Type>::operator()(const Standard_Integer theIndex) {
- if (FindBlock(theIndex)) {
- return myPBlock->ChangeValue(theIndex);
- }
- return myDfltItem;
- }
-//=======================================================================
-//function : ChangeValue
-//purpose :
-//=======================================================================
-template <class Type>
- Type& BOPCol_Array1<Type>::ChangeValue(const Standard_Integer theIndex) {
- return operator()(theIndex);
- }
-//=======================================================================
-//function : FindBlock
-//purpose :
-//=======================================================================
-template <class Type>
- Standard_Boolean BOPCol_Array1<Type>::FindBlock(const Standard_Integer theIndex)const {
- Standard_Boolean bRet;
- //
- bRet=myPBlock->Contains(theIndex);
- if(bRet) {
- return bRet;
- }
- //
- Standard_Integer i1, i2;
- BOPCol_PMemBlock pBlock, *xPBlock;
- //
- xPBlock=(BOPCol_PMemBlock*)&myPBlock;
- pBlock=myPBlock1;
- //
- i1=0;
- i2=myStartSize-1;
- do {
- if (theIndex>=i1 && theIndex<=i2) {
- *xPBlock=pBlock;
- return !bRet;
- }
- //
- i1=i2+1;
- i2=i1+myIncrement-1;
- pBlock=pBlock->myNext;
- } while(pBlock);
- //
- return bRet;
- }
-
-#endif
-BOPCol_Array1.hxx
BOPCol_DataMapOfShapeInteger.hxx
BOPCol_DataMapOfShapeReal.hxx
BOPCol_MapOfInteger.hxx
BOPCol_DataMapOfShapeAddress.hxx
BOPCol_DataMapOfTransientAddress.hxx
BOPCol_PListOfInteger.hxx
-BOPCol_VectorOfInteger.hxx
BOPCol_MapOfShape.hxx
BOPCol_DataMapOfShapeShape.hxx
BOPCol_DataMapOfShapeListOfShape.hxx
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myArguments(myAllocator),
- myRanges(myAllocator),
- myLines(myAllocator),
+ myRanges(0,myAllocator),
+ myLines(0, myAllocator),
myMapShapeIndex(100, myAllocator),
- myPaveBlocksPool(myAllocator),
+ myPaveBlocksPool(0,myAllocator),
myMapPBCB(100, myAllocator),
- myFaceInfoPool(myAllocator),
+ myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
myInterfTB(100, myAllocator),
- myInterfVV(myAllocator),
- myInterfVE(myAllocator),
- myInterfVF(myAllocator),
- myInterfEE(myAllocator),
- myInterfEF(myAllocator),
- myInterfFF(myAllocator),
- myInterfVZ(myAllocator),
- myInterfEZ(myAllocator),
- myInterfFZ(myAllocator),
- myInterfZZ(myAllocator),
+ myInterfVV(0, myAllocator),
+ myInterfVE(0, myAllocator),
+ myInterfVF(0, myAllocator),
+ myInterfEE(0, myAllocator),
+ myInterfEF(0, myAllocator),
+ myInterfFF(0, myAllocator),
+ myInterfVZ(0, myAllocator),
+ myInterfEZ(0, myAllocator),
+ myInterfFZ(0, myAllocator),
+ myInterfZZ(0, myAllocator),
myFuzzyValue(0.),
myToleranceMap(100, myAllocator)
{
:
myAllocator(theAllocator),
myArguments(myAllocator),
- myRanges(myAllocator),
- myLines(myAllocator),
+ myRanges(0, myAllocator),
+ myLines(0, myAllocator),
myMapShapeIndex(100, myAllocator),
- myPaveBlocksPool(myAllocator),
+ myPaveBlocksPool(0, myAllocator),
myMapPBCB(100, myAllocator),
- myFaceInfoPool(myAllocator),
+ myFaceInfoPool(0, myAllocator),
myShapesSD(100, myAllocator),
myInterfTB(100, myAllocator),
- myInterfVV(myAllocator),
- myInterfVE(myAllocator),
- myInterfVF(myAllocator),
- myInterfEE(myAllocator),
- myInterfEF(myAllocator),
- myInterfFF(myAllocator),
- myInterfVZ(myAllocator),
- myInterfEZ(myAllocator),
- myInterfFZ(myAllocator),
- myInterfZZ(myAllocator),
+ myInterfVV(0, myAllocator),
+ myInterfVE(0, myAllocator),
+ myInterfVF(0, myAllocator),
+ myInterfEE(0, myAllocator),
+ myInterfEF(0, myAllocator),
+ myInterfFF(0, myAllocator),
+ myInterfVZ(0, myAllocator),
+ myInterfEZ(0, myAllocator),
+ myInterfFZ(0, myAllocator),
+ myInterfZZ(0, myAllocator),
myFuzzyValue(0.),
myToleranceMap(100, myAllocator)
{
{
Standard_Integer iX;
//
- iX=myLines.Append()-1;
- myLines(iX)=theSI;
+ myLines.Append1()=theSI;
+ iX=myLines.Extent()-1;
+ //
return iX;
}
//=======================================================================
{
Standard_Integer iX;
//
- iX=myLines.Append()-1;
- myLines(iX).SetShape(theS);
+ myLines.Append1().SetShape(theS);
+ iX=myLines.Extent()-1;
return iX;
}
//=======================================================================
//=======================================================================
const TopoDS_Shape& BOPDS_DS::Shape(const Standard_Integer theI)const
{
+
const TopoDS_Shape& aS=ShapeInfo(theI).Shape();
return aS;
}
return;
}
//
- myRanges.SetStartSize(aNb);
- myRanges.Init();
+ myRanges.SetIncrement(aNb);
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
aNbS=aNbS+aNbSx;
}
//
- myLines.SetStartSize(2*aNbS);
- myLines.SetIncrement(aNbS);
- myLines.Init();
- //
+ myLines.SetIncrement(2*aNbS);
//-----------------------------------------------------scope_1 f
aAllocator=new NCollection_IncAllocator();
//
aMI.Clear();
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
- //
// 3 myPaveBlocksPool
- myPaveBlocksPool.SetStartSize(aNbE);
- myPaveBlocksPool.SetIncrement(aNbE);
- myPaveBlocksPool.Init();
- //
// 4. myFaceInfoPool
- myFaceInfoPool.SetStartSize(aNbF);
+ myPaveBlocksPool.SetIncrement(aNbE);
myFaceInfoPool.SetIncrement(aNbF);
- myFaceInfoPool.Init();
- //
}
//=======================================================================
//function : InitShape
}
}
//
- iRef = myPaveBlocksPool.Append() - 1;
- BOPDS_ListOfPaveBlock &aLPB=myPaveBlocksPool(iRef);
+ BOPDS_ListOfPaveBlock &aLPB=myPaveBlocksPool.Append1();
+ iRef=myPaveBlocksPool.Extent()-1;
//
aPB->Update(aLPB, Standard_False);
aSI.SetReference(iRef);
Standard_Integer iRef;
//
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(theI);
- iRef=myFaceInfoPool.Append()-1;
- BOPDS_FaceInfo &aFI=myFaceInfoPool(iRef);
+ BOPDS_FaceInfo &aFI=myFaceInfoPool.Append1();
+ iRef=myFaceInfoPool.Extent()-1;
aSI.SetReference(iRef);
//
aFI.SetIndex(theI);
myTangentFaces(Standard_False),
myTolR3D(1.e-7),
myTolR2D(1.e-7),
- myCurves(myAllocator),
- myPoints(myAllocator) {
+ myCurves(0, myAllocator),
+ myPoints(0, myAllocator)
+ {
}
//
- /**
- * Constructor
- * @param theAllocator
- * allocator to manage the memory
- */
- /*
- BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator)
- :
- BOPDS_Interf(theAllocator),
- myTangentFaces(Standard_False),
- myTolR3D(1.e-7),
- myTolR2D(1.e-7),
- myCurves(myAllocator),
- myPoints(myAllocator) {
- }
- */
- //
/**
* Destructor
*/
* @param theNbPoints
* number of intersection points
*/
+
void Init(const Standard_Integer theNbCurves,
const Standard_Integer theNbPoints) {
+ //modified by NIZNHY-PKV Mon Jan 26 09:01:06 2015f
+ if (theNbCurves>0) {
+ myCurves.SetIncrement(theNbCurves);
+ }
+ if (theNbPoints>0) {
+ myPoints.SetIncrement(theNbPoints);
+ }
+ /*
if (theNbCurves>0) {
myCurves.SetStartSize(theNbCurves);
myCurves.SetIncrement(theNbCurves);
myPoints.SetIncrement(theNbPoints);
myPoints.Init();
}
+ */
+ //modified by NIZNHY-PKV Mon Jan 26 09:01:12 2015t
}
/**
* Modifier
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myRunParallel(Standard_False)
{
+ Standard_Integer i, aNb;
+ //
myDS=NULL;
myLength=0;
//
- myLists.SetStartSize(BOPDS_DS::NbInterfTypes());
- myLists.Init();
+ aNb=BOPDS_DS::NbInterfTypes();
+ myLists.SetIncrement(aNb);
+ for (i=0; i<aNb; ++i) {
+ myLists.Append1();
+ }
}
//=======================================================================
//function :
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
- myLists(theAllocator),
+ myLists(0, theAllocator),
myRunParallel(Standard_False)
{
+ Standard_Integer i, aNb;
+ //
myDS=NULL;
myLength=0;
//
- myLists.SetStartSize(BOPDS_DS::NbInterfTypes());
- myLists.Init();
+ aNb=BOPDS_DS::NbInterfTypes();
+ myLists.SetIncrement(aNb);
+ for (i=0; i<aNb; ++i) {
+ myLists.Append1();
+ }
}
//=======================================================================
//function : ~
#ifndef BOPDS_VectorOfCurve_HeaderFile
#define BOPDS_VectorOfCurve_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Curve.hxx>
-#define BOPCol_Array1_Use_Allocator
-
-typedef BOPCol_Array1<BOPDS_Curve> BOPDS_VectorOfCurve;
-
-#undef BOPCol_Array1_Use_Allocator
-
+typedef BOPCol_NCVector<BOPDS_Curve> BOPDS_VectorOfCurve;
#endif
#ifndef BOPDS_VectorOfFaceInfo_HeaderFile
#define BOPDS_VectorOfFaceInfo_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_FaceInfo.hxx>
-#define BOPCol_Array1_Use_Allocator
-
-typedef BOPCol_Array1<BOPDS_FaceInfo> BOPDS_VectorOfFaceInfo;
-
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_FaceInfo> BOPDS_VectorOfFaceInfo;
#endif
#ifndef BOPDS_VectorOfIndexRange_HeaderFile
#define BOPDS_VectorOfIndexRange_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_IndexRange.hxx>
-typedef BOPCol_Array1<BOPDS_IndexRange> BOPDS_VectorOfIndexRange;
+typedef BOPCol_NCVector<BOPDS_IndexRange> BOPDS_VectorOfIndexRange;
#endif
#ifndef BOPDS_VectorOfInterfEE_HeaderFile
#define BOPDS_VectorOfInterfEE_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfEE> BOPDS_VectorOfInterfEE;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfEE> BOPDS_VectorOfInterfEE;
#endif
#ifndef BOPDS_VectorOfInterfEF_HeaderFile
#define BOPDS_VectorOfInterfEF_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfEF> BOPDS_VectorOfInterfEF;
-#undef BOPCol_Array1_Use_Allocator
-
+typedef BOPCol_NCVector<BOPDS_InterfEF> BOPDS_VectorOfInterfEF;
#endif
#ifndef BOPDS_VectorOfInterfEZ_HeaderFile
#define BOPDS_VectorOfInterfEZ_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfEZ> BOPDS_VectorOfInterfEZ;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfEZ> BOPDS_VectorOfInterfEZ;
#endif
#ifndef BOPDS_VectorOfInterfFF_HeaderFile
#define BOPDS_VectorOfInterfFF_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfFF> BOPDS_VectorOfInterfFF;
-#undef BOPCol_Array1_Use_Allocator
-
+typedef BOPCol_NCVector<BOPDS_InterfFF> BOPDS_VectorOfInterfFF;
#endif
#ifndef BOPDS_VectorOfInterfFZ_HeaderFile
#define BOPDS_VectorOfInterfFZ_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfFZ> BOPDS_VectorOfInterfFZ;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfFZ> BOPDS_VectorOfInterfFZ;
#endif
#ifndef BOPDS_VectorOfInterfVE_HeaderFile
#define BOPDS_VectorOfInterfVE_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfVE> BOPDS_VectorOfInterfVE;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfVE> BOPDS_VectorOfInterfVE;
#endif
#ifndef BOPDS_VectorOfInterfVF_HeaderFile
#define BOPDS_VectorOfInterfVF_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfVF> BOPDS_VectorOfInterfVF;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfVF> BOPDS_VectorOfInterfVF;
#endif
#ifndef BOPDS_VectorOfInterfVV_HeaderFile
#define BOPDS_VectorOfInterfVV_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfVV> BOPDS_VectorOfInterfVV;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfVV> BOPDS_VectorOfInterfVV;
#endif
#ifndef BOPDS_VectorOfInterfVZ_HeaderFile
#define BOPDS_VectorOfInterfVZ_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfVZ> BOPDS_VectorOfInterfVZ;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfVZ> BOPDS_VectorOfInterfVZ;
#endif
#ifndef BOPDS_VectorOfInterfZZ_HeaderFile
#define BOPDS_VectorOfInterfZZ_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Interf.hxx>
-#define BOPCol_Array1_Use_Allocator
-typedef BOPCol_Array1<BOPDS_InterfZZ> BOPDS_VectorOfInterfZZ;
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_InterfZZ> BOPDS_VectorOfInterfZZ;
#endif
#ifndef BOPDS_VectorOfListOfPassKeyBoolean_HeaderFile
#define BOPDS_VectorOfListOfPassKeyBoolean_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_ListOfPassKeyBoolean.hxx>
-#define BOPCol_Array1_Use_Allocator
-
-typedef BOPCol_Array1<BOPDS_ListOfPassKeyBoolean> BOPDS_VectorOfListOfPassKeyBoolean;
-
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_ListOfPassKeyBoolean> BOPDS_VectorOfListOfPassKeyBoolean;
#endif
#ifndef BOPDS_VectorOfListOfPaveBlock_HeaderFile
#define BOPDS_VectorOfListOfPaveBlock_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
-#define BOPCol_Array1_Use_Allocator
-
-typedef BOPCol_Array1<BOPDS_ListOfPaveBlock> BOPDS_VectorOfListOfPaveBlock;
-
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_ListOfPaveBlock> BOPDS_VectorOfListOfPaveBlock;
#endif
#ifndef BOPDS_VectorOfPnt_HeaderFile
#define BOPDS_VectorOfPnt_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_Point.hxx>
-#define BOPCol_Array1_Use_Allocator
-
-typedef BOPCol_Array1<BOPDS_Point> BOPDS_VectorOfPoint;
-
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_Point> BOPDS_VectorOfPoint;
#endif
#ifndef BOPDS_VectorOfShapeInfo_HeaderFile
#define BOPDS_VectorOfShapeInfo_HeaderFile
-#include <BOPCol_Array1.hxx>
+#include <BOPCol_NCVector.hxx>
#include <BOPDS_ShapeInfo.hxx>
-#define BOPCol_Array1_Use_Allocator
-
-typedef BOPCol_Array1<BOPDS_ShapeInfo> BOPDS_VectorOfShapeInfo;
-
-#undef BOPCol_Array1_Use_Allocator
+typedef BOPCol_NCVector<BOPDS_ShapeInfo> BOPDS_VectorOfShapeInfo;
#endif
#ifndef BOPTest_Chronometer_HeaderFile
#define BOPTest_Chronometer_HeaderFile
//
-#include <OSD_Chronometer.hxx>
+#include <OSD_Timer.hxx>
//=======================================================================
//class : BOPTest_Chronometer
//purpose :
//
void Stop() {
myChronometer.Stop();
- myChronometer.Show(myTime);
+ myTime=myChronometer.ElapsedTime();
}
//
double Time() const{
};
//
protected:
- OSD_Chronometer myChronometer;
+ OSD_Timer myChronometer;
double myTime;
};
//! Empty the vector of its objects
Standard_EXPORT void Clear();
+ // to set the size of increment dynamically
+ void SetIncrement(const Standard_Integer aIncrement) {
+ if (aIncrement > 0) {
+ if (!myIncrement) {
+ myIncrement=aIncrement;
+ }
+ }
+ }
protected: //! @name Protected fields
nb = pDS->NbSourceShapes();
nE = pDS->Index(theEdge);
+ //
+ if (nE<0) {
+ return Standard_False;
+ }
+ //
const BOPDS_ListOfPaveBlock& aLPB1 = pDS->PaveBlocks(nE);
if (!aLPB1.Extent()) {
return Standard_False;