]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0021723: EDF SMESH: Calculation of Aspect Ratio
authoreap <eap@opencascade.com>
Fri, 13 Jul 2012 07:24:06 +0000 (07:24 +0000)
committereap <eap@opencascade.com>
Fri, 13 Jul 2012 07:24:06 +0000 (07:24 +0000)
  Use vtkMeshQuality::QuadAspectRatio()

src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_ControlsDef.hxx

index 74f6a9563b5f95bb6eaddb895d54c6ce73e9c1cf..c804e6df310fae823f2f2120e4a6561bc03f5c51 100644 (file)
@@ -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
index 965a06b29d6c28833fe5a5f2c536ebc7b0e11cfe..319420fa1f4ab096c08c26dd8eac5dc94767dc1f 100644 (file)
@@ -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;