Version: 6.3.1
Public Member Functions | Private Attributes

SMESH.Controls.CoplanarFaces Class Reference

#include <SMESH_ControlsDef.hxx>

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

Public Member Functions

 CoplanarFaces ()
 Class CoplanarFaces.
void SetFace (long theID)
long GetFace () const
void SetTolerance (const double theToler)
double GetTolerance () const
virtual void SetMesh (const SMDS_Mesh *theMesh)
virtual SMDSAbs_ElementType GetType () const
virtual bool IsSatisfy (long theElementId)

Private Attributes

const SMDS_MeshmyMesh
long myFaceID
double myToler
std::set< long > myCoplanarIDs

Detailed Description

Definition at line 884 of file SMESH_ControlsDef.hxx.


Constructor & Destructor Documentation

CoplanarFaces::CoplanarFaces ( )

Class CoplanarFaces.

Definition at line 2549 of file SMESH_Controls.cxx.

  : myMesh(0), myFaceID(0), myToler(0)
{
}

Member Function Documentation

long SMESH.Controls.CoplanarFaces.GetFace ( ) const

Definition at line 889 of file SMESH_ControlsDef.hxx.

{ return myFaceID; }
double SMESH.Controls.CoplanarFaces.GetTolerance ( ) const

Definition at line 891 of file SMESH_ControlsDef.hxx.

{ return myToler; }
virtual SMDSAbs_ElementType SMESH.Controls.CoplanarFaces.GetType ( ) const [virtual]

Implements SMESH.Controls.Predicate.

Definition at line 893 of file SMESH_ControlsDef.hxx.

References SMDSAbs_Face.

{ return SMDSAbs_Face; }
bool CoplanarFaces::IsSatisfy ( long  theElementId) [virtual]

Implements SMESH.Controls.Predicate.

Definition at line 2553 of file SMESH_Controls.cxx.

References PAL_MESH_043_3D.face, SMDS_Mesh.FindElement(), SMDS_MeshElement.GetID(), SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.GetNode(), SMESH.getNormale(), SMDS_MeshElement.GetType(), SMESH.Controls.CoplanarFaces.myCoplanarIDs, SMESH.Controls.CoplanarFaces.myFaceID, SMESH.Controls.CoplanarFaces.myMesh, SMESH.Controls.CoplanarFaces.myToler, SMDS_MeshElement.NbCornerNodes(), and SMDSAbs_Face.

{
  if ( myCoplanarIDs.empty() )
  {
    // Build a set of coplanar face ids

    if ( !myMesh || !myFaceID || !myToler )
      return false;

    const SMDS_MeshElement* face = myMesh->FindElement( myFaceID );
    if ( !face || face->GetType() != SMDSAbs_Face )
      return false;

    bool normOK;
    gp_Vec myNorm = getNormale( static_cast<const SMDS_MeshFace*>(face), &normOK );
    if (!normOK)
      return false;

    const double radianTol = myToler * PI180;
    typedef SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > TFaceIt;
    std::set<const SMDS_MeshElement*> checkedFaces, checkedNodes;
    std::list<const SMDS_MeshElement*> faceQueue( 1, face );
    while ( !faceQueue.empty() )
    {
      face = faceQueue.front();
      if ( checkedFaces.insert( face ).second )
      {
        gp_Vec norm = getNormale( static_cast<const SMDS_MeshFace*>(face), &normOK );
        if (!normOK || myNorm.Angle( norm ) <= radianTol)
        {
          myCoplanarIDs.insert( face->GetID() );
          std::set<const SMDS_MeshElement*> neighborFaces;
          for ( int i = 0; i < face->NbCornerNodes(); ++i )
          {
            const SMDS_MeshNode* n = face->GetNode( i );
            if ( checkedNodes.insert( n ).second )
              neighborFaces.insert( TFaceIt( n->GetInverseElementIterator(SMDSAbs_Face)),
                                    TFaceIt());
          }
          faceQueue.insert( faceQueue.end(), neighborFaces.begin(), neighborFaces.end() );
        }
      }
      faceQueue.pop_front();
    }
  }
  return myCoplanarIDs.count( theElementId );
}
void SMESH.Controls.CoplanarFaces.SetFace ( long  theID)

Definition at line 888 of file SMESH_ControlsDef.hxx.

{ myFaceID = theID; }
virtual void SMESH.Controls.CoplanarFaces.SetMesh ( const SMDS_Mesh theMesh) [virtual]

Implements SMESH.Controls.Functor.

Definition at line 892 of file SMESH_ControlsDef.hxx.

{ myMesh = theMesh; }
void SMESH.Controls.CoplanarFaces.SetTolerance ( const double  theToler)

Definition at line 890 of file SMESH_ControlsDef.hxx.

{ myToler = theToler; }

Field Documentation

std::set< long > SMESH.Controls.CoplanarFaces.myCoplanarIDs [private]

Definition at line 901 of file SMESH_ControlsDef.hxx.

Referenced by SMESH.Controls.CoplanarFaces.IsSatisfy().

Definition at line 899 of file SMESH_ControlsDef.hxx.

Referenced by SMESH.Controls.CoplanarFaces.IsSatisfy().

Definition at line 898 of file SMESH_ControlsDef.hxx.

Referenced by SMESH.Controls.CoplanarFaces.IsSatisfy().

Definition at line 900 of file SMESH_ControlsDef.hxx.

Referenced by SMESH.Controls.CoplanarFaces.IsSatisfy().

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