Salome HOME
Merge from BR_V5_DEV 17Feb09
authorvsr <vsr@opencascade.com>
Tue, 17 Feb 2009 06:55:16 +0000 (06:55 +0000)
committervsr <vsr@opencascade.com>
Tue, 17 Feb 2009 06:55:16 +0000 (06:55 +0000)
src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx

index 292c29ecb7fc8964985f66f29ef4b03eaae0c53c..35bfeef1a3246a03e8155175f7880ac976b175c0 100644 (file)
@@ -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,
index f88f1fc08e0732b60c2a42140967ea005f5454e4..f9f906240dd4d2c44a76d2ef2ef97479864dc835 100644 (file)
@@ -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 ----------