Salome HOME
IPAL15344 (SMESH_MeshEditor.idl: signature of MergeEqualElements() was changed):
[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    * Structure used in mesh edit preview data
34    */
35   struct ElementSubType { ElementType SMDS_ElementType;
36                           boolean     isPoly;
37                           long        nbNodesInElement; };
38
39   typedef sequence<ElementSubType> types_array;
40
41   /*!
42    * Structure containing mesh edit preview data
43    */
44   struct MeshPreviewStruct { nodes_array nodesXYZ;
45                              long_array  elementConnectivities;
46                              types_array elementTypes; };
47
48   /*!
49    * This interface makes modifications on the Mesh - removing elements and nodes etc.
50    */
51   interface NumericalFunctor;
52   interface SMESH_MeshEditor
53   {
54     boolean RemoveElements(in long_array IDsOfElements);
55
56     boolean RemoveNodes(in long_array IDsOfNodes);
57
58     long AddNode(in double x, in double y, in double z);
59
60     /*!
61      *  Create edge, either linear and quadratic (this is determed
62      *  by number of given nodes).
63      *  \param IdsOfNodes List of node IDs for creation of element.
64      *  Needed order of nodes in this list corresponds to description
65      *  of MED. This description is located by the following link:
66      *   http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
67      */
68     long AddEdge(in long_array IDsOfNodes);
69
70     /*!
71      *  Create face, either linear and quadratic (this is determed
72      *  by number of given nodes).
73      *  \param IdsOfNodes List of node IDs for creation of element.
74      *  Needed order of nodes in this list corresponds to description
75      *  of MED. This description is located by the following link:
76      *   http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
77      */
78     long AddFace(in long_array IDsOfNodes);
79
80     long AddPolygonalFace(in long_array IdsOfNodes);
81
82     /*!
83      *  Create volume, either linear and quadratic (this is determed
84      *  by number of given nodes).
85      *  \param IdsOfNodes List of node IDs for creation of element.
86      *  Needed order of nodes in this list corresponds to description
87      *  of MED. This description is located by the following link:
88      *   http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
89      */
90     long AddVolume(in long_array IDsOfNodes);
91
92     /*!
93      *  Create volume of many faces, giving nodes for each face.
94      *  \param IdsOfNodes List of node IDs for volume creation face by face.
95      *  \param Quantities List of integer values, Quantities[i]
96      *         gives quantity of nodes in face number i.
97      */
98     long AddPolyhedralVolume (in long_array IdsOfNodes,
99                               in long_array Quantities);
100
101     /*!
102      *  Create volume of many faces, giving IDs of existing faces.
103      *  \param IdsOfFaces List of face IDs for volume creation.
104      *  \note The created volume will refer only to nodes
105      *        of the given faces, not to the faces itself.
106      */
107     long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
108
109     boolean MoveNode(in long NodeID, in double x, in double y, in double z);
110
111     boolean InverseDiag(in long NodeID1, in long NodeID2);
112
113     boolean DeleteDiag(in long NodeID1, in long NodeID2);
114
115     boolean Reorient(in long_array IDsOfElements);
116
117     boolean ReorientObject(in SMESH_IDSource theObject);
118
119     /*!
120      * \brief Fuse neighbour triangles into quadrangles.
121      * \param theElems     The triangles to be fused.
122      * \param theCriterion Is used to choose a neighbour to fuse with.
123      * \param theMaxAngle  Is a max angle between element normals at which fusion
124      *                     is still performed; theMaxAngle is mesured in radians.
125      * \return TRUE in case of success, FALSE otherwise.
126      */
127     boolean TriToQuad (in long_array       IDsOfElements,
128                        in NumericalFunctor Criterion,
129                        in double           MaxAngle);
130
131     /*!
132      * \brief Fuse neighbour triangles into quadrangles.
133      *
134      * Behaves like the above method, taking list of elements from \a theObject
135      */
136     boolean TriToQuadObject (in SMESH_IDSource   theObject,
137                              in NumericalFunctor Criterion,
138                              in double           MaxAngle);
139
140     /*!
141      * \brief Split quadrangles into triangles.
142      * \param theElems     The faces to be splitted.
143      * \param theCriterion Is used to choose a diagonal for splitting.
144      * \return TRUE in case of success, FALSE otherwise.
145      */
146     boolean QuadToTri (in long_array       IDsOfElements,
147                        in NumericalFunctor Criterion);
148
149     /*!
150      * \brief Split quadrangles into triangles.
151      *
152      * Behaves like the above method, taking list of elements from \a theObject
153      */
154     boolean QuadToTriObject (in SMESH_IDSource   theObject,
155                              in NumericalFunctor Criterion);
156
157     /*!
158      * \brief Split quadrangles into triangles.
159      * \param theElems  The faces to be splitted.
160      * \param the13Diag Is used to choose a diagonal for splitting.
161      * \return TRUE in case of success, FALSE otherwise.
162      */
163     boolean SplitQuad (in long_array IDsOfElements,
164                        in boolean    Diag13);
165
166     /*!
167      * \brief Split quadrangles into triangles.
168      *
169      * Behaves like the above method, taking list of elements from \a theObject
170      */
171     boolean SplitQuadObject (in SMESH_IDSource theObject,
172                              in boolean        Diag13);
173
174     /*!
175      *  Find better splitting of the given quadrangle.
176      *  \param IDOfQuad  ID of the quadrangle to be splitted.
177      *  \param Criterion A criterion to choose a diagonal for splitting.
178      *  \return 1 if 1-3 diagonal is better, 2 if 2-4
179      *          diagonal is better, 0 if error occurs.
180      */
181     long BestSplit (in long             IDOfQuad,
182                     in NumericalFunctor Criterion);
183
184     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
185
186     boolean Smooth(in long_array    IDsOfElements,
187                    in long_array    IDsOfFixedNodes,
188                    in long          MaxNbOfIterations,
189                    in double        MaxAspectRatio,
190                    in Smooth_Method Method);
191
192     boolean SmoothObject(in SMESH_IDSource  theObject,
193                          in long_array      IDsOfFixedNodes,
194                          in long            MaxNbOfIterations,
195                          in double          MaxAspectRatio,
196                          in Smooth_Method   Method);
197
198     boolean SmoothParametric(in long_array    IDsOfElements,
199                              in long_array    IDsOfFixedNodes,
200                              in long          MaxNbOfIterations,
201                              in double        MaxAspectRatio,
202                              in Smooth_Method Method);
203
204     boolean SmoothParametricObject(in SMESH_IDSource  theObject,
205                                    in long_array      IDsOfFixedNodes,
206                                    in long            MaxNbOfIterations,
207                                    in double          MaxAspectRatio,
208                                    in Smooth_Method   Method);
209
210     void ConvertToQuadratic(in boolean theForce3d);
211
212     boolean ConvertFromQuadratic();
213
214     void RenumberNodes();
215
216     void RenumberElements();
217
218     void RotationSweep(in long_array       IDsOfElements,
219                        in AxisStruct       Axix,
220                        in double           AngleInRadians,
221                        in long             NbOfSteps,
222                        in double           Tolerance);
223
224     void RotationSweepObject(in SMESH_IDSource  theObject,
225                              in AxisStruct      Axix,
226                              in double          AngleInRadians,
227                              in long            NbOfSteps,
228                              in double          Tolerance);
229
230     void ExtrusionSweep(in long_array      IDsOfElements,
231                         in DirStruct       StepVector,
232                         in long            NbOfSteps);
233
234    /*!
235     * Generate new elements by extrusion of theElements 
236     * by StepVector by NbOfSteps
237     * param ExtrFlags set flags for performing extrusion
238     * param SewTolerance - uses for comparing locations of nodes if flag
239     *   EXTRUSION_FLAG_SEW is set
240     */
241     void AdvancedExtrusion(in long_array      IDsOfElements,
242                            in DirStruct       StepVector,
243                            in long            NbOfSteps,
244                            in long            ExtrFlags,
245                            in double          SewTolerance);
246
247     void ExtrusionSweepObject(in SMESH_IDSource  theObject,
248                               in DirStruct       StepVector,
249                               in long            NbOfSteps);
250
251     void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
252                                 in DirStruct      StepVector,
253                                 in long           NbOfSteps);
254
255     void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
256                                 in DirStruct      StepVector,
257                                 in long           NbOfSteps);
258
259     enum Extrusion_Error {
260       EXTR_OK,
261       EXTR_NO_ELEMENTS,
262       EXTR_PATH_NOT_EDGE,
263       EXTR_BAD_PATH_SHAPE,
264       EXTR_BAD_STARTING_NODE,
265       EXTR_BAD_ANGLES_NUMBER,
266       EXTR_CANT_GET_TANGENT
267       };
268
269     Extrusion_Error ExtrusionAlongPath(in long_array        IDsOfElements,
270                                        in SMESH_Mesh        PathMesh,
271                                        in GEOM::GEOM_Object PathShape,
272                                        in long              NodeStart,
273                                        in boolean           HasAngles,
274                                        in double_array      Angles,
275                                        in boolean           HasRefPoint,
276                                        in PointStruct       RefPoint);
277
278     Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource    theObject,
279                                              in SMESH_Mesh        PathMesh,
280                                              in GEOM::GEOM_Object PathShape,
281                                              in long              NodeStart,
282                                              in boolean           HasAngles,
283                                              in double_array      Angles,
284                                              in boolean           HasRefPoint,
285                                              in PointStruct       RefPoint);
286
287    /*!
288     * Compute rotation angles for ExtrusionAlongPath as linear variation
289     * of given angles along path steps
290     * param PathMesh mesh containing a 1D sub-mesh on the edge, along 
291     *                which proceeds the extrusion
292     * param PathShape is shape(edge); as the mesh can be complex, the edge 
293     *                 is used to define the sub-mesh for the path
294     */
295     double_array LinearAnglesVariation(in SMESH_Mesh        PathMesh,
296                                        in GEOM::GEOM_Object PathShape,
297                                        in double_array      Angles);
298
299     enum MirrorType { POINT, AXIS, PLANE };
300
301     void Mirror (in long_array       IDsOfElements,
302                  in AxisStruct       Mirror,
303                  in MirrorType       theMirrorType,
304                  in boolean          Copy);
305
306     void MirrorObject (in SMESH_IDSource  theObject,
307                        in AxisStruct      Mirror,
308                        in MirrorType      theMirrorType,
309                        in boolean         Copy);
310
311     void Translate (in long_array      IDsOfElements,
312                     in DirStruct       Vector,
313                     in boolean         Copy);
314
315     void TranslateObject (in SMESH_IDSource  theObject,
316                           in DirStruct       Vector,
317                           in boolean         Copy);
318
319     void Rotate (in long_array       IDsOfElements,
320                  in AxisStruct       Axis,
321                  in double           AngleInRadians,
322                  in boolean          Copy);
323
324     void RotateObject (in SMESH_IDSource  theObject,
325                        in AxisStruct      Axis,
326                        in double          AngleInRadians,
327                        in boolean         Copy);
328
329     void FindCoincidentNodes (in  double              Tolerance,
330                               out array_of_long_array GroupsOfNodes);
331
332     void FindCoincidentNodesOnPart (in  SMESH_IDSource      SubMeshOrGroup,
333                                     in  double              Tolerance,
334                                     out array_of_long_array GroupsOfNodes);
335
336     void MergeNodes (in array_of_long_array GroupsOfNodes);
337
338     /*!
339      * \brief Find elements built on the same nodes.
340      * \param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching.
341      * \return List of groups of equal elements.
342      */
343     void FindEqualElements (in  SMESH_IDSource      MeshOrSubMeshOrGroup,
344                             out array_of_long_array GroupsOfElementsID);
345
346     /*!
347      * \brief Merge elements in each given group.
348      * \param GroupsOfElementsID Groups of elements for merging.
349      */
350     void MergeElements(in array_of_long_array GroupsOfElementsID);
351
352     /*!
353      * \brief Merge equal elements in the whole mesh.
354      */
355     void MergeEqualElements();
356     
357     /*!
358      * If the given ID is a valid node ID (nodeID > 0), just move this node, else
359      * move the node closest to the point to point's location and return ID of the node
360      */
361     long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
362
363     enum Sew_Error {
364       SEW_OK,
365       SEW_BORDER1_NOT_FOUND,
366       SEW_BORDER2_NOT_FOUND,
367       SEW_BOTH_BORDERS_NOT_FOUND,
368       SEW_BAD_SIDE_NODES,
369       SEW_VOLUMES_TO_SPLIT,
370       // for SewSideElements() only:
371       SEW_DIFF_NB_OF_ELEMENTS,
372       SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
373       SEW_BAD_SIDE1_NODES,
374       SEW_BAD_SIDE2_NODES
375       };
376
377     Sew_Error SewFreeBorders (in long FirstNodeID1,
378                               in long SecondNodeID1,
379                               in long LastNodeID1,
380                               in long FirstNodeID2,
381                               in long SecondNodeID2,
382                               in long LastNodeID2,
383                               in boolean CreatePolygons,
384                               in boolean CreatePolyedrs);
385
386     Sew_Error SewConformFreeBorders (in long FirstNodeID1,
387                                      in long SecondNodeID1,
388                                      in long LastNodeID1,
389                                      in long FirstNodeID2,
390                                      in long SecondNodeID2);
391
392     Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
393                                in long SecondNodeIDOnFreeBorder,
394                                in long LastNodeIDOnFreeBorder,
395                                in long FirstNodeIDOnSide,
396                                in long LastNodeIDOnSide,
397                                in boolean CreatePolygons,
398                                in boolean CreatePolyedrs);
399
400     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
401                                in long_array IDsOfSide2Elements,
402                                in long       NodeID1OfSide1ToMerge,
403                                in long       NodeID1OfSide2ToMerge,
404                                in long       NodeID2OfSide1ToMerge,
405                                in long       NodeID2OfSide2ToMerge);
406
407    /*!
408     * Set new nodes for given element.
409     * If number of nodes is not corresponded to type of
410     * element - returns false
411     */
412     boolean ChangeElemNodes(in long ide, in long_array newIDs);
413
414    /*!
415     * Return data of mesh edition preview which is computed provided 
416     * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
417     */
418     MeshPreviewStruct GetPreviewData();
419
420    /*!
421     * If during last operation of MeshEditor some nodes were
422     * created this method returns list of it's IDs, if new nodes
423     * not creared - returns empty list
424     */
425     long_array GetLastCreatedNodes();
426
427    /*!
428     * If during last operation of MeshEditor some elements were
429     * created this method returns list of it's IDs, if new elements
430     * not creared - returns empty list
431     */
432     long_array GetLastCreatedElems();
433
434   };
435 };
436
437 #endif