Version: 6.3.1
Public Member Functions | Static Public Member Functions | Protected Attributes

SMESH.Controls.MaxElementLength3D Class Reference

#include <SMESH_ControlsDef.hxx>

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

Public Member Functions

virtual double GetValue (long theElementId)
virtual double GetBadRate (double Value, int nbNodes) const
virtual SMDSAbs_ElementType GetType () const
virtual void SetMesh (const SMDS_Mesh *theMesh)
virtual double GetValue (const TSequenceOfXYZ &thePoints)
void GetHistogram (int nbIntervals, std::vector< int > &nbEvents, std::vector< double > &funValues, const std::vector< int > &elements, const double *minmax=0)
long GetPrecision () const
void SetPrecision (const long thePrecision)
double Round (const double &value)
bool GetPoints (const int theId, TSequenceOfXYZ &theRes) const

Static Public Member Functions

static bool GetPoints (const SMDS_MeshElement *theElem, TSequenceOfXYZ &theRes)

Protected Attributes

const SMDS_MeshmyMesh
const SMDS_MeshElementmyCurrElement
long myPrecision
double myPrecisionValue

Detailed Description

Definition at line 182 of file SMESH_ControlsDef.hxx.


Member Function Documentation

double MaxElementLength3D::GetBadRate ( double  Value,
int  nbNodes 
) const [virtual]

Implements SMESH.Controls.NumericalFunctor.

Definition at line 659 of file SMESH_Controls.cxx.

{
  return Value;
}
void SMESH.Controls.NumericalFunctor.GetHistogram ( int  nbIntervals,
std::vector< int > &  nbEvents,
std::vector< double > &  funValues,
const std::vector< int > &  elements,
const double *  minmax = 0 
) [inherited]

Referenced by SaveDistribution().

bool NumericalFunctor::GetPoints ( const int  theId,
TSequenceOfXYZ theRes 
) const [inherited]
bool NumericalFunctor::GetPoints ( const SMDS_MeshElement theElem,
TSequenceOfXYZ theRes 
) [static, inherited]

Definition at line 239 of file SMESH_Controls.cxx.

References SMESH.Controls.TSequenceOfXYZ.clear(), SMDS_MeshElement.GetType(), SMDS_MeshElement.IsQuadratic(), SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), SMESH.Controls.TSequenceOfXYZ.push_back(), SMESH.Controls.TSequenceOfXYZ.reserve(), SMDSAbs_Edge, SMDSAbs_Face, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().

{
  theRes.clear();

  if ( anElem == 0)
    return false;

  theRes.reserve( anElem->NbNodes() );

  // Get nodes of the element
  SMDS_ElemIteratorPtr anIter;

  if ( anElem->IsQuadratic() ) {
    switch ( anElem->GetType() ) {
    case SMDSAbs_Edge:
      anIter = dynamic_cast<const SMDS_VtkEdge*>
        (anElem)->interlacedNodesElemIterator();
      break;
    case SMDSAbs_Face:
      anIter = dynamic_cast<const SMDS_VtkFace*>
        (anElem)->interlacedNodesElemIterator();
      break;
    default:
      anIter = anElem->nodesIterator();
      //return false;
    }
  }
  else {
    anIter = anElem->nodesIterator();
  }

  if ( anIter ) {
    while( anIter->more() ) {
      if ( const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( anIter->next() ))
        theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
    }
  }

  return true;
}
long NumericalFunctor::GetPrecision ( ) const [inherited]

Definition at line 281 of file SMESH_Controls.cxx.

References SMESH.Controls.NumericalFunctor.myPrecision.

{
  return myPrecision;
}
SMDSAbs_ElementType MaxElementLength3D::GetType ( ) const [virtual]

Implements SMESH.Controls.NumericalFunctor.

Definition at line 664 of file SMESH_Controls.cxx.

References SMDSAbs_Volume.

{
  return SMDSAbs_Volume;
}
virtual double SMESH.Controls.NumericalFunctor.GetValue ( const TSequenceOfXYZ thePoints) [virtual, inherited]
double MaxElementLength3D::GetValue ( long  theElementId) [virtual]

Reimplemented from SMESH.Controls.NumericalFunctor.

Definition at line 506 of file SMESH_Controls.cxx.

References SMDS_Mesh.FindElement(), SMESH.Controls.NumericalFunctor.GetPoints(), SMDS_MeshElement.GetType(), SMDS_MeshElement.IsPoly(), Max(), SMESH.Controls.NumericalFunctor.myMesh, SMESH.Controls.NumericalFunctor.myPrecision, SMESH.Controls.TSequenceOfXYZ.size(), and SMDSAbs_Volume.

{
  TSequenceOfXYZ P;
  if( GetPoints( theElementId, P ) ) {
    double aVal = 0;
    const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
    SMDSAbs_ElementType aType = aElem->GetType();
    int len = P.size();
    switch( aType ) {
    case SMDSAbs_Volume:
      if( len == 4 ) { // tetras
        double L1 = getDistance(P( 1 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 1 ));
        double L4 = getDistance(P( 1 ),P( 4 ));
        double L5 = getDistance(P( 2 ),P( 4 ));
        double L6 = getDistance(P( 3 ),P( 4 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        break;
      }
      else if( len == 5 ) { // pyramids
        double L1 = getDistance(P( 1 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 4 ));
        double L4 = getDistance(P( 4 ),P( 1 ));
        double L5 = getDistance(P( 1 ),P( 5 ));
        double L6 = getDistance(P( 2 ),P( 5 ));
        double L7 = getDistance(P( 3 ),P( 5 ));
        double L8 = getDistance(P( 4 ),P( 5 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(L7,L8));
        break;
      }
      else if( len == 6 ) { // pentas
        double L1 = getDistance(P( 1 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 1 ));
        double L4 = getDistance(P( 4 ),P( 5 ));
        double L5 = getDistance(P( 5 ),P( 6 ));
        double L6 = getDistance(P( 6 ),P( 4 ));
        double L7 = getDistance(P( 1 ),P( 4 ));
        double L8 = getDistance(P( 2 ),P( 5 ));
        double L9 = getDistance(P( 3 ),P( 6 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(Max(L7,L8),L9));
        break;
      }
      else if( len == 8 ) { // hexas
        double L1 = getDistance(P( 1 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 4 ));
        double L4 = getDistance(P( 4 ),P( 1 ));
        double L5 = getDistance(P( 5 ),P( 6 ));
        double L6 = getDistance(P( 6 ),P( 7 ));
        double L7 = getDistance(P( 7 ),P( 8 ));
        double L8 = getDistance(P( 8 ),P( 5 ));
        double L9 = getDistance(P( 1 ),P( 5 ));
        double L10= getDistance(P( 2 ),P( 6 ));
        double L11= getDistance(P( 3 ),P( 7 ));
        double L12= getDistance(P( 4 ),P( 8 ));
        double D1 = getDistance(P( 1 ),P( 7 ));
        double D2 = getDistance(P( 2 ),P( 8 ));
        double D3 = getDistance(P( 3 ),P( 5 ));
        double D4 = getDistance(P( 4 ),P( 6 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
        aVal = Max(aVal,Max(L11,L12));
        aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
        break;
      }
      else if( len == 10 ) { // quadratic tetras
        double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
        double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
        double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
        double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        break;
      }
      else if( len == 13 ) { // quadratic pyramids
        double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
        double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
        double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
        double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
        double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
        double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(L7,L8));
        break;
      }
      else if( len == 15 ) { // quadratic pentas
        double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
        double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
        double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
        double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
        double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
        double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
        double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(Max(L7,L8),L9));
        break;
      }
      else if( len == 20 ) { // quadratic hexas
        double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
        double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
        double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
        double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
        double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
        double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
        double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
        double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
        double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
        double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
        double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
        double D1 = getDistance(P( 1 ),P( 7 ));
        double D2 = getDistance(P( 2 ),P( 8 ));
        double D3 = getDistance(P( 3 ),P( 5 ));
        double D4 = getDistance(P( 4 ),P( 6 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
        aVal = Max(aVal,Max(L11,L12));
        aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
        break;
      }
      else if( len > 1 && aElem->IsPoly() ) { // polys
        // get the maximum distance between all pairs of nodes
        for( int i = 1; i <= len; i++ ) {
          for( int j = 1; j <= len; j++ ) {
            if( j > i ) { // optimization of the loop
              double D = getDistance( P(i), P(j) );
              aVal = Max( aVal, D );
            }
          }
        }
      }
    }

    if( myPrecision >= 0 )
    {
      double prec = pow( 10., (double)myPrecision );
      aVal = floor( aVal * prec + 0.5 ) / prec;
    }
    return aVal;
  }
  return 0.;
}
double NumericalFunctor::Round ( const double &  value) [inherited]
void NumericalFunctor::SetMesh ( const SMDS_Mesh theMesh) [virtual, inherited]

Implements SMESH.Controls.Functor.

Definition at line 223 of file SMESH_Controls.cxx.

References SMESH.Controls.NumericalFunctor.myMesh.

{
  myMesh = theMesh;
}
void NumericalFunctor::SetPrecision ( const long  thePrecision) [inherited]

Field Documentation

const SMDS_Mesh* SMESH.Controls.NumericalFunctor.myMesh [protected, inherited]
long SMESH.Controls.NumericalFunctor.myPrecision [protected, inherited]
double SMESH.Controls.NumericalFunctor.myPrecisionValue [protected, inherited]
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