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