Salome HOME
0020749: EDF 1291 SMESH : Create 2D Mesh from 2D improvement
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.hxx
1 //  Copyright (C) 2007-2010  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
183   void RenumberNodes();
184   void RenumberElements();
185
186   void RotationSweep(const SMESH::long_array & IDsOfElements,
187                      const SMESH::AxisStruct & Axis,
188                      CORBA::Double             AngleInRadians,
189                      CORBA::Long               NbOfSteps,
190                      CORBA::Double             Tolerance);
191   void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
192                            const SMESH::AxisStruct & Axis,
193                            CORBA::Double             AngleInRadians,
194                            CORBA::Long               NbOfSteps,
195                            CORBA::Double             Tolerance);
196   void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
197                              const SMESH::AxisStruct & Axis,
198                              CORBA::Double             AngleInRadians,
199                              CORBA::Long               NbOfSteps,
200                              CORBA::Double             Tolerance);
201   void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
202                              const SMESH::AxisStruct & Axis,
203                              CORBA::Double             AngleInRadians,
204                              CORBA::Long               NbOfSteps,
205                              CORBA::Double             Tolerance);
206
207   void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
208                       const SMESH::DirStruct &  StepVector,
209                       CORBA::Long               NbOfSteps);
210   void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
211                             const SMESH::DirStruct &  StepVector,
212                             CORBA::Long               NbOfSteps);
213   void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
214                               const SMESH::DirStruct &  StepVector,
215                               CORBA::Long               NbOfSteps);
216   void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
217                               const SMESH::DirStruct &  StepVector,
218                               CORBA::Long               NbOfSteps);
219   void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
220                          const SMESH::DirStruct &  theStepVector,
221                          CORBA::Long               theNbOfSteps,
222                          CORBA::Long               theExtrFlags,
223                          CORBA::Double             theSewTolerance);
224
225   SMESH::SMESH_MeshEditor::Extrusion_Error
226   ExtrusionAlongPath(const SMESH::long_array &   IDsOfElements,
227                      SMESH::SMESH_Mesh_ptr       PathMesh,
228                      GEOM::GEOM_Object_ptr       PathShape,
229                      CORBA::Long                 NodeStart,
230                      CORBA::Boolean              HasAngles,
231                      const SMESH::double_array & Angles,
232                      CORBA::Boolean              HasRefPoint,
233                      const SMESH::PointStruct &  RefPoint);
234
235   SMESH::SMESH_MeshEditor::Extrusion_Error
236   ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObject,
237                            SMESH::SMESH_Mesh_ptr       PathMesh,
238                            GEOM::GEOM_Object_ptr       PathShape,
239                            CORBA::Long                 NodeStart,
240                            CORBA::Boolean              HasAngles,
241                            const SMESH::double_array & Angles,
242                            CORBA::Boolean              HasRefPoint,
243                            const SMESH::PointStruct &  RefPoint);
244   SMESH::SMESH_MeshEditor::Extrusion_Error
245   ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr   theObject,
246                              SMESH::SMESH_Mesh_ptr       PathMesh,
247                              GEOM::GEOM_Object_ptr       PathShape,
248                              CORBA::Long                 NodeStart,
249                              CORBA::Boolean              HasAngles,
250                              const SMESH::double_array & Angles,
251                              CORBA::Boolean              HasRefPoint,
252                              const SMESH::PointStruct &  RefPoint);
253   SMESH::SMESH_MeshEditor::Extrusion_Error
254   ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr   theObject,
255                              SMESH::SMESH_Mesh_ptr       PathMesh,
256                              GEOM::GEOM_Object_ptr       PathShape,
257                              CORBA::Long                 NodeStart,
258                              CORBA::Boolean              HasAngles,
259                              const SMESH::double_array & Angles,
260                              CORBA::Boolean              HasRefPoint,
261                              const SMESH::PointStruct &  RefPoint);
262
263   SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr       PathMesh,
264                                              GEOM::GEOM_Object_ptr       PathShape,
265                                              const SMESH::double_array & Angles);
266
267   void Mirror(const SMESH::long_array &           IDsOfElements,
268               const SMESH::AxisStruct &           Axis,
269               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
270               CORBA::Boolean                      Copy);
271   void MirrorObject(SMESH::SMESH_IDSource_ptr           theObject,
272                     const SMESH::AxisStruct &           Axis,
273                     SMESH::SMESH_MeshEditor::MirrorType MirrorType,
274                     CORBA::Boolean                      Copy);
275   void Translate(const SMESH::long_array & IDsOfElements,
276                  const SMESH::DirStruct &   Vector,
277                  CORBA::Boolean            Copy);
278   void TranslateObject(SMESH::SMESH_IDSource_ptr  theObject,
279                        const SMESH::DirStruct &   Vector,
280                        CORBA::Boolean             Copy);
281   void Rotate(const SMESH::long_array & IDsOfElements,
282               const SMESH::AxisStruct &  Axis,
283               CORBA::Double             Angle,
284               CORBA::Boolean            Copy);
285   void RotateObject(SMESH::SMESH_IDSource_ptr  theObject,
286                     const SMESH::AxisStruct &  Axis,
287                     CORBA::Double              Angle,
288                     CORBA::Boolean             Copy);
289
290   SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
291                                                const SMESH::AxisStruct& Axix,
292                                                CORBA::Double            AngleInRadians,
293                                                CORBA::Long              NbOfSteps,
294                                                CORBA::Double            Tolerance);
295   SMESH::ListOfGroups* RotationSweepObjectMakeGroups(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* RotationSweepObject1DMakeGroups(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* RotationSweepObject2DMakeGroups(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* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
311                                                 const SMESH::DirStruct&  StepVector,
312                                                 CORBA::Long              NbOfSteps);
313   SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
314                                                    const SMESH::DirStruct&  StepVector,
315                                                    CORBA::Long              NbOfSteps,
316                                                    CORBA::Long              ExtrFlags,
317                                                    CORBA::Double            SewTolerance);
318   SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
319                                                       const SMESH::DirStruct&   StepVector,
320                                                       CORBA::Long               NbOfSteps);
321   SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
322                                                         const SMESH::DirStruct&   StepVector,
323                                                         CORBA::Long               NbOfSteps);
324   SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
325                                                         const SMESH::DirStruct&   StepVector,
326                                                         CORBA::Long               NbOfSteps);
327   SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array&   IDsOfElements,
328                                                     SMESH::SMESH_Mesh_ptr      PathMesh,
329                                                     GEOM::GEOM_Object_ptr      PathShape,
330                                                     CORBA::Long                NodeStart,
331                                                     CORBA::Boolean             HasAngles,
332                                                     const SMESH::double_array& Angles,
333                                                     CORBA::Boolean             HasRefPoint,
334                                                     const SMESH::PointStruct&  RefPoint,
335                                                     SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
336   SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr  Object,
337                                                           SMESH::SMESH_Mesh_ptr      PathMesh,
338                                                           GEOM::GEOM_Object_ptr      PathShape,
339                                                           CORBA::Long                NodeStart,
340                                                           CORBA::Boolean             HasAngles,
341                                                           const SMESH::double_array& Angles,
342                                                           CORBA::Boolean             HasRefPoint,
343                                                           const SMESH::PointStruct&  RefPoint,
344                                                           SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
345   SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr  Object,
346                                                             SMESH::SMESH_Mesh_ptr      PathMesh,
347                                                             GEOM::GEOM_Object_ptr      PathShape,
348                                                             CORBA::Long                NodeStart,
349                                                             CORBA::Boolean             HasAngles,
350                                                             const SMESH::double_array& Angles,
351                                                             CORBA::Boolean             HasRefPoint,
352                                                             const SMESH::PointStruct&  RefPoint,
353                                                             SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
354   SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr  Object,
355                                                             SMESH::SMESH_Mesh_ptr      PathMesh,
356                                                             GEOM::GEOM_Object_ptr      PathShape,
357                                                             CORBA::Long                NodeStart,
358                                                             CORBA::Boolean             HasAngles,
359                                                             const SMESH::double_array& Angles,
360                                                             CORBA::Boolean             HasRefPoint,
361                                                             const SMESH::PointStruct&  RefPoint,
362                                                             SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
363
364   // skl 04.06.2009 
365   SMESH::ListOfGroups* ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr  Object,
366                                               SMESH::SMESH_IDSource_ptr  Path,
367                                               CORBA::Long                NodeStart,
368                                               CORBA::Boolean             HasAngles,
369                                               const SMESH::double_array& Angles,
370                                               CORBA::Boolean             LinearVariation,
371                                               CORBA::Boolean             HasRefPoint,
372                                               const SMESH::PointStruct&  RefPoint,
373                                               CORBA::Boolean             MakeGroups,
374                                               SMESH::ElementType         ElemType,
375                                               SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
376   SMESH::ListOfGroups* ExtrusionAlongPathX(const SMESH::long_array&   IDsOfElements,
377                                            SMESH::SMESH_IDSource_ptr  Path,
378                                            CORBA::Long                NodeStart,
379                                            CORBA::Boolean             HasAngles,
380                                            const SMESH::double_array& Angles,
381                                            CORBA::Boolean             LinearVariation,
382                                            CORBA::Boolean             HasRefPoint,
383                                            const SMESH::PointStruct&  RefPoint,
384                                            CORBA::Boolean             MakeGroups,
385                                            SMESH::ElementType         ElemType,
386                                            SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
387
388   SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array&            IDsOfElements,
389                                         const SMESH::AxisStruct&            Mirror,
390                                         SMESH::SMESH_MeshEditor::MirrorType MirrorType);
391   SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           Object,
392                                               const SMESH::AxisStruct&            Mirror,
393                                               SMESH::SMESH_MeshEditor::MirrorType MirrorType);
394   SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
395                                            const SMESH::DirStruct&  Vector);
396   SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
397                                                  const SMESH::DirStruct&   Vector);
398   SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
399                                         const SMESH::AxisStruct& Axis,
400                                         CORBA::Double            AngleInRadians);
401   SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
402                                               const SMESH::AxisStruct&  Axis,
403                                               CORBA::Double             AngleInRadians);
404
405   SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array&            IDsOfElements,
406                                        const SMESH::AxisStruct&            Mirror,
407                                        SMESH::SMESH_MeshEditor::MirrorType MirrorType,
408                                        CORBA::Boolean                      CopyGroups,
409                                        const char*                         MeshName);
410   SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           Object,
411                                              const SMESH::AxisStruct&            Mirror,
412                                              SMESH::SMESH_MeshEditor::MirrorType MirrorType,
413                                              CORBA::Boolean                      CopyGroups,
414                                              const char*                         MeshName);
415   SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
416                                           const SMESH::DirStruct&  Vector,
417                                           CORBA::Boolean           CopyGroups,
418                                           const char*              MeshName);
419   SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
420                                                 const SMESH::DirStruct&   Vector,
421                                                 CORBA::Boolean            CopyGroups,
422                                                 const char*               MeshName);
423   SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
424                                        const SMESH::AxisStruct& Axis,
425                                        CORBA::Double            AngleInRadians,
426                                        CORBA::Boolean           CopyGroups,
427                                        const char*              MeshName);
428   SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
429                                              const SMESH::AxisStruct&  Axis,
430                                              CORBA::Double             AngleInRadians,
431                                              CORBA::Boolean            CopyGroups,
432                                              const char*               MeshName);
433
434   void Scale(SMESH::SMESH_IDSource_ptr  theObject,
435              const SMESH::PointStruct&  thePoint,
436              const SMESH::double_array& theScaleFact,
437              CORBA::Boolean             theCopy);
438
439   SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr  theObject,
440                                        const SMESH::PointStruct&  thePoint,
441                                        const SMESH::double_array& theScaleFact);
442
443   SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
444                                       const SMESH::PointStruct& Point,
445                                       const SMESH::double_array& theScaleFact,
446                                       CORBA::Boolean            CopyGroups,
447                                       const char*               MeshName);
448
449   void FindCoincidentNodes (CORBA::Double                  Tolerance,
450                             SMESH::array_of_long_array_out GroupsOfNodes);
451   void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr      Object,
452                                  CORBA::Double                  Tolerance,
453                                  SMESH::array_of_long_array_out GroupsOfNodes);
454   void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr      Object,
455                                     CORBA::Double                  Tolerance,
456                                     SMESH::array_of_long_array_out GroupsOfNodes,
457                                     const SMESH::ListOfIDSources&  ExceptSubMeshOrGroups);
458   void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
459   void FindEqualElements(SMESH::SMESH_IDSource_ptr      Object,
460                          SMESH::array_of_long_array_out GroupsOfElementsID);
461   void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
462   void MergeEqualElements();
463   CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
464                                      CORBA::Double y,
465                                      CORBA::Double z,
466                                      CORBA::Long   nodeID);
467   /*!
468    * \brief Return ID of node closest to a given point
469    */
470   CORBA::Long FindNodeClosestTo(CORBA::Double x,
471                                 CORBA::Double y,
472                                 CORBA::Double z);
473   /*!
474    * Return elements of given type where the given point is IN or ON.
475    * 'ALL' type means elements of any type excluding nodes
476    */
477   SMESH::long_array* FindElementsByPoint(CORBA::Double      x,
478                                          CORBA::Double      y,
479                                          CORBA::Double      z,
480                                          SMESH::ElementType type);
481
482   /*!
483    * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
484    * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
485    */
486   CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z);
487
488   SMESH::SMESH_MeshEditor::Sew_Error
489   SewFreeBorders(CORBA::Long FirstNodeID1,
490                  CORBA::Long SecondNodeID1,
491                  CORBA::Long LastNodeID1,
492                  CORBA::Long FirstNodeID2,
493                  CORBA::Long SecondNodeID2,
494                  CORBA::Long LastNodeID2,
495                  CORBA::Boolean CreatePolygons,
496                  CORBA::Boolean CreatePolyedrs);
497   SMESH::SMESH_MeshEditor::Sew_Error
498   SewConformFreeBorders(CORBA::Long FirstNodeID1,
499                         CORBA::Long SecondNodeID1,
500                         CORBA::Long LastNodeID1,
501                         CORBA::Long FirstNodeID2,
502                         CORBA::Long SecondNodeID2);
503   SMESH::SMESH_MeshEditor::Sew_Error
504   SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
505                   CORBA::Long SecondNodeIDOnFreeBorder,
506                   CORBA::Long LastNodeIDOnFreeBorder,
507                   CORBA::Long FirstNodeIDOnSide,
508                   CORBA::Long LastNodeIDOnSide,
509                   CORBA::Boolean CreatePolygons,
510                   CORBA::Boolean CreatePolyedrs);
511   SMESH::SMESH_MeshEditor::Sew_Error
512   SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
513                   const SMESH::long_array& IDsOfSide2Elements,
514                   CORBA::Long NodeID1OfSide1ToMerge,
515                   CORBA::Long NodeID1OfSide2ToMerge,
516                   CORBA::Long NodeID2OfSide1ToMerge,
517                   CORBA::Long NodeID2OfSide2ToMerge);
518
519   /*!
520    * Set new nodes for given element.
521    * If number of nodes is not corresponded to type of
522    * element - returns false
523    */
524   CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
525
526   /*!
527    * Return data of mesh edition preview
528    */
529   SMESH::MeshPreviewStruct* GetPreviewData();
530
531   /*!
532    * If during last operation of MeshEditor some nodes were
533    * created this method returns list of it's IDs, if new nodes
534    * not creared - returns empty list
535    */
536   SMESH::long_array* GetLastCreatedNodes();
537
538   /*!
539    * If during last operation of MeshEditor some elements were
540    * created this method returns list of it's IDs, if new elements
541    * not creared - returns empty list
542    */
543   SMESH::long_array* GetLastCreatedElems();
544
545   /*!
546    * \brief Return edited mesh ID
547    * \retval int - mesh ID
548    */
549   int GetMeshId() const { return myMesh->GetId(); }
550
551   CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
552                               const SMESH::long_array& theModifiedElems );
553
554   CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
555                              const SMESH::long_array& theModifiedElems );
556
557   CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
558                                   SMESH::SMESH_GroupBase_ptr theModifiedElems );
559
560   /*!
561    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
562    * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
563    * \param theNodes - group of nodes to be doubled.
564    * \param theModifiedElems - group of elements to be updated.
565    * \return a new group with newly created nodes
566    * \sa DoubleNodeGroup()
567    */
568   SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
569                                              SMESH::SMESH_GroupBase_ptr theModifiedElems );
570
571   CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
572                                    const SMESH::ListOfGroups& theModifiedElems);
573
574   /*!
575    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
576    * \param theElems - the list of elements (edges or faces) to be replicated
577    *       The nodes for duplication could be found from these elements
578    * \param theNodesNot - list of nodes to NOT replicate
579    * \param theAffectedElems - the list of elements (cells and edges) to which the 
580    *       replicated nodes should be associated to.
581    * \return TRUE if operation has been completed successfully, FALSE otherwise
582    * \sa DoubleNodeGroup(), DoubleNodeGroups()
583    */
584   CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems, 
585                                  const SMESH::long_array& theNodesNot,
586                                  const SMESH::long_array& theAffectedElems );
587
588   /*!
589    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
590    * \param theElems - the list of elements (edges or faces) to be replicated
591    *        The nodes for duplication could be found from these elements
592    * \param theNodesNot - list of nodes to NOT replicate
593    * \param theShape - shape to detect affected elements (element which geometric center
594    *        located on or inside shape).
595    *        The replicated nodes should be associated to affected elements.
596    * \return TRUE if operation has been completed successfully, FALSE otherwise
597    * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
598    */
599   CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems, 
600                                          const SMESH::long_array& theNodesNot,
601                                          GEOM::GEOM_Object_ptr    theShape );
602
603   /*!
604    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
605    * \param theElems - group of of elements (edges or faces) to be replicated
606    * \param theNodesNot - group of nodes not to replicated
607    * \param theAffectedElems - group of elements to which the replicated nodes
608    *        should be associated to.
609    * \return TRUE if operation has been completed successfully, FALSE otherwise
610    * \sa DoubleNodes(), DoubleNodeGroups()
611    */
612   CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
613                                       SMESH::SMESH_GroupBase_ptr theNodesNot,
614                                       SMESH::SMESH_GroupBase_ptr theAffectedElems );
615
616   /*!
617    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
618    * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
619    * \param theElems - group of of elements (edges or faces) to be replicated
620    * \param theNodesNot - group of nodes not to replicated
621    * \param theAffectedElems - group of elements to which the replicated nodes
622    *        should be associated to.
623    * \return a new group with newly created elements
624    * \sa DoubleNodeElemGroup()
625    */
626   SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
627                                                  SMESH::SMESH_GroupBase_ptr theNodesNot,
628                                                  SMESH::SMESH_GroupBase_ptr theAffectedElems );
629   
630   /*!
631    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
632    * \param theElems - group of of elements (edges or faces) to be replicated
633    * \param theNodesNot - group of nodes not to replicated
634    * \param theShape - shape to detect affected elements (element which geometric center
635    *        located on or inside shape).
636    *        The replicated nodes should be associated to affected elements.
637    * \return TRUE if operation has been completed successfully, FALSE otherwise
638    * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
639    */
640   CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
641                                               SMESH::SMESH_GroupBase_ptr theNodesNot,
642                                               GEOM::GEOM_Object_ptr      theShape );
643
644   /*!
645    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
646    * This method provided for convenience works as DoubleNodes() described above.
647    * \param theElems - list of groups of elements (edges or faces) to be replicated
648    * \param theNodesNot - list of groups of nodes not to replicated
649    * \param theAffectedElems - group of elements to which the replicated nodes
650    *        should be associated to.
651    * \return TRUE if operation has been completed successfully, FALSE otherwise
652    * \sa DoubleNodeGroup(), DoubleNodes()
653    */
654   CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
655                                        const SMESH::ListOfGroups& theNodesNot,
656                                        const SMESH::ListOfGroups& theAffectedElems );
657
658
659   /*!
660    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
661    * This method provided for convenience works as DoubleNodes() described above.
662    * \param theElems - list of groups of elements (edges or faces) to be replicated
663    * \param theNodesNot - list of groups of nodes not to replicated
664    * \param theShape - shape to detect affected elements (element which geometric center
665    *        located on or inside shape).
666    *        The replicated nodes should be associated to affected elements.
667    * \return TRUE if operation has been completed successfully, FALSE otherwise
668    * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
669    */
670   CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
671                                                const SMESH::ListOfGroups& theNodesNot,
672                                                GEOM::GEOM_Object_ptr      theShape );
673
674   /*!
675    * \brief Generated skin mesh (containing 2D cells) from 3D mesh
676    * The created 2D mesh elements based on nodes of free faces of boundary volumes
677    * \return TRUE if operation has been completed successfully, FALSE otherwise
678    */
679   CORBA::Boolean Make2DMeshFrom3D();
680
681   SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
682                                          SMESH::Bnd_Dimension      dimension,
683                                          const char*               groupName,
684                                          const char*               meshName,
685                                          CORBA::Boolean            toCopyElements,
686                                          CORBA::Boolean            toCopyMissingBondary,
687                                          SMESH::SMESH_Group_out    group);
688
689 private: //!< private methods
690
691   SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
692
693   /*!
694    * \brief Update myLastCreated* or myPreviewData
695    * \param anEditor - it contains edition results
696    */
697   void storeResult(::SMESH_MeshEditor& anEditor);
698   /*!
699    * \brief Clear myLastCreated* or myPreviewData
700    */
701   void initData(bool deleteSearchers=true);
702
703   /*!
704    * \brief Return groups by their IDs
705    */
706   SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
707
708   SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
709                                      const SMESH::AxisStruct & Axis,
710                                      CORBA::Double             AngleInRadians,
711                                      CORBA::Long               NbOfSteps,
712                                      CORBA::Double             Tolerance,
713                                      const bool                MakeGroups,
714                                      const SMDSAbs_ElementType ElementType=SMDSAbs_All);
715   SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
716                                       const SMESH::DirStruct &  StepVector,
717                                       CORBA::Long               NbOfSteps,
718                                       const bool                MakeGroups,
719                                       const SMDSAbs_ElementType ElementType=SMDSAbs_All);
720   SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
721                                          const SMESH::DirStruct &  theStepVector,
722                                          CORBA::Long               theNbOfSteps,
723                                          CORBA::Long               theExtrFlags,
724                                          CORBA::Double             theSewTolerance,
725                                          const bool                MakeGroups);
726   SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array &   IDsOfElements,
727                                           SMESH::SMESH_Mesh_ptr       PathMesh,
728                                           GEOM::GEOM_Object_ptr       PathShape,
729                                           CORBA::Long                 NodeStart,
730                                           CORBA::Boolean              HasAngles,
731                                           const SMESH::double_array & Angles,
732                                           CORBA::Boolean              HasRefPoint,
733                                           const SMESH::PointStruct &  RefPoint,
734                                           const bool                  MakeGroups,
735                                           SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
736                                           const SMDSAbs_ElementType   ElementType=SMDSAbs_All);
737   SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array &  IDsOfElements,
738                                            SMESH::SMESH_IDSource_ptr  Path,
739                                            CORBA::Long                NodeStart,
740                                            CORBA::Boolean             HasAngles,
741                                            const SMESH::double_array& Angles,
742                                            CORBA::Boolean             LinearVariation,
743                                            CORBA::Boolean             HasRefPoint,
744                                            const SMESH::PointStruct&  RefPoint,
745                                            const bool                 MakeGroups,
746                                            const SMDSAbs_ElementType  ElementType,
747                                            SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
748   SMESH::ListOfGroups* mirror(TIDSortedElemSet &                  IDsOfElements,
749                               const SMESH::AxisStruct &           Axis,
750                               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
751                               CORBA::Boolean                      Copy,
752                               const bool                          MakeGroups,
753                               ::SMESH_Mesh*                       TargetMesh=0);
754   SMESH::ListOfGroups* translate(TIDSortedElemSet        & IDsOfElements,
755                                  const SMESH::DirStruct &  Vector,
756                                  CORBA::Boolean            Copy,
757                                  const bool                MakeGroups,
758                                  ::SMESH_Mesh*             TargetMesh=0);
759   SMESH::ListOfGroups* rotate(TIDSortedElemSet &           IDsOfElements,
760                               const SMESH::AxisStruct &  Axis,
761                               CORBA::Double             Angle,
762                               CORBA::Boolean            Copy,
763                               const bool                MakeGroups,
764                               ::SMESH_Mesh*             TargetMesh=0);
765
766   SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr   theObject,
767                              const SMESH::PointStruct&   thePoint,
768                              const SMESH::double_array&  theScaleFact,
769                              CORBA::Boolean              theCopy,
770                              const bool                  theMakeGroups,
771                              ::SMESH_Mesh*               theTargetMesh=0);
772
773   SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
774
775   void DumpGroupsList(SMESH::TPythonDump & theDumpPython, 
776                       const SMESH::ListOfGroups * theGroupList);
777
778   string generateGroupName(const string& thePrefix);
779
780 private: //!< fields
781
782   SMESH_Mesh_i*         myMesh_i;
783   SMESH_Mesh *          myMesh;
784
785   SMESH::long_array_var myLastCreatedElems;
786   SMESH::long_array_var myLastCreatedNodes;
787
788   SMESH::MeshPreviewStruct_var myPreviewData;
789   bool                         myPreviewMode;
790 };
791
792 #endif