Back to index

salome-geom  6.5.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
NMTDS_IteratorCheckerSI Class Reference

#include <NMTDS_IteratorCheckerSI.hxx>

Inheritance diagram for NMTDS_IteratorCheckerSI:
Inheritance graph
[legend]
Collaboration diagram for NMTDS_IteratorCheckerSI:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Standard_EXPORT NMTDS_IteratorCheckerSI ()
virtual Standard_EXPORT ~NMTDS_IteratorCheckerSI ()
Standard_EXPORT void SetDS (const NMTDS_PShapesDataStructure &pDS)
Standard_EXPORT const
NMTDS_ShapesDataStructure
DS () const
Standard_EXPORT void Initialize (const TopAbs_ShapeEnum aType1, const TopAbs_ShapeEnum aType2)
Standard_EXPORT Standard_Boolean More () const
Standard_EXPORT void Next ()
Standard_EXPORT void Current (Standard_Integer &aIndex1, Standard_Integer &aIndex2, Standard_Boolean &aWithSubShape) const
virtual Standard_EXPORT void Prepare ()
Standard_EXPORT Standard_Integer ExpectedLength () const
Standard_EXPORT Standard_Integer BlockLength () const
Standard_EXPORT const
TColStd_DataMapOfIntegerListOfInteger & 
SDVertices () const

Static Public Member Functions

static Standard_EXPORT void FillMVSD (const TColStd_DataMapOfIntegerListOfInteger &aMVSD1, TColStd_DataMapOfIntegerListOfInteger &aMVSD2)

Protected Member Functions

virtual Standard_EXPORT void Intersect ()

Protected Attributes

NMTDS_PShapesDataStructure myDS
NMTDS_ListOfPairBoolean myLists [6]
NMTDS_ListIteratorOfListOfPairBoolean myIterator
NMTDS_ListOfPairBoolean myEmptyList
Standard_Integer myLength
TColStd_DataMapOfIntegerListOfInteger myMVSD

Detailed Description

Definition at line 34 of file NMTDS_IteratorCheckerSI.hxx.


Constructor & Destructor Documentation

Definition at line 59 of file NMTDS_IteratorCheckerSI.cxx.

Definition at line 68 of file NMTDS_IteratorCheckerSI.cxx.

{
}

Member Function Documentation

Standard_Integer NMTDS_Iterator::BlockLength ( ) const [inherited]

Definition at line 102 of file NMTDS_Iterator.cxx.

{
  Standard_Integer aNbIIs, iTresh;
  Standard_Real aCfPredict=.5;
  
  aNbIIs=ExpectedLength();
  
  if (aNbIIs<=1) {
    return 1;
  }
  //modified by NIZNHY-PKV Mon Dec 12 08:50:50 2011f
  iTresh=1000;
  if (aNbIIs>iTresh) {
    aNbIIs=iTresh;
    return aNbIIs;
  }
  //modified by NIZNHY-PKV Mon Dec 12 08:50:54 2011t
  //
  aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
  return aNbIIs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_Iterator::Current ( Standard_Integer &  aIndex1,
Standard_Integer &  aIndex2,
Standard_Boolean &  aWithSubShape 
) const [inherited]

Definition at line 162 of file NMTDS_Iterator.cxx.

{
  const NMTDS_PairBoolean& aPKB=myIterator.Value();
  aPKB.Ids(aIndex1, aIndex2);
  aWithSubShape=aPKB.Flag();
}

Here is the call graph for this function:

Here is the caller graph for this function:

const NMTDS_ShapesDataStructure & NMTDS_Iterator::DS ( ) const [inherited]

Definition at line 86 of file NMTDS_Iterator.cxx.

{
  return *myDS;
}
Standard_Integer NMTDS_Iterator::ExpectedLength ( ) const [inherited]

Definition at line 94 of file NMTDS_Iterator.cxx.

{
  return myLength;
}

Here is the caller graph for this function:

void NMTDS_Iterator::FillMVSD ( const TColStd_DataMapOfIntegerListOfInteger &  aMVSD1,
TColStd_DataMapOfIntegerListOfInteger &  aMVSD2 
) [static, inherited]

Definition at line 350 of file NMTDS_Iterator.cxx.

{
  Standard_Boolean bFound;
  Standard_Integer aNbVSD, iCnt, i, j, k;
  TColStd_ListOfInteger aLV;
  TColStd_ListIteratorOfListOfInteger aIt;
  TColStd_MapOfInteger aMF;
  TColStd_MapIteratorOfMapOfInteger aItMI;
  TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
  NMTDS_DataMapOfIntegerMapOfInteger aDMIMI;
  NMTDS_DataMapIteratorOfDataMapOfIntegerMapOfInteger aIti, aItj;
  //
  aNbVSD=aMVSD.Extent();
  if (!aNbVSD) {
    return;
  }
  //
  aItVSD.Initialize(aMVSD);
  for (; aItVSD.More(); aItVSD.Next()) {
    TColStd_MapOfInteger aMI;
    //
    i=aItVSD.Key();
    aMI.Add(i);
    const TColStd_ListOfInteger& aLVSD=aItVSD.Value();
    aIt.Initialize(aLVSD);
    for (; aIt.More(); aIt.Next()) {
      j=aIt.Value();
      aMI.Add(j);
    }
    aDMIMI.Bind(i, aMI);
  }
  // i
  aIti.Initialize(aDMIMI);
  for (; aIti.More(); aIti.Next()) {
    i=aIti.Key();
    if (aMF.Contains(i)) {
      continue;
    }
    aMF.Add(i);
    //
    //TColStd_MapOfInteger& aMIi=aDMIMI.ChangeFind(i);
    TColStd_MapOfInteger *pMIi=(TColStd_MapOfInteger *)&aIti.Value();
    TColStd_MapOfInteger& aMIi=*pMIi;
    //  j
    while (1) {
      iCnt=0;
      aItj.Initialize(aDMIMI);
      for (; aItj.More(); aItj.Next()) {
        j=aItj.Key();
        if (aMF.Contains(j)) {
          continue;
        }
        //
        //TColStd_MapOfInteger& aMIj=aDMIMI.ChangeFind(j);
        TColStd_MapOfInteger *pMj=(TColStd_MapOfInteger *)&aItj.Value();
        TColStd_MapOfInteger& aMIj=*pMj;
        //
        aItMI.Initialize(aMIj);
        for (; aItMI.More(); aItMI.Next()) {
          k=aItMI.Key();
          bFound=aMIi.Contains(k);
          if (bFound) {
            break;
          }
        }
        if (!bFound) {
          continue;
        }
        //
        aItMI.Initialize(aMIj);
        for (; aItMI.More(); aItMI.Next()) {
          k=aItMI.Key();
          aMIi.Add(k);
        }
        //
        if (aMF.Add(j)) {
          ++iCnt;
        }
      } //for (; aItj.More(); aItj.Next()) {
      if (!iCnt) {
        break;
      }
    } // while (1) {
    //
    aLV.Clear();
    aItMI.Initialize(aMIi);
    for (; aItMI.More(); aItMI.Next()) {
      k=aItMI.Key();
        if (k!=i) {
          aLV.Append(k);
        }
    }
    bMVSD.Bind(i, aLV);
  }// for (; aIti.More(); aIti.Next()) {
}

Here is the caller graph for this function:

void NMTDS_Iterator::Initialize ( const TopAbs_ShapeEnum  aType1,
const TopAbs_ShapeEnum  aType2 
) [inherited]

Definition at line 127 of file NMTDS_Iterator.cxx.

{
  Standard_Integer iX;
  //
  iX=NMTDS_Tools::TypeToInteger(aType1, aType2);
  if (iX>=0) {
    myIterator.Initialize(myLists[iX]);
    myLength=myLists[iX].Extent();
  }
  else {
    myIterator.Initialize(myEmptyList);
    myLength=0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void NMTDS_IteratorCheckerSI::Intersect ( ) [protected, virtual]

Reimplemented from NMTDS_Iterator.

Definition at line 75 of file NMTDS_IteratorCheckerSI.cxx.

{
  Standard_Boolean bFlag;
  Standard_Integer aNbS, i, aNbA, aNbB, iFlag;
  Standard_Integer aNbSD, iX, j, iDS, jB, k, aNbLV;
  TColStd_ListIteratorOfListOfInteger aIt;
  TColStd_DataMapOfIntegerInteger aMII;
  TColStd_DataMapOfIntegerListOfInteger aMVSD;
  TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItVSD;
  TopTools_DataMapOfShapeInteger aMSI;
  TopAbs_ShapeEnum aTi, aTj;
  NMTDS_PairBoolean aPKXB; 
  NMTDS_MapOfPairBoolean aMPKXB;
  NMTDS_IndexedDataMapOfShapeBox aMSB;
  NMTDS_MapOfPairBoolean aMPA;//myPairsAvoid
  //
  NMTDS_BoxBndTreeSelector aSelector;
  NMTDS_BoxBndTree aBBTree;
  NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
  //
  aNbS=myDS->NumberOfShapesOfTheObject();
  //
  // myPairsAvoid, aMSI, aMSB
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aSi=myDS->Shape(i);
    aTi=aSi.ShapeType();
    if (NMTDS_Tools::HasBRep(aTi)) {
      if (aTi!=TopAbs_VERTEX) {
        TColStd_IndexedMapOfInteger aMA;
        //
        myDS->GetAllSuccessors(i, aMA);
        //
        aNbA=aMA.Extent();
        for (j=1; j<=aNbA; ++j) {
          iX=aMA(j);
          aPKXB.Clear();
          aPKXB.SetIds(i, iX);
          aMPA.Add(aPKXB);
        }
      }
      else {
        aPKXB.Clear();
        aPKXB.SetIds(i, i);
        aMPA.Add(aPKXB);
      }
      //
      Bnd_Box aBoxEx;
      //
      myDS->ComputeBoxEx(i, aBoxEx);
      aMSI.Bind(aSi, i);
      aMSB.Add(aSi, aBoxEx);
    }
  }
  // 
  // aMII
  aNbB=aMSB.Extent();
  for (i=1; i<=aNbB; ++i) {
    const TopoDS_Shape& aS=aMSB.FindKey(i);
    const Bnd_Box& aBoxEx=aMSB(i);
    //
    aTreeFiller.Add(i, aBoxEx);
    //
    iDS=aMSI.Find(aS);
    aMII.Bind(i, iDS);
  }
  //
  aTreeFiller.Fill();
  //
  for (i=1; i<=aNbS; ++i) {
    const TopoDS_Shape& aSi=myDS->Shape(i);
    aTi=aSi.ShapeType();
    if (!NMTDS_Tools::HasBRep(aTi)){
      continue;
    }
    const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
    aSelector.Clear();
    aSelector.SetBox(aBoxEx);
    //
    aNbSD=aBBTree.Select(aSelector);
    if (!aNbSD){
      continue;
    }
    //
    const TColStd_ListOfInteger& aLI=aSelector.Indices();
    //
    k=0;
    TColStd_ListOfInteger aLV;
    //
    aIt.Initialize(aLI);
    for (; aIt.More(); aIt.Next()) {
      jB=aIt.Value();  // box index in MII
      j=aMII.Find(jB); // DS index
      //
      aPKXB.SetIds(i, j);
      if (aMPA.Contains(aPKXB)) {
        continue;
      }
      //
      if (aMPKXB.Add(aPKXB)) {
        bFlag=Standard_False;// Bounding boxes are intersected
        const Bnd_Box& aBoxi=myDS->GetBoundingBox(i);
        const Bnd_Box& aBoxj=myDS->GetBoundingBox(j);
        if (aBoxi.IsOut(aBoxj)) {
          bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
        }
        const TopoDS_Shape& aSj=myDS->Shape(j);
        aTj=aSj.ShapeType();
        iX=NMTDS_Tools::TypeToInteger(aTi, aTj);
        //bFlag=(iStatus==2);
        aPKXB.SetFlag(bFlag);
        myLists[iX].Append(aPKXB);
        //
        // VSD prepare
        if (iX==5) { //VV
          aLV.Append(j);
        }
      }// if (aMPKXB.Add(aPKXB)) {
    }// for (; aIt.More(); aIt.Next()) {
    //
    // VSD treatment
    aNbLV=aLV.Extent();
    if (aNbLV) {
      TColStd_ListOfInteger aLV1;
      //
      const TopoDS_Vertex& aVi=TopoDS::Vertex(aSi);
      aIt.Initialize(aLV);
      for (; aIt.More(); aIt.Next()) {
        j=aIt.Value();  
        const TopoDS_Shape&  aSj=myDS->Shape(j);
        const TopoDS_Vertex& aVj=TopoDS::Vertex(aSj);
        iFlag=NMTDS_Tools::ComputeVV(aVi, aVj);
        if (!iFlag) {
          aLV1.Append(j);
        }
        else {
          aPKXB.SetIds(i, j);
          aMPKXB.Remove(aPKXB);
        }
      } 
      aMVSD.Bind(i, aLV1);
    }
  }//for (i=1; i<=aNbS; ++i) {
  //
  //
  // 2. Chains
  //=================
  myMVSD.Clear();
  NMTDS_Iterator::FillMVSD(aMVSD, myMVSD);
}

Here is the call graph for this function:

Standard_Boolean NMTDS_Iterator::More ( ) const [inherited]

Definition at line 146 of file NMTDS_Iterator.cxx.

{
  return myIterator.More();
}

Here is the caller graph for this function:

void NMTDS_Iterator::Next ( ) [inherited]

Definition at line 154 of file NMTDS_Iterator.cxx.

{
  myIterator.Next();
}

Here is the caller graph for this function:

void NMTDS_Iterator::Prepare ( ) [virtual, inherited]

Definition at line 182 of file NMTDS_Iterator.cxx.

{
  Standard_Integer i;
  //
  myLength=0;
  for (i=0; i<6; ++i) {
    myLists[i].Clear();
  }
  myMVSD.Clear();
  //
  if (myDS==NULL){
    return;
  }
  Intersect();
}

Here is the call graph for this function:

Here is the caller graph for this function:

const TColStd_DataMapOfIntegerListOfInteger & NMTDS_Iterator::SDVertices ( ) const [inherited]

Definition at line 174 of file NMTDS_Iterator.cxx.

{
  return myMVSD;
}

Here is the caller graph for this function:

void NMTDS_Iterator::SetDS ( const NMTDS_PShapesDataStructure pDS) [inherited]

Definition at line 78 of file NMTDS_Iterator.cxx.

{
  myDS=aDS;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 95 of file NMTDS_Iterator.hxx.

Definition at line 98 of file NMTDS_Iterator.hxx.

Definition at line 97 of file NMTDS_Iterator.hxx.

Standard_Integer NMTDS_Iterator::myLength [protected, inherited]

Definition at line 99 of file NMTDS_Iterator.hxx.

Definition at line 96 of file NMTDS_Iterator.hxx.

TColStd_DataMapOfIntegerListOfInteger NMTDS_Iterator::myMVSD [protected, inherited]

Definition at line 100 of file NMTDS_Iterator.hxx.


The documentation for this class was generated from the following files: