From: eap Date: Mon, 16 Feb 2009 16:44:16 +0000 (+0000) Subject: PAL15429 Computation of the mesh, based on "014.brep" via Tetrahedron(NETGEN), is... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b22df369ef8a6e561b086710bf030a1254e022c5;p=modules%2Fsmesh.git PAL15429 Computation of the mesh, based on "014.brep" via Tetrahedron(NETGEN), is failed. fix for G7.py + /*! + * \brief Return number of unique ancestors of the shape + */ + static int NbAncestors(const TopoDS_Shape& shape, + const SMESH_Mesh& mesh, + TopAbs_ShapeEnum ancestorType=TopAbs_SHAPE); + --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 292c29ecb..35bfeef1a 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -1149,6 +1149,25 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap, return true; } +//======================================================================= +/*! + * \brief Return number of unique ancestors of the shape + */ +//======================================================================= + +int SMESH_MesherHelper::NbAncestors(const TopoDS_Shape& shape, + const SMESH_Mesh& mesh, + TopAbs_ShapeEnum ancestorType/*=TopAbs_SHAPE*/) +{ + TopTools_MapOfShape ancestors; + TopTools_ListIteratorOfListOfShape ansIt( mesh.GetAncestors(shape) ); + for ( ; ansIt.More(); ansIt.Next() ) { + if ( ancestorType == TopAbs_SHAPE || ansIt.Value().ShapeType() == ancestorType ) + ancestors.Add( ansIt.Value() ); + } + return ancestors.Extent(); +} + //======================================================================= /** * Check mesh without geometry for: if all elements on this shape are quadratic, diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index f88f1fc08..f9f906240 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -106,6 +106,13 @@ public: return ind; } + /*! + * \brief Return number of unique ancestors of the shape + */ + static int NbAncestors(const TopoDS_Shape& shape, + const SMESH_Mesh& mesh, + TopAbs_ShapeEnum ancestorType=TopAbs_SHAPE); + public: // ---------- PUBLIC INSTANCE METHODS ----------