Salome HOME
Add a function to know kind of mesh element
authoreap <eap@opencascade.com>
Thu, 4 Mar 2010 08:08:21 +0000 (08:08 +0000)
committereap <eap@opencascade.com>
Thu, 4 Mar 2010 08:08:21 +0000 (08:08 +0000)
+    EntityType GetElementGeomType( in long id )

idl/SMESH_Mesh.idl
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_SWIG/smeshDC.py

index 8d55cd0db319d0809240bdede538c15ef9488fb7..14ced70cecfbc40651fba6c99403e6f98ca07711 100644 (file)
@@ -666,6 +666,9 @@ module SMESH
     ElementType GetElementType( in long id, in boolean iselem )
       raises (SALOME::SALOME_Exception);
 
+    EntityType GetElementGeomType( in long id )
+      raises (SALOME::SALOME_Exception);
+
     long_array GetSubMeshElementsId(in long ShapeID)
       raises (SALOME::SALOME_Exception);
 
index 9c44e29d2e49609bd17c86cd05acf714e4f73258..41dbdeb0ae640c3f008cccb347e904aa4a664f1b 100644 (file)
@@ -2755,6 +2755,21 @@ SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const boo
   return ( SMESH::ElementType )_impl->GetElementType( id, iselem );
 }
 
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id )
+  throw (SALOME::SALOME_Exception)
+{
+  const SMDS_MeshElement* e = _impl->GetMeshDS()->FindElement(id);
+  if ( !e )
+    THROW_SALOME_CORBA_EXCEPTION( "invalid element id", SALOME::BAD_PARAM );
+
+  return ( SMESH::EntityType ) e->GetEntityType();
+}
 
 //=============================================================================
 /*!
index ab8abdabf27dcb2a2a442d9bb0fb37dad983f3d2..db41226b6ad4a25f1798fa341ee3a28a9da9e9a9 100644 (file)
@@ -307,6 +307,9 @@ public:
   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
     throw (SALOME::SALOME_Exception);
   
+  SMESH::EntityType GetElementGeomType( CORBA::Long id )
+    throw (SALOME::SALOME_Exception);
+  
   /*!
    * Returns ID of elements for given submesh
    */
index fd890c1ba09b09bdac8daf9ded9e49b24489686b..8e7560bc733390dfd0ccf34bfb61bfcb07e32132 100644 (file)
@@ -197,6 +197,10 @@ DefaultSize, DefaultGeom, Custom = 0,0,1
 
 PrecisionConfusion = 1e-07
 
+# TopAbs_State enumeration
+[TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4)
+
+
 ## Converts an angle from degrees to radians
 def DegreesToRadians(AngleInDegrees):
     from math import pi
@@ -1920,6 +1924,12 @@ class Mesh:
     def GetElementType(self, id, iselem):
         return self.mesh.GetElementType(id, iselem)
 
+    ## Returns the geometric type of mesh element
+    #  @return the value from SMESH::EntityType enumeration
+    #  @ingroup l1_meshinfo
+    def GetElementGeomType(self, id):
+        return self.mesh.GetElementGeomType(id)
+
     ## Returns the list of submesh elements IDs
     #  @param Shape a geom object(subshape) IOR
     #         Shape must be the subshape of a ShapeToMesh()
@@ -2285,6 +2295,11 @@ class Mesh:
     def FindElementsByPoint(self, x, y, z, elementType = SMESH.ALL):
         return self.editor.FindElementsByPoint(x, y, z, elementType)
         
+    # Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
+    # TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
+     
+    def GetPointState(self, x, y, z):
+        return self.editor.GetPointState(x, y, z)
 
     ## Finds the node closest to a point and moves it to a point location
     #  @param x  the X coordinate of a point