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