From: eap Date: Mon, 10 Oct 2005 14:40:28 +0000 (+0000) Subject: IMP 10199 (add Volume Control). Add Volume NumericalFunctor. X-Git-Tag: ForTest_3_1_0a2~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2875648bdbc323df97bdb879b60673a2de776889;p=modules%2Fsmesh.git IMP 10199 (add Volume Control). Add Volume NumericalFunctor. --- diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 1aef723e8..3ebd18b90 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -204,6 +204,42 @@ double NumericalFunctor::GetValue( long theId ) 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 @@ -792,6 +828,7 @@ double Area::GetValue( const TSequenceOfXYZ& P ) double Area::GetBadRate( double Value, int /*nbNodes*/ ) const { + // meaningless as it is not quality control functor return Value; } @@ -812,6 +849,7 @@ double Length::GetValue( const TSequenceOfXYZ& P ) double Length::GetBadRate( double Value, int /*nbNodes*/ ) const { + // meaningless as it is not quality control functor return Value; } @@ -943,6 +981,7 @@ double Length2D::GetValue( long theElementId) double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const { + // meaningless as it is not quality control functor return Value; } @@ -1022,6 +1061,7 @@ double MultiConnection::GetValue( long theId ) double MultiConnection::GetBadRate( double Value, int /*nbNodes*/ ) const { + // meaningless as it is not quality control functor return Value; } @@ -1099,6 +1139,7 @@ double MultiConnection2D::GetValue( long theElementId ) double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const { + // meaningless as it is not quality control functor return Value; } diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx index 02336ebbc..576b1e8e0 100644 --- a/src/Controls/SMESH_ControlsDef.hxx +++ b/src/Controls/SMESH_ControlsDef.hxx @@ -93,6 +93,10 @@ namespace SMESH{ const_reference operator[](size_type n) const; }; + /* + Class : Functor + Description : Root of all Functors + */ class Functor { public: @@ -101,6 +105,10 @@ namespace SMESH{ virtual SMDSAbs_ElementType GetType() const = 0; }; + /* + Class : NumericalFunctor + Description : Root of all Functors returning numeric value + */ 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