Back to index

salome-smesh  6.5.0
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
_QuadFaceGrid Class Reference

Class corresponding to a meshed composite face of a box. More...

Collaboration diagram for _QuadFaceGrid:
Collaboration graph
[legend]

List of all members.

Public Types

typedef SMDS_SetIterator
< const _QuadFaceGrid
&, TChildren::const_iterator > 
TChildIterator

Public Member Functions

 _QuadFaceGrid ()
 constructor of non-initialized _QuadFaceGrid
bool Init (const TopoDS_Face &f)
 < initialization
bool AddContinuousFace (const _QuadFaceGrid &f)
 Try to set the side as bottom hirizontal side.
bool SetBottomSide (const _FaceSide &side, int *sideIndex=0)
 Return face adjacent to i-th side of this face.
_QuadFaceGridFindAdjacentForSide (int i, vector< _QuadFaceGrid > &faces) const
 Return face adjacent to i-th side of this face, (0<i<4)
void ReverseEdges ()
 < Reverse edges in order to have the bottom edge going along axes of the unit box
bool IsComplex () const
TChildIterator GetChildren () const
bool LoadGrid (SMESH_Mesh &mesh)
 < Load nodes of a mesh
int GetNbHoriSegments (SMESH_Mesh &mesh, bool withBrothers=false) const
 Return number of segments on the vertical sides.
int GetNbVertSegments (SMESH_Mesh &mesh, bool withBrothers=false) const
 Return a node by its position.
const SMDS_MeshNode * GetNode (int iHori, int iVert) const
 Return node coordinates by its position.
gp_XYZ GetXYZ (int iHori, int iVert) const
 Return node coordinates by its position.
const _FaceSideGetSide (int i) const
 < Return i-th face side (0<i<4)
TopoDS_Face GetFace () const
 Return normal to the face at vertex v.
bool GetNormal (const TopoDS_Vertex &v, gp_Vec &n) const
 Return normal to the face at vertex v.
SMESH_ComputeErrorPtr GetError () const
void SetID (EBoxSides id)
void DumpGrid () const
 Dumps coordinates of grid nodes.
void DumpVertices () const
 Dump vertices.

Private Types

typedef list< _QuadFaceGridTChildren

Private Member Functions

bool error (const std::string &text, int code=COMPERR_ALGO_FAILED)
bool error (const SMESH_ComputeErrorPtr &err)
bool loadCompositeGrid (SMESH_Mesh &mesh)
 Fill myGrid with nodes of patches.
bool fillGrid (SMESH_Mesh &theMesh, vector< const SMDS_MeshNode * > &theGrid, const _Indexer &theIndexer, int theX, int theY)
 Store nodes of a simple face into grid starting from (x,y) position.
bool locateChildren ()
 Find out mutual location of children: find their right and up brothers.
void setBrothers (set< _QuadFaceGrid * > &notLocatedBrothers)
 Find right an upper brothers among notLocatedBrothers.

Private Attributes

TopoDS_Face myFace
_FaceSide mySides
bool myReverse
TChildren myChildren
_QuadFaceGridmyLeftBottomChild
_QuadFaceGridmyRightBrother
_QuadFaceGridmyUpBrother
_Indexer myIndexer
vector< const SMDS_MeshNode * > myGrid
SMESH_ComputeErrorPtr myError
EBoxSides myID

Detailed Description

Class corresponding to a meshed composite face of a box.

Provides simplified access to it's sub-mesh data.

Definition at line 140 of file StdMeshers_CompositeHexa_3D.cxx.


Member Typedef Documentation

typedef SMDS_SetIterator< const _QuadFaceGrid&, TChildren::const_iterator > _QuadFaceGrid::TChildIterator

Definition at line 165 of file StdMeshers_CompositeHexa_3D.cxx.

typedef list< _QuadFaceGrid > _QuadFaceGrid::TChildren [private]

Definition at line 142 of file StdMeshers_CompositeHexa_3D.cxx.


Constructor & Destructor Documentation

constructor of non-initialized _QuadFaceGrid

Definition at line 723 of file StdMeshers_CompositeHexa_3D.cxx.


Member Function Documentation

Try to set the side as bottom hirizontal side.

Try to unite self with other ordinary face.

Definition at line 796 of file StdMeshers_CompositeHexa_3D.cxx.

{
  for ( int i = 0; i < 4; ++i ) {
    const _FaceSide& otherSide = other.GetSide( i );
    int iMyCommon;
    if ( mySides.Contain( otherSide, &iMyCommon ) ) {
      // check if normals of two faces are collinear at all vertices of a otherSide
      const double angleTol = M_PI / 180. / 2.;
      int iV, nbV = otherSide.NbVertices(), nbCollinear = 0;
      for ( iV = 0; iV < nbV; ++iV )
      {
        TopoDS_Vertex v = otherSide.Vertex( iV );
        gp_Vec n1, n2;
        if ( !GetNormal( v, n1 ) || !other.GetNormal( v, n2 ))
          continue;
        if ( n1 * n2 < 0 )
          n1.Reverse();
        if ( n1.Angle(n2) < angleTol )
          nbCollinear++;
        else
          break;
      }
      if ( nbCollinear > 1 ) { // this face becomes composite if not yet is
        DUMP_VERT("Cont 1", mySides.GetSide(iMyCommon)->FirstVertex());
        DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex());
        DUMP_VERT("Cont 3", otherSide.FirstVertex());
        DUMP_VERT("Cont 4", otherSide.LastVertex());
        if ( myChildren.empty() ) {
          myChildren.push_back( *this );
          myFace.Nullify();
        }
        myChildren.push_back( other );
        int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
        myChildren.back().SetBottomSide( other.GetSide( otherBottomIndex ));
        // collect vertices in mySides
        mySides.AppendSide( other.GetSide(0) );
        mySides.AppendSide( other.GetSide(1) );
        mySides.AppendSide( other.GetSide(2) );
        mySides.AppendSide( other.GetSide(3) );
        return true;
      }
    }
  }
  return false;
}

Here is the call graph for this function:

void _QuadFaceGrid::DumpGrid ( ) const

Dumps coordinates of grid nodes.

Definition at line 1350 of file StdMeshers_CompositeHexa_3D.cxx.

{
#ifdef DEB_GRID
  const char* names[] = { "B_BOTTOM", "B_RIGHT", "B_TOP", "B_LEFT", "B_FRONT", "B_BACK" };
  cout << "****** Face " << names[ myID ] << endl;

  if ( myChildren.empty() || !myGrid.empty() )
  {
    cout << "x size: " << myIndexer._xSize << "; y size: " << myIndexer._ySize << endl;
    for ( int y = 0; y < myIndexer._ySize; ++y ) {
      cout << "-- row " << y << endl;
      for ( int x = 0; x < myIndexer._xSize; ++x ) {
        const SMDS_MeshNode* n = myGrid[ myIndexer( x, y ) ];
        cout << x << " ( " << n->X() << ", " << n->Y() << ", " << n->Z() << " )" << endl;
      }
    }
  }
  else
  {
    cout << "Nb children: " << myChildren.size() << endl;
    TChildren::const_iterator child = myChildren.begin(), childEnd = myChildren.end();
    for ( int i=0; child != childEnd; ++child, ++i ) {
      cout << "   *** SUBFACE " << i+1 << endl;
      ((_QuadFaceGrid&)(*child)).SetID( myID );
      child->DumpGrid();
    }
  }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Dump vertices.

Definition at line 1386 of file StdMeshers_CompositeHexa_3D.cxx.

{
#ifdef DEB_FACES
  cout << "****** Face ";
  const char* names[] = { "B_BOTTOM", "B_RIGHT", "B_TOP", "B_LEFT", "B_FRONT", "B_BACK" };
  if ( myID >= B_BOTTOM && myID < B_BACK )
    cout << names[ myID ] << endl;
  else
    cout << "UNDEFINED" << endl;

  if ( myChildren.empty() )
  {
    for ( int i = 0; i < 4; ++i )
    {
      cout << "  Side "; mySides.GetSide( i )->Dump();
    }
  }
  else
  {
    cout << "-- Nb children: " << myChildren.size() << endl;
    TChildren::const_iterator child = myChildren.begin(), childEnd = myChildren.end();
    for ( int i=0; child != childEnd; ++child, ++i ) {
      cout << "   *** SUBFACE " << i+1 << endl;
      ((_QuadFaceGrid&)(*child)).SetID( myID );
      child->DumpVertices();
    }
  }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool _QuadFaceGrid::error ( const std::string &  text,
int  code = COMPERR_ALGO_FAILED 
) [inline, private]

Definition at line 208 of file StdMeshers_CompositeHexa_3D.cxx.

  { myError = SMESH_ComputeError::New( code, text ); return false; }

Here is the call graph for this function:

Here is the caller graph for this function:

bool _QuadFaceGrid::error ( const SMESH_ComputeErrorPtr err) [inline, private]

Definition at line 211 of file StdMeshers_CompositeHexa_3D.cxx.

  { myError = err; return ( !myError || myError->IsOK() ); }
bool _QuadFaceGrid::fillGrid ( SMESH_Mesh &  theMesh,
vector< const SMDS_MeshNode * > &  theGrid,
const _Indexer &  theIndexer,
int  theX,
int  theY 
) [private]

Store nodes of a simple face into grid starting from (x,y) position.

Definition at line 1206 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myGrid.empty() && !LoadGrid( theMesh ))
    return false;

  // store my own grid in the global grid

  int fromX = myReverse ? theX - myIndexer._xSize: theX;

  for ( int i = 0, x = fromX; i < myIndexer._xSize; ++i, ++x )
    for ( int j = 0, y = theY; j < myIndexer._ySize; ++j, ++y )
      theGrid[ theIndexer( x, y )] = myGrid[ myIndexer( i, j )];

  // store grids of my right and upper brothers

  if ( myRightBrother )
  {
    if ( myReverse )
      fromX += 1;
    else
      fromX += myIndexer._xSize - 1;
    if ( !myRightBrother->fillGrid( theMesh, theGrid, theIndexer, fromX, theY ))
      return error( myRightBrother->GetError() );
  }
  if ( myUpBrother )
  {
    if ( !myUpBrother->fillGrid( theMesh, theGrid, theIndexer,
                                 theX, theY + myIndexer._ySize - 1))
      return error( myUpBrother->GetError() );
  }
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

_QuadFaceGrid * _QuadFaceGrid::FindAdjacentForSide ( int  i,
vector< _QuadFaceGrid > &  faces 
) const

Return face adjacent to i-th side of this face, (0<i<4)

Definition at line 889 of file StdMeshers_CompositeHexa_3D.cxx.

{
  for ( int iF = 0; iF < faces.size(); ++iF ) {
    _QuadFaceGrid* f  = &faces[ iF ];
    if ( f != this && f->SetBottomSide( GetSide( i )))
      return f;
  }
  return (_QuadFaceGrid*) 0;
}

Here is the call graph for this function:

Definition at line 167 of file StdMeshers_CompositeHexa_3D.cxx.

  { return TChildIterator( myChildren.begin(), myChildren.end()); }

Here is the caller graph for this function:

Definition at line 198 of file StdMeshers_CompositeHexa_3D.cxx.

{ return myError; }

Here is the caller graph for this function:

TopoDS_Face _QuadFaceGrid::GetFace ( ) const [inline]

Return normal to the face at vertex v.

Definition at line 193 of file StdMeshers_CompositeHexa_3D.cxx.

Here is the caller graph for this function:

int _QuadFaceGrid::GetNbHoriSegments ( SMESH_Mesh &  mesh,
bool  withBrothers = false 
) const

Return number of segments on the vertical sides.

Return number of segments on the hirizontal sides.

Definition at line 1249 of file StdMeshers_CompositeHexa_3D.cxx.

{
  int nbSegs = 0;
  if ( myLeftBottomChild )
  {
    nbSegs += myLeftBottomChild->GetNbHoriSegments( mesh, true );
  }
  else
  {
    nbSegs = mySides.GetSide( Q_BOTTOM )->GetNbSegments(mesh);
    if ( withBrothers && myRightBrother )
      nbSegs += myRightBrother->GetNbHoriSegments( mesh, withBrothers );
  }
  return nbSegs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _QuadFaceGrid::GetNbVertSegments ( SMESH_Mesh &  mesh,
bool  withBrothers = false 
) const

Return a node by its position.

Return number of segments on the vertical sides.

Definition at line 1271 of file StdMeshers_CompositeHexa_3D.cxx.

{
  int nbSegs = 0;
  if ( myLeftBottomChild )
  {
    nbSegs += myLeftBottomChild->GetNbVertSegments( mesh, true );
  }
  else
  {
    nbSegs = mySides.GetSide( Q_LEFT )->GetNbSegments(mesh);
    if ( withBrothers && myUpBrother )
      nbSegs += myUpBrother->GetNbVertSegments( mesh, withBrothers );
  }
  return nbSegs;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const SMDS_MeshNode * _QuadFaceGrid::GetNode ( int  iHori,
int  iVert 
) const

Return node coordinates by its position.

Return a node by its position.

Definition at line 1293 of file StdMeshers_CompositeHexa_3D.cxx.

{
  return myGrid[ myIndexer( iHori, iVert )];
}
bool _QuadFaceGrid::GetNormal ( const TopoDS_Vertex &  v,
gp_Vec &  n 
) const

Return normal to the face at vertex v.

Definition at line 1316 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
  {
    if ( mySides.Contain( v )) {
      try {
        gp_Pnt2d uv = BRep_Tool::Parameters( v, myFace );
        BRepAdaptor_Surface surface( myFace );
        gp_Pnt p; gp_Vec d1u, d1v;
        surface.D1( uv.X(), uv.Y(), p, d1u, d1v );
        n = d1u.Crossed( d1v );
        return true;
      }
      catch (Standard_Failure) {
        return false;
      }
    }
  }
  else
  {
    TChildren::const_iterator child = myChildren.begin(), childEnd = myChildren.end();
    for ( ; child != childEnd; ++child )
      if ( child->GetNormal( v, n ))
        return true;
  }
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const _FaceSide & _QuadFaceGrid::GetSide ( int  i) const

< Return i-th face side (0<i<4)

Return i-th side.

Return it's face, NULL if it is composite

Definition at line 905 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
    return *mySides.GetSide(i);

  _QuadFaceGrid* me = const_cast<_QuadFaceGrid*>(this);
  if ( !me->locateChildren() || !myLeftBottomChild )
    return *mySides.GetSide(i);

  const _QuadFaceGrid* child = myLeftBottomChild;
  switch ( i ){
  case Q_BOTTOM:
  case Q_LEFT:
    break;
  case Q_RIGHT:
    while ( child->myRightBrother )
      child = child->myRightBrother;
    break;
  case Q_TOP:
    while ( child->myUpBrother )
      child = child->myUpBrother;
    break;
  default: ;
  }
  return child->GetSide( i );
}

Here is the call graph for this function:

Here is the caller graph for this function:

gp_XYZ _QuadFaceGrid::GetXYZ ( int  iHori,
int  iVert 
) const

Return node coordinates by its position.

Definition at line 1304 of file StdMeshers_CompositeHexa_3D.cxx.

{
  const SMDS_MeshNode* n = myGrid[ myIndexer( iHori, iVert )];
  return gp_XYZ( n->X(), n->Y(), n->Z() );
}
bool _QuadFaceGrid::Init ( const TopoDS_Face &  f)

< initialization

Initialization.

try to unite self with other face

Definition at line 734 of file StdMeshers_CompositeHexa_3D.cxx.

{
  myFace         = f;
  mySides        = _FaceSide();
  myReverse      = false;
  myLeftBottomChild = myRightBrother = myUpBrother = 0;
  myChildren.clear();
  myGrid.clear();
  //if ( myFace.Orientation() != TopAbs_FORWARD )
    //myFace.Reverse();

  TopoDS_Vertex V;
  list< TopoDS_Edge > edges;
  list< int > nbEdgesInWire;
  int nbWire = SMESH_Block::GetOrderedEdges (myFace, V, edges, nbEdgesInWire);
  if ( nbWire != 1 )
    return false;

  list< TopoDS_Edge >::iterator edgeIt = edges.begin();
  if ( nbEdgesInWire.front() == 4 ) // exactly 4 edges
  {
    for ( ; edgeIt != edges.end(); ++edgeIt )
      mySides.AppendSide( _FaceSide( *edgeIt ));
  }
  else if ( nbEdgesInWire.front() > 4 ) { // more than 4 edges - try to unite some
    list< TopoDS_Edge > sideEdges;
    while ( !edges.empty()) {
      sideEdges.clear();
      sideEdges.splice( sideEdges.end(), edges, edges.begin());// edges.front()->sideEdges.back()
      while ( !edges.empty() ) {
        if ( SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() )) {
          sideEdges.splice( sideEdges.end(), edges, edges.begin());
        }
        else if ( SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() )) {
          sideEdges.splice( sideEdges.begin(), edges, --edges.end());
        }
        else {
          break;
        }
      }
      mySides.AppendSide( _FaceSide( sideEdges ));
    }
  }
  if (mySides.size() != 4)
    return false;

#ifdef _DEBUG_
  mySides.GetSide( Q_BOTTOM )->SetID( Q_BOTTOM );
  mySides.GetSide( Q_RIGHT  )->SetID( Q_RIGHT );
  mySides.GetSide( Q_TOP    )->SetID( Q_TOP );
  mySides.GetSide( Q_LEFT   )->SetID( Q_LEFT );
#endif

  return true;
}

Here is the call graph for this function:

bool _QuadFaceGrid::IsComplex ( ) const [inline]

Definition at line 163 of file StdMeshers_CompositeHexa_3D.cxx.

{ return !myChildren.empty(); }
bool _QuadFaceGrid::loadCompositeGrid ( SMESH_Mesh &  mesh) [private]

Fill myGrid with nodes of patches.

Definition at line 1131 of file StdMeshers_CompositeHexa_3D.cxx.

{
  // Find out mutual location of children: find their right and up brothers
  if ( !locateChildren() )
    return false;

  // Load nodes according to mutual location of children

  // grid size
  myIndexer._xSize = 1 + myLeftBottomChild->GetNbHoriSegments(mesh, /*withBrothers=*/true);
  myIndexer._ySize = 1 + myLeftBottomChild->GetNbVertSegments(mesh, /*withBrothers=*/true);

  myGrid.resize( myIndexer.size() );

  int fromX = myReverse ? myIndexer._xSize : 0;
  if (!myLeftBottomChild->fillGrid( mesh, myGrid, myIndexer, fromX, 0 ))
    return error( myLeftBottomChild->GetError() );

  DumpGrid();

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool _QuadFaceGrid::LoadGrid ( SMESH_Mesh &  mesh)

< Load nodes of a mesh

Load nodes of a mesh.

Return number of segments on the hirizontal sides

Definition at line 968 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( !myChildren.empty() )
  {
    // Let child faces load their grids
    TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
    for ( ; child != childEnd; ++child ) {
      child->SetID( myID );
      if ( !child->LoadGrid( mesh ) )
        return error( child->GetError() );
    }
    // Fill myGrid with nodes of patches
    return loadCompositeGrid( mesh );
  }

  // ---------------------------------------
  // Fill myGrid with nodes bound to myFace
  // ---------------------------------------

  if ( !myGrid.empty() )
    return true;

  SMESHDS_SubMesh* faceSubMesh = mesh.GetSubMesh( myFace )->GetSubMeshDS();
  // check that all faces are quadrangular
  SMDS_ElemIteratorPtr fIt = faceSubMesh->GetElements();
  while ( fIt->more() )
    if ( fIt->next()->NbNodes() % 4 > 0 )
      return error("Non-quadrangular mesh faces are not allowed on sides of a composite block");
  
  myIndexer._xSize = 1 + mySides.GetSide( Q_BOTTOM )->GetNbSegments( mesh );
  myIndexer._ySize = 1 + mySides.GetSide( Q_LEFT   )->GetNbSegments( mesh );

  myGrid.resize( myIndexer.size() );

  // strore nodes bound to the bottom edge
  mySides.GetSide( Q_BOTTOM )->StoreNodes( mesh, myGrid, myReverse );

  // store the rest nodes row by row

  const SMDS_MeshNode* dummy = mesh.GetMeshDS()->AddNode(0,0,0);
  const SMDS_MeshElement* firstQuad = dummy; // most left face above the last row of found nodes
  
  int nbFoundNodes = myIndexer._xSize;
  while ( nbFoundNodes != myGrid.size() )
  {
    // first and last nodes of the last filled row of nodes
    const SMDS_MeshNode* n1down = myGrid[ nbFoundNodes - myIndexer._xSize ];
    const SMDS_MeshNode* n2down = myGrid[ nbFoundNodes - myIndexer._xSize + 1];
    const SMDS_MeshNode* n1downLast = myGrid[ nbFoundNodes-1 ];

    // find the first face above the row by the first two left nodes
    //
    // n1up     n2up
    //     o---o
    //     |   |
    //     o---o  o  o  o  o
    //n1down    n2down
    //
    TIDSortedElemSet emptySet, avoidSet;
    avoidSet.insert( firstQuad );
    firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
    while ( firstQuad && !faceSubMesh->Contains( firstQuad )) {
      avoidSet.insert( firstQuad );
      firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
    }
    if ( !firstQuad || !faceSubMesh->Contains( firstQuad ))
      return error(ERR_LI("Error in _QuadFaceGrid::LoadGrid()"));

    // find the node of quad bound to the left geom edge
    int i2down = firstQuad->GetNodeIndex( n2down );
    const SMDS_MeshNode* n1up = firstQuad->GetNode(( i2down+2 ) % 4 );
    myGrid[ nbFoundNodes++ ] = n1up;
    // the 4-the node of the first quad
    int i1down = firstQuad->GetNodeIndex( n1down );
    const SMDS_MeshNode* n2up = firstQuad->GetNode(( i1down+2 ) % 4 );
    myGrid[ nbFoundNodes++ ] = n2up;

    n1down = n2down;
    n1up   = n2up;
    const SMDS_MeshElement* quad = firstQuad;

    // find the rest nodes by remaining faces above the row
    //
    //             n1up
    //     o---o--o
    //     |   |  | ->
    //     o---o--o  o  o  o
    //                      n1downLast
    //
    while ( n1down != n1downLast )
    {
      // next face
      avoidSet.clear(); avoidSet.insert( quad );
      quad = SMESH_MeshEditor::FindFaceInSet( n1down, n1up, emptySet, avoidSet );
      if ( !quad || quad->NbNodes() % 4 > 0)
        return error(ERR_LI("Error in _QuadFaceGrid::LoadGrid()"));

      // next node
      if ( quad->GetNode( i1down ) != n1down ) // check already found index
        i1down = quad->GetNodeIndex( n1down );
      n2up = quad->GetNode(( i1down+2 ) % 4 );
      myGrid[ nbFoundNodes++ ] = n2up;

      n1down = myGrid[ nbFoundNodes - myIndexer._xSize - 1 ];
      n1up   = n2up;
    }
  }
  mesh.GetMeshDS()->RemoveNode(dummy);
  DumpGrid(); // debug

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool _QuadFaceGrid::locateChildren ( ) [private]

Find out mutual location of children: find their right and up brothers.

Definition at line 1087 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myLeftBottomChild )
    return true;

  TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();

  // find a child sharing it's first bottom vertex with no other brother
  myLeftBottomChild = 0;
  for ( ; !myLeftBottomChild && child != childEnd; ++child )
  {
    TopoDS_Vertex leftVertex = child->GetSide( Q_BOTTOM ).FirstVertex();
    bool sharedVertex = false;
    TChildren::iterator otherChild = myChildren.begin();
    for ( ; otherChild != childEnd && !sharedVertex; ++otherChild )
      if ( otherChild != child )
        sharedVertex = otherChild->mySides.Contain( leftVertex );
    if ( !sharedVertex ) {
      myLeftBottomChild = & (*child);
      DUMP_VERT("0 left bottom Vertex: ",leftVertex );
    }
  }
  if (!myLeftBottomChild)
    return error(ERR_LI("Error in locateChildren()"));

  set< _QuadFaceGrid* > notLocatedChilren;
  for (child = myChildren.begin() ; child != childEnd; ++child )
    notLocatedChilren.insert( & (*child));

  // connect myLeftBottomChild to it's right and upper brothers
  notLocatedChilren.erase( myLeftBottomChild );
  myLeftBottomChild->setBrothers( notLocatedChilren );
  if ( !notLocatedChilren.empty() )
    return error(ERR_LI("Error in locateChildren()"));

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

< Reverse edges in order to have the bottom edge going along axes of the unit box

Reverse edges in order to have them oriented along axes of the unit box.

Definition at line 938 of file StdMeshers_CompositeHexa_3D.cxx.

{
  myReverse = !myReverse;

// #ifdef DEB_FACES
//   if ( !myFace.IsNull() )
//     TopAbs::Print(myFace.Orientation(), cout);
// #endif

  if ( myChildren.empty() )
  {
//     mySides.GetSide( e1 )->Reverse();
//     mySides.GetSide( e2 )->Reverse();
    DumpVertices();
  }
  else
  {
    DumpVertices();
    TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
    for ( ; child != childEnd; ++child )
      child->ReverseEdges( /*e1, e2*/ );
  }
}

Here is the call graph for this function:

bool _QuadFaceGrid::SetBottomSide ( const _FaceSide side,
int *  sideIndex = 0 
)

Return face adjacent to i-th side of this face.

Try to set the side as bottom hirizontal side.

Definition at line 848 of file StdMeshers_CompositeHexa_3D.cxx.

{
  myLeftBottomChild = myRightBrother = myUpBrother = 0;

  int myBottomIndex;
  if ( myChildren.empty() )
  {
    if ( mySides.Contain( bottom, &myBottomIndex )) {
      mySides.SetBottomSide( myBottomIndex );
      if ( sideIndex )
        *sideIndex = myBottomIndex;
      return true;
    }
  }
  else
  {
    TChildren::iterator childFace = myChildren.begin(), childEnd = myChildren.end();
    for ( ; childFace != childEnd; ++childFace )
    {
      if ( childFace->SetBottomSide( bottom, &myBottomIndex ))
      {
        TChildren::iterator orientedCild = childFace;
        for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) {
          if ( childFace != orientedCild )
            childFace->SetBottomSide( childFace->GetSide( myBottomIndex ));
        }
        if ( sideIndex )
          *sideIndex = myBottomIndex;
        return true;
      }
    }
  }
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _QuadFaceGrid::setBrothers ( set< _QuadFaceGrid * > &  notLocatedBrothers) [private]

Find right an upper brothers among notLocatedBrothers.

Definition at line 1160 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( !notLocatedBrothers.empty() )
  {
    // find right brother
    TopoDS_Vertex rightVertex = GetSide( Q_BOTTOM ).LastVertex();
    DUMP_VERT("1 right bottom Vertex: ",rightVertex );
    set< _QuadFaceGrid* >::iterator brIt, brEnd = notLocatedBrothers.end();
    for ( brIt = notLocatedBrothers.begin(); !myRightBrother && brIt != brEnd; ++brIt )
    {
      _QuadFaceGrid* brother = *brIt;
      TopoDS_Vertex brotherLeftVertex = brother->GetSide( Q_BOTTOM ).FirstVertex();
      DUMP_VERT( "brother left bottom: ", brotherLeftVertex );
      if ( rightVertex.IsSame( brotherLeftVertex )) {
        myRightBrother = brother;
        notLocatedBrothers.erase( myRightBrother );
      }
    }
    // find upper brother
    TopoDS_Vertex upVertex = GetSide( Q_LEFT ).FirstVertex();
    DUMP_VERT("1 left up Vertex: ",upVertex);
    brIt = notLocatedBrothers.begin(), brEnd = notLocatedBrothers.end();
    for ( ; !myUpBrother && brIt != brEnd; ++brIt )
    {
      _QuadFaceGrid* brother = *brIt;
      TopoDS_Vertex brotherLeftVertex = brother->GetSide( Q_BOTTOM ).FirstVertex();
      DUMP_VERT("brother left bottom: ", brotherLeftVertex);
      if ( upVertex.IsSame( brotherLeftVertex )) {
        myUpBrother = brother;
        notLocatedBrothers.erase( myUpBrother );
      }
    }
    // recursive call
    if ( myRightBrother )
      myRightBrother->setBrothers( notLocatedBrothers );
    if ( myUpBrother )
      myUpBrother->setBrothers( notLocatedBrothers );
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _QuadFaceGrid::SetID ( EBoxSides  id) [inline]

Definition at line 200 of file StdMeshers_CompositeHexa_3D.cxx.

{ myID = id; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 230 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 239 of file StdMeshers_CompositeHexa_3D.cxx.

TopoDS_Face _QuadFaceGrid::myFace [private]

Definition at line 226 of file StdMeshers_CompositeHexa_3D.cxx.

vector<const SMDS_MeshNode*> _QuadFaceGrid::myGrid [private]

Definition at line 237 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 241 of file StdMeshers_CompositeHexa_3D.cxx.

_Indexer _QuadFaceGrid::myIndexer [private]

Definition at line 236 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 232 of file StdMeshers_CompositeHexa_3D.cxx.

bool _QuadFaceGrid::myReverse [private]

Definition at line 228 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 233 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 227 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 234 of file StdMeshers_CompositeHexa_3D.cxx.


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