From: asl Date: Mon, 4 Jul 2005 10:28:51 +0000 (+0000) Subject: New methods for SMDS_Mesh X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4800541e9ec33cf2de48f906036a0cb57dddc39b;p=modules%2Fsmesh.git New methods for SMDS_Mesh GetElementType - returns element type by id --- diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 0058da878..c883bbe62 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -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(); +} diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index 9d59a3ddf..acdd19170 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -59,6 +59,8 @@ public: SMDS_VolumeIteratorPtr volumesIterator() const; SMDS_ElemIteratorPtr elementsIterator() const; + SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const; + SMDS_Mesh *AddSubMesh(); virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);