Salome HOME
Move from StdMeshers_ProjectionUtils
authoreap <eap@opencascade.com>
Tue, 23 Mar 2010 14:32:26 +0000 (14:32 +0000)
committereap <eap@opencascade.com>
Tue, 23 Mar 2010 14:32:26 +0000 (14:32 +0000)
+  static bool IsSubShape( const TopoDS_Shape& shape, const TopoDS_Shape& mainShape );
+
+  static bool IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh );

src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx

index 1647d0a4657dfb2e71a2f6ed78d6b662422affc4..ef545254b3798103cd861fadb4819bee32b0c051 100644 (file)
@@ -1451,6 +1451,42 @@ TopAbs_Orientation SMESH_MesherHelper::GetSubShapeOri(const TopoDS_Shape& shape,
   return ori;
 }
 
+//=======================================================================
+//function : IsSubShape
+//purpose  : 
+//=======================================================================
+
+bool SMESH_MesherHelper::IsSubShape( const TopoDS_Shape& shape,
+                                     const TopoDS_Shape& mainShape )
+{
+  if ( !shape.IsNull() && !mainShape.IsNull() )
+  {
+    for ( TopExp_Explorer exp( mainShape, shape.ShapeType());
+          exp.More();
+          exp.Next() )
+      if ( shape.IsSame( exp.Current() ))
+        return true;
+  }
+  SCRUTE((shape.IsNull()));
+  SCRUTE((mainShape.IsNull()));
+  return false;
+}
+
+//=======================================================================
+//function : IsSubShape
+//purpose  : 
+//=======================================================================
+
+bool SMESH_MesherHelper::IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh )
+{
+  if ( shape.IsNull() || !aMesh )
+    return false;
+  return
+    aMesh->GetMeshDS()->ShapeToIndex( shape ) ||
+    // PAL16202
+    shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape );
+}
+
 //=======================================================================
 //function : IsQuadraticMesh
 //purpose  : Check mesh without geometry for: if all elements on this shape are quadratic,
index c4623a57a39ff9359b35a0fb2ba705fc2ee5eabe..a4c039120bf0f3f23d4e6aa18c6761c09fbd1fd0 100644 (file)
@@ -134,6 +134,11 @@ public:
   static TopAbs_Orientation GetSubShapeOri(const TopoDS_Shape& shape,
                                            const TopoDS_Shape& subShape);
 
+  static bool IsSubShape( const TopoDS_Shape& shape, const TopoDS_Shape& mainShape );
+
+  static bool IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh );
+
+
 public:
   // ---------- PUBLIC INSTANCE METHODS ----------