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

SMESH.Controls.Warping Class Reference

#include <SMESH_ControlsDef.hxx>

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

Public Member Functions

virtual double GetValue (const TSequenceOfXYZ &thePoints)
virtual double GetBadRate (double Value, int nbNodes) const
virtual SMDSAbs_ElementType GetType () const
virtual void SetMesh (const SMDS_Mesh *theMesh)
virtual double GetValue (long theElementId)
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

Private Member Functions

double ComputeA (const gp_XYZ &, const gp_XYZ &, const gp_XYZ &, const gp_XYZ &) const

Detailed Description

Definition at line 231 of file SMESH_ControlsDef.hxx.


Member Function Documentation

double Warping::ComputeA ( const gp_XYZ &  thePnt1,
const gp_XYZ &  thePnt2,
const gp_XYZ &  thePnt3,
const gp_XYZ &  theG 
) const [private]

Definition at line 1242 of file SMESH_Controls.cxx.

References Min(), and PI.

Referenced by SMESH.Controls.Warping.GetValue().

{
  double aLen1 = gp_Pnt( thePnt1 ).Distance( gp_Pnt( thePnt2 ) );
  double aLen2 = gp_Pnt( thePnt2 ).Distance( gp_Pnt( thePnt3 ) );
  double L = Min( aLen1, aLen2 ) * 0.5;
  if ( L < Precision::Confusion())
    return 0.;

  gp_XYZ GI = ( thePnt2 + thePnt1 ) / 2. - theG;
  gp_XYZ GJ = ( thePnt3 + thePnt2 ) / 2. - theG;
  gp_XYZ N  = GI.Crossed( GJ );

  if ( N.Modulus() < gp::Resolution() )
    return PI / 2;

  N.Normalize();

  double H = ( thePnt2 - theG ).Dot( N );
  return asin( fabs( H / L ) ) * 180. / PI;
}
double Warping::GetBadRate ( double  Value,
int  nbNodes 
) const [virtual]

Implements SMESH.Controls.NumericalFunctor.

Definition at line 1266 of file SMESH_Controls.cxx.

{
  // the warp is in the range [0.0,PI/2]
  // 0.0 = good (no warp)
  // PI/2 = bad  (face pliee)
  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 Warping::GetType ( ) const [virtual]

Implements SMESH.Controls.NumericalFunctor.

Definition at line 1274 of file SMESH_Controls.cxx.

References SMDSAbs_Face.

{
  return SMDSAbs_Face;
}
double Warping::GetValue ( const TSequenceOfXYZ thePoints) [virtual]

Reimplemented from SMESH.Controls.NumericalFunctor.

Definition at line 1227 of file SMESH_Controls.cxx.

References SMESH.Controls.Warping.ComputeA(), Max(), and SMESH.Controls.TSequenceOfXYZ.size().

{
  if ( P.size() != 4 )
    return 0;

  gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4.;

  double A1 = ComputeA( P( 1 ), P( 2 ), P( 3 ), G );
  double A2 = ComputeA( P( 2 ), P( 3 ), P( 4 ), G );
  double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
  double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );

  return Max( Max( A1, A2 ), Max( A3, A4 ) );
}
double NumericalFunctor::GetValue ( long  theElementId) [virtual, inherited]
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