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