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