Salome HOME
Merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev_08Jul08)
[modules/smesh.git] / idl / SMESH_MeshEditor.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 //  This library is free software; you can redistribute it and/or
5 //  modify it under the terms of the GNU Lesser General Public
6 //  License as published by the Free Software Foundation; either
7 //  version 2.1 of the License.
8 //
9 //  This library is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 //  Lesser General Public License for more details.
13 //
14 //  You should have received a copy of the GNU Lesser General Public
15 //  License along with this library; if not, write to the Free Software
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 //
22 //  File   : SMESH_MeshEditor.idl
23 //  $Header$
24
25 #ifndef _SMESH_MESHEDITOR_IDL_
26 #define _SMESH_MESHEDITOR_IDL_
27
28 #include "SMESH_Mesh.idl"
29
30 module SMESH
31 {
32   /*!
33    * This interface makes modifications on the Mesh - removing elements and nodes etc.
34    */
35   interface NumericalFunctor;
36   interface SMESH_MeshEditor
37   {
38     boolean RemoveElements(in long_array IDsOfElements);
39
40     boolean RemoveNodes(in long_array IDsOfNodes);
41
42     long AddNode(in double x, in double y, in double z);
43
44     /*!
45      *  Create edge, either linear and quadratic (this is determed
46      *  by number of given nodes).
47      *  \param IdsOfNodes List of node IDs for creation of element.
48      *  Needed order of nodes in this list corresponds to description
49      *  of MED. This description is located by the following link:
50      *   http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
51      */
52     long AddEdge(in long_array IDsOfNodes);
53
54     /*!
55      *  Create face, either linear and quadratic (this is determed
56      *  by number of given nodes).
57      *  \param IdsOfNodes List of node IDs for creation of element.
58      *  Needed order of nodes in this list corresponds to description
59      *  of MED. This description is located by the following link:
60      *   http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
61      */
62     long AddFace(in long_array IDsOfNodes);
63
64     long AddPolygonalFace(in long_array IdsOfNodes);
65
66     /*!
67      *  Create volume, either linear and quadratic (this is determed
68      *  by number of given nodes).
69      *  \param IdsOfNodes List of node IDs for creation of element.
70      *  Needed order of nodes in this list corresponds to description
71      *  of MED. This description is located by the following link:
72      *   http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
73      */
74     long AddVolume(in long_array IDsOfNodes);
75
76     /*!
77      *  Create volume of many faces, giving nodes for each face.
78      *  \param IdsOfNodes List of node IDs for volume creation face by face.
79      *  \param Quantities List of integer values, Quantities[i]
80      *         gives quantity of nodes in face number i.
81      */
82     long AddPolyhedralVolume (in long_array IdsOfNodes,
83                               in long_array Quantities);
84
85     /*!
86      *  Create volume of many faces, giving IDs of existing faces.
87      *  \param IdsOfFaces List of face IDs for volume creation.
88      *  \note The created volume will refer only to nodes
89      *        of the given faces, not to the faces itself.
90      */
91     long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
92
93     /*!
94      * \brief Bind a node to a vertex
95       * \param NodeID - node ID
96       * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
97      */
98     void SetNodeOnVertex(in long NodeID, in long VertexID)
99       raises (SALOME::SALOME_Exception);
100     /*!
101      * \brief Store node position on an edge
102       * \param NodeID - node ID
103       * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
104       * \param paramOnEdge - parameter on edge where the node is located
105      */
106     void SetNodeOnEdge(in long NodeID, in long EdgeID, in double paramOnEdge)
107       raises (SALOME::SALOME_Exception);
108     /*!
109      * \brief Store node position on a face
110       * \param NodeID - node ID
111       * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
112       * \param u - U parameter on face where the node is located
113       * \param v - V parameter on face where the node is located
114      */
115     void SetNodeOnFace(in long NodeID, in long FaceID, in double u, in double v)
116       raises (SALOME::SALOME_Exception);
117     /*!
118      * \brief Bind a node to a solid
119       * \param NodeID - node ID
120       * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
121      */
122     void SetNodeInVolume(in long NodeID, in long SolidID)
123       raises (SALOME::SALOME_Exception);
124     /*!
125      * \brief Bind an element to a shape
126       * \param ElementID - element ID
127       * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
128      */
129     void SetMeshElementOnShape(in long ElementID, in long ShapeID)
130       raises (SALOME::SALOME_Exception);
131
132
133     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
134
135     boolean InverseDiag(in long NodeID1, in long NodeID2);
136
137     boolean DeleteDiag(in long NodeID1, in long NodeID2);
138
139     boolean Reorient(in long_array IDsOfElements);
140
141     boolean ReorientObject(in SMESH_IDSource theObject);
142
143     /*!
144      * \brief Fuse neighbour triangles into quadrangles.
145      * \param theElems     The triangles to be fused.
146      * \param theCriterion Is used to choose a neighbour to fuse with.
147      * \param theMaxAngle  Is a max angle between element normals at which fusion
148      *                     is still performed; theMaxAngle is mesured in radians.
149      * \return TRUE in case of success, FALSE otherwise.
150      */
151     boolean TriToQuad (in long_array       IDsOfElements,
152                        in NumericalFunctor Criterion,
153                        in double           MaxAngle);
154
155     /*!
156      * \brief Fuse neighbour triangles into quadrangles.
157      *
158      * Behaves like the above method, taking list of elements from \a theObject
159      */
160     boolean TriToQuadObject (in SMESH_IDSource   theObject,
161                              in NumericalFunctor Criterion,
162                              in double           MaxAngle);
163
164     /*!
165      * \brief Split quadrangles into triangles.
166      * \param theElems     The faces to be splitted.
167      * \param theCriterion Is used to choose a diagonal for splitting.
168      * \return TRUE in case of success, FALSE otherwise.
169      */
170     boolean QuadToTri (in long_array       IDsOfElements,
171                        in NumericalFunctor Criterion);
172
173     /*!
174      * \brief Split quadrangles into triangles.
175      *
176      * Behaves like the above method, taking list of elements from \a theObject
177      */
178     boolean QuadToTriObject (in SMESH_IDSource   theObject,
179                              in NumericalFunctor Criterion);
180
181     /*!
182      * \brief Split quadrangles into triangles.
183      * \param theElems  The faces to be splitted.
184      * \param the13Diag Is used to choose a diagonal for splitting.
185      * \return TRUE in case of success, FALSE otherwise.
186      */
187     boolean SplitQuad (in long_array IDsOfElements,
188                        in boolean    Diag13);
189
190     /*!
191      * \brief Split quadrangles into triangles.
192      *
193      * Behaves like the above method, taking list of elements from \a theObject
194      */
195     boolean SplitQuadObject (in SMESH_IDSource theObject,
196                              in boolean        Diag13);
197
198     /*!
199      *  Find better splitting of the given quadrangle.
200      *  \param IDOfQuad  ID of the quadrangle to be splitted.
201      *  \param Criterion A criterion to choose a diagonal for splitting.
202      *  \return 1 if 1-3 diagonal is better, 2 if 2-4
203      *          diagonal is better, 0 if error occurs.
204      */
205     long BestSplit (in long             IDOfQuad,
206                     in NumericalFunctor Criterion);
207
208     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
209
210     boolean Smooth(in long_array    IDsOfElements,
211                    in long_array    IDsOfFixedNodes,
212                    in long          MaxNbOfIterations,
213                    in double        MaxAspectRatio,
214                    in Smooth_Method Method);
215
216     boolean SmoothObject(in SMESH_IDSource  theObject,
217                          in long_array      IDsOfFixedNodes,
218                          in long            MaxNbOfIterations,
219                          in double          MaxAspectRatio,
220                          in Smooth_Method   Method);
221
222     boolean SmoothParametric(in long_array    IDsOfElements,
223                              in long_array    IDsOfFixedNodes,
224                              in long          MaxNbOfIterations,
225                              in double        MaxAspectRatio,
226                              in Smooth_Method Method);
227
228     boolean SmoothParametricObject(in SMESH_IDSource  theObject,
229                                    in long_array      IDsOfFixedNodes,
230                                    in long            MaxNbOfIterations,
231                                    in double          MaxAspectRatio,
232                                    in Smooth_Method   Method);
233
234     void ConvertToQuadratic(in boolean theForce3d);
235
236     boolean ConvertFromQuadratic();
237
238     void RenumberNodes();
239
240     void RenumberElements();
241
242     /*!
243      * \brief Genarate dim+1 elements by rotation of given elements around axis
244      * \param IDsOfElements - elements to ratate
245      * \param Axix - rotation axis
246      * \param AngleInRadians - rotation angle
247      * \param NbOfSteps - number of elements to generate from one element
248      */
249     void RotationSweep(in long_array       IDsOfElements,
250                        in AxisStruct       Axix,
251                        in double           AngleInRadians,
252                        in long             NbOfSteps,
253                        in double           Tolerance);
254     /*!
255      * \brief Same as previous but additionally create groups of elements
256      *  generated from elements belonging to preexisting groups
257      */
258     ListOfGroups RotationSweepMakeGroups(in long_array       IDsOfElements,
259                                          in AxisStruct       Axix,
260                                          in double           AngleInRadians,
261                                          in long             NbOfSteps,
262                                          in double           Tolerance);
263     /*!
264      * \brief Genarate dim+1 elements by rotation of the object around axis
265      * \param theObject - object containing elements to ratate
266      * \param Axix - rotation axis
267      * \param AngleInRadians - rotation angle
268      * \param NbOfSteps - number of elements to generate from one element
269      */
270     void RotationSweepObject(in SMESH_IDSource  theObject,
271                              in AxisStruct      Axix,
272                              in double          AngleInRadians,
273                              in long            NbOfSteps,
274                              in double          Tolerance);
275     /*!
276      * \brief Same as previous but additionally create groups of elements
277      *  generated from elements belonging to preexisting groups
278      */
279     ListOfGroups RotationSweepObjectMakeGroups(in SMESH_IDSource  theObject,
280                                                in AxisStruct      Axix,
281                                                in double          AngleInRadians,
282                                                in long            NbOfSteps,
283                                                in double          Tolerance);
284     /*!
285      * \brief Genarate dim+1 elements by extrusion of elements along vector
286      * \param IDsOfElements - elements to sweep
287      * \param StepVector - vector giving direction and distance of an extrusion step
288      * \param NbOfSteps - number of elements to generate from one element
289      */
290     void ExtrusionSweep(in long_array      IDsOfElements,
291                         in DirStruct       StepVector,
292                         in long            NbOfSteps);
293     /*!
294      * \brief Same as previous but additionally create groups of elements
295      *  generated from elements belonging to preexisting groups
296      */
297     ListOfGroups ExtrusionSweepMakeGroups(in long_array      IDsOfElements,
298                                           in DirStruct       StepVector,
299                                           in long            NbOfSteps);
300    /*!
301     * Generate new elements by extrusion of theElements 
302     * by StepVector by NbOfSteps
303     * param ExtrFlags set flags for performing extrusion
304     * param SewTolerance - uses for comparing locations of nodes if flag
305     *   EXTRUSION_FLAG_SEW is set
306     */
307     void AdvancedExtrusion(in long_array      IDsOfElements,
308                            in DirStruct       StepVector,
309                            in long            NbOfSteps,
310                            in long            ExtrFlags,
311                            in double          SewTolerance);
312     /*!
313      * \brief Same as previous but additionally create groups of elements
314      *  generated from elements belonging to preexisting groups
315      */
316     ListOfGroups AdvancedExtrusionMakeGroups(in long_array      IDsOfElements,
317                                              in DirStruct       StepVector,
318                                              in long            NbOfSteps,
319                                              in long            ExtrFlags,
320                                              in double          SewTolerance);
321
322     void ExtrusionSweepObject(in SMESH_IDSource  theObject,
323                               in DirStruct       StepVector,
324                               in long            NbOfSteps);
325     ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource  theObject,
326                                                 in DirStruct       StepVector,
327                                                 in long            NbOfSteps);
328
329     void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
330                                 in DirStruct      StepVector,
331                                 in long           NbOfSteps);
332     ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject,
333                                                   in DirStruct      StepVector,
334                                                   in long           NbOfSteps);
335
336     void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
337                                 in DirStruct      StepVector,
338                                 in long           NbOfSteps);
339     ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject,
340                                                   in DirStruct      StepVector,
341                                                   in long           NbOfSteps);
342
343     enum Extrusion_Error {
344       EXTR_OK,
345       EXTR_NO_ELEMENTS,
346       EXTR_PATH_NOT_EDGE,
347       EXTR_BAD_PATH_SHAPE,
348       EXTR_BAD_STARTING_NODE,
349       EXTR_BAD_ANGLES_NUMBER,
350       EXTR_CANT_GET_TANGENT
351       };
352
353     Extrusion_Error ExtrusionAlongPath(in long_array        IDsOfElements,
354                                        in SMESH_Mesh        PathMesh,
355                                        in GEOM::GEOM_Object PathShape,
356                                        in long              NodeStart,
357                                        in boolean           HasAngles,
358                                        in double_array      Angles,
359                                        in boolean           HasRefPoint,
360                                        in PointStruct       RefPoint);
361     ListOfGroups ExtrusionAlongPathMakeGroups(in long_array        IDsOfElements,
362                                               in SMESH_Mesh        PathMesh,
363                                               in GEOM::GEOM_Object PathShape,
364                                               in long              NodeStart,
365                                               in boolean           HasAngles,
366                                               in double_array      Angles,
367                                               in boolean           HasRefPoint,
368                                               in PointStruct       RefPoint,
369                                               out Extrusion_Error  Error);
370
371     Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource    theObject,
372                                              in SMESH_Mesh        PathMesh,
373                                              in GEOM::GEOM_Object PathShape,
374                                              in long              NodeStart,
375                                              in boolean           HasAngles,
376                                              in double_array      Angles,
377                                              in boolean           HasRefPoint,
378                                              in PointStruct       RefPoint);
379     ListOfGroups ExtrusionAlongPathObjectMakeGroups(in SMESH_IDSource    theObject,
380                                                     in SMESH_Mesh        PathMesh,
381                                                     in GEOM::GEOM_Object PathShape,
382                                                     in long              NodeStart,
383                                                     in boolean           HasAngles,
384                                                     in double_array      Angles,
385                                                     in boolean           HasRefPoint,
386                                                     in PointStruct       RefPoint,
387                                                     out Extrusion_Error  Error);
388
389    /*!
390     * Compute rotation angles for ExtrusionAlongPath as linear variation
391     * of given angles along path steps
392     * param PathMesh mesh containing a 1D sub-mesh on the edge, along 
393     *                which proceeds the extrusion
394     * param PathShape is shape(edge); as the mesh can be complex, the edge 
395     *                 is used to define the sub-mesh for the path
396     */
397     double_array LinearAnglesVariation(in SMESH_Mesh        PathMesh,
398                                        in GEOM::GEOM_Object PathShape,
399                                        in double_array      Angles);
400
401     enum MirrorType { POINT, AXIS, PLANE };
402
403     void Mirror (in long_array IDsOfElements,
404                  in AxisStruct Mirror,
405                  in MirrorType Type,
406                  in boolean    Copy);
407     ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
408                                    in AxisStruct Mirror,
409                                    in MirrorType Type);
410     SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
411                                in AxisStruct Mirror,
412                                in MirrorType Type,
413                                in boolean    CopyGroups,
414                                in string     MeshName);
415
416     void MirrorObject (in SMESH_IDSource theObject,
417                        in AxisStruct     Mirror,
418                        in MirrorType     Type,
419                        in boolean        Copy);
420     ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
421                                          in AxisStruct     Mirror,
422                                          in MirrorType     Type);
423     SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
424                                      in AxisStruct     Mirror,
425                                      in MirrorType     Type,
426                                      in boolean        CopyGroups,
427                                      in string         MeshName);
428
429     void Translate (in long_array IDsOfElements,
430                     in DirStruct  Vector,
431                     in boolean    Copy);
432     ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
433                                       in DirStruct  Vector);
434     SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
435                                   in DirStruct  Vector,
436                                   in boolean    CopyGroups,
437                                   in string     MeshName);
438
439     void TranslateObject (in SMESH_IDSource theObject,
440                           in DirStruct      Vector,
441                           in boolean        Copy);
442     ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
443                                             in DirStruct      Vector);
444     SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
445                                         in DirStruct      Vector,
446                                         in boolean        CopyGroups,
447                                         in string         MeshName);
448
449     void Rotate (in long_array IDsOfElements,
450                  in AxisStruct Axis,
451                  in double     AngleInRadians,
452                  in boolean    Copy);
453     ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
454                                    in AxisStruct Axis,
455                                    in double     AngleInRadians);
456     SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
457                                in AxisStruct Axis,
458                                in double     AngleInRadians,
459                                in boolean    CopyGroups,
460                                in string     MeshName);
461
462     void RotateObject (in SMESH_IDSource theObject,
463                        in AxisStruct     Axis,
464                        in double         AngleInRadians,
465                        in boolean        Copy);
466     ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
467                                          in AxisStruct     Axis,
468                                          in double         AngleInRadians);
469     SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
470                                      in AxisStruct     Axis,
471                                      in double         AngleInRadians,
472                                      in boolean        CopyGroups,
473                                      in string         MeshName);
474
475     void FindCoincidentNodes (in  double              Tolerance,
476                               out array_of_long_array GroupsOfNodes);
477
478     void FindCoincidentNodesOnPart (in  SMESH_IDSource      SubMeshOrGroup,
479                                     in  double              Tolerance,
480                                     out array_of_long_array GroupsOfNodes);
481
482     void MergeNodes (in array_of_long_array GroupsOfNodes);
483
484     /*!
485      * \brief Find elements built on the same nodes.
486      * \param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching.
487      * \return List of groups of equal elements.
488      */
489     void FindEqualElements (in  SMESH_IDSource      MeshOrSubMeshOrGroup,
490                             out array_of_long_array GroupsOfElementsID);
491
492     /*!
493      * \brief Merge elements in each given group.
494      * \param GroupsOfElementsID Groups of elements for merging.
495      */
496     void MergeElements(in array_of_long_array GroupsOfElementsID);
497
498     /*!
499      * \brief Merge equal elements in the whole mesh.
500      */
501     void MergeEqualElements();
502     
503     /*!
504      * If the given ID is a valid node ID (nodeID > 0), just move this node, else
505      * move the node closest to the point to point's location and return ID of the node
506      */
507     long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
508
509     enum Sew_Error {
510       SEW_OK,
511       SEW_BORDER1_NOT_FOUND,
512       SEW_BORDER2_NOT_FOUND,
513       SEW_BOTH_BORDERS_NOT_FOUND,
514       SEW_BAD_SIDE_NODES,
515       SEW_VOLUMES_TO_SPLIT,
516       // for SewSideElements() only:
517       SEW_DIFF_NB_OF_ELEMENTS,
518       SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
519       SEW_BAD_SIDE1_NODES,
520       SEW_BAD_SIDE2_NODES
521       };
522
523     Sew_Error SewFreeBorders (in long FirstNodeID1,
524                               in long SecondNodeID1,
525                               in long LastNodeID1,
526                               in long FirstNodeID2,
527                               in long SecondNodeID2,
528                               in long LastNodeID2,
529                               in boolean CreatePolygons,
530                               in boolean CreatePolyedrs);
531
532     Sew_Error SewConformFreeBorders (in long FirstNodeID1,
533                                      in long SecondNodeID1,
534                                      in long LastNodeID1,
535                                      in long FirstNodeID2,
536                                      in long SecondNodeID2);
537
538     Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
539                                in long SecondNodeIDOnFreeBorder,
540                                in long LastNodeIDOnFreeBorder,
541                                in long FirstNodeIDOnSide,
542                                in long LastNodeIDOnSide,
543                                in boolean CreatePolygons,
544                                in boolean CreatePolyedrs);
545
546     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
547                                in long_array IDsOfSide2Elements,
548                                in long       NodeID1OfSide1ToMerge,
549                                in long       NodeID1OfSide2ToMerge,
550                                in long       NodeID2OfSide1ToMerge,
551                                in long       NodeID2OfSide2ToMerge);
552
553    /*!
554     * Set new nodes for given element.
555     * If number of nodes is not corresponded to type of
556     * element - returns false
557     */
558     boolean ChangeElemNodes(in long ide, in long_array newIDs);
559
560    /*!
561     * Return data of mesh edition preview which is computed provided 
562     * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
563     */
564     MeshPreviewStruct GetPreviewData();
565
566    /*!
567     * If during last operation of MeshEditor some nodes were
568     * created this method returns list of it's IDs, if new nodes
569     * not creared - returns empty list
570     */
571     long_array GetLastCreatedNodes();
572
573    /*!
574     * If during last operation of MeshEditor some elements were
575     * created this method returns list of it's IDs, if new elements
576     * not creared - returns empty list
577     */
578     long_array GetLastCreatedElems();
579
580   };
581 };
582
583 #endif