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