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