From bbfbac1990b2cf41334d48f3b15e656f9b2f5aea Mon Sep 17 00:00:00 2001 From: sln Date: Tue, 23 Aug 2005 08:58:58 +0000 Subject: [PATCH] GetElementType method added --- src/SMDS/SMDS_Mesh.cxx | 22 ++++++++++++++++++++++ src/SMDS/SMDS_Mesh.hxx | 2 ++ src/SMESH/SMESH_Mesh.cxx | 9 +++++++++ src/SMESH/SMESH_Mesh.hxx | 2 ++ 4 files changed, 35 insertions(+) diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 0058da878..6381e547e 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(); +} \ No newline at end of file diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index 9d59a3ddf..7f00c4be7 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -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(); diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 9501c4d5d..c473bd612 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -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 diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index a91a8861b..321714ac1 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -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 ); // -- 2.30.2