1 // SMESH SMESHDS : management of mesh data and SMESH document
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHDS_Document.cxx
25 // Author : Yves FRICAUD, OCC
29 #include "SMESHDS_Document.hxx"
30 #include "utilities.h"
32 //=======================================================================
35 //=======================================================================
36 SMESHDS_Document::SMESHDS_Document(int UserID):myUserID(UserID)
40 //=======================================================================
43 //=======================================================================
44 int SMESHDS_Document::NewMesh()
46 static int NewMeshID = 0;
48 SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(NewMeshID);
49 myMeshes[NewMeshID] = aNewMesh;
53 //=======================================================================
56 //=======================================================================
57 SMESHDS_Mesh *SMESHDS_Document::GetMesh(int MeshID)
59 map<int,SMESHDS_Mesh*>::iterator it=myMeshes.find(MeshID);
60 if (it==myMeshes.end())
62 MESSAGE("SMESHDS_Document::GetMesh : ID not found");
65 else return (*it).second;
68 //=======================================================================
69 //function : RemoveMesh
71 //=======================================================================
72 void SMESHDS_Document::RemoveMesh(int MeshID)
74 map<int,SMESHDS_Mesh*>::iterator it=myMeshes.find(MeshID);
75 if (it==myMeshes.end())
76 MESSAGE("SMESHDS_Document::RemoveMesh : ID not found");
80 //=======================================================================
81 //function : AddHypothesis
83 //=======================================================================
84 void SMESHDS_Document::AddHypothesis(SMESHDS_Hypothesis * H)
86 myHypothesis[H->GetID()]=H;
89 //=======================================================================
90 //function : GetHypothesis
92 //=======================================================================
93 SMESHDS_Hypothesis * SMESHDS_Document::GetHypothesis(int HypID)
95 map<int,SMESHDS_Hypothesis*>::iterator it=myHypothesis.find(HypID);
96 if (it==myHypothesis.end())
98 MESSAGE("SMESHDS_Document::GetHypothesis : ID not found");
101 else return (*it).second;
104 //=======================================================================
105 //function : RemoveHypothesis
107 //=======================================================================
108 void SMESHDS_Document::RemoveHypothesis(int HypID)
110 map<int,SMESHDS_Hypothesis*>::iterator it=myHypothesis.find(HypID);
111 if (it==myHypothesis.end())
112 MESSAGE("SMESHDS_Document::RemoveHypothesis : ID not found");
113 myHypothesis.erase(it);
116 //=======================================================================
117 //function : NbMeshes
119 //=======================================================================
120 int SMESHDS_Document::NbMeshes()
122 return myMeshes.size();
125 //=======================================================================
126 //function : NbHypothesis
128 //=======================================================================
129 int SMESHDS_Document::NbHypothesis()
131 return myHypothesis.size();
134 //=======================================================================
135 //function : InitMeshesIterator
137 //=======================================================================
138 void SMESHDS_Document::InitMeshesIterator()
140 myMeshesIt=myMeshes.begin();
143 //=======================================================================
144 //function : NextMesh
146 //=======================================================================
147 SMESHDS_Mesh * SMESHDS_Document::NextMesh()
149 SMESHDS_Mesh * toReturn=(*myMeshesIt).second;
154 //=======================================================================
155 //function : MoreMesh
157 //=======================================================================
158 bool SMESHDS_Document::MoreMesh()
160 return myMeshesIt!=myMeshes.end();
163 //=======================================================================
164 //function : InitHypothesisIterator
166 //=======================================================================
167 void SMESHDS_Document::InitHypothesisIterator()
169 myHypothesisIt=myHypothesis.begin();
172 //=======================================================================
173 //function : NextMesh
175 //=======================================================================
176 SMESHDS_Hypothesis * SMESHDS_Document::NextHypothesis()
178 SMESHDS_Hypothesis * toReturn=(*myHypothesisIt).second;
183 //=======================================================================
184 //function : MoreMesh
186 //=======================================================================
187 bool SMESHDS_Document::MoreHypothesis()
189 return myHypothesisIt!=myHypothesis.end();