Salome HOME
Issue: 0020935: A group created with a type of element criteria is empty
[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   CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
556                                    const SMESH::ListOfGroups& theModifiedElems);
557
558   /*!
559    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
560    * \param theElems - the list of elements (edges or faces) to be replicated
561    *       The nodes for duplication could be found from these elements
562    * \param theNodesNot - list of nodes to NOT replicate
563    * \param theAffectedElems - the list of elements (cells and edges) to which the 
564    *       replicated nodes should be associated to.
565    * \return TRUE if operation has been completed successfully, FALSE otherwise
566    * \sa DoubleNodeGroup(), DoubleNodeGroups()
567    */
568   CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems, 
569                                  const SMESH::long_array& theNodesNot,
570                                  const SMESH::long_array& theAffectedElems );
571
572   /*!
573    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
574    * \param theElems - the list of elements (edges or faces) to be replicated
575    *        The nodes for duplication could be found from these elements
576    * \param theNodesNot - list of nodes to NOT replicate
577    * \param theShape - shape to detect affected elements (element which geometric center
578    *        located on or inside shape).
579    *        The replicated nodes should be associated to affected elements.
580    * \return TRUE if operation has been completed successfully, FALSE otherwise
581    * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
582    */
583   CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems, 
584                                          const SMESH::long_array& theNodesNot,
585                                          GEOM::GEOM_Object_ptr    theShape );
586
587   /*!
588    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
589    * \param theElems - group of of elements (edges or faces) to be replicated
590    * \param theNodesNot - group of nodes not to replicated
591    * \param theAffectedElems - group of elements to which the replicated nodes
592    *        should be associated to.
593    * \return TRUE if operation has been completed successfully, FALSE otherwise
594    * \sa DoubleNodes(), DoubleNodeGroups()
595    */
596   CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
597                                       SMESH::SMESH_GroupBase_ptr theNodesNot,
598                                       SMESH::SMESH_GroupBase_ptr theAffectedElems );
599   
600   /*!
601    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
602    * \param theElems - group of of elements (edges or faces) to be replicated
603    * \param theNodesNot - group of nodes not to replicated
604    * \param theShape - shape to detect affected elements (element which geometric center
605    *        located on or inside shape).
606    *        The replicated nodes should be associated to affected elements.
607    * \return TRUE if operation has been completed successfully, FALSE otherwise
608    * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
609    */
610   CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
611                                               SMESH::SMESH_GroupBase_ptr theNodesNot,
612                                               GEOM::GEOM_Object_ptr      theShape );
613
614   /*!
615    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
616    * This method provided for convenience works as DoubleNodes() described above.
617    * \param theElems - list of groups of elements (edges or faces) to be replicated
618    * \param theNodesNot - list of groups of nodes not to replicated
619    * \param theAffectedElems - group of elements to which the replicated nodes
620    *        should be associated to.
621    * \return TRUE if operation has been completed successfully, FALSE otherwise
622    * \sa DoubleNodeGroup(), DoubleNodes()
623    */
624   CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
625                                        const SMESH::ListOfGroups& theNodesNot,
626                                        const SMESH::ListOfGroups& theAffectedElems );
627
628
629   /*!
630    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
631    * This method provided for convenience works as DoubleNodes() described above.
632    * \param theElems - list of groups of elements (edges or faces) to be replicated
633    * \param theNodesNot - list of groups of nodes not to replicated
634    * \param theShape - shape to detect affected elements (element which geometric center
635    *        located on or inside shape).
636    *        The replicated nodes should be associated to affected elements.
637    * \return TRUE if operation has been completed successfully, FALSE otherwise
638    * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
639    */
640   CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
641                                                const SMESH::ListOfGroups& theNodesNot,
642                                                GEOM::GEOM_Object_ptr      theShape );
643
644     /*!
645      * \brief Generated skin mesh (containing 2D cells) from 3D mesh
646      * The created 2D mesh elements based on nodes of free faces of boundary volumes
647      * \return TRUE if operation has been completed successfully, FALSE otherwise
648     */
649     CORBA::Boolean Make2DMeshFrom3D();
650
651  private: //!< private methods
652
653   SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
654
655   /*!
656    * \brief Update myLastCreated* or myPreviewData
657    * \param anEditor - it contains edition results
658    */
659   void storeResult(::SMESH_MeshEditor& anEditor);
660   /*!
661    * \brief Clear myLastCreated* or myPreviewData
662    */
663   void initData(bool deleteSearchers=true);
664
665   /*!
666    * \brief Return groups by their IDs
667    */
668   SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
669
670   SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
671                                      const SMESH::AxisStruct & Axis,
672                                      CORBA::Double             AngleInRadians,
673                                      CORBA::Long               NbOfSteps,
674                                      CORBA::Double             Tolerance,
675                                      const bool                MakeGroups,
676                                      const SMDSAbs_ElementType ElementType=SMDSAbs_All);
677   SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
678                                       const SMESH::DirStruct &  StepVector,
679                                       CORBA::Long               NbOfSteps,
680                                       const bool                MakeGroups,
681                                       const SMDSAbs_ElementType ElementType=SMDSAbs_All);
682   SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
683                                          const SMESH::DirStruct &  theStepVector,
684                                          CORBA::Long               theNbOfSteps,
685                                          CORBA::Long               theExtrFlags,
686                                          CORBA::Double             theSewTolerance,
687                                          const bool                MakeGroups);
688   SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array &   IDsOfElements,
689                                           SMESH::SMESH_Mesh_ptr       PathMesh,
690                                           GEOM::GEOM_Object_ptr       PathShape,
691                                           CORBA::Long                 NodeStart,
692                                           CORBA::Boolean              HasAngles,
693                                           const SMESH::double_array & Angles,
694                                           CORBA::Boolean              HasRefPoint,
695                                           const SMESH::PointStruct &  RefPoint,
696                                           const bool                  MakeGroups,
697                                           SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
698                                           const SMDSAbs_ElementType   ElementType=SMDSAbs_All);
699   SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array &  IDsOfElements,
700                                            SMESH::SMESH_IDSource_ptr  Path,
701                                            CORBA::Long                NodeStart,
702                                            CORBA::Boolean             HasAngles,
703                                            const SMESH::double_array& Angles,
704                                            CORBA::Boolean             LinearVariation,
705                                            CORBA::Boolean             HasRefPoint,
706                                            const SMESH::PointStruct&  RefPoint,
707                                            const bool                 MakeGroups,
708                                            const SMDSAbs_ElementType  ElementType,
709                                            SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
710   SMESH::ListOfGroups* mirror(const SMESH::long_array &           IDsOfElements,
711                               const SMESH::AxisStruct &           Axis,
712                               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
713                               CORBA::Boolean                      Copy,
714                               const bool                          MakeGroups,
715                               ::SMESH_Mesh*                       TargetMesh=0);
716   SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
717                                  const SMESH::DirStruct &  Vector,
718                                  CORBA::Boolean            Copy,
719                                  const bool                MakeGroups,
720                                  ::SMESH_Mesh*             TargetMesh=0);
721   SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
722                               const SMESH::AxisStruct &  Axis,
723                               CORBA::Double             Angle,
724                               CORBA::Boolean            Copy,
725                               const bool                MakeGroups,
726                               ::SMESH_Mesh*             TargetMesh=0);
727
728   SMESH::ListOfGroups* scale(const SMESH::long_array &  theIDsOfElements,
729                              const SMESH::PointStruct&  thePoint,
730                              const SMESH::double_array& theScaleFact,
731                              CORBA::Boolean             theCopy,
732                              const bool                 theMakeGroups,
733                              ::SMESH_Mesh*              theTargetMesh=0);
734
735   SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
736
737   void DumpGroupsList(SMESH::TPythonDump & theDumpPython, 
738                       const SMESH::ListOfGroups * theGroupList);
739
740 private: //!< fields
741
742   SMESH_Mesh_i*         myMesh_i;
743   SMESH_Mesh *          myMesh;
744
745   SMESH::long_array_var myLastCreatedElems;
746   SMESH::long_array_var myLastCreatedNodes;
747
748   SMESH::MeshPreviewStruct_var myPreviewData;
749   bool                         myPreviewMode;
750 };
751
752 #endif