Back to index

salome-geom  6.5.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
GEOMImpl_IBlocksOperations Class Reference

#include <GEOMImpl_IBlocksOperations.hxx>

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

List of all members.

Classes

struct  BCError

Public Types

enum  BCErrorType {
  NOT_BLOCK, EXTRA_EDGE, INVALID_CONNECTION, NOT_CONNECTED,
  NOT_GLUED
}

Public Member Functions

Standard_EXPORT GEOMImpl_IBlocksOperations (GEOM_Engine *theEngine, int theDocID)
 constructor:
Standard_EXPORT ~GEOMImpl_IBlocksOperations ()
 destructor
Standard_EXPORT Handle (GEOM_Object) MakeQuad(Handle(GEOM_Object) theEdge1
Standard_EXPORT Handle (GEOM_Object) theEdge2
Standard_EXPORT Handle (GEOM_Object) theEdge3
Standard_EXPORT Handle (GEOM_Object) theEdge4)
Standard_EXPORT Handle (GEOM_Object) MakeQuad2Edges(Handle(GEOM_Object) theEdge1
Standard_EXPORT Handle (GEOM_Object) theEdge2)
Standard_EXPORT Handle (GEOM_Object) MakeQuad4Vertices(Handle(GEOM_Object) thePoint1
Standard_EXPORT Handle (GEOM_Object) thePoint2
Standard_EXPORT Handle (GEOM_Object) thePoint3
Standard_EXPORT Handle (GEOM_Object) thePoint4)
Standard_EXPORT Handle (GEOM_Object) MakeHexa(Handle(GEOM_Object) theFace1
Standard_EXPORT Handle (GEOM_Object) theFace2
Standard_EXPORT Handle (GEOM_Object) theFace3
Standard_EXPORT Handle (GEOM_Object) theFace4
Standard_EXPORT Handle (GEOM_Object) theFace5
Standard_EXPORT Handle (GEOM_Object) theFace6)
Standard_EXPORT Handle (GEOM_Object) MakeHexa2Faces(Handle(GEOM_Object) theFace1
Standard_EXPORT Handle (GEOM_Object) theFace2)
Standard_EXPORT Handle (GEOM_Object) MakeBlockCompound(Handle(GEOM_Object) theCompound)
Standard_EXPORT Handle (GEOM_Object) GetPoint(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) GetVertexNearPoint(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) thePoint)
Standard_EXPORT Handle (GEOM_Object) GetEdge(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) thePoint1
Standard_EXPORT Handle (GEOM_Object) thePoint2)
Standard_EXPORT Handle (GEOM_Object) GetEdgeNearPoint(Handle(GEOM_Object) theBlock
Standard_EXPORT Handle (GEOM_Object) thePoint)
Standard_EXPORT Handle (GEOM_Object) GetFaceByPoints(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) thePoint1
Standard_EXPORT Handle (GEOM_Object) thePoint2
Standard_EXPORT Handle (GEOM_Object) thePoint3
Standard_EXPORT Handle (GEOM_Object) thePoint4)
Standard_EXPORT Handle (GEOM_Object) GetFaceByEdges(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) theEdge1
Standard_EXPORT Handle (GEOM_Object) theEdge2)
Standard_EXPORT Handle (GEOM_Object) GetOppositeFace(Handle(GEOM_Object) theBlock
Standard_EXPORT Handle (GEOM_Object) theFace)
Standard_EXPORT Handle (GEOM_Object) GetFaceNearPoint(Handle(GEOM_Object) theBlock
Standard_EXPORT Handle (GEOM_Object) thePoint)
Standard_EXPORT Handle (GEOM_Object) GetFaceByNormale(Handle(GEOM_Object) theBlock
Standard_EXPORT Handle (GEOM_Object) theVector)
Standard_EXPORT Handle (GEOM_Object) GetShapesNearPoint(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) thePoint
Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object) theCompound, const Standard_Integer theMinNbFaces, const Standard_Integer theMaxNbFaces, Standard_Integer &theNbBlocks)
 IsCompoundOfBlocks.
Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound, std::list< BCError > &theErrors)
 CheckCompoundOfBlocksOld.
Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound, std::list< BCError > &theErrors)
 CheckCompoundOfBlocks.
Standard_EXPORT
TCollection_AsciiString 
PrintBCErrors (Handle(GEOM_Object) theCompound, const std::list< BCError > &theErrors)
 PrintBCErrors.
Standard_EXPORT Handle (GEOM_Object) RemoveExtraEdges(Handle(GEOM_Object) theShape
Standard_EXPORT Handle (GEOM_Object) CheckAndImprove(Handle(GEOM_Object) theCompound)
Standard_EXPORT Handle (TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks(Handle(GEOM_Object) theCompound
Standard_EXPORT Handle (GEOM_Object) GetBlockNearPoint(Handle(GEOM_Object) theCompound
Standard_EXPORT Handle (GEOM_Object) thePoint)
Standard_EXPORT Handle (GEOM_Object) GetBlockByParts(Handle(GEOM_Object) theCompound
Standard_EXPORT const Handle (TColStd_HSequenceOfTransient)&theParts)
Standard_EXPORT Handle (TColStd_HSequenceOfTransient) GetBlocksByParts(Handle(GEOM_Object) theCompound
Standard_EXPORT const Handle (TColStd_HSequenceOfTransient)&theParts)
Standard_EXPORT Handle (GEOM_Object) MakeMultiTransformation1D(Handle(GEOM_Object) theBlock
Standard_EXPORT Handle (GEOM_Object) MakeMultiTransformation2D(Handle(GEOM_Object) theBlock
Standard_EXPORT Handle (TColStd_HSequenceOfTransient) Propagate(Handle(GEOM_Object) theShape)
Standard_EXPORT void StartOperation ()
 StartOperation.
Standard_EXPORT void FinishOperation ()
 FinishOperation.
Standard_EXPORT void AbortOperation ()
 AbortOperation.
Standard_EXPORT bool IsDone ()
 IsDone.
Standard_EXPORT void SetNotDone ()
Standard_EXPORT void SetErrorCode (const TCollection_AsciiString &theErrorCode)
Standard_EXPORT char * GetErrorCode ()
Standard_EXPORT GEOM_EngineGetEngine ()
Standard_EXPORT GEOM_SolverGetSolver ()
Standard_EXPORT int GetDocID ()

Static Public Member Functions

static Standard_EXPORT void AddBlocksFrom (const TopoDS_Shape &theShape, TopTools_ListOfShape &BLO, TopTools_ListOfShape &NOT, TopTools_ListOfShape &EXT)
 Set of functions, used by CheckCompoundOfBlocks() method.

Public Attributes

Standard_EXPORT const Standard_Real theX
Standard_EXPORT const
Standard_Real const
Standard_Real 
theY
Standard_EXPORT const
Standard_Real const
Standard_Real const
Standard_Real 
theZ
Standard_EXPORT const
Standard_Real const
Standard_Real const
Standard_Real const
Standard_Real 
theEpsilon
Standard_EXPORT const
Standard_Integer 
theShapeType
Standard_EXPORT const
Standard_Integer const
Standard_Real 
theTolerance
Standard_EXPORT const
Standard_Integer 
theOptimumNbFaces = 6)
Standard_EXPORT const
Standard_Integer 
theMinNbFaces
Standard_EXPORT const
Standard_Integer const
Standard_Integer 
theMaxNbFaces
Standard_EXPORT const
Standard_Integer 
theDirFace1
Standard_EXPORT const
Standard_Integer const
Standard_Integer 
theDirFace2
Standard_EXPORT const
Standard_Integer const
Standard_Integer const
Standard_Integer 
theNbTimes
Standard_EXPORT const
Standard_Integer 
theDirFace1U
Standard_EXPORT const
Standard_Integer const
Standard_Integer 
theDirFace2U
Standard_EXPORT const
Standard_Integer const
Standard_Integer const
Standard_Integer 
theNbTimesU
Standard_EXPORT const
Standard_Integer const
Standard_Integer const
Standard_Integer const
Standard_Integer 
theDirFace1V
Standard_EXPORT const
Standard_Integer const
Standard_Integer const
Standard_Integer const
Standard_Integer const
Standard_Integer 
theDirFace2V
Standard_EXPORT const
Standard_Integer const
Standard_Integer const
Standard_Integer const
Standard_Integer const
Standard_Integer const
Standard_Integer 
theNbTimesV

Detailed Description

Definition at line 37 of file GEOMImpl_IBlocksOperations.hxx.


Class Documentation

struct GEOMImpl_IBlocksOperations::BCError

Definition at line 123 of file GEOMImpl_IBlocksOperations.hxx.

Collaboration diagram for GEOMImpl_IBlocksOperations::BCError:
Class Members
BCErrorType error
list< int > incriminated

Member Enumeration Documentation

Enumerator:
NOT_BLOCK 
EXTRA_EDGE 
INVALID_CONNECTION 
NOT_CONNECTED 
NOT_GLUED 

Definition at line 115 of file GEOMImpl_IBlocksOperations.hxx.


Constructor & Destructor Documentation

constructor:

Definition at line 111 of file GEOMImpl_IBlocksOperations.cxx.

: GEOM_IOperations(theEngine, theDocID)
{
  MESSAGE("GEOMImpl_IBlocksOperations::GEOMImpl_IBlocksOperations");
}

destructor

Definition at line 122 of file GEOMImpl_IBlocksOperations.cxx.

{
  MESSAGE("GEOMImpl_IBlocksOperations::~GEOMImpl_IBlocksOperations");
}

Member Function Documentation

void GEOM_IOperations::AbortOperation ( ) [inherited]

AbortOperation.

Definition at line 89 of file GEOM_IOperations.cxx.

{
  Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID);
  aDoc->AbortCommand();
}

Here is the call graph for this function:

void GEOMImpl_IBlocksOperations::AddBlocksFrom ( const TopoDS_Shape &  theShape,
TopTools_ListOfShape &  BLO,
TopTools_ListOfShape &  NOT,
TopTools_ListOfShape &  EXT 
) [static]

Set of functions, used by CheckCompoundOfBlocks() method.

Definition at line 1735 of file GEOMImpl_IBlocksOperations.cxx.

{
  TopAbs_ShapeEnum aType = theShape.ShapeType();
  switch (aType) {
  case TopAbs_COMPOUND:
  case TopAbs_COMPSOLID:
    {
      TopoDS_Iterator It (theShape);
      for (; It.More(); It.Next()) {
        AddBlocksFrom(It.Value(), BLO, NOT, EXT);
      }
    }
    break;
  case TopAbs_SOLID:
    {
      // Check, if there are seam or degenerated edges
      BlockFix_CheckTool aTool;
      aTool.SetShape(theShape);
      aTool.Perform();
      if (aTool.NbPossibleBlocks() > 0) {
        EXT.Append(theShape);
      } else {
        // Count faces and edges in each face to recognize blocks
        TopTools_MapOfShape mapFaces;
        Standard_Integer nbFaces = 0;
        Standard_Boolean hasNonQuadr = Standard_False;
        TopExp_Explorer expF (theShape, TopAbs_FACE);

        for (; expF.More(); expF.Next()) {
          if (mapFaces.Add(expF.Current())) {
            nbFaces++;
            if (nbFaces > 6) break;

            // get wire
            TopoDS_Shape aF = expF.Current();
            TopExp_Explorer wires (aF, TopAbs_WIRE);
            if (!wires.More()) {
              // no wire in the face
              hasNonQuadr = Standard_True;
              break;
            }
            TopoDS_Shape aWire = wires.Current();
            wires.Next();
            if (wires.More()) {
              // multiple wires in the face
              hasNonQuadr = Standard_True;
              break;
            }

            // Check number of edges in the face
            Standard_Integer nbEdges = 0;
            TopTools_MapOfShape mapEdges;
            TopExp_Explorer expW (aWire, TopAbs_EDGE);
            for (; expW.More(); expW.Next()) {
              if (mapEdges.Add(expW.Current())) {
                nbEdges++;
                if (nbEdges > 4) break;
              }
            }
            if (nbEdges != 4) {
              hasNonQuadr = Standard_True;
            }
          }
        }

        if (nbFaces == 6 && !hasNonQuadr) {
          BLO.Append(theShape);
        } else {
          NOT.Append(theShape);
        }
      }
    }
    break;
  default:
    NOT.Append(theShape);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks ( Handle(GEOM_Object theCompound,
std::list< BCError > &  theErrors 
)

CheckCompoundOfBlocks.

Definition at line 2338 of file GEOMImpl_IBlocksOperations.cxx.

{
  SetErrorCode(KO);

  if (theCompound.IsNull()) return Standard_False;
  TopoDS_Shape aBlockOrComp = theCompound->GetValue();

  Standard_Boolean isCompOfBlocks = Standard_True;

  // Map sub-shapes and their indices
  TopTools_IndexedMapOfShape anIndices;
  TopExp::MapShapes(aBlockOrComp, anIndices);

  // 1. Separate blocks from non-blocks
  TopTools_ListOfShape NOT; // Not blocks
  TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
  TopTools_ListOfShape BLO; // All blocks from the given compound
  AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT);

  // Report non-blocks
  if (NOT.Extent() > 0) {
    isCompOfBlocks = Standard_False;
    BCError anErr;
    anErr.error = NOT_BLOCK;
    TopTools_ListIteratorOfListOfShape it (NOT);
    for (; it.More(); it.Next()) {
      anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
    }
    theErrors.push_back(anErr);
  }

  // Report solids, having degenerated and/or seam edges
  if (EXT.Extent() > 0) {
    isCompOfBlocks = Standard_False;
    BCError anErr;
    anErr.error = EXTRA_EDGE;
    TopTools_ListIteratorOfListOfShape it (EXT);
    for (; it.More(); it.Next()) {
      anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
    }
    theErrors.push_back(anErr);
  }

  Standard_Integer nbBlocks = BLO.Extent();
  if (nbBlocks == 0) {
    isCompOfBlocks = Standard_False;
    SetErrorCode(OK);
    return isCompOfBlocks;
  }
  if (nbBlocks == 1) {
    SetErrorCode(OK);
    return isCompOfBlocks;
  }

  // Prepare data for 2. and 3.
  TColStd_Array2OfInteger aRelations (1, nbBlocks, 1, nbBlocks);
  aRelations.Init(REL_NOT_CONNECTED);

  TopTools_IndexedMapOfShape mapBlocks;

  BRep_Builder BB;
  TopoDS_Compound aComp;
  BB.MakeCompound(aComp);

  TopTools_ListIteratorOfListOfShape BLOit (BLO);
  for (; BLOit.More(); BLOit.Next()) {
    mapBlocks.Add(BLOit.Value());
    BB.Add(aComp, BLOit.Value());
  }

  // 2. Find glued blocks (having shared faces)
  TopTools_IndexedDataMapOfShapeListOfShape mapFaceBlocks;
  GEOMImpl_Block6Explorer::MapShapesAndAncestors
    (aComp, TopAbs_FACE, TopAbs_SOLID, mapFaceBlocks);

  Standard_Integer prevInd = 0, curInd = 0;
  Standard_Integer ind = 1, nbFaces = mapFaceBlocks.Extent();
  for (; ind <= nbFaces; ind++) {
    const TopTools_ListOfShape& aGluedBlocks = mapFaceBlocks.FindFromIndex(ind);
    if (aGluedBlocks.Extent() > 1) { // Shared face found
      TopTools_ListIteratorOfListOfShape aGluedBlocksIt (aGluedBlocks);
      TopoDS_Shape prevBlock, curBlock;
      for (; aGluedBlocksIt.More(); aGluedBlocksIt.Next()) {
        curBlock = aGluedBlocksIt.Value();
        if (!prevBlock.IsNull()) {
          prevInd = mapBlocks.FindIndex(prevBlock);
          curInd  = mapBlocks.FindIndex(curBlock);
          aRelations.SetValue(prevInd, curInd, REL_OK);
          aRelations.SetValue(curInd, prevInd, REL_OK);
        }
        prevBlock = curBlock;
      }
    }
  }

  // 3. Find not glued blocks
  GEOMAlgo_GlueAnalyser aGD;

  aGD.SetShape(aComp);
  aGD.SetTolerance(Precision::Confusion());
  aGD.SetCheckGeometry(Standard_True);
  aGD.Perform();

  Standard_Integer iErr, iWrn;
  iErr = aGD.ErrorStatus();
  if (iErr) {
    SetErrorCode("Error in GEOMAlgo_GlueAnalyser");
    return isCompOfBlocks;
  }
  iWrn = aGD.WarningStatus();
  if (iWrn) {
    MESSAGE("Warning in GEOMAlgo_GlueAnalyser");
  }

  // Report not glued blocks
  if (aGD.HasSolidsToGlue()) {
    isCompOfBlocks = Standard_False;
    Standard_Integer aSx1Ind, aSx2Ind;

    const GEOMAlgo_ListOfCoupleOfShapes& aLCS = aGD.SolidsToGlue();
    GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS (aLCS);
    for (; aItCS.More(); aItCS.Next()) {
      const GEOMAlgo_CoupleOfShapes& aCS = aItCS.Value();
      const TopoDS_Shape& aSx1 = aCS.Shape1();
      const TopoDS_Shape& aSx2 = aCS.Shape2();

      aSx1Ind = mapBlocks.FindIndex(aSx1);
      aSx2Ind = mapBlocks.FindIndex(aSx2);
      aRelations.SetValue(aSx1Ind, aSx2Ind, NOT_GLUED);
      aRelations.SetValue(aSx2Ind, aSx1Ind, NOT_GLUED);

      BCError anErr;
      anErr.error = NOT_GLUED;
      anErr.incriminated.push_back(anIndices.FindIndex(aSx1));
      anErr.incriminated.push_back(anIndices.FindIndex(aSx2));
      theErrors.push_back(anErr);
    }
  }

  // 4. Find largest set of connected (good connection or not glued) blocks
  Standard_Integer ibl = 1;
  TColStd_MapOfInteger aProcessedMap;
  TColStd_MapOfInteger aLargestSet;
  TColStd_MapOfInteger aCurrentSet;
  for (ibl = 1; ibl <= nbBlocks; ibl++) {
    if (!aProcessedMap.Contains(ibl)) {
      aCurrentSet.Clear();
      FindConnected(ibl, aRelations, aProcessedMap, aCurrentSet);
      if (aCurrentSet.Extent() > aLargestSet.Extent()) {
        aLargestSet = aCurrentSet;
      }
    }
  }

  // 5. Report all blocks, isolated from <aLargestSet>
  BCError anErr;
  anErr.error = NOT_CONNECTED;
  Standard_Boolean hasIsolated = Standard_False;
  for (ibl = 1; ibl <= nbBlocks; ibl++) {
    if (!aLargestSet.Contains(ibl)) {
      aProcessedMap.Clear();
      if (!HasAnyConnection(ibl, aLargestSet, aRelations, aProcessedMap)) {
        // report connection absence
        hasIsolated = Standard_True;
        anErr.incriminated.push_back(anIndices.FindIndex(mapBlocks.FindKey(ibl)));
      }
    }
  }
  if (hasIsolated) {
    isCompOfBlocks = Standard_False;
    theErrors.push_back(anErr);
  }

  SetErrorCode(OK);
  return isCompOfBlocks;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocksOld ( Handle(GEOM_Object theCompound,
std::list< BCError > &  theErrors 
)

CheckCompoundOfBlocksOld.

Definition at line 2137 of file GEOMImpl_IBlocksOperations.cxx.

{
  SetErrorCode(KO);

  if (theCompound.IsNull()) return Standard_False;
  TopoDS_Shape aBlockOrComp = theCompound->GetValue();

  Standard_Boolean isCompOfBlocks = Standard_True;

  // Map sub-shapes and their indices
  TopTools_IndexedMapOfShape anIndices;
  TopExp::MapShapes(aBlockOrComp, anIndices);

  // 1. Report non-blocks
  TopTools_ListOfShape NOT; // Not blocks
  TopTools_ListOfShape DEG; // Hexahedral solids, having degenerated edges
  TopTools_ListOfShape SEA; // Hexahedral solids, having seam edges
  TopTools_ListOfShape BLO; // All blocks from the given compound
  AddBlocksFromOld(aBlockOrComp, BLO, NOT, DEG, SEA);

  if (NOT.Extent() > 0) {
    isCompOfBlocks = Standard_False;
    BCError anErr;
    anErr.error = NOT_BLOCK;
    TopTools_ListIteratorOfListOfShape it (NOT);
    for (; it.More(); it.Next()) {
      anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
    }
    theErrors.push_back(anErr);
  }

  if (DEG.Extent() > 0 || SEA.Extent() > 0) {
    isCompOfBlocks = Standard_False;
    BCError anErr;
    anErr.error = EXTRA_EDGE;

    TopTools_ListIteratorOfListOfShape itDEG (DEG);
    for (; itDEG.More(); itDEG.Next()) {
      anErr.incriminated.push_back(anIndices.FindIndex(itDEG.Value()));
    }

    TopTools_ListIteratorOfListOfShape itSEA (SEA);
    for (; itSEA.More(); itSEA.Next()) {
      anErr.incriminated.push_back(anIndices.FindIndex(itSEA.Value()));
    }

    theErrors.push_back(anErr);
  }

  Standard_Integer nbBlocks = BLO.Extent();
  if (nbBlocks == 0) {
    isCompOfBlocks = Standard_False;
    SetErrorCode(OK);
    return isCompOfBlocks;
  }
  if (nbBlocks == 1) {
    SetErrorCode(OK);
    return isCompOfBlocks;
  }

  // Convert list of blocks into array for easy and fast access
  Standard_Integer ibl = 1;
  TopTools_Array1OfShape aBlocks (1, nbBlocks);
  TopTools_ListIteratorOfListOfShape BLOit (BLO);
  for (; BLOit.More(); BLOit.Next(), ibl++) {
    aBlocks.SetValue(ibl, BLOit.Value());
  }

  // 2. Find relations between all blocks,
  //    report connection errors (NOT_GLUED and INVALID_CONNECTION)
  TColStd_Array2OfInteger aRelations (1, nbBlocks, 1, nbBlocks);
  aRelations.Init(REL_NOT_CONNECTED);

  Standard_Integer row = 1;
  for (row = 1; row <= nbBlocks; row++) {
    TopoDS_Shape aBlock = aBlocks.Value(row);

    Standard_Integer col = row + 1;
    for (; col <= nbBlocks; col++) {
      Standard_Integer aRel = BlocksRelation(aBlock, aBlocks.Value(col));
      if (aRel != REL_NOT_CONNECTED) {
        aRelations.SetValue(row, col, aRel);
        aRelations.SetValue(col, row, aRel);
        if (aRel == REL_NOT_GLUED) {
          // report connection error
          isCompOfBlocks = Standard_False;
          BCError anErr;
          anErr.error = NOT_GLUED;
          anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(row)));
          anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(col)));
          theErrors.push_back(anErr);
        } else if (aRel == REL_COLLISION_VV ||
                   aRel == REL_COLLISION_FF ||
                   aRel == REL_COLLISION_EE ||
                   aRel == REL_UNKNOWN) {
          // report connection error
          isCompOfBlocks = Standard_False;
          BCError anErr;
          anErr.error = INVALID_CONNECTION;
          anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(row)));
          anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(col)));
          theErrors.push_back(anErr);
        } else {
        }
      }
    }
  }

  // 3. Find largest set of connected (good connection or not glued) blocks
  TColStd_MapOfInteger aProcessedMap;
  TColStd_MapOfInteger aLargestSet;
  TColStd_MapOfInteger aCurrentSet;
  for (ibl = 1; ibl <= nbBlocks; ibl++) {
    if (!aProcessedMap.Contains(ibl)) {
      aCurrentSet.Clear();
      FindConnected(ibl, aRelations, aProcessedMap, aCurrentSet);
      if (aCurrentSet.Extent() > aLargestSet.Extent()) {
        aLargestSet = aCurrentSet;
      }
    }
  }

  // 4. Report all blocks, isolated from <aLargestSet>
  BCError anErr;
  anErr.error = NOT_CONNECTED;
  Standard_Boolean hasIsolated = Standard_False;
  for (ibl = 1; ibl <= nbBlocks; ibl++) {
    if (!aLargestSet.Contains(ibl)) {
      aProcessedMap.Clear();
      if (!HasAnyConnection(ibl, aLargestSet, aRelations, aProcessedMap)) {
        // report connection absence
        hasIsolated = Standard_True;
        anErr.incriminated.push_back(anIndices.FindIndex(aBlocks.Value(ibl)));
      }
    }
  }
  if (hasIsolated) {
    isCompOfBlocks = Standard_False;
    theErrors.push_back(anErr);
  }

  SetErrorCode(OK);
  return isCompOfBlocks;
}

Here is the call graph for this function:

void GEOM_IOperations::FinishOperation ( ) [inherited]

FinishOperation.

Definition at line 77 of file GEOM_IOperations.cxx.

{
  Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID);
  if(aDoc->GetUndoLimit() > 0) 
    aDoc->CommitCommand();
}

Here is the call graph for this function:

Standard_EXPORT int GEOM_IOperations::GetDocID ( ) [inline, inherited]

Definition at line 77 of file GEOM_IOperations.hxx.

{ return _docID; }

Here is the caller graph for this function:

Definition at line 71 of file GEOM_IOperations.hxx.

{ return _engine; }

Here is the caller graph for this function:

Standard_EXPORT char* GEOM_IOperations::GetErrorCode ( ) [inline, inherited]

Definition at line 66 of file GEOM_IOperations.hxx.

                                       {
    return (char*) _errorCode.ToCString();    
  }

Here is the caller graph for this function:

Definition at line 74 of file GEOM_IOperations.hxx.

{ return _solver; }
Standard_EXPORT GEOMImpl_IBlocksOperations::Handle ( TColStd_HSequenceOfTransient  )
Standard_EXPORT const GEOMImpl_IBlocksOperations::Handle ( TColStd_HSequenceOfTransient  )
Standard_EXPORT GEOMImpl_IBlocksOperations::Handle ( TColStd_HSequenceOfTransient  )
Standard_EXPORT const GEOMImpl_IBlocksOperations::Handle ( TColStd_HSequenceOfTransient  )
Standard_EXPORT GEOMImpl_IBlocksOperations::Handle ( TColStd_HSequenceOfTransient  )
Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks ( Handle(GEOM_Object theCompound,
const Standard_Integer  theMinNbFaces,
const Standard_Integer  theMaxNbFaces,
Standard_Integer &  theNbBlocks 
)

IsCompoundOfBlocks.

Definition at line 1676 of file GEOMImpl_IBlocksOperations.cxx.

{
  SetErrorCode(KO);
  Standard_Boolean isCompOfBlocks = Standard_False;
  theNbBlocks = 0;

  if (theCompound.IsNull()) return isCompOfBlocks;
  TopoDS_Shape aBlockOrComp = theCompound->GetValue();

  //Check
  isCompOfBlocks = Standard_True;
  try {
#if OCC_VERSION_LARGE > 0x06010000
    OCC_CATCH_SIGNALS;
#endif
    TopTools_MapOfShape mapShape;
    TopExp_Explorer exp (aBlockOrComp, TopAbs_SOLID);
    for (; exp.More(); exp.Next()) {
      if (mapShape.Add(exp.Current())) {
        TopoDS_Shape aSolid = exp.Current();

        TopTools_MapOfShape mapFaces;
        TopExp_Explorer expF (aSolid, TopAbs_FACE);
        Standard_Integer nbFaces = 0;
        for (; expF.More(); expF.Next()) {
          if (mapFaces.Add(expF.Current())) {
            nbFaces++;
            if (nbFaces > theMaxNbFaces) {
              isCompOfBlocks = Standard_False;
              break;
            }
          }
        }
        if (nbFaces < theMinNbFaces || theMaxNbFaces < nbFaces) {
          isCompOfBlocks = Standard_False;
        } else {
          theNbBlocks++;
        }
      }
    }
  }
  catch (Standard_Failure) {
    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
    SetErrorCode(aFail->GetMessageString());
    return isCompOfBlocks;
  }

  SetErrorCode(OK);
  return isCompOfBlocks;
}

Here is the call graph for this function:

bool GEOM_IOperations::IsDone ( ) [inherited]

IsDone.

Definition at line 101 of file GEOM_IOperations.cxx.

{
  return (_errorCode == OK);
}  
TCollection_AsciiString GEOMImpl_IBlocksOperations::PrintBCErrors ( Handle(GEOM_Object theCompound,
const std::list< BCError > &  theErrors 
)

PrintBCErrors.

Definition at line 2289 of file GEOMImpl_IBlocksOperations.cxx.

{
  TCollection_AsciiString aDescr;

  std::list<BCError>::const_iterator errIt = theErrors.begin();
  int i = 0;
  for (; errIt != theErrors.end(); i++, errIt++) {
    BCError errStruct = *errIt;

    switch (errStruct.error) {
    case NOT_BLOCK:
      aDescr += "\n\tNot a Blocks: ";
      break;
    case EXTRA_EDGE:
      aDescr += "\n\tHexahedral solids with degenerated and/or seam edges: ";
      break;
    case INVALID_CONNECTION:
      aDescr += "\n\tInvalid connection between two blocks: ";
      break;
    case NOT_CONNECTED:
      aDescr += "\n\tBlocks, not connected with main body: ";
      break;
    case NOT_GLUED:
      aDescr += "\n\tNot glued blocks: ";
      break;
    default:
      break;
    }

    std::list<int> sshList = errStruct.incriminated;
    std::list<int>::iterator sshIt = sshList.begin();
    int jj = 0;
    for (; sshIt != sshList.end(); jj++, sshIt++) {
      if (jj > 0)
        aDescr += ", ";
      aDescr += TCollection_AsciiString(*sshIt);
    }
  }

  return aDescr;
}
Standard_EXPORT void GEOM_IOperations::SetErrorCode ( const TCollection_AsciiString &  theErrorCode) [inline, inherited]

Definition at line 61 of file GEOM_IOperations.hxx.

                                                                                 {
    _errorCode = theErrorCode;    
  } 

Here is the caller graph for this function:

Standard_EXPORT void GEOM_IOperations::SetNotDone ( ) [inline, inherited]

Definition at line 58 of file GEOM_IOperations.hxx.

{ _errorCode = KO; }
void GEOM_IOperations::StartOperation ( ) [inherited]

StartOperation.

Definition at line 65 of file GEOM_IOperations.cxx.

{
  Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID);
  if(aDoc->GetUndoLimit() > 0) 
    aDoc->NewCommand();
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 166 of file GEOMImpl_IBlocksOperations.hxx.

Definition at line 171 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theDirFace1V

Definition at line 171 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theDirFace2

Definition at line 166 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theDirFace2U

Definition at line 171 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer const Standard_Integer const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theDirFace2V

Definition at line 171 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Real const Standard_Real const Standard_Real const Standard_Real GEOMImpl_IBlocksOperations::theEpsilon

Definition at line 70 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theMaxNbFaces

Definition at line 150 of file GEOMImpl_IBlocksOperations.hxx.

Definition at line 150 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theNbTimes

Definition at line 166 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theNbTimesU

Definition at line 171 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Integer const Standard_Integer const Standard_Integer const Standard_Integer const Standard_Integer GEOMImpl_IBlocksOperations::theNbTimesV

Definition at line 171 of file GEOMImpl_IBlocksOperations.hxx.

Definition at line 138 of file GEOMImpl_IBlocksOperations.hxx.

Definition at line 106 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Integer const Standard_Real GEOMImpl_IBlocksOperations::theTolerance

Definition at line 106 of file GEOMImpl_IBlocksOperations.hxx.

Definition at line 70 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Real const Standard_Real GEOMImpl_IBlocksOperations::theY

Definition at line 70 of file GEOMImpl_IBlocksOperations.hxx.

Standard_EXPORT const Standard_Real const Standard_Real const Standard_Real GEOMImpl_IBlocksOperations::theZ

Definition at line 70 of file GEOMImpl_IBlocksOperations.hxx.


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