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