mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
0020948: EDF 1468 SMESH: Histogram of the quality controls
limit computed histogram to a submesh 0020944: EDF 1464 SMESH: detection of over-constrained elements + class OverConstrainedVolume: public Predicate + class OverConstrainedFace: public Predicate
This commit is contained in:
parent
1ad6590ec1
commit
cddf6847bc
@ -283,12 +283,14 @@ double NumericalFunctor::GetValue( long theId )
|
||||
* \param nbIntervals - number of intervals
|
||||
* \param nbEvents - number of mesh elements having values within i-th interval
|
||||
* \param funValues - boundaries of intervals
|
||||
* \param elements - elements to check vulue of; empty list means "of all"
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void NumericalFunctor::GetHistogram(int nbIntervals,
|
||||
std::vector<int>& nbEvents,
|
||||
std::vector<double>& funValues)
|
||||
std::vector<double>& funValues,
|
||||
const vector<int>& elements)
|
||||
{
|
||||
if ( nbIntervals < 1 ||
|
||||
!myMesh ||
|
||||
@ -299,9 +301,18 @@ void NumericalFunctor::GetHistogram(int nbIntervals,
|
||||
|
||||
// get all values sorted
|
||||
std::multiset< double > values;
|
||||
SMDS_ElemIteratorPtr elemIt = myMesh->elementsIterator(GetType());
|
||||
while ( elemIt->more() )
|
||||
values.insert( GetValue( elemIt->next()->GetID() ));
|
||||
if ( elements.empty() )
|
||||
{
|
||||
SMDS_ElemIteratorPtr elemIt = myMesh->elementsIterator(GetType());
|
||||
while ( elemIt->more() )
|
||||
values.insert( GetValue( elemIt->next()->GetID() ));
|
||||
}
|
||||
else
|
||||
{
|
||||
vector<int>::const_iterator id = elements.begin();
|
||||
for ( ; id != elements.end(); ++id )
|
||||
values.insert( GetValue( *id ));
|
||||
}
|
||||
|
||||
// case nbIntervals == 1
|
||||
funValues[0] = *values.begin();
|
||||
@ -1932,6 +1943,59 @@ bool BareBorderFace::IsSatisfy(long theElementId )
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Class : OverConstrainedVolume
|
||||
*/
|
||||
|
||||
bool OverConstrainedVolume::IsSatisfy(long theElementId )
|
||||
{
|
||||
// An element is over-constrained if it has N-1 free borders where
|
||||
// N is the number of edges/faces for a 2D/3D element.
|
||||
SMDS_VolumeTool myTool;
|
||||
if ( myTool.Set( myMesh->FindElement(theElementId)))
|
||||
{
|
||||
int nbSharedFaces = 0;
|
||||
for ( int iF = 0; iF < myTool.NbFaces(); ++iF )
|
||||
if ( !myTool.IsFreeFace( iF ) && ++nbSharedFaces > 1 )
|
||||
break;
|
||||
return ( nbSharedFaces == 1 );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Class : OverConstrainedFace
|
||||
*/
|
||||
|
||||
bool OverConstrainedFace::IsSatisfy(long theElementId )
|
||||
{
|
||||
// An element is over-constrained if it has N-1 free borders where
|
||||
// N is the number of edges/faces for a 2D/3D element.
|
||||
if ( const SMDS_MeshElement* face = myMesh->FindElement(theElementId))
|
||||
if ( face->GetType() == SMDSAbs_Face )
|
||||
{
|
||||
int nbSharedBorders = 0;
|
||||
int nbN = face->NbCornerNodes();
|
||||
for ( int i = 0; i < nbN; ++i )
|
||||
{
|
||||
// check if a link is shared by another face
|
||||
const SMDS_MeshNode* n1 = face->GetNode( i );
|
||||
const SMDS_MeshNode* n2 = face->GetNode( (i+1)%nbN );
|
||||
SMDS_ElemIteratorPtr fIt = n1->GetInverseElementIterator( SMDSAbs_Face );
|
||||
bool isShared = false;
|
||||
while ( !isShared && fIt->more() )
|
||||
{
|
||||
const SMDS_MeshElement* f = fIt->next();
|
||||
isShared = ( f != face && f->GetNodeIndex(n2) != -1 );
|
||||
}
|
||||
if ( isShared && ++nbSharedBorders > 1 )
|
||||
break;
|
||||
}
|
||||
return ( nbSharedBorders == 1 );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Class : FreeBorders
|
||||
Description : Predicate for free borders
|
||||
|
@ -127,9 +127,10 @@ namespace SMESH{
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh );
|
||||
virtual double GetValue( long theElementId );
|
||||
virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
|
||||
void GetHistogram(int nbIntervals,
|
||||
std::vector<int>& nbEvents,
|
||||
std::vector<double>& funValues);
|
||||
void GetHistogram(int nbIntervals,
|
||||
std::vector<int>& nbEvents,
|
||||
std::vector<double>& funValues,
|
||||
const std::vector<int>& elements);
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
virtual double GetBadRate( double Value, int nbNodes ) const = 0;
|
||||
long GetPrecision() const;
|
||||
@ -409,6 +410,37 @@ namespace SMESH{
|
||||
};
|
||||
typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
|
||||
|
||||
/*
|
||||
OverConstrainedVolume
|
||||
*/
|
||||
class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
|
||||
{
|
||||
public:
|
||||
OverConstrainedVolume():myMesh(0) {}
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
|
||||
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
protected:
|
||||
const SMDS_Mesh* myMesh;
|
||||
};
|
||||
typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
|
||||
|
||||
/*
|
||||
OverConstrainedFace
|
||||
*/
|
||||
class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
|
||||
{
|
||||
public:
|
||||
OverConstrainedFace():myMesh(0) {}
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
|
||||
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
|
||||
virtual bool IsSatisfy( long theElementId );
|
||||
protected:
|
||||
const SMDS_Mesh* myMesh;
|
||||
std::vector< const SMDS_MeshNode* > myLinkNodes;
|
||||
};
|
||||
typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
|
||||
|
||||
/*
|
||||
Class : FreeEdges
|
||||
Description : Predicate for free Edges
|
||||
|
Loading…
Reference in New Issue
Block a user