Salome HOME
Fix PAL8562: rpath (rpath-link) option needs parameter - directory to search shared...
[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 #include "SMESHDS_Command.hxx"
30
31 #include "utilities.h"
32
33 using namespace std;
34
35 //=======================================================================
36 //function : 
37 //purpose  : 
38 //=======================================================================
39 SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
40 myNumber(0)
41 {
42 }
43
44 //=======================================================================
45 //function : 
46 //purpose  : 
47 //=======================================================================
48 void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
49 {
50         if (!myType == SMESHDS_AddNode)
51         {
52                 MESSAGE("SMESHDS_Command::AddNode : Bad Type");
53                 return;
54         }
55         myIntegers.push_back(NewNodeID);
56         myReals.push_back(x);
57         myReals.push_back(y);
58         myReals.push_back(z);
59         myNumber++;
60 }
61
62 //=======================================================================
63 //function : 
64 //purpose  : 
65 //=======================================================================
66 void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
67 {
68         if (!myType == SMESHDS_MoveNode)
69         {
70                 MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
71                 return;
72         }
73         myIntegers.push_back(NodeID);
74         myReals.push_back(x);
75         myReals.push_back(y);
76         myReals.push_back(z);
77         myNumber++;
78 }
79
80 //=======================================================================
81 //function : 
82 //purpose  : 
83 //=======================================================================
84 void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
85 {
86         if (!myType == SMESHDS_AddEdge)
87         {
88                 MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
89                 return;
90         }
91         myIntegers.push_back(NewEdgeID);
92         myIntegers.push_back(idnode1);
93         myIntegers.push_back(idnode2);
94         myNumber++;
95 }
96
97 //=======================================================================
98 //function : 
99 //purpose  : 
100 //=======================================================================
101 void SMESHDS_Command::AddFace(int NewFaceID,
102         int idnode1, int idnode2, int idnode3)
103 {
104         if (!myType == SMESHDS_AddTriangle)
105         {
106                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
107                 return;
108         }
109         myIntegers.push_back(NewFaceID);
110         myIntegers.push_back(idnode1);
111         myIntegers.push_back(idnode2);
112         myIntegers.push_back(idnode3);
113         myNumber++;
114 }
115
116 //=======================================================================
117 //function : 
118 //purpose  : 
119 //=======================================================================
120 void SMESHDS_Command::AddFace(int NewFaceID,
121         int idnode1, int idnode2, int idnode3, int idnode4)
122 {
123         if (!myType == SMESHDS_AddQuadrangle)
124         {
125                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
126                 return;
127         }
128         myIntegers.push_back(NewFaceID);
129         myIntegers.push_back(idnode1);
130         myIntegers.push_back(idnode2);
131         myIntegers.push_back(idnode3);
132         myIntegers.push_back(idnode4);
133         myNumber++;
134 }
135
136 //=======================================================================
137 //function : 
138 //purpose  : 
139 //=======================================================================
140 void SMESHDS_Command::AddVolume(int NewVolID,
141         int idnode1, int idnode2, int idnode3, int idnode4)
142 {
143         if (!myType == SMESHDS_AddTetrahedron)
144         {
145                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
146                 return;
147         }
148         myIntegers.push_back(NewVolID);
149         myIntegers.push_back(idnode1);
150         myIntegers.push_back(idnode2);
151         myIntegers.push_back(idnode3);
152         myIntegers.push_back(idnode4);
153         myNumber++;
154 }
155
156 //=======================================================================
157 //function : 
158 //purpose  : 
159 //=======================================================================
160 void SMESHDS_Command::AddVolume(int NewVolID,
161         int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
162 {
163         if (!myType == SMESHDS_AddPyramid)
164         {
165                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
166                 return;
167         }
168         myIntegers.push_back(NewVolID);
169         myIntegers.push_back(idnode1);
170         myIntegers.push_back(idnode2);
171         myIntegers.push_back(idnode3);
172         myIntegers.push_back(idnode4);
173         myIntegers.push_back(idnode5);
174         myNumber++;
175 }
176
177 //=======================================================================
178 //function : 
179 //purpose  : 
180 //=======================================================================
181 void SMESHDS_Command::AddVolume(int NewVolID,
182         int idnode1,
183         int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
184 {
185         if (!myType == SMESHDS_AddPrism)
186         {
187                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
188                 return;
189         }
190         myIntegers.push_back(NewVolID);
191         myIntegers.push_back(idnode1);
192         myIntegers.push_back(idnode2);
193         myIntegers.push_back(idnode3);
194         myIntegers.push_back(idnode4);
195         myIntegers.push_back(idnode5);
196         myIntegers.push_back(idnode6);
197         myNumber++;
198 }
199
200 //=======================================================================
201 //function : 
202 //purpose  : 
203 //=======================================================================
204 void SMESHDS_Command::AddVolume(int NewVolID,
205         int idnode1,
206         int idnode2,
207         int idnode3,
208         int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
209 {
210         if (!myType == SMESHDS_AddHexahedron)
211         {
212                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
213                 return;
214         }
215         myIntegers.push_back(NewVolID);
216         myIntegers.push_back(idnode1);
217         myIntegers.push_back(idnode2);
218         myIntegers.push_back(idnode3);
219         myIntegers.push_back(idnode4);
220         myIntegers.push_back(idnode5);
221         myIntegers.push_back(idnode6);
222         myIntegers.push_back(idnode7);
223         myIntegers.push_back(idnode8);
224         myNumber++;
225 }
226
227 //=======================================================================
228 //function : 
229 //purpose  : 
230 //=======================================================================
231 void SMESHDS_Command::RemoveNode(int NodeID)
232 {
233         if (!myType == SMESHDS_RemoveNode)
234         {
235                 MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
236                 return;
237         }
238         myIntegers.push_back(NodeID);
239         myNumber++;
240 }
241
242 //=======================================================================
243 //function : 
244 //purpose  : 
245 //=======================================================================
246 void SMESHDS_Command::RemoveElement(int ElementID)
247 {
248         if (!myType == SMESHDS_RemoveElement)
249         {
250                 MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
251                 return;
252         }
253         myIntegers.push_back(ElementID);
254         myNumber++;
255 }
256
257 //=======================================================================
258 //function : ChangeElementNodes
259 //purpose  : 
260 //=======================================================================
261
262 void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
263 {
264   if (!myType == SMESHDS_ChangeElementNodes)
265   {
266     MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
267     return;
268   }
269   myIntegers.push_back(ElementID);
270   myIntegers.push_back(nbnodes);
271   for ( int i = 0; i < nbnodes; i++ )
272     myIntegers.push_back( nodes[ i ] );
273
274   myNumber++;
275 }
276
277 //=======================================================================
278 //function : Renumber
279 //purpose  : 
280 //=======================================================================
281
282 void SMESHDS_Command::Renumber (const bool isNodes, const int startID, const int deltaID)
283 {
284   if (!myType == SMESHDS_Renumber)
285   {
286     MESSAGE("SMESHDS_Command::Renumber : Bad Type");
287     return;
288   }
289   myIntegers.push_back(isNodes);
290   myIntegers.push_back(startID);
291   myIntegers.push_back(deltaID);
292   myNumber++;
293 }
294
295 //=======================================================================
296 //function : 
297 //purpose  : 
298 //=======================================================================
299 SMESHDS_CommandType SMESHDS_Command::GetType()
300 {
301         return myType;
302 }
303
304 //=======================================================================
305 //function : 
306 //purpose  : 
307 //=======================================================================
308 int SMESHDS_Command::GetNumber()
309 {
310         return myNumber;
311 }
312
313 //=======================================================================
314 //function : 
315 //purpose  : 
316 //=======================================================================
317 const list < int >&SMESHDS_Command::GetIndexes()
318 {
319         return myIntegers;
320 }
321
322 //=======================================================================
323 //function : 
324 //purpose  : 
325 //=======================================================================
326 const list < double >&SMESHDS_Command::GetCoords()
327 {
328         return myReals;
329 }