Salome HOME
IMP 10199 (add Volume Control). Add Volume NumericalFunctor.
authoreap <eap@opencascade.com>
Mon, 10 Oct 2005 14:40:28 +0000 (14:40 +0000)
committereap <eap@opencascade.com>
Mon, 10 Oct 2005 14:40:28 +0000 (14:40 +0000)
src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_ControlsDef.hxx

index 1aef723e89b63098ee06af41b623a08ef660286e..3ebd18b907798734bf2ebb70ef940725c955589b 100644 (file)
@@ -204,6 +204,42 @@ double NumericalFunctor::GetValue( long theId )
   return 0.;
 }
 
   return 0.;
 }
 
+//=======================================================================
+//function : GetValue
+//purpose  : 
+//=======================================================================
+
+double Volume::GetValue( long theElementId )
+{
+  if ( theElementId && myMesh ) {
+    SMDS_VolumeTool aVolumeTool;
+    if ( aVolumeTool.Set( myMesh->FindElement( theElementId )))
+      return aVolumeTool.GetSize();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : GetBadRate
+//purpose  : meaningless as it is not quality control functor
+//=======================================================================
+
+double Volume::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+  return Value;
+}
+
+//=======================================================================
+//function : GetType
+//purpose  : 
+//=======================================================================
+
+SMDSAbs_ElementType Volume::GetType() const
+{
+  return SMDSAbs_Volume;
+}
+
+
 /*
   Class       : MinimumAngle
   Description : Functor for calculation of minimum angle
 /*
   Class       : MinimumAngle
   Description : Functor for calculation of minimum angle
@@ -792,6 +828,7 @@ double Area::GetValue( const TSequenceOfXYZ& P )
 
 double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
 
 double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
   return Value;
 }
 
@@ -812,6 +849,7 @@ double Length::GetValue( const TSequenceOfXYZ& P )
 
 double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
 
 double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
   return Value;
 }
 
@@ -943,6 +981,7 @@ double Length2D::GetValue( long theElementId)
 
 double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
 
 double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
   return Value;
 }
 
@@ -1022,6 +1061,7 @@ double MultiConnection::GetValue( long theId )
 
 double MultiConnection::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
 
 double MultiConnection::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
   return Value;
 }
 
@@ -1099,6 +1139,7 @@ double MultiConnection2D::GetValue( long theElementId )
 
 double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
 
 double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
 {
+  // meaningless as it is not quality control functor
   return Value;
 }
 
   return Value;
 }
 
index 02336ebbcec1e286f6842afd7939f56eb54bc513..576b1e8e011b9cec6f90c939fc040d6db3f9a9ae 100644 (file)
@@ -93,6 +93,10 @@ namespace SMESH{
       const_reference operator[](size_type n) const;
     };
 
       const_reference operator[](size_type n) const;
     };
 
+    /*
+      Class       : Functor
+      Description : Root of all Functors
+    */
     class Functor
     {
     public:
     class Functor
     {
     public:
@@ -101,6 +105,10 @@ namespace SMESH{
       virtual SMDSAbs_ElementType GetType() const = 0;
     };
 
       virtual SMDSAbs_ElementType GetType() const = 0;
     };
 
+    /*
+      Class       : NumericalFunctor
+      Description : Root of all Functors returning numeric value
+    */
     class NumericalFunctor: public virtual Functor{
     public:
       NumericalFunctor();
     class NumericalFunctor: public virtual Functor{
     public:
       NumericalFunctor();
@@ -122,6 +130,19 @@ namespace SMESH{
     };
   
   
     };
   
   
+    /*
+      Class       : Volume
+      Description : Functor calculating volume of 3D mesh element
+    */
+    class Volume: 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;
+    };
+  
+  
     /*
       Class       : SMESH_MinimumAngle
       Description : Functor for calculation of minimum angle
     /*
       Class       : SMESH_MinimumAngle
       Description : Functor for calculation of minimum angle