Fix for improvement 0019927 (EDF770 SMESH: Analyzing the Mesh Quality: Orphan nodes).

This commit is contained in:
mzn 2008-12-26 10:47:02 +00:00
parent 69980b70a2
commit 01e646e9da
5 changed files with 91 additions and 0 deletions

View File

@ -1691,6 +1691,37 @@ void FreeEdges::GetBoreders(TBorders& theBorders)
//std::cout<<"theBorders.size() = "<<theBorders.size()<<endl;
}
/*
Class : FreeNodes
Description : Predicate for free nodes
*/
FreeNodes::FreeNodes()
{
myMesh = 0;
}
void FreeNodes::SetMesh( const SMDS_Mesh* theMesh )
{
myMesh = theMesh;
}
bool FreeNodes::IsSatisfy( long theNodeId )
{
const SMDS_MeshNode* aNode = myMesh->FindNode( theNodeId );
if (!aNode)
return false;
return (aNode->NbInverseElements() < 1);
}
SMDSAbs_ElementType FreeNodes::GetType() const
{
return SMDSAbs_Node;
}
/*
Class : RangeOfIds
Description : Predicate for Range of Ids.

View File

@ -380,7 +380,23 @@ namespace SMESH{
const SMDS_Mesh* myMesh;
};
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
/*
Class : FreeNodes
Description : Predicate for free nodes
*/
class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
public:
FreeNodes();
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theNodeId );
virtual SMDSAbs_ElementType GetType() const;
protected:
const SMDS_Mesh* myMesh;
};
/*
Class : RangeOfIds

View File

@ -224,6 +224,7 @@ namespace SMESH
case FT_Area: myStream<< "aArea"; break;
case FT_FreeBorders: myStream<< "aFreeBorders"; break;
case FT_FreeEdges: myStream<< "aFreeEdges"; break;
case FT_FreeNodes: myStream<< "aFreeNodes"; break;
case FT_MultiConnection: myStream<< "aMultiConnection"; break;
case FT_MultiConnection2D:myStream<< "aMultiConnection2D";break;
case FT_Length: myStream<< "aLength"; break;

View File

@ -1283,6 +1283,21 @@ FunctorType FreeEdges_i::GetFunctorType()
return SMESH::FT_FreeEdges;
}
/*
Class : FreeNodes_i
Description : Predicate for free nodes
*/
FreeNodes_i::FreeNodes_i()
{
myPredicatePtr.reset(new Controls::FreeNodes());
myFunctorPtr = myPredicatePtr;
}
FunctorType FreeNodes_i::GetFunctorType()
{
return SMESH::FT_FreeNodes;
}
/*
Class : RangeOfIds_i
Description : Predicate for Range of Ids.
@ -1763,6 +1778,14 @@ FreeEdges_ptr FilterManager_i::CreateFreeEdges()
return anObj._retn();
}
FreeNodes_ptr FilterManager_i::CreateFreeNodes()
{
SMESH::FreeNodes_i* aServant = new SMESH::FreeNodes_i();
SMESH::FreeNodes_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateFreeNodes()";
return anObj._retn();
}
RangeOfIds_ptr FilterManager_i::CreateRangeOfIds()
{
SMESH::RangeOfIds_i* aServant = new SMESH::RangeOfIds_i();
@ -2011,6 +2034,7 @@ static inline bool getCriteria( Predicate_i* thePred,
{
case FT_FreeBorders:
case FT_FreeEdges:
case FT_FreeNodes:
{
CORBA::ULong i = theCriteria->length();
theCriteria->length( i + 1 );
@ -2257,6 +2281,9 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
case SMESH::FT_FreeEdges:
aPredicate = aFilterMgr->CreateFreeEdges();
break;
case SMESH::FT_FreeNodes:
aPredicate = aFilterMgr->CreateFreeNodes();
break;
case SMESH::FT_BelongToGeom:
{
SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom();
@ -2515,6 +2542,7 @@ static inline LDOMString toString( CORBA::Long theType )
case FT_RangeOfIds : return "Range of IDs";
case FT_FreeBorders : return "Free borders";
case FT_FreeEdges : return "Free edges";
case FT_FreeNodes : return "Free nodes";
case FT_MultiConnection : return "Borders at multi-connections";
case FT_MultiConnection2D: return "Borders at multi-connections 2D";
case FT_Length : return "Length";
@ -2550,6 +2578,7 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
else if ( theStr.equals( "Lying on Geom" ) ) return FT_LyingOnGeom;
else if ( theStr.equals( "Free borders" ) ) return FT_FreeBorders;
else if ( theStr.equals( "Free edges" ) ) return FT_FreeEdges;
else if ( theStr.equals( "Free nodes" ) ) return FT_FreeNodes;
else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Length" ) ) return FT_Length;

View File

@ -521,6 +521,19 @@ namespace SMESH
Controls::FreeEdgesPtr myFreeEdgesPtr;
};
/*
Class : FreeNodes_i
Description : Predicate for free nodes
*/
class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes,
public virtual Predicate_i
{
public:
FreeNodes_i();
FunctorType GetFunctorType();
};
/*
Class : RangeOfIds_i
@ -816,6 +829,7 @@ namespace SMESH
FreeBorders_ptr CreateFreeBorders();
FreeEdges_ptr CreateFreeEdges();
FreeNodes_ptr CreateFreeNodes();
RangeOfIds_ptr CreateRangeOfIds();