1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 // File : SMESH_MeshEditor_i.hxx
25 // Author : Nicolas REJNERI
28 #ifndef _SMESH_MESHEDITOR_I_HXX_
29 #define _SMESH_MESHEDIOTR_I_HXX_
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
36 #include "SMESH_Mesh.hxx"
37 #include "SMESH_PythonDump.hxx"
38 #include "SMESH_MeshEditor.hxx"
43 namespace MeshEditor_I {
45 struct ExtrusionParams;
48 class SMESH_I_EXPORT SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
51 SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
53 virtual ~ SMESH_MeshEditor_i();
55 * \brief Return edited mesh ID
56 * \retval int - mesh ID
58 int GetMeshId() const { return myMesh->GetId(); }
60 SMESH::SMESH_Mesh_ptr GetMesh();
65 * Return data of mesh edition preview
67 SMESH::MeshPreviewStruct* GetPreviewData() throw (SALOME::SALOME_Exception);
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
73 SMESH::long_array* GetLastCreatedNodes() throw (SALOME::SALOME_Exception);
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
79 SMESH::long_array* GetLastCreatedElems() throw (SALOME::SALOME_Exception);
81 * \brief Clears sequences of last created elements and nodes
83 void ClearLastCreated() throw (SALOME::SALOME_Exception);
85 * \brief Returns description of an error/warning occured during the last operation
87 SMESH::ComputeError* GetLastError() throw (SALOME::SALOME_Exception);
90 * \brief Wrap a sequence of ids in a SMESH_IDSource
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 );
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);
105 * Methods for creation new elements.
106 * Returns ID of created element or 0 if element not created
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);
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.
139 SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
140 const char* theGroupName)
141 throw (SALOME::SALOME_Exception);
144 * \brief Bind a node to a vertex
145 * \param NodeID - node ID
146 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
148 void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
149 throw (SALOME::SALOME_Exception);
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
156 void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
157 CORBA::Double paramOnEdge)
158 throw (SALOME::SALOME_Exception);
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
166 void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
167 CORBA::Double u, CORBA::Double v)
168 throw (SALOME::SALOME_Exception);
170 * \brief Bind a node to a solid
171 * \param NodeID - node ID
172 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
174 void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
175 throw (SALOME::SALOME_Exception);
177 * \brief Bind an element to a shape
178 * \param ElementID - element ID
179 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
181 void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
182 throw (SALOME::SALOME_Exception);
185 CORBA::Boolean MoveNode(CORBA::Long NodeID,
186 CORBA::Double x, CORBA::Double y, CORBA::Double z)
187 throw (SALOME::SALOME_Exception);
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);
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.
207 CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
208 const SMESH::DirStruct& theDirection,
210 const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
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.
219 CORBA::Long Reorient2DBy3D(const SMESH::ListOfIDSources & faces,
220 SMESH::SMESH_IDSource_ptr volumes,
221 CORBA::Boolean outsideNormal)
222 throw (SALOME::SALOME_Exception);
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 void SplitBiQuadraticIntoLinear(const SMESH::ListOfIDSources& elems)
260 throw (SALOME::SALOME_Exception);
262 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
263 const SMESH::long_array & IDsOfFixedNodes,
264 CORBA::Long MaxNbOfIterations,
265 CORBA::Double MaxAspectRatio,
266 SMESH::SMESH_MeshEditor::Smooth_Method Method)
267 throw (SALOME::SALOME_Exception);
268 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
269 const SMESH::long_array & IDsOfFixedNodes,
270 CORBA::Long MaxNbOfIterations,
271 CORBA::Double MaxAspectRatio,
272 SMESH::SMESH_MeshEditor::Smooth_Method Method)
273 throw (SALOME::SALOME_Exception);
274 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
275 const SMESH::long_array & IDsOfFixedNodes,
276 CORBA::Long MaxNbOfIterations,
277 CORBA::Double MaxAspectRatio,
278 SMESH::SMESH_MeshEditor::Smooth_Method Method)
279 throw (SALOME::SALOME_Exception);
280 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
281 const SMESH::long_array & IDsOfFixedNodes,
282 CORBA::Long MaxNbOfIterations,
283 CORBA::Double MaxAspectRatio,
284 SMESH::SMESH_MeshEditor::Smooth_Method Method)
285 throw (SALOME::SALOME_Exception);
286 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
287 const SMESH::long_array & IDsOfFixedNodes,
288 CORBA::Long MaxNbOfIterations,
289 CORBA::Double MaxAspectRatio,
290 SMESH::SMESH_MeshEditor::Smooth_Method Method,
292 throw (SALOME::SALOME_Exception);
293 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
294 const SMESH::long_array & IDsOfFixedNodes,
295 CORBA::Long MaxNbOfIterations,
296 CORBA::Double MaxAspectRatio,
297 SMESH::SMESH_MeshEditor::Smooth_Method Method,
299 throw (SALOME::SALOME_Exception);
301 CORBA::Boolean ConvertFromQuadratic()
302 throw (SALOME::SALOME_Exception);
303 void ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr theObject)
304 throw (SALOME::SALOME_Exception);
305 void ConvertToQuadratic(CORBA::Boolean Force3d)
306 throw (SALOME::SALOME_Exception);
307 void ConvertToQuadraticObject(CORBA::Boolean theForce3d,
308 SMESH::SMESH_IDSource_ptr theObject)
309 throw (SALOME::SALOME_Exception);
310 void ConvertToBiQuadratic(CORBA::Boolean theForce3d,
311 SMESH::SMESH_IDSource_ptr theObject)
312 throw (SALOME::SALOME_Exception);
314 void RenumberNodes() throw (SALOME::SALOME_Exception);
315 void RenumberElements() throw (SALOME::SALOME_Exception);
317 SMESH::ListOfGroups* RotationSweepObjects(const SMESH::ListOfIDSources & nodes,
318 const SMESH::ListOfIDSources & edges,
319 const SMESH::ListOfIDSources & faces,
320 const SMESH::AxisStruct & Axis,
321 CORBA::Double AngleInRadians,
322 CORBA::Long NbOfSteps,
323 CORBA::Double Tolerance,
324 CORBA::Boolean toMakeGroups)
325 throw (SALOME::SALOME_Exception);
327 SMESH::ListOfGroups* ExtrusionSweepObjects(const SMESH::ListOfIDSources & nodes,
328 const SMESH::ListOfIDSources & edges,
329 const SMESH::ListOfIDSources & faces,
330 const SMESH::DirStruct & stepVector,
331 CORBA::Long nbOfSteps,
332 CORBA::Boolean toMakeGroups)
333 throw (SALOME::SALOME_Exception);
335 SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
336 CORBA::Double stepSize,
337 CORBA::Long nbOfSteps,
338 CORBA::Boolean byAverageNormal,
339 CORBA::Boolean useInputElemsOnly,
340 CORBA::Boolean makeGroups,
342 throw (SALOME::SALOME_Exception);
343 SMESH::ListOfGroups* AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
344 const SMESH::DirStruct & theStepVector,
345 CORBA::Long theNbOfSteps,
346 CORBA::Long theExtrFlags,
347 CORBA::Double theSewTolerance,
348 CORBA::Boolean theMakeGroups)
349 throw (SALOME::SALOME_Exception);
352 ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & nodes,
353 const SMESH::ListOfIDSources & edges,
354 const SMESH::ListOfIDSources & faces,
355 SMESH::SMESH_IDSource_ptr PathMesh,
356 GEOM::GEOM_Object_ptr PathShape,
357 CORBA::Long NodeStart,
358 CORBA::Boolean HasAngles,
359 const SMESH::double_array & Angles,
360 CORBA::Boolean LinearVariation,
361 CORBA::Boolean HasRefPoint,
362 const SMESH::PointStruct & RefPoint,
364 SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
365 throw (SALOME::SALOME_Exception);
367 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
368 GEOM::GEOM_Object_ptr PathShape,
369 const SMESH::double_array & Angles);
371 void Mirror(const SMESH::long_array & IDsOfElements,
372 const SMESH::AxisStruct & Axis,
373 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
375 throw (SALOME::SALOME_Exception);
376 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
377 const SMESH::AxisStruct & Axis,
378 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
380 throw (SALOME::SALOME_Exception);
381 void Translate(const SMESH::long_array & IDsOfElements,
382 const SMESH::DirStruct & Vector,
384 throw (SALOME::SALOME_Exception);
385 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
386 const SMESH::DirStruct & Vector,
388 throw (SALOME::SALOME_Exception);
389 void Rotate(const SMESH::long_array & IDsOfElements,
390 const SMESH::AxisStruct & Axis,
393 throw (SALOME::SALOME_Exception);
394 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
395 const SMESH::AxisStruct & Axis,
398 throw (SALOME::SALOME_Exception);
400 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
401 const SMESH::AxisStruct& Mirror,
402 SMESH::SMESH_MeshEditor::MirrorType MirrorType)
403 throw (SALOME::SALOME_Exception);
404 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
405 const SMESH::AxisStruct& Mirror,
406 SMESH::SMESH_MeshEditor::MirrorType MirrorType)
407 throw (SALOME::SALOME_Exception);
408 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
409 const SMESH::DirStruct& Vector)
410 throw (SALOME::SALOME_Exception);
411 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
412 const SMESH::DirStruct& Vector)
413 throw (SALOME::SALOME_Exception);
414 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
415 const SMESH::AxisStruct& Axis,
416 CORBA::Double AngleInRadians)
417 throw (SALOME::SALOME_Exception);
418 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
419 const SMESH::AxisStruct& Axis,
420 CORBA::Double AngleInRadians)
421 throw (SALOME::SALOME_Exception);
423 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
424 const SMESH::AxisStruct& Mirror,
425 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
426 CORBA::Boolean CopyGroups,
427 const char* MeshName)
428 throw (SALOME::SALOME_Exception);
429 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
430 const SMESH::AxisStruct& Mirror,
431 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
432 CORBA::Boolean CopyGroups,
433 const char* MeshName)
434 throw (SALOME::SALOME_Exception);
435 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
436 const SMESH::DirStruct& Vector,
437 CORBA::Boolean CopyGroups,
438 const char* MeshName)
439 throw (SALOME::SALOME_Exception);
440 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
441 const SMESH::DirStruct& Vector,
442 CORBA::Boolean CopyGroups,
443 const char* MeshName)
444 throw (SALOME::SALOME_Exception);
445 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
446 const SMESH::AxisStruct& Axis,
447 CORBA::Double AngleInRadians,
448 CORBA::Boolean CopyGroups,
449 const char* MeshName)
450 throw (SALOME::SALOME_Exception);
451 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
452 const SMESH::AxisStruct& Axis,
453 CORBA::Double AngleInRadians,
454 CORBA::Boolean CopyGroups,
455 const char* MeshName)
456 throw (SALOME::SALOME_Exception);
458 void Scale(SMESH::SMESH_IDSource_ptr theObject,
459 const SMESH::PointStruct& thePoint,
460 const SMESH::double_array& theScaleFact,
461 CORBA::Boolean theCopy)
462 throw (SALOME::SALOME_Exception);
464 SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
465 const SMESH::PointStruct& thePoint,
466 const SMESH::double_array& theScaleFact)
467 throw (SALOME::SALOME_Exception);
469 SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
470 const SMESH::PointStruct& Point,
471 const SMESH::double_array& theScaleFact,
472 CORBA::Boolean CopyGroups,
473 const char* MeshName)
474 throw (SALOME::SALOME_Exception);
476 void FindCoincidentNodes (CORBA::Double Tolerance,
477 SMESH::array_of_long_array_out GroupsOfNodes,
478 CORBA::Boolean SeparateCornersAndMedium)
479 throw (SALOME::SALOME_Exception);
480 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
481 CORBA::Double Tolerance,
482 SMESH::array_of_long_array_out GroupsOfNodes,
483 CORBA::Boolean SeparateCornersAndMedium)
484 throw (SALOME::SALOME_Exception);
485 void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr Object,
486 CORBA::Double Tolerance,
487 SMESH::array_of_long_array_out GroupsOfNodes,
488 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
489 CORBA::Boolean SeparateCornersAndMedium)
490 throw (SALOME::SALOME_Exception);
491 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes,
492 const SMESH::ListOfIDSources& NodesToKeep )
493 throw (SALOME::SALOME_Exception);
494 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
495 SMESH::array_of_long_array_out GroupsOfElementsID)
496 throw (SALOME::SALOME_Exception);
497 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID)
498 throw (SALOME::SALOME_Exception);
499 void MergeEqualElements()
500 throw (SALOME::SALOME_Exception);
501 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
505 throw (SALOME::SALOME_Exception);
507 * \brief Return ID of node closest to a given point
509 CORBA::Long FindNodeClosestTo(CORBA::Double x,
512 throw (SALOME::SALOME_Exception);
514 * Return elements of given type where the given point is IN or ON.
515 * 'ALL' type means elements of any type excluding nodes
517 SMESH::long_array* FindElementsByPoint(CORBA::Double x,
520 SMESH::ElementType type)
521 throw (SALOME::SALOME_Exception);
523 * Searching among the given elements, return elements of given type
524 * where the given point is IN or ON.
525 * 'ALL' type means elements of any type excluding nodes
527 SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
531 SMESH::ElementType type)
532 throw (SALOME::SALOME_Exception);
535 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
536 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
538 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z)
539 throw (SALOME::SALOME_Exception);
541 SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
542 CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
543 CORBA::Boolean createPolygons,
544 CORBA::Boolean createPolyedrs)
545 throw (SALOME::SALOME_Exception);
547 SMESH::SMESH_MeshEditor::Sew_Error
548 SewFreeBorders(CORBA::Long FirstNodeID1,
549 CORBA::Long SecondNodeID1,
550 CORBA::Long LastNodeID1,
551 CORBA::Long FirstNodeID2,
552 CORBA::Long SecondNodeID2,
553 CORBA::Long LastNodeID2,
554 CORBA::Boolean CreatePolygons,
555 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
556 SMESH::SMESH_MeshEditor::Sew_Error
557 SewConformFreeBorders(CORBA::Long FirstNodeID1,
558 CORBA::Long SecondNodeID1,
559 CORBA::Long LastNodeID1,
560 CORBA::Long FirstNodeID2,
561 CORBA::Long SecondNodeID2) throw (SALOME::SALOME_Exception);
562 SMESH::SMESH_MeshEditor::Sew_Error
563 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
564 CORBA::Long SecondNodeIDOnFreeBorder,
565 CORBA::Long LastNodeIDOnFreeBorder,
566 CORBA::Long FirstNodeIDOnSide,
567 CORBA::Long LastNodeIDOnSide,
568 CORBA::Boolean CreatePolygons,
569 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
570 SMESH::SMESH_MeshEditor::Sew_Error
571 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
572 const SMESH::long_array& IDsOfSide2Elements,
573 CORBA::Long NodeID1OfSide1ToMerge,
574 CORBA::Long NodeID1OfSide2ToMerge,
575 CORBA::Long NodeID2OfSide1ToMerge,
576 CORBA::Long NodeID2OfSide2ToMerge) throw (SALOME::SALOME_Exception);
579 * Set new nodes for given element.
580 * If number of nodes is not corresponded to type of
581 * element - returns false
583 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
584 throw (SALOME::SALOME_Exception);
586 SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
587 const char* theGroupName)
588 throw (SALOME::SALOME_Exception);
590 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
591 const SMESH::long_array& theModifiedElems )
592 throw (SALOME::SALOME_Exception);
594 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
595 const SMESH::long_array& theModifiedElems )
596 throw (SALOME::SALOME_Exception);
598 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
599 SMESH::SMESH_GroupBase_ptr theModifiedElems )
600 throw (SALOME::SALOME_Exception);
603 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
604 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
605 * \param theNodes - group of nodes to be doubled.
606 * \param theModifiedElems - group of elements to be updated.
607 * \return a new group with newly created nodes
608 * \sa DoubleNodeGroup()
610 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
611 SMESH::SMESH_GroupBase_ptr theModifiedElems )
612 throw (SALOME::SALOME_Exception);
614 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
615 const SMESH::ListOfGroups& theModifiedElems )
616 throw (SALOME::SALOME_Exception);
618 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
619 const SMESH::ListOfGroups& theModifiedElems )
620 throw (SALOME::SALOME_Exception);
623 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
624 * \param theElems - the list of elements (edges or faces) to be replicated
625 * The nodes for duplication could be found from these elements
626 * \param theNodesNot - list of nodes to NOT replicate
627 * \param theAffectedElems - the list of elements (cells and edges) to which the
628 * replicated nodes should be associated to.
629 * \return TRUE if operation has been completed successfully, FALSE otherwise
630 * \sa DoubleNodeGroup(), DoubleNodeGroups()
632 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
633 const SMESH::long_array& theNodesNot,
634 const SMESH::long_array& theAffectedElems )
635 throw (SALOME::SALOME_Exception);
638 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
639 * \param theElems - the list of elements (edges or faces) to be replicated
640 * The nodes for duplication could be found from these elements
641 * \param theNodesNot - list of nodes to NOT replicate
642 * \param theShape - shape to detect affected elements (element which geometric center
643 * located on or inside shape).
644 * The replicated nodes should be associated to affected elements.
645 * \return TRUE if operation has been completed successfully, FALSE otherwise
646 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
648 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
649 const SMESH::long_array& theNodesNot,
650 GEOM::GEOM_Object_ptr theShape )
651 throw (SALOME::SALOME_Exception);
654 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
655 * \param theElems - group of of elements (edges or faces) to be replicated
656 * \param theNodesNot - group of nodes not to replicated
657 * \param theAffectedElems - group of elements to which the replicated nodes
658 * should be associated to.
659 * \return TRUE if operation has been completed successfully, FALSE otherwise
660 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
662 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
663 SMESH::SMESH_GroupBase_ptr theNodesNot,
664 SMESH::SMESH_GroupBase_ptr theAffectedElems )
665 throw (SALOME::SALOME_Exception);
668 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
669 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
670 * \param theElems - group of of elements (edges or faces) to be replicated
671 * \param theNodesNot - group of nodes not to replicated
672 * \param theAffectedElems - group of elements to which the replicated nodes
673 * should be associated to.
674 * \return a new group with newly created elements
675 * \sa DoubleNodeElemGroup()
677 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
678 SMESH::SMESH_GroupBase_ptr theNodesNot,
679 SMESH::SMESH_GroupBase_ptr theAffectedElems )
680 throw (SALOME::SALOME_Exception);
682 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
683 SMESH::SMESH_GroupBase_ptr theNodesNot,
684 SMESH::SMESH_GroupBase_ptr theAffectedElems,
685 CORBA::Boolean theElemGroupNeeded,
686 CORBA::Boolean theNodeGroupNeeded)
687 throw (SALOME::SALOME_Exception);
690 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
691 * \param theElems - group of of elements (edges or faces) to be replicated
692 * \param theNodesNot - group of nodes not to replicated
693 * \param theShape - shape to detect affected elements (element which geometric center
694 * located on or inside shape).
695 * The replicated nodes should be associated to affected elements.
696 * \return TRUE if operation has been completed successfully, FALSE otherwise
697 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
699 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
700 SMESH::SMESH_GroupBase_ptr theNodesNot,
701 GEOM::GEOM_Object_ptr theShape )
702 throw (SALOME::SALOME_Exception);
705 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
706 * This method provided for convenience works as DoubleNodes() described above.
707 * \param theElems - list of groups of elements (edges or faces) to be replicated
708 * \param theNodesNot - list of groups of nodes not to replicated
709 * \param theAffectedElems - group of elements to which the replicated nodes
710 * should be associated to.
711 * \return TRUE if operation has been completed successfully, FALSE otherwise
712 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
714 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
715 const SMESH::ListOfGroups& theNodesNot,
716 const SMESH::ListOfGroups& theAffectedElems )
717 throw (SALOME::SALOME_Exception);
720 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
721 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
722 * \param theElems - list of groups of elements (edges or faces) to be replicated
723 * \param theNodesNot - list of groups of nodes not to replicated
724 * \param theAffectedElems - group of elements to which the replicated nodes
725 * should be associated to.
726 * \return a new group with newly created elements
727 * \sa DoubleNodeElemGroups()
729 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
730 const SMESH::ListOfGroups& theNodesNot,
731 const SMESH::ListOfGroups& theAffectedElems )
732 throw (SALOME::SALOME_Exception);
734 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
735 const SMESH::ListOfGroups& theNodesNot,
736 const SMESH::ListOfGroups& theAffectedElems,
737 CORBA::Boolean theElemGroupNeeded,
738 CORBA::Boolean theNodeGroupNeeded)
739 throw (SALOME::SALOME_Exception);
742 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
743 * This method provided for convenience works as DoubleNodes() described above.
744 * \param theElems - list of groups of elements (edges or faces) to be replicated
745 * \param theNodesNot - list of groups of nodes not to replicated
746 * \param theShape - shape to detect affected elements (element which geometric center
747 * located on or inside shape).
748 * The replicated nodes should be associated to affected elements.
749 * \return TRUE if operation has been completed successfully, FALSE otherwise
750 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
752 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
753 const SMESH::ListOfGroups& theNodesNot,
754 GEOM::GEOM_Object_ptr theShape )
755 throw (SALOME::SALOME_Exception);
758 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
759 * This method is the first step of DoubleNodeElemGroupsInRegion.
760 * \param theElems - list of groups of elements (edges or faces) to be replicated
761 * \param theNodesNot - list of groups of nodes not to replicated
762 * \param theShape - shape to detect affected elements (element which geometric center
763 * located on or inside shape).
764 * The replicated nodes should be associated to affected elements.
765 * \return groups of affected elements
766 * \sa DoubleNodeElemGroupsInRegion()
768 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
769 const SMESH::ListOfGroups& theNodesNot,
770 GEOM::GEOM_Object_ptr theShape )
771 throw (SALOME::SALOME_Exception);
774 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
775 * The list of groups must describe a partition of the mesh volumes.
776 * The nodes of the internal faces at the boundaries of the groups are doubled.
777 * In option, the internal faces are replaced by flat elements.
778 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
779 * \param theDomains - list of groups of volumes
780 * \param createJointElems - if TRUE, create the elements
781 * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
782 * the boundary between \a theDomains and the rest mesh
783 * \return TRUE if operation has been completed successfully, FALSE otherwise
785 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
786 CORBA::Boolean createJointElems,
787 CORBA::Boolean onAllBoundaries )
788 throw (SALOME::SALOME_Exception);
790 * \brief Double nodes on some external faces and create flat elements.
791 * Flat elements are mainly used by some types of mechanic calculations.
793 * Each group of the list must be constituted of faces.
794 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
795 * @param theGroupsOfFaces - list of groups of faces
796 * @return TRUE if operation has been completed successfully, FALSE otherwise
798 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces )
799 throw (SALOME::SALOME_Exception);
802 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
803 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
804 * groups of faces to remove insidethe object, (idem edges).
805 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
807 void CreateHoleSkin(CORBA::Double radius,
808 GEOM::GEOM_Object_ptr theShape,
809 const char* groupName,
810 const SMESH::double_array& theNodesCoords,
811 SMESH::array_of_long_array_out GroupsOfNodes)
812 throw (SALOME::SALOME_Exception);
815 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
816 * The created 2D mesh elements based on nodes of free faces of boundary volumes
817 * \return TRUE if operation has been completed successfully, FALSE otherwise
819 CORBA::Boolean Make2DMeshFrom3D()
820 throw (SALOME::SALOME_Exception);
822 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
823 SMESH::Bnd_Dimension dimension,
824 const char* groupName,
825 const char* meshName,
826 CORBA::Boolean toCopyElements,
827 CORBA::Boolean toCopyMissingBondary,
828 SMESH::SMESH_Group_out group)
829 throw (SALOME::SALOME_Exception);
831 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
832 const char* groupName,
833 const char* meshName,
834 CORBA::Boolean toCopyAll,
835 const SMESH::ListOfIDSources& groups,
836 SMESH::SMESH_Mesh_out mesh,
837 SMESH::SMESH_Group_out group)
838 throw (SALOME::SALOME_Exception);
840 private: //!< private methods
842 ::SMESH_MeshEditor& getEditor();
844 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
846 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
848 void declareMeshModified( bool isReComputeSafe );
851 * \brief Clear myLastCreated* or myPreviewData
853 void initData(bool deleteSearchers=true);
856 * \brief Return groups by their IDs
858 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
859 throw (SALOME::SALOME_Exception);
861 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
862 const SMESH::AxisStruct & Axis,
863 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
866 ::SMESH_Mesh* TargetMesh=0)
867 throw (SALOME::SALOME_Exception);
868 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
869 const SMESH::DirStruct & Vector,
872 ::SMESH_Mesh* TargetMesh=0)
873 throw (SALOME::SALOME_Exception);
874 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
875 const SMESH::AxisStruct & Axis,
879 ::SMESH_Mesh* TargetMesh=0)
880 throw (SALOME::SALOME_Exception);
882 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
883 const SMESH::PointStruct& thePoint,
884 const SMESH::double_array& theScaleFact,
885 CORBA::Boolean theCopy,
887 ::SMESH_Mesh* theTargetMesh=0)
888 throw (SALOME::SALOME_Exception);
890 void convertToQuadratic(CORBA::Boolean theForce3d,
891 CORBA::Boolean theToBiQuad,
892 SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil())
893 throw (SALOME::SALOME_Exception);
895 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
897 void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
898 const SMESH::ListOfGroups * theGroupList);
900 string generateGroupName(const string& thePrefix);
902 void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
905 enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
907 bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
908 const SMESHDS_Mesh* theMeshDS,
909 TIDSortedElemSet& theElemSet,
910 const SMDSAbs_ElementType theType,
911 const bool emptyIfIsMesh = false,
912 IDSource_Error* error = 0);
914 void findCoincidentNodes( TIDSortedNodeSet & Nodes,
915 CORBA::Double Tolerance,
916 SMESH::array_of_long_array_out GroupsOfNodes,
917 CORBA::Boolean SeparateCornersAndMedium);
923 SMESH_Mesh_i* myMesh_i;
925 ::SMESH_MeshEditor myEditor;
927 bool myIsPreviewMode;
928 MeshEditor_I::TPreviewMesh * myPreviewMesh;
929 ::SMESH_MeshEditor * myPreviewEditor;
930 SMESH::MeshPreviewStruct_var myPreviewData;
932 // temporary IDSources
934 // std::list< _IDSource* > myAuxIDSources;
935 // void deleteAuxIDSources();