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