mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-04 00:00:33 +05:00
ACTION 31.3 from CoTech:
EURIWARE BO: Homogenize the formulas used to calculate the Controls in SMESH to fit with those of ParaView. The library used by ParaView for those calculations can be reused in SMESH.
This commit is contained in:
parent
18e25f5736
commit
f0a9396455
@ -66,6 +66,8 @@
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMESHDS_GroupBase.hxx"
|
||||
|
||||
#include <vtkMeshQuality.h>
|
||||
|
||||
/*
|
||||
AUXILIARY METHODS
|
||||
*/
|
||||
@ -284,24 +286,25 @@ long NumericalFunctor::GetPrecision() const
|
||||
void NumericalFunctor::SetPrecision( const long thePrecision )
|
||||
{
|
||||
myPrecision = thePrecision;
|
||||
myPrecisionValue = pow( 10., (double)( myPrecision ) );
|
||||
}
|
||||
|
||||
double NumericalFunctor::GetValue( long theId )
|
||||
{
|
||||
double aVal = 0;
|
||||
|
||||
myCurrElement = myMesh->FindElement( theId );
|
||||
|
||||
TSequenceOfXYZ P;
|
||||
if ( GetPoints( theId, P ))
|
||||
{
|
||||
double aVal = GetValue( P );
|
||||
if ( myPrecision >= 0 )
|
||||
{
|
||||
double prec = pow( 10., (double)( myPrecision ) );
|
||||
aVal = floor( aVal * prec + 0.5 ) / prec;
|
||||
}
|
||||
return aVal;
|
||||
}
|
||||
aVal = Round( GetValue( P ));
|
||||
|
||||
return 0.;
|
||||
return aVal;
|
||||
}
|
||||
|
||||
double NumericalFunctor::Round( const double & aVal )
|
||||
{
|
||||
return ( myPrecision >= 0 ) ? floor( aVal * myPrecisionValue + 0.5 ) / myPrecisionValue : aVal;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -929,6 +932,28 @@ namespace{
|
||||
|
||||
}
|
||||
|
||||
double AspectRatio3D::GetValue( long theId )
|
||||
{
|
||||
double aVal = 0;
|
||||
myCurrElement = myMesh->FindElement( theId );
|
||||
if ( myCurrElement && myCurrElement->GetVtkType() == VTK_TETRA )
|
||||
{
|
||||
// Action from CoTech | ACTION 31.3:
|
||||
// EURIWARE BO: Homogenize the formulas used to calculate the Controls in SMESH to fit with
|
||||
// those of ParaView. The library used by ParaView for those calculations can be reused in SMESH.
|
||||
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myCurrElement->getMeshId()]->getGrid();
|
||||
if ( vtkCell* avtkCell = grid->GetCell( myCurrElement->getVtkId() ))
|
||||
aVal = Round( vtkMeshQuality::TetAspectRatio( avtkCell ));
|
||||
}
|
||||
else
|
||||
{
|
||||
TSequenceOfXYZ P;
|
||||
if ( GetPoints( myCurrElement, P ))
|
||||
aVal = Round( GetValue( P ));
|
||||
}
|
||||
return aVal;
|
||||
}
|
||||
|
||||
double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
|
||||
{
|
||||
double aQuality = 0.0;
|
||||
|
@ -136,15 +136,17 @@ namespace SMESH{
|
||||
virtual double GetBadRate( double Value, int nbNodes ) const = 0;
|
||||
long GetPrecision() const;
|
||||
void SetPrecision( const long thePrecision );
|
||||
double Round( const double & value );
|
||||
|
||||
bool GetPoints(const int theId,
|
||||
TSequenceOfXYZ& theRes) const;
|
||||
static bool GetPoints(const SMDS_MeshElement* theElem,
|
||||
TSequenceOfXYZ& theRes);
|
||||
protected:
|
||||
const SMDS_Mesh* myMesh;
|
||||
const SMDS_Mesh* myMesh;
|
||||
const SMDS_MeshElement* myCurrElement;
|
||||
long myPrecision;
|
||||
long myPrecision;
|
||||
double myPrecisionValue;
|
||||
};
|
||||
|
||||
|
||||
@ -215,6 +217,7 @@ namespace SMESH{
|
||||
*/
|
||||
class SMESHCONTROLS_EXPORT AspectRatio3D: 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;
|
||||
|
Loading…
Reference in New Issue
Block a user