1) Add a check of element type to GetPoints(elemID)

2) Fix double MaxElementLength2D::GetValue( long theElementId )
This commit is contained in:
eap 2012-11-21 16:04:03 +00:00
parent 1f560f8507
commit 387aa16d04

View File

@ -231,7 +231,11 @@ bool NumericalFunctor::GetPoints(const int theId,
if ( myMesh == 0 ) if ( myMesh == 0 )
return false; return false;
return GetPoints( myMesh->FindElement( theId ), theRes ); const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
if ( !anElem || anElem->GetType() != this->GetType() )
return false;
return GetPoints( anElem, theRes );
} }
bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem, bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
@ -239,7 +243,7 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
{ {
theRes.clear(); theRes.clear();
if ( anElem == 0) if ( anElem == 0 )
return false; return false;
theRes.reserve( anElem->NbNodes() ); theRes.reserve( anElem->NbNodes() );
@ -424,7 +428,7 @@ SMDSAbs_ElementType Volume::GetType() const
return SMDSAbs_Volume; return SMDSAbs_Volume;
} }
//=======================================================================
/* /*
Class : MaxElementLength2D Class : MaxElementLength2D
Description : Functor calculating maximum length of 2D element Description : Functor calculating maximum length of 2D element
@ -477,10 +481,7 @@ double MaxElementLength2D::GetValue( const TSequenceOfXYZ& P )
double MaxElementLength2D::GetValue( long theElementId ) double MaxElementLength2D::GetValue( long theElementId )
{ {
TSequenceOfXYZ P; TSequenceOfXYZ P;
if( GetPoints( theElementId, P ) && myMesh->FindElement( theElementId )->GetType() == SMDSAbs_Face) { return GetPoints( theElementId, P ) ? GetValue(P) : 0.0;
GetValue(P);
}
return 0.;
} }
double MaxElementLength2D::GetBadRate( double Value, int /*nbNodes*/ ) const double MaxElementLength2D::GetBadRate( double Value, int /*nbNodes*/ ) const
@ -493,6 +494,7 @@ SMDSAbs_ElementType MaxElementLength2D::GetType() const
return SMDSAbs_Face; return SMDSAbs_Face;
} }
//=======================================================================
/* /*
Class : MaxElementLength3D Class : MaxElementLength3D
Description : Functor calculating maximum length of 3D element Description : Functor calculating maximum length of 3D element
@ -667,7 +669,7 @@ SMDSAbs_ElementType MaxElementLength3D::GetType() const
return SMDSAbs_Volume; return SMDSAbs_Volume;
} }
//=======================================================================
/* /*
Class : MinimumAngle Class : MinimumAngle
Description : Functor for calculation of minimum angle Description : Functor for calculation of minimum angle