00001 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 // SMESH SMESHDS : management of mesh data and SMESH document 00023 // File : SMESHDS_SubMesh.hxx 00024 // Module : SMESH 00025 // 00026 #ifndef _SMESHDS_SubMesh_HeaderFile 00027 #define _SMESHDS_SubMesh_HeaderFile 00028 00029 #include "SMESH_SMESHDS.hxx" 00030 00031 #include "SMDS_Mesh.hxx" 00032 #include <set> 00033 00034 class SMESHDS_SubMesh; 00035 typedef SMDS_Iterator<const SMESHDS_SubMesh*> SMESHDS_SubMeshIterator; 00036 typedef boost::shared_ptr< SMESHDS_SubMeshIterator > SMESHDS_SubMeshIteratorPtr; 00037 00038 class SMESHDS_EXPORT SMESHDS_SubMesh 00039 { 00040 public: 00041 00042 bool IsComplexSubmesh() const { return !mySubMeshes.empty(); } 00043 00044 // if !IsComplexSubmesh() 00045 void AddElement(const SMDS_MeshElement * ME); 00046 bool RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted); // ret true if ME was in 00047 void AddNode(const SMDS_MeshNode * ME); 00048 bool RemoveNode(const SMDS_MeshNode * ME, bool isNodeDeleted); // ret true if ME was in 00049 00050 // if IsComplexSubmesh() 00051 void AddSubMesh( const SMESHDS_SubMesh* theSubMesh ); 00052 bool RemoveSubMesh( const SMESHDS_SubMesh* theSubMesh ); 00053 bool ContainsSubMesh( const SMESHDS_SubMesh* theSubMesh ) const; 00054 int NbSubMeshes() const { return mySubMeshes.size(); } 00055 SMESHDS_SubMeshIteratorPtr GetSubMeshIterator() const; 00056 00057 // for both types 00058 int NbElements() const; 00059 SMDS_ElemIteratorPtr GetElements() const; 00060 int NbNodes() const; 00061 SMDS_NodeIteratorPtr GetNodes() const; 00062 bool Contains(const SMDS_MeshElement * ME) const; // check if elem or node is in 00063 00064 // clear the contents 00065 void Clear(); 00066 00067 private: 00068 00069 typedef std::set<const SMDS_MeshElement*, TIDCompare > TElemSet; 00070 TElemSet myElements, myNodes; 00071 00072 std::set<const SMESHDS_SubMesh*> mySubMeshes; 00073 }; 00074 #endif