Salome HOME
Remove Opencascade dependencies. Change to STL.
[modules/smesh.git] / src / SMESHDS / SMESHDS_Command.cxx
1 //  SMESH SMESHDS : management of mesh data and SMESH document
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESH_Command.cxx
25 //  Author : Yves FRICAUD, OCC
26 //  Module : SMESH
27 //  $Header: 
28
29 using namespace std;
30 #include "SMESHDS_Command.hxx"
31 #include "utilities.h"
32
33 //=======================================================================
34 //function : 
35 //purpose  : 
36 //=======================================================================
37 SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
38 myNumber(0)
39 {
40 }
41
42 //=======================================================================
43 //function : 
44 //purpose  : 
45 //=======================================================================
46 void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
47 {
48         if (!myType == SMESHDS_AddNode)
49         {
50                 MESSAGE("SMESHDS_Command::AddNode : Bad Type");
51                 return;
52         }
53         myIntegers.push_back(NewNodeID);
54         myReals.push_back(x);
55         myReals.push_back(y);
56         myReals.push_back(z);
57         myNumber++;
58 }
59
60 //=======================================================================
61 //function : 
62 //purpose  : 
63 //=======================================================================
64 void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
65 {
66         if (!myType == SMESHDS_MoveNode)
67         {
68                 MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
69                 return;
70         }
71         myIntegers.push_back(NodeID);
72         myReals.push_back(x);
73         myReals.push_back(y);
74         myReals.push_back(z);
75         myNumber++;
76 }
77
78 //=======================================================================
79 //function : 
80 //purpose  : 
81 //=======================================================================
82 void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
83 {
84         if (!myType == SMESHDS_AddEdge)
85         {
86                 MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
87                 return;
88         }
89         myIntegers.push_back(NewEdgeID);
90         myIntegers.push_back(idnode1);
91         myIntegers.push_back(idnode2);
92         myNumber++;
93 }
94
95 //=======================================================================
96 //function : 
97 //purpose  : 
98 //=======================================================================
99 void SMESHDS_Command::AddFace(int NewFaceID,
100         int idnode1, int idnode2, int idnode3)
101 {
102         if (!myType == SMESHDS_AddTriangle)
103         {
104                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
105                 return;
106         }
107         myIntegers.push_back(NewFaceID);
108         myIntegers.push_back(idnode1);
109         myIntegers.push_back(idnode2);
110         myIntegers.push_back(idnode3);
111         myNumber++;
112 }
113
114 //=======================================================================
115 //function : 
116 //purpose  : 
117 //=======================================================================
118 void SMESHDS_Command::AddFace(int NewFaceID,
119         int idnode1, int idnode2, int idnode3, int idnode4)
120 {
121         if (!myType == SMESHDS_AddQuadrangle)
122         {
123                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
124                 return;
125         }
126         myIntegers.push_back(NewFaceID);
127         myIntegers.push_back(idnode1);
128         myIntegers.push_back(idnode2);
129         myIntegers.push_back(idnode3);
130         myIntegers.push_back(idnode4);
131         myNumber++;
132 }
133
134 //=======================================================================
135 //function : 
136 //purpose  : 
137 //=======================================================================
138 void SMESHDS_Command::AddVolume(int NewVolID,
139         int idnode1, int idnode2, int idnode3, int idnode4)
140 {
141         if (!myType == SMESHDS_AddTetrahedron)
142         {
143                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
144                 return;
145         }
146         myIntegers.push_back(NewVolID);
147         myIntegers.push_back(idnode1);
148         myIntegers.push_back(idnode2);
149         myIntegers.push_back(idnode3);
150         myIntegers.push_back(idnode4);
151         myNumber++;
152 }
153
154 //=======================================================================
155 //function : 
156 //purpose  : 
157 //=======================================================================
158 void SMESHDS_Command::AddVolume(int NewVolID,
159         int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
160 {
161         if (!myType == SMESHDS_AddPyramid)
162         {
163                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
164                 return;
165         }
166         myIntegers.push_back(NewVolID);
167         myIntegers.push_back(idnode1);
168         myIntegers.push_back(idnode2);
169         myIntegers.push_back(idnode3);
170         myIntegers.push_back(idnode4);
171         myIntegers.push_back(idnode5);
172         myNumber++;
173 }
174
175 //=======================================================================
176 //function : 
177 //purpose  : 
178 //=======================================================================
179 void SMESHDS_Command::AddVolume(int NewVolID,
180         int idnode1,
181         int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
182 {
183         if (!myType == SMESHDS_AddPrism)
184         {
185                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
186                 return;
187         }
188         myIntegers.push_back(NewVolID);
189         myIntegers.push_back(idnode1);
190         myIntegers.push_back(idnode2);
191         myIntegers.push_back(idnode3);
192         myIntegers.push_back(idnode4);
193         myIntegers.push_back(idnode5);
194         myIntegers.push_back(idnode6);
195         myNumber++;
196 }
197
198 //=======================================================================
199 //function : 
200 //purpose  : 
201 //=======================================================================
202 void SMESHDS_Command::AddVolume(int NewVolID,
203         int idnode1,
204         int idnode2,
205         int idnode3,
206         int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
207 {
208         if (!myType == SMESHDS_AddHexahedron)
209         {
210                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
211                 return;
212         }
213         myIntegers.push_back(NewVolID);
214         myIntegers.push_back(idnode1);
215         myIntegers.push_back(idnode2);
216         myIntegers.push_back(idnode3);
217         myIntegers.push_back(idnode4);
218         myIntegers.push_back(idnode5);
219         myIntegers.push_back(idnode6);
220         myIntegers.push_back(idnode7);
221         myIntegers.push_back(idnode8);
222         myNumber++;
223 }
224
225 //=======================================================================
226 //function : 
227 //purpose  : 
228 //=======================================================================
229 void SMESHDS_Command::RemoveNode(int NodeID)
230 {
231         if (!myType == SMESHDS_RemoveNode)
232         {
233                 MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
234                 return;
235         }
236         myIntegers.push_back(NodeID);
237         myNumber++;
238 }
239
240 //=======================================================================
241 //function : 
242 //purpose  : 
243 //=======================================================================
244 void SMESHDS_Command::RemoveElement(int ElementID)
245 {
246         if (!myType == SMESHDS_RemoveElement)
247         {
248                 MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
249                 return;
250         }
251         myIntegers.push_back(ElementID);
252         myNumber++;
253 }
254
255 //=======================================================================
256 //function : 
257 //purpose  : 
258 //=======================================================================
259 SMESHDS_CommandType SMESHDS_Command::GetType()
260 {
261         return myType;
262 }
263
264 //=======================================================================
265 //function : 
266 //purpose  : 
267 //=======================================================================
268 int SMESHDS_Command::GetNumber()
269 {
270         return myNumber;
271 }
272
273 //=======================================================================
274 //function : 
275 //purpose  : 
276 //=======================================================================
277 const list < int >&SMESHDS_Command::GetIndexes()
278 {
279         return myIntegers;
280 }
281
282 //=======================================================================
283 //function : 
284 //purpose  : 
285 //=======================================================================
286 const list < double >&SMESHDS_Command::GetCoords()
287 {
288         return myReals;
289 }