-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
//
// File: NMTDS_ShapesDataStructure.cxx
-// Created: Mon Dec 1 10:21:04 2003
// Author: Peter KURNEV
-// <pkv@irinox>
-//
-#include <NMTDS_ShapesDataStructure.ixx>
+
+#include <NMTDS_ShapesDataStructure.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
//function : NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure
//purpose :
//===========================================================================
- NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure()
+NMTDS_ShapesDataStructure::NMTDS_ShapesDataStructure()
:
BooleanOperations_ShapesDataStructure()
{}
//function : SetCompositeShape
//purpose :
//===========================================================================
- void NMTDS_ShapesDataStructure::SetCompositeShape(const TopoDS_Shape& aS)
+void NMTDS_ShapesDataStructure::SetCompositeShape(const TopoDS_Shape& aS)
{
myCompositeShape=aS;
}
//function : CompositeShape
//purpose :
//===========================================================================
- const TopoDS_Shape& NMTDS_ShapesDataStructure::CompositeShape()const
+const TopoDS_Shape& NMTDS_ShapesDataStructure::CompositeShape()const
{
return myCompositeShape;
}
//function : Ranges
//purpose :
//===========================================================================
- const NMTDS_CArray1OfIndexRange& NMTDS_ShapesDataStructure::Ranges()const
+const NMTDS_CArray1OfIndexRange& NMTDS_ShapesDataStructure::Ranges()const
{
return myRanges;
}
-// Modified to Add new methods Thu Sep 14 14:35:18 2006
-// Contribution of Samtech www.samcef.com BEGIN
//===========================================================================
//function : FillMap
//purpose :
//===========================================================================
- void NMTDS_ShapesDataStructure::FillMap
+void NMTDS_ShapesDataStructure::FillMap
(const TopoDS_Shape& aS,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const
//function : FillSubshapes
//purpose :
//===========================================================================
- void NMTDS_ShapesDataStructure::FillSubshapes
+void NMTDS_ShapesDataStructure::FillSubshapes
(const TopoDS_Shape& aS,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSA,
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMS) const
}
}
}
-// Contribution of Samtech www.samcef.com END
//===========================================================================
//function : Init
//purpose :
//===========================================================================
- void NMTDS_ShapesDataStructure::Init()
+void NMTDS_ShapesDataStructure::Init()
{
Standard_Integer i, j, aNbSx, aNbS, aShift, aNbRanges;
Standard_Integer iFirst, iLast;
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aSx=anIt.Value();
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors aMS;
- //modified by NIZNHY-PKV Tue Feb 27 17:05:47 2007f
- //FillMap(aSx, aMSA, aMS);
- //aLx.Append(aMS);
//
if (!aMSA.Contains(aSx)) {
FillMap(aSx, aMSA, aMS);
aLx.Append(aMS);
}
- //modified by NIZNHY-PKV Tue Feb 27 17:06:03 2007t
}
aNbS=aMSA.Extent();
//
// Fill myRanges
- //modified by NIZNHY-PKV Tue Feb 27 17:10:07 2007f
i=aLx.Extent();
- //modified by NIZNHY-PKV Tue Feb 27 17:10:10 2007t
myRanges.Resize(i);
aLit.Initialize(aLx);
for (i=1; aLit.More(); aLit.Next(), ++i) {
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
const BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& aMSx=aLit.Value();
aNbSx=aMSx.Extent();
- // Contribution of Samtech www.samcef.com END
if (i==1) {
iFirst=1;
iLast=aNbSx;
}
//
myNumberOfShapesOfTheObject=aNbS;
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
- //myNumberOfShapesOfTheTool=aNbS;
- //myLength=3*aNbS;
myNumberOfShapesOfTheTool=0;
myLength=2*aNbS;
- // Contribution of Samtech www.samcef.com END
//
// Allocate the whole Table
myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences));
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
//
// Fill the table
-
- //aShift=0;
- //for (i=0; i<2; ++i) {
- // if (i) {
- // aShift=aNbS;
- // }
- // for (j=1; j<=aNbS; ++j) {
- // const TopoDS_Shape& aSx=aMSA.FindKey(j);
- // const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=
- // aMSA.FindFromIndex(j);
- // InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift);
- // }
- //}
aShift=0;
for (j=1; j<=aNbS; ++j) {
const BooleanOperations_AncestorsSeqAndSuccessorsSeq& aASx=aMSA.FindFromIndex(j);
InsertShapeAndAncestorsSuccessors(aSx, aASx, aShift);
}
- // Contribution of Samtech www.samcef.com END
- //
// myShapeIndexMap
myShapeIndexMap.Clear();
//
+ //modified by NIZNHY-PKV Mon Dec 12 09:01:53 2011f
aNbRanges=myRanges.Extent();
for (i=1; i<=aNbRanges; ++i){
- BooleanOperations_IndexedDataMapOfShapeInteger aSIM;
- //
const NMTDS_IndexRange& aR=myRanges(i);
iFirst=aR.First();
iLast =aR.Last();
for (j=iFirst; j<=iLast; ++j) {
const TopoDS_Shape& aS=Shape(j);
- aSIM.Add(aS, j);
+ myShapeIndexMap.Bind(aS, j);
}
- myShapeIndexMap.Add(i, aSIM);
}
+ //modified by NIZNHY-PKV Mon Dec 12 09:02:00 2011t
//
// myRefEdges
iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
//function : ShapeRangeIndex
//purpose :
//===========================================================================
- Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex(const Standard_Integer aId)const
+Standard_Integer NMTDS_ShapesDataStructure::ShapeRangeIndex
+ (const Standard_Integer aId)const
{
Standard_Boolean bFound;
Standard_Integer i, aNbR, aIdx, aNbS, aZero=0;
//function : Rank
//purpose :
//===========================================================================
- Standard_Integer NMTDS_ShapesDataStructure::Rank(const Standard_Integer aId)const
+Standard_Integer NMTDS_ShapesDataStructure::Rank
+ (const Standard_Integer aId)const
{
Standard_Boolean bFound;
Standard_Integer i, aNbR, aNbS, aZero=0;
//function : ShapeIndex
//purpose :
//===========================================================================
- Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex(const TopoDS_Shape& aS,
- const Standard_Integer aRank)const
+Standard_Integer NMTDS_ShapesDataStructure::ShapeIndex
+ (const TopoDS_Shape& aS,
+ const Standard_Integer aRank)const
{
- Standard_Boolean bFound;
- Standard_Integer aIndex=0;
- //
- bFound=myShapeIndexMap.Contains(aRank);
- if (!bFound) {
- return aIndex;
- }
- // Modified Thu Sep 14 14:35:18 2006
- // Contribution of Samtech www.samcef.com BEGIN
+ Standard_Address pIndex;
+ Standard_Integer aIndex;
//
- //const BooleanOperations_IndexedDataMapOfShapeInteger& aSIM=
- // myShapeIndexMap.FindFromKey(aRank);
+ aIndex=0;
//
- //bFound=aSIM.Contains(aS);
- //if (!bFound) {
- // return aIndex;
- //}
- //
- //aIndex=aSIM.FindFromKey(aS);
- //
- Standard_Integer i, aNbRanks;
- //
- aNbRanks=myShapeIndexMap.Extent();
- for (i=1; i<=aNbRanks; ++i){
- const BooleanOperations_IndexedDataMapOfShapeInteger& aSIM=myShapeIndexMap.FindFromKey(i);
- bFound=aSIM.Contains(aS);
- if (bFound) {
- aIndex=aSIM.FindFromKey(aS);
- return aIndex;
- }
+ //modified by NIZNHY-PKV Mon Dec 12 09:02:48 2011f
+ pIndex=myShapeIndexMap.Find1(aS);
+ if (pIndex) {
+ aIndex=*((Standard_Integer*)pIndex);
}
- // Contribution of Samtech www.samcef.com END
+ //modified by NIZNHY-PKV Mon Dec 12 09:02:54 2011t
return aIndex;
}
//function : ComputeBoxEx
//purpose :
//=======================================================================
- void NMTDS_ShapesDataStructure::ComputeBoxEx (const Standard_Integer aIx,
- Bnd_Box& aBoxEx)const
+void NMTDS_ShapesDataStructure::ComputeBoxEx
+ (const Standard_Integer aIx,
+ Bnd_Box& aBoxEx)const
{
ComputeBoxExS(aIx, this, aBoxEx);
}
//function : GetAllSuccessors
//purpose :
//=======================================================================
- void NMTDS_ShapesDataStructure::GetAllSuccessors(const Standard_Integer nS,
- TColStd_IndexedMapOfInteger& aMA)const
+void NMTDS_ShapesDataStructure::GetAllSuccessors
+ (const Standard_Integer nS,
+ TColStd_IndexedMapOfInteger& aMA)const
{
GetAllSuccessorsS(nS, this, aMA);
}
// function: ComputeBoxExS
// purpose:
//=======================================================================
- void ComputeBoxExS(const Standard_Integer aIx,
- const NMTDS_ShapesDataStructure* pDS,
- Bnd_Box& aBoxEx)
+void ComputeBoxExS(const Standard_Integer aIx,
+ const NMTDS_ShapesDataStructure* pDS,
+ Bnd_Box& aBoxEx)
{
Standard_Integer i, aNbS, iS;
//