1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESH_MeshEditor.idl
25 #ifndef _SMESH_MESHEDITOR_IDL_
26 #define _SMESH_MESHEDITOR_IDL_
28 #include "SMESH_Mesh.idl"
33 * This interface makes modifications on the Mesh - removing elements and nodes etc.
35 interface NumericalFunctor;
36 interface SMESH_MeshEditor
38 boolean RemoveElements(in long_array IDsOfElements);
40 boolean RemoveNodes(in long_array IDsOfNodes);
42 long AddNode(in double x, in double y, in double z);
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.
52 long AddEdge(in long_array IDsOfNodes);
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.
62 long AddFace(in long_array IDsOfNodes);
64 long AddPolygonalFace(in long_array IdsOfNodes);
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.
74 long AddVolume(in long_array IDsOfNodes);
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.
82 long AddPolyhedralVolume (in long_array IdsOfNodes,
83 in long_array Quantities);
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.
91 long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
94 * \brief Bind a node to a vertex
95 * \param NodeID - node ID
96 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
98 void SetNodeOnVertex(in long NodeID, in long VertexID)
99 raises (SALOME::SALOME_Exception);
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
106 void SetNodeOnEdge(in long NodeID, in long EdgeID, in double paramOnEdge)
107 raises (SALOME::SALOME_Exception);
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
115 void SetNodeOnFace(in long NodeID, in long FaceID, in double u, in double v)
116 raises (SALOME::SALOME_Exception);
118 * \brief Bind a node to a solid
119 * \param NodeID - node ID
120 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
122 void SetNodeInVolume(in long NodeID, in long SolidID)
123 raises (SALOME::SALOME_Exception);
125 * \brief Bind an element to a shape
126 * \param ElementID - element ID
127 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
129 void SetMeshElementOnShape(in long ElementID, in long ShapeID)
130 raises (SALOME::SALOME_Exception);
133 boolean MoveNode(in long NodeID, in double x, in double y, in double z);
135 boolean InverseDiag(in long NodeID1, in long NodeID2);
137 boolean DeleteDiag(in long NodeID1, in long NodeID2);
139 boolean Reorient(in long_array IDsOfElements);
141 boolean ReorientObject(in SMESH_IDSource theObject);
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.
151 boolean TriToQuad (in long_array IDsOfElements,
152 in NumericalFunctor Criterion,
156 * \brief Fuse neighbour triangles into quadrangles.
158 * Behaves like the above method, taking list of elements from \a theObject
160 boolean TriToQuadObject (in SMESH_IDSource theObject,
161 in NumericalFunctor Criterion,
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.
170 boolean QuadToTri (in long_array IDsOfElements,
171 in NumericalFunctor Criterion);
174 * \brief Split quadrangles into triangles.
176 * Behaves like the above method, taking list of elements from \a theObject
178 boolean QuadToTriObject (in SMESH_IDSource theObject,
179 in NumericalFunctor Criterion);
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.
187 boolean SplitQuad (in long_array IDsOfElements,
191 * \brief Split quadrangles into triangles.
193 * Behaves like the above method, taking list of elements from \a theObject
195 boolean SplitQuadObject (in SMESH_IDSource theObject,
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.
205 long BestSplit (in long IDOfQuad,
206 in NumericalFunctor Criterion);
208 enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
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);
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);
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);
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);
234 void ConvertToQuadratic(in boolean theForce3d);
236 boolean ConvertFromQuadratic();
238 void RenumberNodes();
240 void RenumberElements();
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
249 void RotationSweep(in long_array IDsOfElements,
251 in double AngleInRadians,
253 in double Tolerance);
255 * \brief Same as previous but additionally create groups of elements
256 * generated from elements belonging to preexisting groups
258 ListOfGroups RotationSweepMakeGroups(in long_array IDsOfElements,
260 in double AngleInRadians,
262 in double Tolerance);
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
270 void RotationSweepObject(in SMESH_IDSource theObject,
272 in double AngleInRadians,
274 in double Tolerance);
276 * \brief Same as previous but additionally create groups of elements
277 * generated from elements belonging to preexisting groups
279 ListOfGroups RotationSweepObjectMakeGroups(in SMESH_IDSource theObject,
281 in double AngleInRadians,
283 in double Tolerance);
285 * \brief Genarate dim+1 elements by rotation of the object around axis
286 * \param theObject - object containing elements to ratate
287 * \param Axix - rotation axis
288 * \param AngleInRadians - rotation angle
289 * \param NbOfSteps - number of elements to generate from one element
291 void RotationSweepObject1D(in SMESH_IDSource theObject,
293 in double AngleInRadians,
295 in double Tolerance);
297 * \brief Same as previous but additionally create groups of elements
298 * generated from elements belonging to preexisting groups
300 ListOfGroups RotationSweepObject1DMakeGroups(in SMESH_IDSource theObject,
302 in double AngleInRadians,
304 in double Tolerance);
306 * \brief Genarate dim+1 elements by rotation of the object around axis
307 * \param theObject - object containing elements to ratate
308 * \param Axix - rotation axis
309 * \param AngleInRadians - rotation angle
310 * \param NbOfSteps - number of elements to generate from one element
312 void RotationSweepObject2D(in SMESH_IDSource theObject,
314 in double AngleInRadians,
316 in double Tolerance);
318 * \brief Same as previous but additionally create groups of elements
319 * generated from elements belonging to preexisting groups
321 ListOfGroups RotationSweepObject2DMakeGroups(in SMESH_IDSource theObject,
323 in double AngleInRadians,
325 in double Tolerance);
327 * \brief Genarate dim+1 elements by extrusion of elements along vector
328 * \param IDsOfElements - elements to sweep
329 * \param StepVector - vector giving direction and distance of an extrusion step
330 * \param NbOfSteps - number of elements to generate from one element
332 void ExtrusionSweep(in long_array IDsOfElements,
333 in DirStruct StepVector,
336 * \brief Same as previous but additionally create groups of elements
337 * generated from elements belonging to preexisting groups
339 ListOfGroups ExtrusionSweepMakeGroups(in long_array IDsOfElements,
340 in DirStruct StepVector,
343 * Generate new elements by extrusion of theElements
344 * by StepVector by NbOfSteps
345 * param ExtrFlags set flags for performing extrusion
346 * param SewTolerance - uses for comparing locations of nodes if flag
347 * EXTRUSION_FLAG_SEW is set
349 void AdvancedExtrusion(in long_array IDsOfElements,
350 in DirStruct StepVector,
353 in double SewTolerance);
355 * \brief Same as previous but additionally create groups of elements
356 * generated from elements belonging to preexisting groups
358 ListOfGroups AdvancedExtrusionMakeGroups(in long_array IDsOfElements,
359 in DirStruct StepVector,
362 in double SewTolerance);
364 void ExtrusionSweepObject(in SMESH_IDSource theObject,
365 in DirStruct StepVector,
367 ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource theObject,
368 in DirStruct StepVector,
371 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
372 in DirStruct StepVector,
374 ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject,
375 in DirStruct StepVector,
378 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
379 in DirStruct StepVector,
381 ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject,
382 in DirStruct StepVector,
385 enum Extrusion_Error {
390 EXTR_BAD_STARTING_NODE,
391 EXTR_BAD_ANGLES_NUMBER,
392 EXTR_CANT_GET_TANGENT
395 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
396 in SMESH_Mesh PathMesh,
397 in GEOM::GEOM_Object PathShape,
399 in boolean HasAngles,
400 in double_array Angles,
401 in boolean HasRefPoint,
402 in PointStruct RefPoint);
403 ListOfGroups ExtrusionAlongPathMakeGroups(in long_array IDsOfElements,
404 in SMESH_Mesh PathMesh,
405 in GEOM::GEOM_Object PathShape,
407 in boolean HasAngles,
408 in double_array Angles,
409 in boolean HasRefPoint,
410 in PointStruct RefPoint,
411 out Extrusion_Error Error);
413 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
414 in SMESH_Mesh PathMesh,
415 in GEOM::GEOM_Object PathShape,
417 in boolean HasAngles,
418 in double_array Angles,
419 in boolean HasRefPoint,
420 in PointStruct RefPoint);
421 ListOfGroups ExtrusionAlongPathObjectMakeGroups(in SMESH_IDSource theObject,
422 in SMESH_Mesh PathMesh,
423 in GEOM::GEOM_Object PathShape,
425 in boolean HasAngles,
426 in double_array Angles,
427 in boolean HasRefPoint,
428 in PointStruct RefPoint,
429 out Extrusion_Error Error);
431 Extrusion_Error ExtrusionAlongPathObject1D(in SMESH_IDSource theObject,
432 in SMESH_Mesh PathMesh,
433 in GEOM::GEOM_Object PathShape,
435 in boolean HasAngles,
436 in double_array Angles,
437 in boolean HasRefPoint,
438 in PointStruct RefPoint);
439 ListOfGroups ExtrusionAlongPathObject1DMakeGroups(in SMESH_IDSource theObject,
440 in SMESH_Mesh PathMesh,
441 in GEOM::GEOM_Object PathShape,
443 in boolean HasAngles,
444 in double_array Angles,
445 in boolean HasRefPoint,
446 in PointStruct RefPoint,
447 out Extrusion_Error Error);
449 Extrusion_Error ExtrusionAlongPathObject2D(in SMESH_IDSource theObject,
450 in SMESH_Mesh PathMesh,
451 in GEOM::GEOM_Object PathShape,
453 in boolean HasAngles,
454 in double_array Angles,
455 in boolean HasRefPoint,
456 in PointStruct RefPoint);
457 ListOfGroups ExtrusionAlongPathObject2DMakeGroups(in SMESH_IDSource theObject,
458 in SMESH_Mesh PathMesh,
459 in GEOM::GEOM_Object PathShape,
461 in boolean HasAngles,
462 in double_array Angles,
463 in boolean HasRefPoint,
464 in PointStruct RefPoint,
465 out Extrusion_Error Error);
468 * Compute rotation angles for ExtrusionAlongPath as linear variation
469 * of given angles along path steps
470 * param PathMesh mesh containing a 1D sub-mesh on the edge, along
471 * which proceeds the extrusion
472 * param PathShape is shape(edge); as the mesh can be complex, the edge
473 * is used to define the sub-mesh for the path
475 double_array LinearAnglesVariation(in SMESH_Mesh PathMesh,
476 in GEOM::GEOM_Object PathShape,
477 in double_array Angles);
479 enum MirrorType { POINT, AXIS, PLANE };
481 void Mirror (in long_array IDsOfElements,
482 in AxisStruct Mirror,
485 ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
486 in AxisStruct Mirror,
488 SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
489 in AxisStruct Mirror,
491 in boolean CopyGroups,
494 void MirrorObject (in SMESH_IDSource theObject,
495 in AxisStruct Mirror,
498 ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
499 in AxisStruct Mirror,
501 SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
502 in AxisStruct Mirror,
504 in boolean CopyGroups,
507 void Translate (in long_array IDsOfElements,
510 ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
511 in DirStruct Vector);
512 SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
514 in boolean CopyGroups,
517 void TranslateObject (in SMESH_IDSource theObject,
520 ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
521 in DirStruct Vector);
522 SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
524 in boolean CopyGroups,
527 void Rotate (in long_array IDsOfElements,
529 in double AngleInRadians,
531 ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
533 in double AngleInRadians);
534 SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
536 in double AngleInRadians,
537 in boolean CopyGroups,
540 void RotateObject (in SMESH_IDSource theObject,
542 in double AngleInRadians,
544 ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
546 in double AngleInRadians);
547 SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
549 in double AngleInRadians,
550 in boolean CopyGroups,
553 void FindCoincidentNodes (in double Tolerance,
554 out array_of_long_array GroupsOfNodes);
556 void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
558 out array_of_long_array GroupsOfNodes);
560 void MergeNodes (in array_of_long_array GroupsOfNodes);
563 * \brief Find elements built on the same nodes.
564 * \param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching.
565 * \return List of groups of equal elements.
567 void FindEqualElements (in SMESH_IDSource MeshOrSubMeshOrGroup,
568 out array_of_long_array GroupsOfElementsID);
571 * \brief Merge elements in each given group.
572 * \param GroupsOfElementsID Groups of elements for merging.
574 void MergeElements(in array_of_long_array GroupsOfElementsID);
577 * \brief Merge equal elements in the whole mesh.
579 void MergeEqualElements();
582 * If the given ID is a valid node ID (nodeID > 0), just move this node, else
583 * move the node closest to the point to point's location and return ID of the node
585 long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
589 SEW_BORDER1_NOT_FOUND,
590 SEW_BORDER2_NOT_FOUND,
591 SEW_BOTH_BORDERS_NOT_FOUND,
593 SEW_VOLUMES_TO_SPLIT,
594 // for SewSideElements() only:
595 SEW_DIFF_NB_OF_ELEMENTS,
596 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
601 Sew_Error SewFreeBorders (in long FirstNodeID1,
602 in long SecondNodeID1,
604 in long FirstNodeID2,
605 in long SecondNodeID2,
607 in boolean CreatePolygons,
608 in boolean CreatePolyedrs);
610 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
611 in long SecondNodeID1,
613 in long FirstNodeID2,
614 in long SecondNodeID2);
616 Sew_Error SewBorderToSide (in long FirstNodeIDOnFreeBorder,
617 in long SecondNodeIDOnFreeBorder,
618 in long LastNodeIDOnFreeBorder,
619 in long FirstNodeIDOnSide,
620 in long LastNodeIDOnSide,
621 in boolean CreatePolygons,
622 in boolean CreatePolyedrs);
624 Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
625 in long_array IDsOfSide2Elements,
626 in long NodeID1OfSide1ToMerge,
627 in long NodeID1OfSide2ToMerge,
628 in long NodeID2OfSide1ToMerge,
629 in long NodeID2OfSide2ToMerge);
632 * Set new nodes for given element.
633 * If number of nodes is not corresponded to type of
634 * element - returns false
636 boolean ChangeElemNodes(in long ide, in long_array newIDs);
639 * Return data of mesh edition preview which is computed provided
640 * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
642 MeshPreviewStruct GetPreviewData();
645 * If during last operation of MeshEditor some nodes were
646 * created this method returns list of it's IDs, if new nodes
647 * not creared - returns empty list
649 long_array GetLastCreatedNodes();
652 * If during last operation of MeshEditor some elements were
653 * created this method returns list of it's IDs, if new elements
654 * not creared - returns empty list
656 long_array GetLastCreatedElems();