From: eap Date: Fri, 13 Jul 2012 07:24:06 +0000 (+0000) Subject: 0021723: EDF SMESH: Calculation of Aspect Ratio X-Git-Tag: V6_6_0a1~268 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=171b3e8882b11a46da5a1d4f374d337aa0e236af;p=modules%2Fsmesh.git 0021723: EDF SMESH: Calculation of Aspect Ratio Use vtkMeshQuality::QuadAspectRatio() --- diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 74f6a9563..c804e6df3 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -715,6 +715,26 @@ SMDSAbs_ElementType MinimumAngle::GetType() const Class : AspectRatio Description : Functor for calculating aspect ratio */ +double AspectRatio::GetValue( long theId ) +{ + double aVal = 0; + myCurrElement = myMesh->FindElement( theId ); + if ( myCurrElement && myCurrElement->GetVtkType() == VTK_QUAD ) + { + // issue 21723 + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myCurrElement->getMeshId()]->getGrid(); + if ( vtkCell* avtkCell = grid->GetCell( myCurrElement->getVtkId() )) + aVal = Round( vtkMeshQuality::QuadAspectRatio( avtkCell )); + } + else + { + TSequenceOfXYZ P; + if ( GetPoints( myCurrElement, P )) + aVal = Round( GetValue( P )); + } + return aVal; +} + double AspectRatio::GetValue( const TSequenceOfXYZ& P ) { // According to "Mesh quality control" by Nadir Bouhamau referring to diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx index 965a06b29..319420fa1 100644 --- a/src/Controls/SMESH_ControlsDef.hxx +++ b/src/Controls/SMESH_ControlsDef.hxx @@ -197,6 +197,7 @@ namespace SMESH{ */ class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{ public: + virtual double GetValue( long theElementId ); virtual double GetValue( const TSequenceOfXYZ& thePoints ); virtual double GetBadRate( double Value, int nbNodes ) const; virtual SMDSAbs_ElementType GetType() const;