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 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
290 void ExtrusionSweep(in long_array IDsOfElements,
291 in DirStruct StepVector,
294 * \brief Same as previous but additionally create groups of elements
295 * generated from elements belonging to preexisting groups
297 ListOfGroups ExtrusionSweepMakeGroups(in long_array IDsOfElements,
298 in DirStruct StepVector,
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
307 void AdvancedExtrusion(in long_array IDsOfElements,
308 in DirStruct StepVector,
311 in double SewTolerance);
313 * \brief Same as previous but additionally create groups of elements
314 * generated from elements belonging to preexisting groups
316 ListOfGroups AdvancedExtrusionMakeGroups(in long_array IDsOfElements,
317 in DirStruct StepVector,
320 in double SewTolerance);
322 void ExtrusionSweepObject(in SMESH_IDSource theObject,
323 in DirStruct StepVector,
325 ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource theObject,
326 in DirStruct StepVector,
329 void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
330 in DirStruct StepVector,
332 ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject,
333 in DirStruct StepVector,
336 void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
337 in DirStruct StepVector,
339 ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject,
340 in DirStruct StepVector,
343 enum Extrusion_Error {
348 EXTR_BAD_STARTING_NODE,
349 EXTR_BAD_ANGLES_NUMBER,
350 EXTR_CANT_GET_TANGENT
353 Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
354 in SMESH_Mesh PathMesh,
355 in GEOM::GEOM_Object PathShape,
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,
365 in boolean HasAngles,
366 in double_array Angles,
367 in boolean HasRefPoint,
368 in PointStruct RefPoint,
369 out Extrusion_Error Error);
371 Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
372 in SMESH_Mesh PathMesh,
373 in GEOM::GEOM_Object PathShape,
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,
383 in boolean HasAngles,
384 in double_array Angles,
385 in boolean HasRefPoint,
386 in PointStruct RefPoint,
387 out Extrusion_Error Error);
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
397 double_array LinearAnglesVariation(in SMESH_Mesh PathMesh,
398 in GEOM::GEOM_Object PathShape,
399 in double_array Angles);
401 enum MirrorType { POINT, AXIS, PLANE };
403 void Mirror (in long_array IDsOfElements,
404 in AxisStruct Mirror,
407 ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
408 in AxisStruct Mirror,
410 SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
411 in AxisStruct Mirror,
413 in boolean CopyGroups,
416 void MirrorObject (in SMESH_IDSource theObject,
417 in AxisStruct Mirror,
420 ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
421 in AxisStruct Mirror,
423 SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
424 in AxisStruct Mirror,
426 in boolean CopyGroups,
429 void Translate (in long_array IDsOfElements,
432 ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
433 in DirStruct Vector);
434 SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
436 in boolean CopyGroups,
439 void TranslateObject (in SMESH_IDSource theObject,
442 ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
443 in DirStruct Vector);
444 SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
446 in boolean CopyGroups,
449 void Rotate (in long_array IDsOfElements,
451 in double AngleInRadians,
453 ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
455 in double AngleInRadians);
456 SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
458 in double AngleInRadians,
459 in boolean CopyGroups,
462 void RotateObject (in SMESH_IDSource theObject,
464 in double AngleInRadians,
466 ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
468 in double AngleInRadians);
469 SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
471 in double AngleInRadians,
472 in boolean CopyGroups,
475 void FindCoincidentNodes (in double Tolerance,
476 out array_of_long_array GroupsOfNodes);
478 void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
480 out array_of_long_array GroupsOfNodes);
482 void MergeNodes (in array_of_long_array GroupsOfNodes);
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.
489 void FindEqualElements (in SMESH_IDSource MeshOrSubMeshOrGroup,
490 out array_of_long_array GroupsOfElementsID);
493 * \brief Merge elements in each given group.
494 * \param GroupsOfElementsID Groups of elements for merging.
496 void MergeElements(in array_of_long_array GroupsOfElementsID);
499 * \brief Merge equal elements in the whole mesh.
501 void MergeEqualElements();
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
507 long MoveClosestNodeToPoint(in double x, in double y, in double z, in long nodeID);
511 SEW_BORDER1_NOT_FOUND,
512 SEW_BORDER2_NOT_FOUND,
513 SEW_BOTH_BORDERS_NOT_FOUND,
515 SEW_VOLUMES_TO_SPLIT,
516 // for SewSideElements() only:
517 SEW_DIFF_NB_OF_ELEMENTS,
518 SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
523 Sew_Error SewFreeBorders (in long FirstNodeID1,
524 in long SecondNodeID1,
526 in long FirstNodeID2,
527 in long SecondNodeID2,
529 in boolean CreatePolygons,
530 in boolean CreatePolyedrs);
532 Sew_Error SewConformFreeBorders (in long FirstNodeID1,
533 in long SecondNodeID1,
535 in long FirstNodeID2,
536 in long SecondNodeID2);
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);
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);
554 * Set new nodes for given element.
555 * If number of nodes is not corresponded to type of
556 * element - returns false
558 boolean ChangeElemNodes(in long ide, in long_array newIDs);
561 * Return data of mesh edition preview which is computed provided
562 * that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer()
564 MeshPreviewStruct GetPreviewData();
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
571 long_array GetLastCreatedNodes();
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
578 long_array GetLastCreatedElems();
581 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
582 * \param theNodes - identifiers of nodes to be doubled
583 * \param theModifiedElems - identifiers of elements to be updated by the new (doubled)
584 * nodes. If list of element identifiers is empty then nodes are doubled but
585 * they not assigned to elements
586 * \return TRUE if operation has been completed successfully, FALSE otherwise
587 * \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
589 boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems );
592 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
593 * This method provided for convenience works as DoubleNodes() described above.
594 * \param theNodeId - identifier of node to be doubled.
595 * \param theModifiedElems - identifiers of elements to be updated.
596 * \return TRUE if operation has been completed successfully, FALSE otherwise
597 * \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
599 boolean DoubleNode( in long theNodeId, in long_array theModifiedElems );
602 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
603 * This method provided for convenience works as DoubleNodes() described above.
604 * \param theNodes - group of nodes to be doubled.
605 * \param theModifiedElems - group of elements to be updated.
606 * \return TRUE if operation has been completed successfully, FALSE otherwise
607 * \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups()
609 boolean DoubleNodeGroup( in SMESH_GroupBase theNodes,
610 in SMESH_GroupBase theModifiedElems );
613 \brief Creates a hole in a mesh by doubling the nodes of some particular elements
614 This method provided for convenience works as DoubleNodes() described above.
615 \param theNodes - list of groups of nodes to be doubled
616 \param theModifiedElems - list of groups of elements to be updated.
617 \return TRUE if operation has been completed successfully, FALSE otherwise
618 \sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
620 boolean DoubleNodeGroups( in ListOfGroups theNodes,
621 in ListOfGroups theModifiedElems );