Back to index

salome-smesh  6.5.0
Public Member Functions | Static Public Member Functions | Private Attributes
_FaceSide Class Reference

Wrapper of a composite or an ordinary edge. More...

Collaboration diagram for _FaceSide:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 _FaceSide (const _FaceSide &other)
 _FaceSide (const TopoDS_Edge &edge=TopoDS_Edge())
 Construct a face side of one edge.
 _FaceSide (const list< TopoDS_Edge > &edges)
 Construct a face side of several edges.
_FaceSideGetSide (const int i)
const _FaceSideGetSide (const int i) const
int size ()
int NbVertices () const
TopoDS_Vertex FirstVertex () const
TopoDS_Vertex LastVertex () const
TopoDS_Vertex Vertex (int i) const
bool Contain (const _FaceSide &side, int *which=0) const
bool Contain (const TopoDS_Vertex &vertex) const
void AppendSide (const _FaceSide &side)
void SetBottomSide (int i)
int GetNbSegments (SMESH_Mesh &mesh) const
bool StoreNodes (SMESH_Mesh &mesh, vector< const SMDS_MeshNode * > &myGrid, bool reverse)
void SetID (EQuadSides id)
void Dump () const

Static Public Member Functions

static const TopoDS_TShape * ptr (const TopoDS_Shape &theShape)

Private Attributes

TopoDS_Edge myEdge
list< _FaceSidemyChildren
int myNbChildren
TopTools_MapOfShape myVertices
EQuadSides myID

Detailed Description

Wrapper of a composite or an ordinary edge.

Definition at line 99 of file StdMeshers_CompositeHexa_3D.cxx.


Constructor & Destructor Documentation

_FaceSide::_FaceSide ( const _FaceSide other)

Definition at line 1421 of file StdMeshers_CompositeHexa_3D.cxx.

{
  myEdge = other.myEdge;
  myChildren = other.myChildren;
  myNbChildren = other.myNbChildren;
  myVertices.Assign( other.myVertices );
  myID = other.myID;
}

Here is the caller graph for this function:

_FaceSide::_FaceSide ( const TopoDS_Edge &  edge = TopoDS_Edge())

Construct a face side of one edge.

Definition at line 1436 of file StdMeshers_CompositeHexa_3D.cxx.

                                           :
  myEdge( edge ), myNbChildren(0)
{
  if ( !edge.IsNull() )
    for ( TopExp_Explorer exp( edge, TopAbs_VERTEX ); exp.More(); exp.Next() )
      //myVertices.insert( ptr ( exp.Current() ));
      myVertices.Add( exp.Current() );
}
_FaceSide::_FaceSide ( const list< TopoDS_Edge > &  edges)

Construct a face side of several edges.

Definition at line 1451 of file StdMeshers_CompositeHexa_3D.cxx.

                                                  :
  myNbChildren(0)
{
  list<TopoDS_Edge>::const_iterator edge = edges.begin(), eEnd = edges.end();
  for ( ; edge != eEnd; ++edge ) {
    myChildren.push_back( _FaceSide( *edge ));
    myNbChildren++;
//     myVertices.insert( myChildren.back().myVertices.begin(),
//                        myChildren.back().myVertices.end() );
    myVertices.Add( myChildren.back().FirstVertex() );
    myVertices.Add( myChildren.back().LastVertex() );
    myChildren.back().SetID( Q_CHILD ); // not to splice them
  }
}

Here is the call graph for this function:


Member Function Documentation

void _FaceSide::AppendSide ( const _FaceSide side)

Definition at line 1594 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( !myEdge.IsNull() )
  {
    myChildren.push_back( *this );
    myNbChildren = 1;
    myEdge.Nullify();
  }
  myChildren.push_back( side );
  myNbChildren++;
  //myVertices.insert( side.myVertices.begin(), side.myVertices.end() );
  TopTools_MapIteratorOfMapOfShape vIt ( side.myVertices );
  for ( ; vIt.More(); vIt.Next() )
    myVertices.Add( vIt.Key() );

  myID = Q_PARENT;
  myChildren.back().SetID( EQuadSides( myNbChildren-1 ));
}

Here is the caller graph for this function:

bool _FaceSide::Contain ( const _FaceSide side,
int *  which = 0 
) const

Definition at line 1553 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( !which || myChildren.empty() )
  {
    if ( which )
      *which = 0;
    int nbCommon = 0;
//     set<const TopoDS_TShape*>::iterator v, vEnd = side.myVertices.end();
//     for ( v = side.myVertices.begin(); v != vEnd; ++v )
//       nbCommon += ( myVertices.find( *v ) != myVertices.end() );
    TopTools_MapIteratorOfMapOfShape vIt ( side.myVertices );
    for ( ; vIt.More(); vIt.Next() )
      nbCommon += ( myVertices.Contains( vIt.Key() ));
    return (nbCommon > 1);
  }
  list< _FaceSide >::const_iterator mySide = myChildren.begin(), sideEnd = myChildren.end();
  for ( int i = 0; mySide != sideEnd; ++mySide, ++i ) {
    if ( mySide->Contain( side )) {
      *which = i;
      return true;
    }
  }
  return false;
}

Here is the caller graph for this function:

bool _FaceSide::Contain ( const TopoDS_Vertex &  vertex) const

Definition at line 1583 of file StdMeshers_CompositeHexa_3D.cxx.

{
  return myVertices.Contains( vertex );
//   return myVertices.find( ptr( vertex )) != myVertices.end();
}
void _FaceSide::Dump ( ) const

Definition at line 1712 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
  {
    const char* sideNames[] = { "Q_BOTTOM", "Q_RIGHT", "Q_TOP", "Q_LEFT", "Q_CHILD", "Q_PARENT" };
    if ( myID >= Q_BOTTOM && myID < Q_PARENT )
      cout << sideNames[ myID ] << endl;
    else
      cout << "<UNDEFINED ID>" << endl;
    TopoDS_Vertex f = FirstVertex();
    TopoDS_Vertex l = LastVertex();
    gp_Pnt pf = BRep_Tool::Pnt(f);
    gp_Pnt pl = BRep_Tool::Pnt(l);
    cout << "\t ( "<< ptr( f ) << " - " << ptr( l )<< " )"
         << "\t ( "<< pf.X()<<", "<<pf.Y()<<", "<<pf.Z()<<" ) - "
         << " ( "<< pl.X()<<", "<<pl.Y()<<", "<<pl.Z()<<" )"<<endl;
  }
  else
  {
    list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
    for ( ; side != sideEnd; ++side ) {
      side->Dump();
      cout << "\t";
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

TopoDS_Vertex _FaceSide::FirstVertex ( ) const

Definition at line 1511 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
    return TopExp::FirstVertex( myEdge, Standard_True );

  return myChildren.front().FirstVertex();
}

Here is the caller graph for this function:

int _FaceSide::GetNbSegments ( SMESH_Mesh &  mesh) const

Definition at line 1638 of file StdMeshers_CompositeHexa_3D.cxx.

{
  int nb = 0;
  if ( myChildren.empty() )
  {
    nb = mesh.GetSubMesh(myEdge)->GetSubMeshDS()->NbElements();
  }
  else
  {
    list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
    for ( ; side != sideEnd; ++side )
      nb += side->GetNbSegments(mesh);
  }
  return nb;
}

Here is the caller graph for this function:

_FaceSide * _FaceSide::GetSide ( const int  i)

Definition at line 1471 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( i >= myNbChildren )
    return 0;

  list< _FaceSide >::iterator side = myChildren.begin();
  if ( i )
    std::advance( side, i );
  return & (*side);
}

Here is the caller graph for this function:

const _FaceSide * _FaceSide::GetSide ( const int  i) const

Definition at line 1487 of file StdMeshers_CompositeHexa_3D.cxx.

{
  return const_cast< _FaceSide* >(this)->GetSide(i);
}

Here is the call graph for this function:

TopoDS_Vertex _FaceSide::LastVertex ( ) const

Definition at line 1524 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
    return TopExp::LastVertex( myEdge, Standard_True );

  return myChildren.back().LastVertex();
}

Here is the caller graph for this function:

int _FaceSide::NbVertices ( ) const

Definition at line 1497 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
    return myVertices.Extent();
//     return myVertices.size();

  return myNbChildren + 1;
}

Here is the caller graph for this function:

static const TopoDS_TShape* _FaceSide::ptr ( const TopoDS_Shape &  theShape) [inline, static]

Definition at line 119 of file StdMeshers_CompositeHexa_3D.cxx.

  { return theShape.TShape().operator->(); }

Here is the caller graph for this function:

void _FaceSide::SetBottomSide ( int  i)

Definition at line 1618 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( i > 0 && myID == Q_PARENT ) {
    list< _FaceSide >::iterator sideEnd, side = myChildren.begin();
    std::advance( side, i );
    myChildren.splice( myChildren.begin(), myChildren, side, myChildren.end() );

    side = myChildren.begin(), sideEnd = myChildren.end();
    for ( int i = 0; side != sideEnd; ++side, ++i ) {
      side->SetID( EQuadSides(i) );
      side->SetBottomSide(i);
    }
  }
}

Here is the caller graph for this function:

void _FaceSide::SetID ( EQuadSides  id) [inline]

Definition at line 118 of file StdMeshers_CompositeHexa_3D.cxx.

{ myID = id; }

Here is the caller graph for this function:

int _FaceSide::size ( ) [inline]

Definition at line 107 of file StdMeshers_CompositeHexa_3D.cxx.

{ return myChildren.size(); }

Here is the caller graph for this function:

bool _FaceSide::StoreNodes ( SMESH_Mesh &  mesh,
vector< const SMDS_MeshNode * > &  myGrid,
bool  reverse 
)

Definition at line 1659 of file StdMeshers_CompositeHexa_3D.cxx.

{
  list< TopoDS_Edge > edges;
  if ( myChildren.empty() )
  {
    edges.push_back( myEdge );
  }
  else
  {
    list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
    for ( ; side != sideEnd; ++side )
      if ( reverse )
        edges.push_front( side->myEdge );
      else
        edges.push_back ( side->myEdge );
  }
  int nbNodes = 0;
  list< TopoDS_Edge >::iterator edge = edges.begin(), eEnd = edges.end();
  for ( ; edge != eEnd; ++edge )
  {
    map< double, const SMDS_MeshNode* > nodes;
    bool ok = SMESH_Algo::GetSortedNodesOnEdge( mesh.GetMeshDS(),
                                                *edge,
                                                /*ignoreMediumNodes=*/true,
                                                nodes);
    if ( !ok ) return false;

    bool forward = ( edge->Orientation() == TopAbs_FORWARD );
    if ( reverse ) forward = !forward;
    if ( forward )
    {
      map< double, const SMDS_MeshNode* >::iterator u_node, nEnd = nodes.end();
      for ( u_node = nodes.begin(); u_node != nEnd; ++u_node )
        myGrid[ nbNodes++ ] = u_node->second;
    }
    else 
    {
      map< double, const SMDS_MeshNode* >::reverse_iterator u_node, nEnd = nodes.rend();
      for ( u_node = nodes.rbegin(); u_node != nEnd; ++u_node )
        myGrid[ nbNodes++ ] = u_node->second;
    }
    nbNodes--; // node on vertex present in two adjacent edges
  }
  return nbNodes > 0;
}

Here is the caller graph for this function:

TopoDS_Vertex _FaceSide::Vertex ( int  i) const

Definition at line 1537 of file StdMeshers_CompositeHexa_3D.cxx.

{
  if ( myChildren.empty() )
    return i ? LastVertex() : FirstVertex();
      
  if ( i >= myNbChildren )
    return myChildren.back().LastVertex();
  
  return GetSide(i)->FirstVertex();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

list< _FaceSide > _FaceSide::myChildren [private]

Definition at line 127 of file StdMeshers_CompositeHexa_3D.cxx.

TopoDS_Edge _FaceSide::myEdge [private]

Definition at line 126 of file StdMeshers_CompositeHexa_3D.cxx.

Definition at line 133 of file StdMeshers_CompositeHexa_3D.cxx.

int _FaceSide::myNbChildren [private]

Definition at line 128 of file StdMeshers_CompositeHexa_3D.cxx.

TopTools_MapOfShape _FaceSide::myVertices [private]

Definition at line 131 of file StdMeshers_CompositeHexa_3D.cxx.


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