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 : SMESH_Command.cxx
25 // Author : Yves FRICAUD, OCC
29 #include "SMESHDS_Command.hxx"
31 #include "utilities.h"
35 //=======================================================================
38 //=======================================================================
39 SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
44 //=======================================================================
47 //=======================================================================
48 void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
50 if (!myType == SMESHDS_AddNode)
52 MESSAGE("SMESHDS_Command::AddNode : Bad Type");
55 myIntegers.push_back(NewNodeID);
62 //=======================================================================
65 //=======================================================================
66 void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
68 if (!myType == SMESHDS_MoveNode)
70 MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
73 myIntegers.push_back(NodeID);
80 //=======================================================================
83 //=======================================================================
84 void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
86 if (!myType == SMESHDS_AddEdge)
88 MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
91 myIntegers.push_back(NewEdgeID);
92 myIntegers.push_back(idnode1);
93 myIntegers.push_back(idnode2);
97 //=======================================================================
100 //=======================================================================
101 void SMESHDS_Command::AddFace(int NewFaceID,
102 int idnode1, int idnode2, int idnode3)
104 if (!myType == SMESHDS_AddTriangle)
106 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
109 myIntegers.push_back(NewFaceID);
110 myIntegers.push_back(idnode1);
111 myIntegers.push_back(idnode2);
112 myIntegers.push_back(idnode3);
116 //=======================================================================
119 //=======================================================================
120 void SMESHDS_Command::AddFace(int NewFaceID,
121 int idnode1, int idnode2, int idnode3, int idnode4)
123 if (!myType == SMESHDS_AddQuadrangle)
125 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
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);
136 //=======================================================================
139 //=======================================================================
140 void SMESHDS_Command::AddVolume(int NewVolID,
141 int idnode1, int idnode2, int idnode3, int idnode4)
143 if (!myType == SMESHDS_AddTetrahedron)
145 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
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);
156 //=======================================================================
159 //=======================================================================
160 void SMESHDS_Command::AddVolume(int NewVolID,
161 int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
163 if (!myType == SMESHDS_AddPyramid)
165 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
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);
177 //=======================================================================
180 //=======================================================================
181 void SMESHDS_Command::AddVolume(int NewVolID,
183 int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
185 if (!myType == SMESHDS_AddPrism)
187 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
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);
200 //=======================================================================
203 //=======================================================================
204 void SMESHDS_Command::AddVolume(int NewVolID,
208 int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
210 if (!myType == SMESHDS_AddHexahedron)
212 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
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);
227 //=======================================================================
230 //=======================================================================
231 void SMESHDS_Command::RemoveNode(int NodeID)
233 if (!myType == SMESHDS_RemoveNode)
235 MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
238 myIntegers.push_back(NodeID);
242 //=======================================================================
245 //=======================================================================
246 void SMESHDS_Command::RemoveElement(int ElementID)
248 if (!myType == SMESHDS_RemoveElement)
250 MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
253 myIntegers.push_back(ElementID);
257 //=======================================================================
258 //function : ChangeElementNodes
260 //=======================================================================
262 void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
264 if (!myType == SMESHDS_ChangeElementNodes)
266 MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
269 myIntegers.push_back(ElementID);
270 myIntegers.push_back(nbnodes);
271 for ( int i = 0; i < nbnodes; i++ )
272 myIntegers.push_back( nodes[ i ] );
277 //=======================================================================
278 //function : Renumber
280 //=======================================================================
282 void SMESHDS_Command::Renumber (const bool isNodes, const int startID, const int deltaID)
284 if (!myType == SMESHDS_Renumber)
286 MESSAGE("SMESHDS_Command::Renumber : Bad Type");
289 myIntegers.push_back(isNodes);
290 myIntegers.push_back(startID);
291 myIntegers.push_back(deltaID);
295 //=======================================================================
298 //=======================================================================
299 SMESHDS_CommandType SMESHDS_Command::GetType()
304 //=======================================================================
307 //=======================================================================
308 int SMESHDS_Command::GetNumber()
313 //=======================================================================
316 //=======================================================================
317 const list < int >&SMESHDS_Command::GetIndexes()
322 //=======================================================================
325 //=======================================================================
326 const list < double >&SMESHDS_Command::GetCoords()