Salome HOME
2cdf9fa6103440e705c7f7c497f39ecd5cb43a4a
[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     throw (SALOME::SALOME_Exception);
477   void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr      Object,
478                                  CORBA::Double                  Tolerance,
479                                  SMESH::array_of_long_array_out GroupsOfNodes)
480     throw (SALOME::SALOME_Exception);
481   void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr      Object,
482                                     CORBA::Double                  Tolerance,
483                                     SMESH::array_of_long_array_out GroupsOfNodes,
484                                     const SMESH::ListOfIDSources&  ExceptSubMeshOrGroups)
485     throw (SALOME::SALOME_Exception);
486   void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
487     throw (SALOME::SALOME_Exception);
488   void FindEqualElements(SMESH::SMESH_IDSource_ptr      Object,
489                          SMESH::array_of_long_array_out GroupsOfElementsID)
490     throw (SALOME::SALOME_Exception);
491   void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID)
492     throw (SALOME::SALOME_Exception);
493   void MergeEqualElements()
494     throw (SALOME::SALOME_Exception);
495   CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
496                                      CORBA::Double y,
497                                      CORBA::Double z,
498                                      CORBA::Long   nodeID)
499     throw (SALOME::SALOME_Exception);
500   /*!
501    * \brief Return ID of node closest to a given point
502    */
503   CORBA::Long FindNodeClosestTo(CORBA::Double x,
504                                 CORBA::Double y,
505                                 CORBA::Double z)
506     throw (SALOME::SALOME_Exception);
507   /*!
508    * Return elements of given type where the given point is IN or ON.
509    * 'ALL' type means elements of any type excluding nodes
510    */
511   SMESH::long_array* FindElementsByPoint(CORBA::Double      x,
512                                          CORBA::Double      y,
513                                          CORBA::Double      z,
514                                          SMESH::ElementType type)
515     throw (SALOME::SALOME_Exception);
516   /*!
517    * Searching among the given elements, return elements of given type 
518    * where the given point is IN or ON.
519    * 'ALL' type means elements of any type excluding nodes
520    */
521   SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
522                                               CORBA::Double             x,
523                                               CORBA::Double             y,
524                                               CORBA::Double             z,
525                                               SMESH::ElementType        type)
526     throw (SALOME::SALOME_Exception);
527
528   /*!
529    * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
530    * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
531    */
532   CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z)
533     throw (SALOME::SALOME_Exception);
534
535   SMESH::SMESH_MeshEditor::Sew_Error
536   SewFreeBorders(CORBA::Long FirstNodeID1,
537                  CORBA::Long SecondNodeID1,
538                  CORBA::Long LastNodeID1,
539                  CORBA::Long FirstNodeID2,
540                  CORBA::Long SecondNodeID2,
541                  CORBA::Long LastNodeID2,
542                  CORBA::Boolean CreatePolygons,
543                  CORBA::Boolean CreatePolyedrs)
544     throw (SALOME::SALOME_Exception);
545   SMESH::SMESH_MeshEditor::Sew_Error
546   SewConformFreeBorders(CORBA::Long FirstNodeID1,
547                         CORBA::Long SecondNodeID1,
548                         CORBA::Long LastNodeID1,
549                         CORBA::Long FirstNodeID2,
550                         CORBA::Long SecondNodeID2)
551     throw (SALOME::SALOME_Exception);
552   SMESH::SMESH_MeshEditor::Sew_Error
553   SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
554                   CORBA::Long SecondNodeIDOnFreeBorder,
555                   CORBA::Long LastNodeIDOnFreeBorder,
556                   CORBA::Long FirstNodeIDOnSide,
557                   CORBA::Long LastNodeIDOnSide,
558                   CORBA::Boolean CreatePolygons,
559                   CORBA::Boolean CreatePolyedrs)
560     throw (SALOME::SALOME_Exception);
561   SMESH::SMESH_MeshEditor::Sew_Error
562   SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
563                   const SMESH::long_array& IDsOfSide2Elements,
564                   CORBA::Long NodeID1OfSide1ToMerge,
565                   CORBA::Long NodeID1OfSide2ToMerge,
566                   CORBA::Long NodeID2OfSide1ToMerge,
567                   CORBA::Long NodeID2OfSide2ToMerge)
568     throw (SALOME::SALOME_Exception);
569
570   /*!
571    * Set new nodes for given element.
572    * If number of nodes is not corresponded to type of
573    * element - returns false
574    */
575   CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
576     throw (SALOME::SALOME_Exception);
577
578   SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
579                                         const char*               theGroupName)
580     throw (SALOME::SALOME_Exception);
581
582   CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
583                               const SMESH::long_array& theModifiedElems )
584     throw (SALOME::SALOME_Exception);
585
586   CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
587                              const SMESH::long_array& theModifiedElems )
588     throw (SALOME::SALOME_Exception);
589
590   CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
591                                   SMESH::SMESH_GroupBase_ptr theModifiedElems )
592     throw (SALOME::SALOME_Exception);
593
594   /*!
595    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
596    * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
597    * \param theNodes - group of nodes to be doubled.
598    * \param theModifiedElems - group of elements to be updated.
599    * \return a new group with newly created nodes
600    * \sa DoubleNodeGroup()
601    */
602   SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
603                                              SMESH::SMESH_GroupBase_ptr theModifiedElems )
604     throw (SALOME::SALOME_Exception);
605
606   CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
607                                    const SMESH::ListOfGroups& theModifiedElems )
608     throw (SALOME::SALOME_Exception);
609
610   SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
611                                               const SMESH::ListOfGroups& theModifiedElems )
612     throw (SALOME::SALOME_Exception);
613
614   /*!
615    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
616    * \param theElems - the list of elements (edges or faces) to be replicated
617    *       The nodes for duplication could be found from these elements
618    * \param theNodesNot - list of nodes to NOT replicate
619    * \param theAffectedElems - the list of elements (cells and edges) to which the 
620    *       replicated nodes should be associated to.
621    * \return TRUE if operation has been completed successfully, FALSE otherwise
622    * \sa DoubleNodeGroup(), DoubleNodeGroups()
623    */
624   CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems, 
625                                  const SMESH::long_array& theNodesNot,
626                                  const SMESH::long_array& theAffectedElems )
627     throw (SALOME::SALOME_Exception);
628
629   /*!
630    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
631    * \param theElems - the list of elements (edges or faces) to be replicated
632    *        The nodes for duplication could be found from these elements
633    * \param theNodesNot - list of nodes to NOT replicate
634    * \param theShape - shape to detect affected elements (element which geometric center
635    *        located on or inside shape).
636    *        The replicated nodes should be associated to affected elements.
637    * \return TRUE if operation has been completed successfully, FALSE otherwise
638    * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
639    */
640   CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems, 
641                                          const SMESH::long_array& theNodesNot,
642                                          GEOM::GEOM_Object_ptr    theShape )
643     throw (SALOME::SALOME_Exception);
644
645   /*!
646    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
647    * \param theElems - group of of elements (edges or faces) to be replicated
648    * \param theNodesNot - group of nodes not to replicated
649    * \param theAffectedElems - group of elements to which the replicated nodes
650    *        should be associated to.
651    * \return TRUE if operation has been completed successfully, FALSE otherwise
652    * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
653    */
654   CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
655                                       SMESH::SMESH_GroupBase_ptr theNodesNot,
656                                       SMESH::SMESH_GroupBase_ptr theAffectedElems )
657     throw (SALOME::SALOME_Exception);
658
659   /*!
660    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
661    * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
662    * \param theElems - group of of elements (edges or faces) to be replicated
663    * \param theNodesNot - group of nodes not to replicated
664    * \param theAffectedElems - group of elements to which the replicated nodes
665    *        should be associated to.
666    * \return a new group with newly created elements
667    * \sa DoubleNodeElemGroup()
668    */
669   SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
670                                                  SMESH::SMESH_GroupBase_ptr theNodesNot,
671                                                  SMESH::SMESH_GroupBase_ptr theAffectedElems )
672     throw (SALOME::SALOME_Exception);
673
674   SMESH::ListOfGroups*   DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
675                                                  SMESH::SMESH_GroupBase_ptr theNodesNot,
676                                                  SMESH::SMESH_GroupBase_ptr theAffectedElems,
677                                                  CORBA::Boolean             theElemGroupNeeded,
678                                                  CORBA::Boolean             theNodeGroupNeeded)
679     throw (SALOME::SALOME_Exception);
680   
681   /*!
682    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
683    * \param theElems - group of of elements (edges or faces) to be replicated
684    * \param theNodesNot - group of nodes not to replicated
685    * \param theShape - shape to detect affected elements (element which geometric center
686    *        located on or inside shape).
687    *        The replicated nodes should be associated to affected elements.
688    * \return TRUE if operation has been completed successfully, FALSE otherwise
689    * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
690    */
691   CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
692                                               SMESH::SMESH_GroupBase_ptr theNodesNot,
693                                               GEOM::GEOM_Object_ptr      theShape )
694     throw (SALOME::SALOME_Exception);
695
696   /*!
697    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
698    * This method provided for convenience works as DoubleNodes() described above.
699    * \param theElems - list of groups of elements (edges or faces) to be replicated
700    * \param theNodesNot - list of groups of nodes not to replicated
701    * \param theAffectedElems - group of elements to which the replicated nodes
702    *        should be associated to.
703    * \return TRUE if operation has been completed successfully, FALSE otherwise
704    * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
705    */
706   CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
707                                        const SMESH::ListOfGroups& theNodesNot,
708                                        const SMESH::ListOfGroups& theAffectedElems )
709     throw (SALOME::SALOME_Exception);
710
711   /*!
712    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
713    * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
714    * \param theElems - list of groups of elements (edges or faces) to be replicated
715    * \param theNodesNot - list of groups of nodes not to replicated
716    * \param theAffectedElems - group of elements to which the replicated nodes
717    *        should be associated to.
718    * \return a new group with newly created elements
719    * \sa DoubleNodeElemGroups()
720    */
721   SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
722                                                   const SMESH::ListOfGroups& theNodesNot,
723                                                   const SMESH::ListOfGroups& theAffectedElems )
724     throw (SALOME::SALOME_Exception);
725
726   SMESH::ListOfGroups*   DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
727                                                   const SMESH::ListOfGroups& theNodesNot,
728                                                   const SMESH::ListOfGroups& theAffectedElems,
729                                                   CORBA::Boolean             theElemGroupNeeded,
730                                                   CORBA::Boolean             theNodeGroupNeeded)
731     throw (SALOME::SALOME_Exception);
732
733   /*!
734    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
735    * This method provided for convenience works as DoubleNodes() described above.
736    * \param theElems - list of groups of elements (edges or faces) to be replicated
737    * \param theNodesNot - list of groups of nodes not to replicated
738    * \param theShape - shape to detect affected elements (element which geometric center
739    *        located on or inside shape).
740    *        The replicated nodes should be associated to affected elements.
741    * \return TRUE if operation has been completed successfully, FALSE otherwise
742    * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
743    */
744   CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
745                                                const SMESH::ListOfGroups& theNodesNot,
746                                                GEOM::GEOM_Object_ptr      theShape )
747     throw (SALOME::SALOME_Exception);
748
749   /*!
750    * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
751    * This method is the first step of DoubleNodeElemGroupsInRegion.
752    * \param theElems - list of groups of elements (edges or faces) to be replicated
753    * \param theNodesNot - list of groups of nodes not to replicated
754    * \param theShape - shape to detect affected elements (element which geometric center
755    *        located on or inside shape).
756    *        The replicated nodes should be associated to affected elements.
757    * \return groups of affected elements
758    * \sa DoubleNodeElemGroupsInRegion()
759    */
760   SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
761                                                    const SMESH::ListOfGroups& theNodesNot,
762                                                    GEOM::GEOM_Object_ptr      theShape )
763     throw (SALOME::SALOME_Exception);
764
765   /*!
766    * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
767    * The list of groups must describe a partition of the mesh volumes.
768    * The nodes of the internal faces at the boundaries of the groups are doubled.
769    * In option, the internal faces are replaced by flat elements.
770    * Triangles are transformed in prisms, and quadrangles in hexahedrons.
771    * \param theDomains - list of groups of volumes
772    * \param createJointElems - if TRUE, create the elements
773    * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
774    *        the boundary between \a theDomains and the rest mesh
775    * \return TRUE if operation has been completed successfully, FALSE otherwise
776    */
777   CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
778                                                CORBA::Boolean             createJointElems,
779                                                CORBA::Boolean             onAllBoundaries )
780     throw (SALOME::SALOME_Exception);
781   /*!
782    * \brief Double nodes on some external faces and create flat elements.
783    * Flat elements are mainly used by some types of mechanic calculations.
784    *
785    * Each group of the list must be constituted of faces.
786    * Triangles are transformed in prisms, and quadrangles in hexahedrons.
787    * @param theGroupsOfFaces - list of groups of faces
788    * @return TRUE if operation has been completed successfully, FALSE otherwise
789    */
790   CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces )
791     throw (SALOME::SALOME_Exception);
792
793   /*!
794    *  \brief identify all the elements around a geom shape, get the faces delimiting the hole
795    *  Build groups of volume to remove, groups of faces to replace on the skin of the object,
796    *  groups of faces to remove insidethe object, (idem edges).
797    *  Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
798    */
799   void CreateHoleSkin(CORBA::Double radius,
800                       GEOM::GEOM_Object_ptr theShape,
801                       const char* groupName,
802                       const SMESH::double_array& theNodesCoords,
803                       SMESH::array_of_long_array_out GroupsOfNodes)
804   throw (SALOME::SALOME_Exception);
805
806   /*!
807    * \brief Generated skin mesh (containing 2D cells) from 3D mesh
808    * The created 2D mesh elements based on nodes of free faces of boundary volumes
809    * \return TRUE if operation has been completed successfully, FALSE otherwise
810    */
811   CORBA::Boolean Make2DMeshFrom3D()
812     throw (SALOME::SALOME_Exception);
813
814   SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
815                                          SMESH::Bnd_Dimension      dimension,
816                                          const char*               groupName,
817                                          const char*               meshName,
818                                          CORBA::Boolean            toCopyElements,
819                                          CORBA::Boolean            toCopyMissingBondary,
820                                          SMESH::SMESH_Group_out    group)
821     throw (SALOME::SALOME_Exception);
822
823   CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
824                                    const char* groupName,
825                                    const char* meshName,
826                                    CORBA::Boolean toCopyAll,
827                                    const SMESH::ListOfIDSources& groups,
828                                    SMESH::SMESH_Mesh_out mesh,
829                                    SMESH::SMESH_Group_out group)
830     throw (SALOME::SALOME_Exception);
831
832 private: //!< private methods
833
834   ::SMESH_MeshEditor& getEditor();
835
836   SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
837
838   MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
839
840   void declareMeshModified( bool isReComputeSafe );
841
842   /*!
843    * \brief Clear myLastCreated* or myPreviewData
844    */
845   void initData(bool deleteSearchers=true);
846
847   /*!
848    * \brief Return groups by their IDs
849    */
850   SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
851     throw (SALOME::SALOME_Exception);
852
853   SMESH::ListOfGroups* mirror(TIDSortedElemSet &                  IDsOfElements,
854                               const SMESH::AxisStruct &           Axis,
855                               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
856                               CORBA::Boolean                      Copy,
857                               bool                                MakeGroups,
858                               ::SMESH_Mesh*                       TargetMesh=0)
859     throw (SALOME::SALOME_Exception);
860   SMESH::ListOfGroups* translate(TIDSortedElemSet        & IDsOfElements,
861                                  const SMESH::DirStruct &  Vector,
862                                  CORBA::Boolean            Copy,
863                                  bool                      MakeGroups,
864                                  ::SMESH_Mesh*             TargetMesh=0)
865     throw (SALOME::SALOME_Exception);
866   SMESH::ListOfGroups* rotate(TIDSortedElemSet &           IDsOfElements,
867                               const SMESH::AxisStruct &  Axis,
868                               CORBA::Double             Angle,
869                               CORBA::Boolean            Copy,
870                               bool                      MakeGroups,
871                               ::SMESH_Mesh*             TargetMesh=0)
872     throw (SALOME::SALOME_Exception);
873
874   SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr   theObject,
875                              const SMESH::PointStruct&   thePoint,
876                              const SMESH::double_array&  theScaleFact,
877                              CORBA::Boolean              theCopy,
878                              bool                        theMakeGroups,
879                              ::SMESH_Mesh*               theTargetMesh=0)
880     throw (SALOME::SALOME_Exception);
881
882   void convertToQuadratic(CORBA::Boolean            theForce3d,
883                           CORBA::Boolean            theToBiQuad,
884                           SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil())
885     throw (SALOME::SALOME_Exception);
886
887   SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
888
889   void dumpGroupsList(SMESH::TPythonDump &        theDumpPython,
890                       const SMESH::ListOfGroups * theGroupList);
891
892   string generateGroupName(const string& thePrefix);
893
894   void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
895
896
897   enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
898
899   bool idSourceToSet(SMESH::SMESH_IDSource_ptr  theIDSource,
900                      const SMESHDS_Mesh*        theMeshDS,
901                      TIDSortedElemSet&          theElemSet,
902                      const SMDSAbs_ElementType  theType,
903                      const bool                 emptyIfIsMesh = false,
904                      IDSource_Error*            error = 0);
905
906
907  private: //!< fields
908
909   SMESH_Mesh_i*                myMesh_i;
910   SMESH_Mesh *                 myMesh;
911   ::SMESH_MeshEditor           myEditor;
912
913   bool                         myIsPreviewMode;
914   MeshEditor_I::TPreviewMesh * myPreviewMesh;
915   ::SMESH_MeshEditor *         myPreviewEditor;
916   SMESH::MeshPreviewStruct_var myPreviewData;
917
918   // temporary IDSources
919   struct _IDSource;
920   // std::list< _IDSource* >      myAuxIDSources;
921   // void                         deleteAuxIDSources();
922 };
923
924 #endif