Version: 6.3.1
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

SMESH.Controls.FreeEdges Class Reference

#include <SMESH_ControlsDef.hxx>

Inheritance diagram for SMESH.Controls.FreeEdges:
Inheritance graph
[legend]

Data Structures

struct  Border

Public Types

typedef long TElemId
typedef std::set< BorderTBorders

Public Member Functions

 FreeEdges ()
virtual void SetMesh (const SMDS_Mesh *theMesh)
virtual bool IsSatisfy (long theElementId)
virtual SMDSAbs_ElementType GetType () const
void GetBoreders (TBorders &theBorders)

Static Public Member Functions

static bool IsFreeEdge (const SMDS_MeshNode **theNodes, const int theFaceId)

Protected Attributes

const SMDS_MeshmyMesh

Detailed Description

Definition at line 452 of file SMESH_ControlsDef.hxx.


Member Typedef Documentation

Definition at line 466 of file SMESH_ControlsDef.hxx.

Definition at line 459 of file SMESH_ControlsDef.hxx.


Constructor & Destructor Documentation

FreeEdges::FreeEdges ( )

Definition at line 2100 of file SMESH_Controls.cxx.

References SMESH.Controls.NumericalFunctor.myMesh.

{
  myMesh = 0;
}

Member Function Documentation

void FreeEdges::GetBoreders ( TBorders theBorders)

Definition at line 2204 of file SMESH_Controls.cxx.

References SMDS_Mesh.facesIterator(), SMDS_MeshElement.GetID(), SMDS_MeshElement.IsQuadratic(), SMESH.Controls.FreeEdges.myMesh, SMDS_MeshElement.nodesIterator(), and UpdateBorders().

{
  TBorders aRegistry;
  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
  for(; anIter->more(); ){
    const SMDS_MeshFace* anElem = anIter->next();
    long anElemId = anElem->GetID();
    SMDS_ElemIteratorPtr aNodesIter;
    if ( anElem->IsQuadratic() )
      aNodesIter = static_cast<const SMDS_VtkFace*>(anElem)->
        interlacedNodesElemIterator();
    else
      aNodesIter = anElem->nodesIterator();
    long aNodeId[2];
    const SMDS_MeshElement* aNode;
    if(aNodesIter->more()){
      aNode = aNodesIter->next();
      aNodeId[0] = aNodeId[1] = aNode->GetID();
    }
    for(; aNodesIter->more(); ){
      aNode = aNodesIter->next();
      long anId = aNode->GetID();
      Border aBorder(anElemId,aNodeId[1],anId);
      aNodeId[1] = anId;
      //std::cout<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<"; "<<aBorder.myElemId<<endl;
      UpdateBorders(aBorder,aRegistry,theBorders);
    }
    Border aBorder(anElemId,aNodeId[0],aNodeId[1]);
    //std::cout<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<"; "<<aBorder.myElemId<<endl;
    UpdateBorders(aBorder,aRegistry,theBorders);
  }
  //std::cout<<"theBorders.size() = "<<theBorders.size()<<endl;
}
SMDSAbs_ElementType FreeEdges::GetType ( ) const [virtual]

Implements SMESH.Controls.Predicate.

Definition at line 2171 of file SMESH_Controls.cxx.

References SMDSAbs_Face.

{
  return SMDSAbs_Face;
}
bool FreeEdges::IsFreeEdge ( const SMDS_MeshNode **  theNodes,
const int  theFaceId 
) [static]

Definition at line 2110 of file SMESH_Controls.cxx.

References SMDS_MeshElement.GetID(), SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.GetType(), and SMDSAbs_Face.

{
  TColStd_MapOfInteger aMap;
  for ( int i = 0; i < 2; i++ )
  {
    SMDS_ElemIteratorPtr anElemIter = theNodes[ i ]->GetInverseElementIterator();
    while( anElemIter->more() )
    {
      const SMDS_MeshElement* anElem = anElemIter->next();
      if ( anElem != 0 && anElem->GetType() == SMDSAbs_Face )
      {
        int anId = anElem->GetID();

        if ( i == 0 )
          aMap.Add( anId );
        else if ( aMap.Contains( anId ) && anId != theFaceId )
          return false;
      }
    }
  }
  return true;
}
bool FreeEdges::IsSatisfy ( long  theElementId) [virtual]

Implements SMESH.Controls.Predicate.

Definition at line 2133 of file SMESH_Controls.cxx.

References SMDS_Mesh.FindElement(), SMDS_MeshElement.GetType(), SMDS_MeshElement.IsQuadratic(), SMESH.Controls.NumericalFunctor.myMesh, SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), and SMDSAbs_Face.

{
  if ( myMesh == 0 )
    return false;

  const SMDS_MeshElement* aFace = myMesh->FindElement( theId );
  if ( aFace == 0 || aFace->GetType() != SMDSAbs_Face || aFace->NbNodes() < 3 )
    return false;

  SMDS_ElemIteratorPtr anIter;
  if ( aFace->IsQuadratic() ) {
    anIter = dynamic_cast<const SMDS_VtkFace*>
      (aFace)->interlacedNodesElemIterator();
  }
  else {
    anIter = aFace->nodesIterator();
  }
  if ( anIter == 0 )
    return false;

  int i = 0, nbNodes = aFace->NbNodes();
  std::vector <const SMDS_MeshNode*> aNodes( nbNodes+1 );
  while( anIter->more() )
  {
    const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
    if ( aNode == 0 )
      return false;
    aNodes[ i++ ] = aNode;
  }
  aNodes[ nbNodes ] = aNodes[ 0 ];

  for ( i = 0; i < nbNodes; i++ )
    if ( IsFreeEdge( &aNodes[ i ], theId ) )
      return true;

  return false;
}
void FreeEdges::SetMesh ( const SMDS_Mesh theMesh) [virtual]

Implements SMESH.Controls.Functor.

Definition at line 2105 of file SMESH_Controls.cxx.

References SMESH.Controls.NumericalFunctor.myMesh.

{
  myMesh = theMesh;
}

Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS