return SMDSAbs_Ball;
}
+//================================================================================
+/*
+ Class : NodeConnectivityNumber
+ Description : Functor returning number of elements connected to a node
+*/
+//================================================================================
+
+double NodeConnectivityNumber::GetValue( long theId )
+{
+ double nb = 0;
+
+ if ( const SMDS_MeshNode* node = myMesh->FindNode( theId ))
+ {
+ SMDSAbs_ElementType type;
+ if ( myMesh->NbVolumes() > 0 )
+ type = SMDSAbs_Volume;
+ else if ( myMesh->NbFaces() > 0 )
+ type = SMDSAbs_Face;
+ else if ( myMesh->NbEdges() > 0 )
+ type = SMDSAbs_Edge;
+ else
+ return 0;
+ nb = node->NbInverseElements( type );
+ }
+ return nb;
+}
+
+double NodeConnectivityNumber::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+ return Value;
+}
+
+SMDSAbs_ElementType NodeConnectivityNumber::GetType() const
+{
+ return SMDSAbs_Node;
+}
/*
PREDICATES
{
char c = aStr.Value( i );
if ( !isdigit( c ) && c != ',' && c != '-' )
- aStr.SetValue( i, ' ');
+ aStr.SetValue( i, ',');
}
aStr.RemoveAll( ' ' );
struct ElementsOnShape::Classifier
{
- //Classifier(const TopoDS_Shape& s, double tol) { Init(s,tol); }
+ Classifier() { mySolidClfr = 0; myFlags = 0; }
+ ~Classifier();
void Init(const TopoDS_Shape& s, double tol, const Bnd_B3d* box = 0 );
bool IsOut(const gp_Pnt& p) { return SetChecked( true ), (this->*myIsOutFun)( p ); }
TopAbs_ShapeEnum ShapeType() const { return myShape.ShapeType(); }
void SetChecked( bool is ) { is ? SetFlag( theIsCheckedFlag ) : UnsetFlag( theIsCheckedFlag ); }
void SetFlag ( int flag ) { myFlags |= flag; }
void UnsetFlag( int flag ) { myFlags &= ~flag; }
+
private:
bool isOutOfSolid (const gp_Pnt& p);
bool isOutOfBox (const gp_Pnt& p);
bool isOutOfVertex(const gp_Pnt& p);
bool isBox (const TopoDS_Shape& s);
- bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
- BRepClass3d_SolidClassifier mySolidClfr;
- Bnd_B3d myBox;
- GeomAPI_ProjectPointOnSurf myProjFace;
- GeomAPI_ProjectPointOnCurve myProjEdge;
- gp_Pnt myVertexXYZ;
- TopoDS_Shape myShape;
- double myTol;
- int myFlags;
+ bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
+ BRepClass3d_SolidClassifier* mySolidClfr; // ptr because of a run-time forbidden copy-constructor
+ Bnd_B3d myBox;
+ GeomAPI_ProjectPointOnSurf myProjFace;
+ GeomAPI_ProjectPointOnCurve myProjEdge;
+ gp_Pnt myVertexXYZ;
+ TopoDS_Shape myShape;
+ double myTol;
+ int myFlags;
};
struct ElementsOnShape::OctreeClassifier : public SMESH_Octree
{
myShape = theShape;
myTol = theTol;
+ myFlags = 0;
bool isShapeBox = false;
switch ( myShape.ShapeType() )
}
else
{
- mySolidClfr.Load(theShape);
+ mySolidClfr = new BRepClass3d_SolidClassifier(theShape);
myIsOutFun = & ElementsOnShape::Classifier::isOutOfSolid;
}
break;
}
}
+ElementsOnShape::Classifier::~Classifier()
+{
+ delete mySolidClfr; mySolidClfr = 0;
+}
+
bool ElementsOnShape::Classifier::isOutOfSolid (const gp_Pnt& p)
{
- mySolidClfr.Perform( p, myTol );
- return ( mySolidClfr.State() != TopAbs_IN && mySolidClfr.State() != TopAbs_ON );
+ mySolidClfr->Perform( p, myTol );
+ return ( mySolidClfr->State() != TopAbs_IN && mySolidClfr->State() != TopAbs_ON );
}
bool ElementsOnShape::Classifier::isOutOfBox (const gp_Pnt& p)
}
else if ( otherTree->myChildren )
{
- myChildren = new SMESH_Tree < Bnd_B3d, 8 >*[ 8 ];
+ myChildren = new SMESH_Tree< Bnd_B3d, 8 > * [ 8 ];
for ( int i = 0; i < nbChildren(); i++ )
myChildren[i] =
new OctreeClassifier( static_cast<const OctreeClassifier*>( otherTree->myChildren[i]),