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