Salome HOME
+ /*!
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
23 //  File   : SMESH_MeshEditor_i.hxx
24 //  Author : Nicolas REJNERI
25 //  Module : SMESH
26 //
27 #ifndef _SMESH_MESHEDITOR_I_HXX_
28 #define _SMESH_MESHEDIOTR_I_HXX_
29
30 #include "SMESH.hxx"
31
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
34
35 #include "SMESH_Mesh.hxx"
36 #include "SMESH_PythonDump.hxx"
37 #include <list>
38
39 class SMESH_MeshEditor;
40 class SMESH_Mesh_i;
41
42 class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
43 {
44 public:
45   SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
46
47   virtual ~ SMESH_MeshEditor_i();
48
49   // --- CORBA
50
51   /*!
52    * \brief Wrap a sequence of ids in a SMESH_IDSource
53    */
54   SMESH::SMESH_IDSource_ptr MakeIDSource(const SMESH::long_array& IDsOfElements);
55
56   CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
57   CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
58
59   /*!
60    * Methods for creation new elements.
61    * Returns ID of created element or 0 if element not created
62    */
63   CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
64   CORBA::Long Add0DElement(CORBA::Long IDOfNode);
65   CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
66   CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
67   CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
68   CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
69   CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
70                                   const SMESH::long_array & Quantities);
71   CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
72
73   /*!
74    * \brief Bind a node to a vertex
75    * \param NodeID - node ID
76    * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
77    */
78   void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
79     throw (SALOME::SALOME_Exception);
80   /*!
81    * \brief Store node position on an edge
82    * \param NodeID - node ID
83    * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
84    * \param paramOnEdge - parameter on edge where the node is located
85    */
86   void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
87                      CORBA::Double paramOnEdge)
88     throw (SALOME::SALOME_Exception);
89   /*!
90    * \brief Store node position on a face
91    * \param NodeID - node ID
92    * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
93    * \param u - U parameter on face where the node is located
94    * \param v - V parameter on face where the node is located
95    */
96   void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
97                      CORBA::Double u, CORBA::Double v)
98     throw (SALOME::SALOME_Exception);
99   /*!
100    * \brief Bind a node to a solid
101    * \param NodeID - node ID
102    * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
103    */
104   void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
105     throw (SALOME::SALOME_Exception);
106   /*!
107    * \brief Bind an element to a shape
108    * \param ElementID - element ID
109    * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
110    */
111   void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
112     throw (SALOME::SALOME_Exception);
113
114
115   CORBA::Boolean MoveNode(CORBA::Long NodeID,
116                           CORBA::Double x, CORBA::Double y, CORBA::Double z);
117
118   CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
119   CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
120   CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
121   CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
122
123   // Split/Join faces
124   CORBA::Boolean TriToQuad       (const SMESH::long_array &   IDsOfElements,
125                                   SMESH::NumericalFunctor_ptr Criterion,
126                                   CORBA::Double               MaxAngle);
127   CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr   theObject,
128                                   SMESH::NumericalFunctor_ptr Criterion,
129                                   CORBA::Double               MaxAngle);
130   CORBA::Boolean QuadToTri       (const SMESH::long_array &   IDsOfElements,
131                                   SMESH::NumericalFunctor_ptr Criterion);
132   CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr   theObject,
133                                   SMESH::NumericalFunctor_ptr Criterion);
134   CORBA::Boolean SplitQuad       (const SMESH::long_array &   IDsOfElements,
135                                   CORBA::Boolean              Diag13);
136   CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr   theObject,
137                                   CORBA::Boolean              Diag13);
138   CORBA::Long    BestSplit       (CORBA::Long                 IDOfQuad,
139                                   SMESH::NumericalFunctor_ptr Criterion);
140
141   CORBA::Boolean Smooth(const SMESH::long_array &              IDsOfElements,
142                         const SMESH::long_array &              IDsOfFixedNodes,
143                         CORBA::Long                            MaxNbOfIterations,
144                         CORBA::Double                          MaxAspectRatio,
145                         SMESH::SMESH_MeshEditor::Smooth_Method Method);
146   CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr              theObject,
147                               const SMESH::long_array &              IDsOfFixedNodes,
148                               CORBA::Long                            MaxNbOfIterations,
149                               CORBA::Double                          MaxAspectRatio,
150                               SMESH::SMESH_MeshEditor::Smooth_Method Method);
151   CORBA::Boolean SmoothParametric(const SMESH::long_array &              IDsOfElements,
152                                   const SMESH::long_array &              IDsOfFixedNodes,
153                                   CORBA::Long                            MaxNbOfIterations,
154                                   CORBA::Double                          MaxAspectRatio,
155                                   SMESH::SMESH_MeshEditor::Smooth_Method Method);
156   CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr              theObject,
157                                         const SMESH::long_array &              IDsOfFixedNodes,
158                                         CORBA::Long                            MaxNbOfIterations,
159                                         CORBA::Double                          MaxAspectRatio,
160                                         SMESH::SMESH_MeshEditor::Smooth_Method Method);
161   CORBA::Boolean smooth(const SMESH::long_array &              IDsOfElements,
162                         const SMESH::long_array &              IDsOfFixedNodes,
163                         CORBA::Long                            MaxNbOfIterations,
164                         CORBA::Double                          MaxAspectRatio,
165                         SMESH::SMESH_MeshEditor::Smooth_Method Method,
166                         bool                                   IsParametric);
167   CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr              theObject,
168                               const SMESH::long_array &              IDsOfFixedNodes,
169                               CORBA::Long                            MaxNbOfIterations,
170                               CORBA::Double                          MaxAspectRatio,
171                               SMESH::SMESH_MeshEditor::Smooth_Method Method,
172                               bool                                   IsParametric);
173
174
175   void ConvertToQuadratic(CORBA::Boolean Force3d);
176   CORBA::Boolean ConvertFromQuadratic();
177
178   void RenumberNodes();
179   void RenumberElements();
180
181   void RotationSweep(const SMESH::long_array & IDsOfElements,
182                      const SMESH::AxisStruct & Axis,
183                      CORBA::Double             AngleInRadians,
184                      CORBA::Long               NbOfSteps,
185                      CORBA::Double             Tolerance);
186   void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
187                            const SMESH::AxisStruct & Axis,
188                            CORBA::Double             AngleInRadians,
189                            CORBA::Long               NbOfSteps,
190                            CORBA::Double             Tolerance);
191   void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
192                              const SMESH::AxisStruct & Axis,
193                              CORBA::Double             AngleInRadians,
194                              CORBA::Long               NbOfSteps,
195                              CORBA::Double             Tolerance);
196   void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
197                              const SMESH::AxisStruct & Axis,
198                              CORBA::Double             AngleInRadians,
199                              CORBA::Long               NbOfSteps,
200                              CORBA::Double             Tolerance);
201
202   void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
203                       const SMESH::DirStruct &  StepVector,
204                       CORBA::Long               NbOfSteps);
205   void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
206                             const SMESH::DirStruct &  StepVector,
207                             CORBA::Long               NbOfSteps);
208   void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
209                               const SMESH::DirStruct &  StepVector,
210                               CORBA::Long               NbOfSteps);
211   void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
212                               const SMESH::DirStruct &  StepVector,
213                               CORBA::Long               NbOfSteps);
214   void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
215                          const SMESH::DirStruct &  theStepVector,
216                          CORBA::Long               theNbOfSteps,
217                          CORBA::Long               theExtrFlags,
218                          CORBA::Double             theSewTolerance);
219
220   SMESH::SMESH_MeshEditor::Extrusion_Error
221   ExtrusionAlongPath(const SMESH::long_array &   IDsOfElements,
222                      SMESH::SMESH_Mesh_ptr       PathMesh,
223                      GEOM::GEOM_Object_ptr       PathShape,
224                      CORBA::Long                 NodeStart,
225                      CORBA::Boolean              HasAngles,
226                      const SMESH::double_array & Angles,
227                      CORBA::Boolean              HasRefPoint,
228                      const SMESH::PointStruct &  RefPoint);
229
230   SMESH::SMESH_MeshEditor::Extrusion_Error
231   ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObject,
232                            SMESH::SMESH_Mesh_ptr       PathMesh,
233                            GEOM::GEOM_Object_ptr       PathShape,
234                            CORBA::Long                 NodeStart,
235                            CORBA::Boolean              HasAngles,
236                            const SMESH::double_array & Angles,
237                            CORBA::Boolean              HasRefPoint,
238                            const SMESH::PointStruct &  RefPoint);
239   SMESH::SMESH_MeshEditor::Extrusion_Error
240   ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr   theObject,
241                              SMESH::SMESH_Mesh_ptr       PathMesh,
242                              GEOM::GEOM_Object_ptr       PathShape,
243                              CORBA::Long                 NodeStart,
244                              CORBA::Boolean              HasAngles,
245                              const SMESH::double_array & Angles,
246                              CORBA::Boolean              HasRefPoint,
247                              const SMESH::PointStruct &  RefPoint);
248   SMESH::SMESH_MeshEditor::Extrusion_Error
249   ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr   theObject,
250                              SMESH::SMESH_Mesh_ptr       PathMesh,
251                              GEOM::GEOM_Object_ptr       PathShape,
252                              CORBA::Long                 NodeStart,
253                              CORBA::Boolean              HasAngles,
254                              const SMESH::double_array & Angles,
255                              CORBA::Boolean              HasRefPoint,
256                              const SMESH::PointStruct &  RefPoint);
257
258   SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr       PathMesh,
259                                              GEOM::GEOM_Object_ptr       PathShape,
260                                              const SMESH::double_array & Angles);
261
262   void Mirror(const SMESH::long_array &           IDsOfElements,
263               const SMESH::AxisStruct &           Axis,
264               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
265               CORBA::Boolean                      Copy);
266   void MirrorObject(SMESH::SMESH_IDSource_ptr           theObject,
267                     const SMESH::AxisStruct &           Axis,
268                     SMESH::SMESH_MeshEditor::MirrorType MirrorType,
269                     CORBA::Boolean                      Copy);
270   void Translate(const SMESH::long_array & IDsOfElements,
271                  const SMESH::DirStruct &   Vector,
272                  CORBA::Boolean            Copy);
273   void TranslateObject(SMESH::SMESH_IDSource_ptr  theObject,
274                        const SMESH::DirStruct &   Vector,
275                        CORBA::Boolean             Copy);
276   void Rotate(const SMESH::long_array & IDsOfElements,
277               const SMESH::AxisStruct &  Axis,
278               CORBA::Double             Angle,
279               CORBA::Boolean            Copy);
280   void RotateObject(SMESH::SMESH_IDSource_ptr  theObject,
281                     const SMESH::AxisStruct &  Axis,
282                     CORBA::Double              Angle,
283                     CORBA::Boolean             Copy);
284
285   SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
286                                                const SMESH::AxisStruct& Axix,
287                                                CORBA::Double            AngleInRadians,
288                                                CORBA::Long              NbOfSteps,
289                                                CORBA::Double            Tolerance);
290   SMESH::ListOfGroups* RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
291                                                      const SMESH::AxisStruct&  Axix,
292                                                      CORBA::Double             AngleInRadians,
293                                                      CORBA::Long               NbOfSteps,
294                                                      CORBA::Double             Tolerance);
295   SMESH::ListOfGroups* RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
296                                                        const SMESH::AxisStruct&  Axix,
297                                                        CORBA::Double             AngleInRadians,
298                                                        CORBA::Long               NbOfSteps,
299                                                        CORBA::Double             Tolerance);
300   SMESH::ListOfGroups* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
301                                                        const SMESH::AxisStruct&  Axix,
302                                                        CORBA::Double             AngleInRadians,
303                                                        CORBA::Long               NbOfSteps,
304                                                        CORBA::Double             Tolerance);
305   SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
306                                                 const SMESH::DirStruct&  StepVector,
307                                                 CORBA::Long              NbOfSteps);
308   SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
309                                                    const SMESH::DirStruct&  StepVector,
310                                                    CORBA::Long              NbOfSteps,
311                                                    CORBA::Long              ExtrFlags,
312                                                    CORBA::Double            SewTolerance);
313   SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
314                                                       const SMESH::DirStruct&   StepVector,
315                                                       CORBA::Long               NbOfSteps);
316   SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
317                                                         const SMESH::DirStruct&   StepVector,
318                                                         CORBA::Long               NbOfSteps);
319   SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
320                                                         const SMESH::DirStruct&   StepVector,
321                                                         CORBA::Long               NbOfSteps);
322   SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array&   IDsOfElements,
323                                                     SMESH::SMESH_Mesh_ptr      PathMesh,
324                                                     GEOM::GEOM_Object_ptr      PathShape,
325                                                     CORBA::Long                NodeStart,
326                                                     CORBA::Boolean             HasAngles,
327                                                     const SMESH::double_array& Angles,
328                                                     CORBA::Boolean             HasRefPoint,
329                                                     const SMESH::PointStruct&  RefPoint,
330                                                     SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
331   SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  Object,
332                                                           SMESH::SMESH_Mesh_ptr      PathMesh,
333                                                           GEOM::GEOM_Object_ptr      PathShape,
334                                                           CORBA::Long                NodeStart,
335                                                           CORBA::Boolean             HasAngles,
336                                                           const SMESH::double_array& Angles,
337                                                           CORBA::Boolean             HasRefPoint,
338                                                           const SMESH::PointStruct&  RefPoint,
339                                                           SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
340   SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr  Object,
341                                                             SMESH::SMESH_Mesh_ptr      PathMesh,
342                                                             GEOM::GEOM_Object_ptr      PathShape,
343                                                             CORBA::Long                NodeStart,
344                                                             CORBA::Boolean             HasAngles,
345                                                             const SMESH::double_array& Angles,
346                                                             CORBA::Boolean             HasRefPoint,
347                                                             const SMESH::PointStruct&  RefPoint,
348                                                             SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
349   SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr  Object,
350                                                             SMESH::SMESH_Mesh_ptr      PathMesh,
351                                                             GEOM::GEOM_Object_ptr      PathShape,
352                                                             CORBA::Long                NodeStart,
353                                                             CORBA::Boolean             HasAngles,
354                                                             const SMESH::double_array& Angles,
355                                                             CORBA::Boolean             HasRefPoint,
356                                                             const SMESH::PointStruct&  RefPoint,
357                                                             SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
358
359   // skl 04.06.2009 
360   SMESH::ListOfGroups* ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr  Object,
361                                               SMESH::SMESH_IDSource_ptr  Path,
362                                               CORBA::Long                NodeStart,
363                                               CORBA::Boolean             HasAngles,
364                                               const SMESH::double_array& Angles,
365                                               CORBA::Boolean             LinearVariation,
366                                               CORBA::Boolean             HasRefPoint,
367                                               const SMESH::PointStruct&  RefPoint,
368                                               CORBA::Boolean             MakeGroups,
369                                               SMESH::ElementType         ElemType,
370                                               SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
371   SMESH::ListOfGroups* ExtrusionAlongPathX(const SMESH::long_array&   IDsOfElements,
372                                            SMESH::SMESH_IDSource_ptr  Path,
373                                            CORBA::Long                NodeStart,
374                                            CORBA::Boolean             HasAngles,
375                                            const SMESH::double_array& Angles,
376                                            CORBA::Boolean             LinearVariation,
377                                            CORBA::Boolean             HasRefPoint,
378                                            const SMESH::PointStruct&  RefPoint,
379                                            CORBA::Boolean             MakeGroups,
380                                            SMESH::ElementType         ElemType,
381                                            SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
382
383   SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array&            IDsOfElements,
384                                         const SMESH::AxisStruct&            Mirror,
385                                         SMESH::SMESH_MeshEditor::MirrorType MirrorType);
386   SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           Object,
387                                               const SMESH::AxisStruct&            Mirror,
388                                               SMESH::SMESH_MeshEditor::MirrorType MirrorType);
389   SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
390                                            const SMESH::DirStruct&  Vector);
391   SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
392                                                  const SMESH::DirStruct&   Vector);
393   SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
394                                         const SMESH::AxisStruct& Axis,
395                                         CORBA::Double            AngleInRadians);
396   SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
397                                               const SMESH::AxisStruct&  Axis,
398                                               CORBA::Double             AngleInRadians);
399
400   SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array&            IDsOfElements,
401                                        const SMESH::AxisStruct&            Mirror,
402                                        SMESH::SMESH_MeshEditor::MirrorType MirrorType,
403                                        CORBA::Boolean                      CopyGroups,
404                                        const char*                         MeshName);
405   SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           Object,
406                                              const SMESH::AxisStruct&            Mirror,
407                                              SMESH::SMESH_MeshEditor::MirrorType MirrorType,
408                                              CORBA::Boolean                      CopyGroups,
409                                              const char*                         MeshName);
410   SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
411                                           const SMESH::DirStruct&  Vector,
412                                           CORBA::Boolean           CopyGroups,
413                                           const char*              MeshName);
414   SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
415                                                 const SMESH::DirStruct&   Vector,
416                                                 CORBA::Boolean            CopyGroups,
417                                                 const char*               MeshName);
418   SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
419                                        const SMESH::AxisStruct& Axis,
420                                        CORBA::Double            AngleInRadians,
421                                        CORBA::Boolean           CopyGroups,
422                                        const char*              MeshName);
423   SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
424                                              const SMESH::AxisStruct&  Axis,
425                                              CORBA::Double             AngleInRadians,
426                                              CORBA::Boolean            CopyGroups,
427                                              const char*               MeshName);
428
429   void FindCoincidentNodes (CORBA::Double                  Tolerance,
430                             SMESH::array_of_long_array_out GroupsOfNodes);
431   void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr      Object,
432                                  CORBA::Double                  Tolerance,
433                                  SMESH::array_of_long_array_out GroupsOfNodes);
434   void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
435   void FindEqualElements(SMESH::SMESH_IDSource_ptr      Object,
436                          SMESH::array_of_long_array_out GroupsOfElementsID);
437   void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
438   void MergeEqualElements();
439   CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
440                                      CORBA::Double y,
441                                      CORBA::Double z,
442                                      CORBA::Long   nodeID);
443   /*!
444    * \brief Return ID of node closest to a given point
445    */
446   CORBA::Long FindNodeClosestTo(CORBA::Double x,
447                                 CORBA::Double y,
448                                 CORBA::Double z);
449   /*!
450    * Return elements of given type where the given point is IN or ON.
451    *
452    * 'ALL' type means elements of any type excluding nodes
453    */
454   SMESH::long_array* FindElementsByPoint(CORBA::Double      x,
455                                          CORBA::Double      y,
456                                          CORBA::Double      z,
457                                          SMESH::ElementType type);
458
459
460   SMESH::SMESH_MeshEditor::Sew_Error
461   SewFreeBorders(CORBA::Long FirstNodeID1,
462                  CORBA::Long SecondNodeID1,
463                  CORBA::Long LastNodeID1,
464                  CORBA::Long FirstNodeID2,
465                  CORBA::Long SecondNodeID2,
466                  CORBA::Long LastNodeID2,
467                  CORBA::Boolean CreatePolygons,
468                  CORBA::Boolean CreatePolyedrs);
469   SMESH::SMESH_MeshEditor::Sew_Error
470   SewConformFreeBorders(CORBA::Long FirstNodeID1,
471                         CORBA::Long SecondNodeID1,
472                         CORBA::Long LastNodeID1,
473                         CORBA::Long FirstNodeID2,
474                         CORBA::Long SecondNodeID2);
475   SMESH::SMESH_MeshEditor::Sew_Error
476   SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
477                   CORBA::Long SecondNodeIDOnFreeBorder,
478                   CORBA::Long LastNodeIDOnFreeBorder,
479                   CORBA::Long FirstNodeIDOnSide,
480                   CORBA::Long LastNodeIDOnSide,
481                   CORBA::Boolean CreatePolygons,
482                   CORBA::Boolean CreatePolyedrs);
483   SMESH::SMESH_MeshEditor::Sew_Error
484   SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
485                   const SMESH::long_array& IDsOfSide2Elements,
486                   CORBA::Long NodeID1OfSide1ToMerge,
487                   CORBA::Long NodeID1OfSide2ToMerge,
488                   CORBA::Long NodeID2OfSide1ToMerge,
489                   CORBA::Long NodeID2OfSide2ToMerge);
490
491   /*!
492    * Set new nodes for given element.
493    * If number of nodes is not corresponded to type of
494    * element - returns false
495    */
496   CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
497
498   /*!
499    * Return data of mesh edition preview
500    */
501   SMESH::MeshPreviewStruct* GetPreviewData();
502
503   /*!
504    * If during last operation of MeshEditor some nodes were
505    * created this method returns list of it's IDs, if new nodes
506    * not creared - returns empty list
507    */
508   SMESH::long_array* GetLastCreatedNodes();
509
510   /*!
511    * If during last operation of MeshEditor some elements were
512    * created this method returns list of it's IDs, if new elements
513    * not creared - returns empty list
514    */
515   SMESH::long_array* GetLastCreatedElems();
516
517   /*!
518    * \brief Return edited mesh ID
519    * \retval int - mesh ID
520    */
521   int GetMeshId() const { return myMesh->GetId(); }
522
523  CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
524                               const SMESH::long_array& theModifiedElems );
525
526   CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
527                              const SMESH::long_array& theModifiedElems );
528
529   CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
530                                   SMESH::SMESH_GroupBase_ptr theModifiedElems );
531
532   CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
533                                    const SMESH::ListOfGroups& theModifiedElems);
534
535   /*!
536    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
537    * \param theElems - the list of elements (edges or faces) to be replicated
538    *       The nodes for duplication could be found from these elements
539    * \param theNodesNot - list of nodes to NOT replicate
540    * \param theAffectedElems - the list of elements (cells and edges) to which the 
541    *       replicated nodes should be associated to.
542    * \return TRUE if operation has been completed successfully, FALSE otherwise
543    * \sa DoubleNodeGroup(), DoubleNodeGroups()
544    */
545   CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems, 
546                                  const SMESH::long_array& theNodesNot,
547                                  const SMESH::long_array& theAffectedElems );
548
549   /*!
550    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
551    * \param theElems - the list of elements (edges or faces) to be replicated
552    *        The nodes for duplication could be found from these elements
553    * \param theNodesNot - list of nodes to NOT replicate
554    * \param theShape - shape to detect affected elements (element which geometric center
555    *        located on or inside shape).
556    *        The replicated nodes should be associated to affected elements.
557    * \return TRUE if operation has been completed successfully, FALSE otherwise
558    * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
559    */
560   CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems, 
561                                          const SMESH::long_array& theNodesNot,
562                                          GEOM::GEOM_Object_ptr    theShape );
563
564   /*!
565    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
566    * \param theElems - group of of elements (edges or faces) to be replicated
567    * \param theNodesNot - group of nodes not to replicated
568    * \param theAffectedElems - group of elements to which the replicated nodes
569    *        should be associated to.
570    * \return TRUE if operation has been completed successfully, FALSE otherwise
571    * \sa DoubleNodes(), DoubleNodeGroups()
572    */
573   CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
574                                       SMESH::SMESH_GroupBase_ptr theNodesNot,
575                                       SMESH::SMESH_GroupBase_ptr theAffectedElems );
576   
577   /*!
578    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
579    * \param theElems - group of of elements (edges or faces) to be replicated
580    * \param theNodesNot - group of nodes not to replicated
581    * \param theShape - shape to detect affected elements (element which geometric center
582    *        located on or inside shape).
583    *        The replicated nodes should be associated to affected elements.
584    * \return TRUE if operation has been completed successfully, FALSE otherwise
585    * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
586    */
587   CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
588                                               SMESH::SMESH_GroupBase_ptr theNodesNot,
589                                               GEOM::GEOM_Object_ptr      theShape );
590
591   /*!
592    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
593    * This method provided for convenience works as DoubleNodes() described above.
594    * \param theElems - list of groups of elements (edges or faces) to be replicated
595    * \param theNodesNot - list of groups of nodes not to replicated
596    * \param theAffectedElems - group of elements to which the replicated nodes
597    *        should be associated to.
598    * \return TRUE if operation has been completed successfully, FALSE otherwise
599    * \sa DoubleNodeGroup(), DoubleNodes()
600    */
601   CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
602                                        const SMESH::ListOfGroups& theNodesNot,
603                                        const SMESH::ListOfGroups& theAffectedElems );
604
605
606   /*!
607    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
608    * This method provided for convenience works as DoubleNodes() described above.
609    * \param theElems - list of groups of elements (edges or faces) to be replicated
610    * \param theNodesNot - list of groups of nodes not to replicated
611    * \param theShape - shape to detect affected elements (element which geometric center
612    *        located on or inside shape).
613    *        The replicated nodes should be associated to affected elements.
614    * \return TRUE if operation has been completed successfully, FALSE otherwise
615    * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
616    */
617   CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
618                                                const SMESH::ListOfGroups& theNodesNot,
619                                                GEOM::GEOM_Object_ptr      theShape );
620
621     /*!
622      * \brief Generated skin mesh (containing 2D cells) from 3D mesh
623      * The created 2D mesh elements based on nodes of free faces of boundary volumes
624      * \return TRUE if operation has been completed successfully, FALSE otherwise
625     */
626     CORBA::Boolean Make2DMeshFrom3D();
627
628  private: //!< private methods
629
630   SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
631
632   /*!
633    * \brief Update myLastCreated* or myPreviewData
634    * \param anEditor - it contains edition results
635    */
636   void storeResult(::SMESH_MeshEditor& anEditor);
637   /*!
638    * \brief Clear myLastCreated* or myPreviewData
639    */
640   void initData(bool deleteSearchers=true);
641
642   /*!
643    * \brief Return groups by their IDs
644    */
645   SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
646
647   SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
648                                      const SMESH::AxisStruct & Axis,
649                                      CORBA::Double             AngleInRadians,
650                                      CORBA::Long               NbOfSteps,
651                                      CORBA::Double             Tolerance,
652                                      const bool                MakeGroups,
653                                      const SMDSAbs_ElementType ElementType=SMDSAbs_All);
654   SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
655                                       const SMESH::DirStruct &  StepVector,
656                                       CORBA::Long               NbOfSteps,
657                                       const bool                MakeGroups,
658                                       const SMDSAbs_ElementType ElementType=SMDSAbs_All);
659   SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
660                                          const SMESH::DirStruct &  theStepVector,
661                                          CORBA::Long               theNbOfSteps,
662                                          CORBA::Long               theExtrFlags,
663                                          CORBA::Double             theSewTolerance,
664                                          const bool                MakeGroups);
665   SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array &   IDsOfElements,
666                                           SMESH::SMESH_Mesh_ptr       PathMesh,
667                                           GEOM::GEOM_Object_ptr       PathShape,
668                                           CORBA::Long                 NodeStart,
669                                           CORBA::Boolean              HasAngles,
670                                           const SMESH::double_array & Angles,
671                                           CORBA::Boolean              HasRefPoint,
672                                           const SMESH::PointStruct &  RefPoint,
673                                           const bool                  MakeGroups,
674                                           SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
675                                           const SMDSAbs_ElementType   ElementType=SMDSAbs_All);
676   SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array &  IDsOfElements,
677                                            SMESH::SMESH_IDSource_ptr  Path,
678                                            CORBA::Long                NodeStart,
679                                            CORBA::Boolean             HasAngles,
680                                            const SMESH::double_array& Angles,
681                                            CORBA::Boolean             LinearVariation,
682                                            CORBA::Boolean             HasRefPoint,
683                                            const SMESH::PointStruct&  RefPoint,
684                                            const bool                 MakeGroups,
685                                            const SMDSAbs_ElementType  ElementType,
686                                            SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
687   SMESH::ListOfGroups* mirror(const SMESH::long_array &           IDsOfElements,
688                               const SMESH::AxisStruct &           Axis,
689                               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
690                               CORBA::Boolean                      Copy,
691                               const bool                          MakeGroups,
692                               ::SMESH_Mesh*                       TargetMesh=0);
693   SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
694                                  const SMESH::DirStruct &  Vector,
695                                  CORBA::Boolean            Copy,
696                                  const bool                MakeGroups,
697                                  ::SMESH_Mesh*             TargetMesh=0);
698   SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
699                               const SMESH::AxisStruct &  Axis,
700                               CORBA::Double             Angle,
701                               CORBA::Boolean            Copy,
702                               const bool                MakeGroups,
703                               ::SMESH_Mesh*             TargetMesh=0);
704
705   SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
706
707   void DumpGroupsList(SMESH::TPythonDump & theDumpPython, 
708                       const SMESH::ListOfGroups * theGroupList);
709
710 private: //!< fields
711
712   SMESH_Mesh_i*         myMesh_i;
713   SMESH_Mesh *          myMesh;
714
715   SMESH::long_array_var myLastCreatedElems;
716   SMESH::long_array_var myLastCreatedNodes;
717
718   SMESH::MeshPreviewStruct_var myPreviewData;
719   bool                         myPreviewMode;
720 };
721
722 #endif