Salome HOME
GetElementType method added
authorsln <sln@opencascade.com>
Tue, 23 Aug 2005 08:58:58 +0000 (08:58 +0000)
committersln <sln@opencascade.com>
Tue, 23 Aug 2005 08:58:58 +0000 (08:58 +0000)
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_Mesh.hxx

index 0058da87809121f013470ed8cc9ec0f88e86e49c..6381e547e626174de6c68a803cc0fee451c26efe 100644 (file)
@@ -2179,3 +2179,25 @@ void SMDS_Mesh::Renumber (const bool isNodes, const int  startID, const int  del
     ID += deltaID;
   }
 }
+
+//=======================================================================
+//function : GetElementType
+//purpose  : Return type of element or node with id
+//=======================================================================
+
+SMDSAbs_ElementType SMDS_Mesh::GetElementType( const int id, const bool iselem ) const
+{
+  SMDS_MeshElement* elem = 0;
+  if( iselem )
+    elem = myElementIDFactory->MeshElement( id );
+  else
+    elem = myNodeIDFactory->MeshElement( id );
+
+  if( !elem )
+  {
+    //throw SALOME_Exception(LOCALIZED ("this element isn't exist"));
+    return SMDSAbs_All;
+  }
+  else
+    return elem->GetType();
+}
\ No newline at end of file
index 9d59a3ddff3c0360510ef3651b5504dfd847e34d..7f00c4be76141b6c4710eb9a7d749a9c055a0ed5 100644 (file)
@@ -58,6 +58,8 @@ public:
   SMDS_FaceIteratorPtr facesIterator() const;
   SMDS_VolumeIteratorPtr volumesIterator() const;
   SMDS_ElemIteratorPtr elementsIterator() const;  
+  
+  SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const;
 
   SMDS_Mesh *AddSubMesh();
   
index 9501c4d5d6edd25d43bd45464f1ce697960c7eae..c473bd61291d1e30cf64bf204a9f8edeec377003 100644 (file)
@@ -1418,3 +1418,12 @@ ostream& SMESH_Mesh::Dump(ostream& save)
   save << "===========================================================================" << endl;
   return save;
 }
+
+//=======================================================================
+//function : GetElementType
+//purpose  : Returns type of mesh element with certain id
+//=======================================================================
+SMDSAbs_ElementType SMESH_Mesh::GetElementType( const int id, const bool iselem )
+{
+  return _myMeshDS->GetElementType( id, iselem );
+}
\ No newline at end of file
index a91a8861bf0157125b55dfc93d7fe91c1a55cafe..321714ac162bf153a163e4e6298cad8cdebace10 100644 (file)
@@ -221,6 +221,8 @@ public:
   bool RebuildPropagationChains();
   bool RemovePropagationChain (const TopoDS_Shape& theMainEdge);
   bool BuildPropagationChain (const TopoDS_Shape& theMainEdge);
+  
+  SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
 
   //