1 // Copyright (C) 2007-2016 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 classes
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"
44 namespace MeshEditor_I {
46 struct ExtrusionParams;
49 class SMESH_I_EXPORT SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
52 SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
54 virtual ~ SMESH_MeshEditor_i();
56 * \brief Return edited mesh ID
57 * \retval int - mesh ID
59 int GetMeshId() const { return myMesh->GetId(); }
61 SMESH::SMESH_Mesh_ptr GetMesh();
66 * Return data of mesh edition preview
68 SMESH::MeshPreviewStruct* GetPreviewData() throw (SALOME::SALOME_Exception);
70 * If during last operation of MeshEditor some nodes were
71 * created this method returns list of their IDs, if new nodes
72 * not created - returns an empty list
74 SMESH::long_array* GetLastCreatedNodes() throw (SALOME::SALOME_Exception);
76 * If during last operation of MeshEditor some elements were
77 * created this method returns list of their IDs, if new elements
78 * not created - returns an empty list
80 SMESH::long_array* GetLastCreatedElems() throw (SALOME::SALOME_Exception);
82 * \brief Clears sequences of last created elements and nodes
84 void ClearLastCreated() throw (SALOME::SALOME_Exception);
86 * \brief Returns description of an error/warning occurred during the last operation
88 SMESH::ComputeError* GetLastError() throw (SALOME::SALOME_Exception);
91 * \brief Wrap a sequence of ids in a SMESH_IDSource
93 SMESH::SMESH_IDSource_ptr MakeIDSource(const SMESH::long_array& IDsOfElements,
94 SMESH::ElementType type);
95 static bool IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource );
96 static CORBA::Long* GetTemporaryIDs( SMESH::SMESH_IDSource_ptr& idSource, int& nbIds );
99 * \brief Generates the unique group name
101 std::string GenerateGroupName(const std::string& thePrefix);
103 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements)
104 throw (SALOME::SALOME_Exception);
105 CORBA::Boolean RemoveNodes (const SMESH::long_array & IDsOfNodes)
106 throw (SALOME::SALOME_Exception);
107 CORBA::Long RemoveOrphanNodes()
108 throw (SALOME::SALOME_Exception);
111 * Methods for creation new elements.
112 * Returns ID of created element or 0 if element not created
114 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z)
115 throw (SALOME::SALOME_Exception);
116 CORBA::Long Add0DElement(CORBA::Long IDOfNode, CORBA::Boolean DuplicateElements)
117 throw (SALOME::SALOME_Exception);
118 CORBA::Long AddBall(CORBA::Long IDOfNodem, CORBA::Double diameter)
119 throw (SALOME::SALOME_Exception);
120 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes)
121 throw (SALOME::SALOME_Exception);
122 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes)
123 throw (SALOME::SALOME_Exception);
124 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes)
125 throw (SALOME::SALOME_Exception);
126 CORBA::Long AddQuadPolygonalFace(const SMESH::long_array & IDsOfNodes)
127 throw (SALOME::SALOME_Exception);
128 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes)
129 throw (SALOME::SALOME_Exception);
130 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
131 const SMESH::long_array & Quantities)
132 throw (SALOME::SALOME_Exception);
133 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces)
134 throw (SALOME::SALOME_Exception);
137 * \brief Create 0D elements on all nodes of the given object except those
138 * nodes on which a 0D element already exists.
139 * \param theObject object on whose nodes 0D elements will be created.
140 * \param theGroupName optional name of a group to add 0D elements created
141 * and/or found on nodes of \a theObject.
142 * \param theDuplicateElements to add one more 0D element to a node or not
143 * \return an object (a new group or a temporary SMESH_IDSource) holding
144 * ids of new and/or found 0D elements.
146 SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
147 const char* theGroupName,
148 CORBA::Boolean theDuplicateElements)
149 throw (SALOME::SALOME_Exception);
152 * \brief Bind a node to a vertex
153 * \param NodeID - node ID
154 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
156 void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
157 throw (SALOME::SALOME_Exception);
159 * \brief Store node position on an edge
160 * \param NodeID - node ID
161 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
162 * \param paramOnEdge - parameter on edge where the node is located
164 void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
165 CORBA::Double paramOnEdge)
166 throw (SALOME::SALOME_Exception);
168 * \brief Store node position on a face
169 * \param NodeID - node ID
170 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
171 * \param u - U parameter on face where the node is located
172 * \param v - V parameter on face where the node is located
174 void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
175 CORBA::Double u, CORBA::Double v)
176 throw (SALOME::SALOME_Exception);
178 * \brief Bind a node to a solid
179 * \param NodeID - node ID
180 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
182 void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
183 throw (SALOME::SALOME_Exception);
185 * \brief Bind an element to a shape
186 * \param ElementID - element ID
187 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
189 void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
190 throw (SALOME::SALOME_Exception);
193 CORBA::Boolean MoveNode(CORBA::Long NodeID,
194 CORBA::Double x, CORBA::Double y, CORBA::Double z)
195 throw (SALOME::SALOME_Exception);
197 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2)
198 throw (SALOME::SALOME_Exception);
199 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2)
200 throw (SALOME::SALOME_Exception);
201 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements)
202 throw (SALOME::SALOME_Exception);
203 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject)
204 throw (SALOME::SALOME_Exception);
207 * \brief Reorient faces contained in \a the2Dgroup.
208 * \param the2Dgroup - the mesh or its part to reorient
209 * \param theDirection - desired direction of normal of \a theFace
210 * \param theFace - ID of face whose orientation is checked.
211 * It can be < 1 then \a thePoint is used to find a face.
212 * \param thePoint - is used to find a face if \a theFace < 1.
213 * \return number of reoriented elements.
215 CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
216 const SMESH::DirStruct& theDirection,
218 const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
220 * \brief Reorient faces basing on orientation of adjacent volumes.
221 * \param faces - a list of objects containing face to reorient
222 * \param volumes - an object containing volumes.
223 * \param outsideNormal - to orient faces to have their normal
224 * pointing either \a outside or \a inside the adjacent volumes.
225 * \return number of reoriented faces.
227 CORBA::Long Reorient2DBy3D(const SMESH::ListOfIDSources & faces,
228 SMESH::SMESH_IDSource_ptr volumes,
229 CORBA::Boolean outsideNormal)
230 throw (SALOME::SALOME_Exception);
233 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
234 SMESH::NumericalFunctor_ptr Criterion,
235 CORBA::Double MaxAngle)
236 throw (SALOME::SALOME_Exception);
237 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
238 SMESH::NumericalFunctor_ptr Criterion,
239 CORBA::Double MaxAngle)
240 throw (SALOME::SALOME_Exception);
241 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
242 SMESH::NumericalFunctor_ptr Criterion)
243 throw (SALOME::SALOME_Exception);
244 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
245 SMESH::NumericalFunctor_ptr Criterion)
246 throw (SALOME::SALOME_Exception);
247 void QuadTo4Tri (SMESH::SMESH_IDSource_ptr theObject)
248 throw (SALOME::SALOME_Exception);
249 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
250 CORBA::Boolean Diag13)
251 throw (SALOME::SALOME_Exception);
252 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
253 CORBA::Boolean Diag13)
254 throw (SALOME::SALOME_Exception);
255 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
256 SMESH::NumericalFunctor_ptr Criterion)
257 throw (SALOME::SALOME_Exception);
258 void SplitVolumesIntoTetra(SMESH::SMESH_IDSource_ptr elems,
259 CORBA::Short methodFlags)
260 throw (SALOME::SALOME_Exception);
261 void SplitHexahedraIntoPrisms(SMESH::SMESH_IDSource_ptr elems,
262 const SMESH::PointStruct & startHexPoint,
263 const SMESH::DirStruct& facetToSplitNormal,
264 CORBA::Short methodFlags,
265 CORBA::Boolean allDomains)
266 throw (SALOME::SALOME_Exception);
267 void SplitBiQuadraticIntoLinear(const SMESH::ListOfIDSources& elems)
268 throw (SALOME::SALOME_Exception);
270 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
271 const SMESH::long_array & IDsOfFixedNodes,
272 CORBA::Long MaxNbOfIterations,
273 CORBA::Double MaxAspectRatio,
274 SMESH::SMESH_MeshEditor::Smooth_Method Method)
275 throw (SALOME::SALOME_Exception);
276 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
277 const SMESH::long_array & IDsOfFixedNodes,
278 CORBA::Long MaxNbOfIterations,
279 CORBA::Double MaxAspectRatio,
280 SMESH::SMESH_MeshEditor::Smooth_Method Method)
281 throw (SALOME::SALOME_Exception);
282 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
283 const SMESH::long_array & IDsOfFixedNodes,
284 CORBA::Long MaxNbOfIterations,
285 CORBA::Double MaxAspectRatio,
286 SMESH::SMESH_MeshEditor::Smooth_Method Method)
287 throw (SALOME::SALOME_Exception);
288 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
289 const SMESH::long_array & IDsOfFixedNodes,
290 CORBA::Long MaxNbOfIterations,
291 CORBA::Double MaxAspectRatio,
292 SMESH::SMESH_MeshEditor::Smooth_Method Method)
293 throw (SALOME::SALOME_Exception);
294 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
295 const SMESH::long_array & IDsOfFixedNodes,
296 CORBA::Long MaxNbOfIterations,
297 CORBA::Double MaxAspectRatio,
298 SMESH::SMESH_MeshEditor::Smooth_Method Method,
300 throw (SALOME::SALOME_Exception);
301 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
302 const SMESH::long_array & IDsOfFixedNodes,
303 CORBA::Long MaxNbOfIterations,
304 CORBA::Double MaxAspectRatio,
305 SMESH::SMESH_MeshEditor::Smooth_Method Method,
307 throw (SALOME::SALOME_Exception);
309 CORBA::Boolean ConvertFromQuadratic()
310 throw (SALOME::SALOME_Exception);
311 void ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr theObject)
312 throw (SALOME::SALOME_Exception);
313 void ConvertToQuadratic(CORBA::Boolean Force3d)
314 throw (SALOME::SALOME_Exception);
315 void ConvertToQuadraticObject(CORBA::Boolean theForce3d,
316 SMESH::SMESH_IDSource_ptr theObject)
317 throw (SALOME::SALOME_Exception);
318 void ConvertToBiQuadratic(CORBA::Boolean theForce3d,
319 SMESH::SMESH_IDSource_ptr theObject)
320 throw (SALOME::SALOME_Exception);
322 void RenumberNodes() throw (SALOME::SALOME_Exception);
323 void RenumberElements() throw (SALOME::SALOME_Exception);
325 SMESH::ListOfGroups* RotationSweepObjects(const SMESH::ListOfIDSources & nodes,
326 const SMESH::ListOfIDSources & edges,
327 const SMESH::ListOfIDSources & faces,
328 const SMESH::AxisStruct & Axis,
329 CORBA::Double AngleInRadians,
330 CORBA::Long NbOfSteps,
331 CORBA::Double Tolerance,
332 CORBA::Boolean toMakeGroups)
333 throw (SALOME::SALOME_Exception);
335 SMESH::ListOfGroups* ExtrusionSweepObjects(const SMESH::ListOfIDSources & nodes,
336 const SMESH::ListOfIDSources & edges,
337 const SMESH::ListOfIDSources & faces,
338 const SMESH::DirStruct & stepVector,
339 CORBA::Long nbOfSteps,
340 const SMESH::double_array & theScaleFactors,
341 CORBA::Boolean theLinearVariation,
342 const SMESH::double_array & theBasePoint,
343 CORBA::Boolean toMakeGroups)
344 throw (SALOME::SALOME_Exception);
346 SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
347 CORBA::Double stepSize,
348 CORBA::Long nbOfSteps,
349 CORBA::Boolean byAverageNormal,
350 CORBA::Boolean useInputElemsOnly,
351 CORBA::Boolean makeGroups,
353 throw (SALOME::SALOME_Exception);
354 SMESH::ListOfGroups* AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
355 const SMESH::DirStruct & theStepVector,
356 CORBA::Long theNbOfSteps,
357 CORBA::Long theExtrFlags,
358 CORBA::Double theSewTolerance,
359 CORBA::Boolean theMakeGroups)
360 throw (SALOME::SALOME_Exception);
363 ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & nodes,
364 const SMESH::ListOfIDSources & edges,
365 const SMESH::ListOfIDSources & faces,
366 SMESH::SMESH_IDSource_ptr PathMesh,
367 GEOM::GEOM_Object_ptr PathShape,
368 CORBA::Long NodeStart,
369 CORBA::Boolean HasAngles,
370 const SMESH::double_array & Angles,
371 CORBA::Boolean LinearVariation,
372 CORBA::Boolean HasRefPoint,
373 const SMESH::PointStruct & RefPoint,
375 SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
376 throw (SALOME::SALOME_Exception);
378 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
379 GEOM::GEOM_Object_ptr PathShape,
380 const SMESH::double_array & Angles);
382 void Mirror(const SMESH::long_array & IDsOfElements,
383 const SMESH::AxisStruct & Axis,
384 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
386 throw (SALOME::SALOME_Exception);
387 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
388 const SMESH::AxisStruct & Axis,
389 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
391 throw (SALOME::SALOME_Exception);
392 void Translate(const SMESH::long_array & IDsOfElements,
393 const SMESH::DirStruct & Vector,
395 throw (SALOME::SALOME_Exception);
396 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
397 const SMESH::DirStruct & Vector,
399 throw (SALOME::SALOME_Exception);
400 void Rotate(const SMESH::long_array & IDsOfElements,
401 const SMESH::AxisStruct & Axis,
404 throw (SALOME::SALOME_Exception);
405 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
406 const SMESH::AxisStruct & Axis,
409 throw (SALOME::SALOME_Exception);
411 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
412 const SMESH::AxisStruct& Mirror,
413 SMESH::SMESH_MeshEditor::MirrorType MirrorType)
414 throw (SALOME::SALOME_Exception);
415 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
416 const SMESH::AxisStruct& Mirror,
417 SMESH::SMESH_MeshEditor::MirrorType MirrorType)
418 throw (SALOME::SALOME_Exception);
419 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
420 const SMESH::DirStruct& Vector)
421 throw (SALOME::SALOME_Exception);
422 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
423 const SMESH::DirStruct& Vector)
424 throw (SALOME::SALOME_Exception);
425 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
426 const SMESH::AxisStruct& Axis,
427 CORBA::Double AngleInRadians)
428 throw (SALOME::SALOME_Exception);
429 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
430 const SMESH::AxisStruct& Axis,
431 CORBA::Double AngleInRadians)
432 throw (SALOME::SALOME_Exception);
434 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
435 const SMESH::AxisStruct& Mirror,
436 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
437 CORBA::Boolean CopyGroups,
438 const char* MeshName)
439 throw (SALOME::SALOME_Exception);
440 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
441 const SMESH::AxisStruct& Mirror,
442 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
443 CORBA::Boolean CopyGroups,
444 const char* MeshName)
445 throw (SALOME::SALOME_Exception);
446 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
447 const SMESH::DirStruct& Vector,
448 CORBA::Boolean CopyGroups,
449 const char* MeshName)
450 throw (SALOME::SALOME_Exception);
451 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
452 const SMESH::DirStruct& Vector,
453 CORBA::Boolean CopyGroups,
454 const char* MeshName)
455 throw (SALOME::SALOME_Exception);
456 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
457 const SMESH::AxisStruct& Axis,
458 CORBA::Double AngleInRadians,
459 CORBA::Boolean CopyGroups,
460 const char* MeshName)
461 throw (SALOME::SALOME_Exception);
462 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
463 const SMESH::AxisStruct& Axis,
464 CORBA::Double AngleInRadians,
465 CORBA::Boolean CopyGroups,
466 const char* MeshName)
467 throw (SALOME::SALOME_Exception);
469 void Scale(SMESH::SMESH_IDSource_ptr theObject,
470 const SMESH::PointStruct& thePoint,
471 const SMESH::double_array& theScaleFact,
472 CORBA::Boolean theCopy)
473 throw (SALOME::SALOME_Exception);
475 SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
476 const SMESH::PointStruct& thePoint,
477 const SMESH::double_array& theScaleFact)
478 throw (SALOME::SALOME_Exception);
480 SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
481 const SMESH::PointStruct& Point,
482 const SMESH::double_array& theScaleFact,
483 CORBA::Boolean CopyGroups,
484 const char* MeshName)
485 throw (SALOME::SALOME_Exception);
487 SMESH::SMESH_Mesh_ptr Offset( SMESH::SMESH_IDSource_ptr theObject,
489 CORBA::Boolean CopyGroups,
490 CORBA::Boolean CopyElements,
491 const char* MeshName,
492 SMESH::ListOfGroups_out Groups)
493 throw (SALOME::SALOME_Exception);
495 void FindCoincidentNodes (CORBA::Double Tolerance,
496 SMESH::array_of_long_array_out GroupsOfNodes,
497 CORBA::Boolean SeparateCornersAndMedium)
498 throw (SALOME::SALOME_Exception);
499 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
500 CORBA::Double Tolerance,
501 SMESH::array_of_long_array_out GroupsOfNodes,
502 CORBA::Boolean SeparateCornersAndMedium)
503 throw (SALOME::SALOME_Exception);
504 void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr Object,
505 CORBA::Double Tolerance,
506 SMESH::array_of_long_array_out GroupsOfNodes,
507 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
508 CORBA::Boolean SeparateCornersAndMedium)
509 throw (SALOME::SALOME_Exception);
510 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes,
511 const SMESH::ListOfIDSources& NodesToKeep,
512 CORBA::Boolean AvoidMakingHoles )
513 throw (SALOME::SALOME_Exception);
514 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
515 SMESH::array_of_long_array_out GroupsOfElementsID)
516 throw (SALOME::SALOME_Exception);
517 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID)
518 throw (SALOME::SALOME_Exception);
519 void MergeEqualElements()
520 throw (SALOME::SALOME_Exception);
521 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
525 throw (SALOME::SALOME_Exception);
527 * \brief Return ID of node closest to a given point
529 CORBA::Long FindNodeClosestTo(CORBA::Double x,
532 throw (SALOME::SALOME_Exception);
534 * Return elements of given type where the given point is IN or ON.
535 * 'ALL' type means elements of any type excluding nodes
537 SMESH::long_array* FindElementsByPoint(CORBA::Double x,
540 SMESH::ElementType type)
541 throw (SALOME::SALOME_Exception);
543 * Searching among the given elements, return elements of given type
544 * where the given point is IN or ON.
545 * 'ALL' type means elements of any type excluding nodes
547 SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
551 SMESH::ElementType type)
552 throw (SALOME::SALOME_Exception);
555 * Project a point to a mesh object.
556 * Return ID of an element of given type where the given point is projected
557 * and coordinates of the projection point.
558 * In the case if nothing found, return -1 and []
560 CORBA::Long ProjectPoint(CORBA::Double x,
563 SMESH::SMESH_IDSource_ptr meshObject,
564 SMESH::ElementType type,
565 SMESH::double_array_out projecton)
566 throw (SALOME::SALOME_Exception);
569 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
570 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
572 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z)
573 throw (SALOME::SALOME_Exception);
576 * Check if a 2D mesh is manifold
578 CORBA::Boolean IsManifold()
579 throw (SALOME::SALOME_Exception);
582 * Check if orientation of 2D elements is coherent
584 CORBA::Boolean IsCoherentOrientation2D()
585 throw (SALOME::SALOME_Exception);
588 * Return sharp edges of faces and non-manifold ones. Optionally adds existing edges.
590 SMESH::ListOfEdges* FindSharpEdges(CORBA::Double angle, CORBA::Boolean addExisting)
591 throw (SALOME::SALOME_Exception);
594 * Returns all or only closed FreeBorder's.
596 SMESH::ListOfFreeBorders* FindFreeBorders(CORBA::Boolean closedOnly)
597 throw (SALOME::SALOME_Exception);
600 * Fill with 2D elements a hole defined by a FreeBorder.
601 * Optionally add new faces to a given group, which is returned
603 SMESH::SMESH_Group_ptr FillHole(const SMESH::FreeBorder& hole,
604 const char* groupName)
605 throw (SALOME::SALOME_Exception);
607 SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
608 CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
609 CORBA::Boolean createPolygons,
610 CORBA::Boolean createPolyedrs)
611 throw (SALOME::SALOME_Exception);
613 SMESH::SMESH_MeshEditor::Sew_Error
614 SewFreeBorders(CORBA::Long FirstNodeID1,
615 CORBA::Long SecondNodeID1,
616 CORBA::Long LastNodeID1,
617 CORBA::Long FirstNodeID2,
618 CORBA::Long SecondNodeID2,
619 CORBA::Long LastNodeID2,
620 CORBA::Boolean CreatePolygons,
621 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
622 SMESH::SMESH_MeshEditor::Sew_Error
623 SewConformFreeBorders(CORBA::Long FirstNodeID1,
624 CORBA::Long SecondNodeID1,
625 CORBA::Long LastNodeID1,
626 CORBA::Long FirstNodeID2,
627 CORBA::Long SecondNodeID2) throw (SALOME::SALOME_Exception);
628 SMESH::SMESH_MeshEditor::Sew_Error
629 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
630 CORBA::Long SecondNodeIDOnFreeBorder,
631 CORBA::Long LastNodeIDOnFreeBorder,
632 CORBA::Long FirstNodeIDOnSide,
633 CORBA::Long LastNodeIDOnSide,
634 CORBA::Boolean CreatePolygons,
635 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
636 SMESH::SMESH_MeshEditor::Sew_Error
637 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
638 const SMESH::long_array& IDsOfSide2Elements,
639 CORBA::Long NodeID1OfSide1ToMerge,
640 CORBA::Long NodeID1OfSide2ToMerge,
641 CORBA::Long NodeID2OfSide1ToMerge,
642 CORBA::Long NodeID2OfSide2ToMerge) throw (SALOME::SALOME_Exception);
645 * Set new nodes for given element.
646 * If number of nodes is not corresponded to type of
647 * element - returns false
649 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
650 throw (SALOME::SALOME_Exception);
652 SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
653 const char* theGroupName)
654 throw (SALOME::SALOME_Exception);
656 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
657 const SMESH::long_array& theModifiedElems )
658 throw (SALOME::SALOME_Exception);
660 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
661 const SMESH::long_array& theModifiedElems )
662 throw (SALOME::SALOME_Exception);
664 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
665 SMESH::SMESH_GroupBase_ptr theModifiedElems )
666 throw (SALOME::SALOME_Exception);
669 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
670 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
671 * \param theNodes - group of nodes to be doubled.
672 * \param theModifiedElems - group of elements to be updated.
673 * \return a new group with newly created nodes
674 * \sa DoubleNodeGroup()
676 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
677 SMESH::SMESH_GroupBase_ptr theModifiedElems )
678 throw (SALOME::SALOME_Exception);
680 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
681 const SMESH::ListOfGroups& theModifiedElems )
682 throw (SALOME::SALOME_Exception);
684 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
685 const SMESH::ListOfGroups& theModifiedElems )
686 throw (SALOME::SALOME_Exception);
689 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
690 * \param theElems - the list of elements (edges or faces) to be replicated
691 * The nodes for duplication could be found from these elements
692 * \param theNodesNot - list of nodes to NOT replicate
693 * \param theAffectedElems - the list of elements (cells and edges) to which the
694 * replicated nodes should be associated to.
695 * \return TRUE if operation has been completed successfully, FALSE otherwise
696 * \sa DoubleNodeGroup(), DoubleNodeGroups()
698 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
699 const SMESH::long_array& theNodesNot,
700 const SMESH::long_array& theAffectedElems )
701 throw (SALOME::SALOME_Exception);
704 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
705 * \param theElems - the list of elements (edges or faces) to be replicated
706 * The nodes for duplication could be found from these elements
707 * \param theNodesNot - list of nodes to NOT replicate
708 * \param theShape - shape to detect affected elements (element which geometric center
709 * located on or inside shape).
710 * The replicated nodes should be associated to affected elements.
711 * \return TRUE if operation has been completed successfully, FALSE otherwise
712 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
714 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
715 const SMESH::long_array& theNodesNot,
716 GEOM::GEOM_Object_ptr theShape )
717 throw (SALOME::SALOME_Exception);
720 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
721 * \param theElems - group of of elements (edges or faces) to be replicated
722 * \param theNodesNot - group of nodes not to replicated
723 * \param theAffectedElems - group of elements to which the replicated nodes
724 * should be associated to.
725 * \return TRUE if operation has been completed successfully, FALSE otherwise
726 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
728 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
729 SMESH::SMESH_GroupBase_ptr theNodesNot,
730 SMESH::SMESH_GroupBase_ptr theAffectedElems )
731 throw (SALOME::SALOME_Exception);
734 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
735 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
736 * \param theElems - group of of elements (edges or faces) to be replicated
737 * \param theNodesNot - group of nodes not to replicated
738 * \param theAffectedElems - group of elements to which the replicated nodes
739 * should be associated to.
740 * \return a new group with newly created elements
741 * \sa DoubleNodeElemGroup()
743 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
744 SMESH::SMESH_GroupBase_ptr theNodesNot,
745 SMESH::SMESH_GroupBase_ptr theAffectedElems )
746 throw (SALOME::SALOME_Exception);
748 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
749 SMESH::SMESH_GroupBase_ptr theNodesNot,
750 SMESH::SMESH_GroupBase_ptr theAffectedElems,
751 CORBA::Boolean theElemGroupNeeded,
752 CORBA::Boolean theNodeGroupNeeded)
753 throw (SALOME::SALOME_Exception);
756 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
757 * \param theElems - group of of elements (edges or faces) to be replicated
758 * \param theNodesNot - group of nodes not to replicated
759 * \param theShape - shape to detect affected elements (element which geometric center
760 * located on or inside shape).
761 * The replicated nodes should be associated to affected elements.
762 * \return TRUE if operation has been completed successfully, FALSE otherwise
763 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
765 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
766 SMESH::SMESH_GroupBase_ptr theNodesNot,
767 GEOM::GEOM_Object_ptr theShape )
768 throw (SALOME::SALOME_Exception);
771 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
772 * This method provided for convenience works as DoubleNodes() described above.
773 * \param theElems - list of groups of elements (edges or faces) to be replicated
774 * \param theNodesNot - list of groups of nodes not to replicated
775 * \param theAffectedElems - group of elements to which the replicated nodes
776 * should be associated to.
777 * \return TRUE if operation has been completed successfully, FALSE otherwise
778 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
780 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
781 const SMESH::ListOfGroups& theNodesNot,
782 const SMESH::ListOfGroups& theAffectedElems )
783 throw (SALOME::SALOME_Exception);
786 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
787 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
788 * \param theElems - list of groups of elements (edges or faces) to be replicated
789 * \param theNodesNot - list of groups of nodes not to replicated
790 * \param theAffectedElems - group of elements to which the replicated nodes
791 * should be associated to.
792 * \return a new group with newly created elements
793 * \sa DoubleNodeElemGroups()
795 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
796 const SMESH::ListOfGroups& theNodesNot,
797 const SMESH::ListOfGroups& theAffectedElems )
798 throw (SALOME::SALOME_Exception);
800 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
801 const SMESH::ListOfGroups& theNodesNot,
802 const SMESH::ListOfGroups& theAffectedElems,
803 CORBA::Boolean theElemGroupNeeded,
804 CORBA::Boolean theNodeGroupNeeded)
805 throw (SALOME::SALOME_Exception);
808 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
809 * This method provided for convenience works as DoubleNodes() described above.
810 * \param theElems - list of groups of elements (edges or faces) to be replicated
811 * \param theNodesNot - list of groups of nodes not to replicated
812 * \param theShape - shape to detect affected elements (element which geometric center
813 * located on or inside shape).
814 * The replicated nodes should be associated to affected elements.
815 * \return TRUE if operation has been completed successfully, FALSE otherwise
816 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
818 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
819 const SMESH::ListOfGroups& theNodesNot,
820 GEOM::GEOM_Object_ptr theShape )
821 throw (SALOME::SALOME_Exception);
824 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
825 * This method is the first step of DoubleNodeElemGroupsInRegion.
826 * \param theElems - list of groups of elements (edges or faces) to be replicated
827 * \param theNodesNot - list of groups of nodes not to replicated
828 * \param theShape - shape to detect affected elements (element which geometric center
829 * located on or inside shape).
830 * The replicated nodes should be associated to affected elements.
831 * \return groups of affected elements
832 * \sa DoubleNodeElemGroupsInRegion()
834 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
835 const SMESH::ListOfGroups& theNodesNot,
836 GEOM::GEOM_Object_ptr theShape )
837 throw (SALOME::SALOME_Exception);
840 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
841 * The list of groups must describe a partition of the mesh volumes.
842 * The nodes of the internal faces at the boundaries of the groups are doubled.
843 * In option, the internal faces are replaced by flat elements.
844 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
845 * \param theDomains - list of groups of volumes
846 * \param createJointElems - if TRUE, create the elements
847 * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
848 * the boundary between \a theDomains and the rest mesh
849 * \return TRUE if operation has been completed successfully, FALSE otherwise
851 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
852 CORBA::Boolean createJointElems,
853 CORBA::Boolean onAllBoundaries )
854 throw (SALOME::SALOME_Exception);
856 * \brief Double nodes on some external faces and create flat elements.
857 * Flat elements are mainly used by some types of mechanic calculations.
859 * Each group of the list must be constituted of faces.
860 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
861 * @param theGroupsOfFaces - list of groups of faces
862 * @return TRUE if operation has been completed successfully, FALSE otherwise
864 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces )
865 throw (SALOME::SALOME_Exception);
868 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
869 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
870 * groups of faces to remove insidethe object, (idem edges).
871 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
873 void CreateHoleSkin(CORBA::Double radius,
874 GEOM::GEOM_Object_ptr theShape,
875 const char* groupName,
876 const SMESH::double_array& theNodesCoords,
877 SMESH::array_of_long_array_out GroupsOfNodes)
878 throw (SALOME::SALOME_Exception);
881 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
882 * The created 2D mesh elements based on nodes of free faces of boundary volumes
883 * \return TRUE if operation has been completed successfully, FALSE otherwise
885 CORBA::Boolean Make2DMeshFrom3D()
886 throw (SALOME::SALOME_Exception);
888 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
889 SMESH::Bnd_Dimension dimension,
890 const char* groupName,
891 const char* meshName,
892 CORBA::Boolean toCopyElements,
893 CORBA::Boolean toCopyMissingBondary,
894 SMESH::SMESH_Group_out group)
895 throw (SALOME::SALOME_Exception);
897 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
898 const char* groupName,
899 const char* meshName,
900 CORBA::Boolean toCopyAll,
901 const SMESH::ListOfIDSources& groups,
902 SMESH::SMESH_Mesh_out mesh,
903 SMESH::SMESH_Group_out group)
904 throw (SALOME::SALOME_Exception);
907 * \brief Create a polyline consisting of 1D mesh elements each lying on a 2D element of
908 * the initial mesh. Positions of new nodes are found by cutting the mesh by the
909 * plane passing through pairs of points specified by each PolySegment structure.
910 * If there are several paths connecting a pair of points, the shortest path is
911 * selected by the module. Position of the cutting plane is defined by the two
912 * points and an optional vector lying on the plane specified by a PolySegment.
913 * By default the vector is defined by Mesh module as following. A middle point
914 * of the two given points is computed. The middle point is projected to the mesh.
915 * The vector goes from the middle point to the projection point. In case of planar
916 * mesh, the vector is normal to the mesh.
917 * \param [inout] segments - PolySegment's defining positions of cutting planes.
918 * Return the used vector and position of the middle point.
919 * \param [in] groupName - optional name of a group where created mesh segments will
922 void MakePolyLine(SMESH::ListOfPolySegments& segments,
923 const char* groupName)
924 throw (SALOME::SALOME_Exception);
927 private: //!< private methods
929 ::SMESH_MeshEditor& getEditor();
931 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
933 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
935 void declareMeshModified( bool isReComputeSafe );
938 * \brief Clear myLastCreated* or myPreviewData
940 void initData(bool deleteSearchers=true);
943 * \brief Return groups by their IDs
945 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
946 throw (SALOME::SALOME_Exception);
948 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
949 const SMESH::AxisStruct & Axis,
950 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
953 ::SMESH_Mesh* TargetMesh=0)
954 throw (SALOME::SALOME_Exception);
955 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
956 const SMESH::DirStruct & Vector,
959 ::SMESH_Mesh* TargetMesh=0)
960 throw (SALOME::SALOME_Exception);
961 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
962 const SMESH::AxisStruct & Axis,
966 ::SMESH_Mesh* TargetMesh=0)
967 throw (SALOME::SALOME_Exception);
969 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
970 const SMESH::PointStruct& thePoint,
971 const SMESH::double_array& theScaleFact,
972 CORBA::Boolean theCopy,
974 ::SMESH_Mesh* theTargetMesh=0)
975 throw (SALOME::SALOME_Exception);
977 void convertToQuadratic(CORBA::Boolean theForce3d,
978 CORBA::Boolean theToBiQuad,
979 SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil())
980 throw (SALOME::SALOME_Exception);
982 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
984 void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
985 const SMESH::ListOfGroups * theGroupList);
987 void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
990 enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
992 bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
993 const SMESHDS_Mesh* theMeshDS,
994 TIDSortedElemSet& theElemSet,
995 const SMDSAbs_ElementType theType,
996 const bool emptyIfIsMesh = false,
997 IDSource_Error* error = 0);
999 void findCoincidentNodes( TIDSortedNodeSet & Nodes,
1000 CORBA::Double Tolerance,
1001 SMESH::array_of_long_array_out GroupsOfNodes,
1002 CORBA::Boolean SeparateCornersAndMedium);
1006 private: //!< fields
1008 SMESH_Mesh_i* myMesh_i;
1009 SMESH_Mesh * myMesh;
1010 ::SMESH_MeshEditor myEditor;
1012 bool myIsPreviewMode;
1013 MeshEditor_I::TPreviewMesh * myPreviewMesh;
1014 ::SMESH_MeshEditor * myPreviewEditor;
1015 SMESH::MeshPreviewStruct_var myPreviewData;
1017 // temporary IDSources