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(const SMESH::ListOfIDSources& Objects,
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(const SMESH::ListOfIDSources& Objects,
515 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
516 SMESH::array_of_long_array_out GroupsOfElementsID)
517 throw (SALOME::SALOME_Exception);
518 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID,
519 const SMESH::ListOfIDSources& ElementsToKeep)
520 throw (SALOME::SALOME_Exception);
521 void MergeEqualElements()
522 throw (SALOME::SALOME_Exception);
523 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
527 throw (SALOME::SALOME_Exception);
529 * \brief Return ID of node closest to a given point
531 CORBA::Long FindNodeClosestTo(CORBA::Double x,
534 throw (SALOME::SALOME_Exception);
536 * Return elements of given type where the given point is IN or ON.
537 * 'ALL' type means elements of any type excluding nodes
539 SMESH::long_array* FindElementsByPoint(CORBA::Double x,
542 SMESH::ElementType type)
543 throw (SALOME::SALOME_Exception);
545 * Searching among the given elements, return elements of given type
546 * where the given point is IN or ON.
547 * 'ALL' type means elements of any type excluding nodes
549 SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
553 SMESH::ElementType type)
554 throw (SALOME::SALOME_Exception);
557 * Project a point to a mesh object.
558 * Return ID of an element of given type where the given point is projected
559 * and coordinates of the projection point.
560 * In the case if nothing found, return -1 and []
562 CORBA::Long ProjectPoint(CORBA::Double x,
565 SMESH::ElementType type,
566 SMESH::SMESH_IDSource_ptr meshObject,
567 SMESH::double_array_out projecton)
568 throw (SALOME::SALOME_Exception);
571 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
572 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
574 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z)
575 throw (SALOME::SALOME_Exception);
578 * Check if a 2D mesh is manifold
580 CORBA::Boolean IsManifold()
581 throw (SALOME::SALOME_Exception);
584 * Check if orientation of 2D elements is coherent
586 CORBA::Boolean IsCoherentOrientation2D()
587 throw (SALOME::SALOME_Exception);
590 * Partition given 1D elements into groups of contiguous edges.
591 * A node where number of meeting edges != 2 is a group end.
592 * An optional startNode is used to orient groups it belongs to.
593 * \return a list of edge groups and a list of corresponding node groups.
594 * If a group is closed, the first and last nodes of the group are same.
596 SMESH::array_of_long_array* Get1DBranches( SMESH::SMESH_IDSource_ptr edges,
597 CORBA::Long startNode,
598 SMESH::array_of_long_array_out nodeGroups)
599 throw (SALOME::SALOME_Exception);
602 * Return sharp edges of faces and non-manifold ones. Optionally adds existing edges.
604 SMESH::ListOfEdges* FindSharpEdges(CORBA::Double angle, CORBA::Boolean addExisting)
605 throw (SALOME::SALOME_Exception);
608 * Returns all or only closed FreeBorder's.
610 SMESH::ListOfFreeBorders* FindFreeBorders(CORBA::Boolean closedOnly)
611 throw (SALOME::SALOME_Exception);
614 * Fill with 2D elements a hole defined by a FreeBorder.
615 * Optionally add new faces to a given group, which is returned
617 SMESH::SMESH_Group_ptr FillHole(const SMESH::FreeBorder& hole,
618 const char* groupName)
619 throw (SALOME::SALOME_Exception);
621 SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
622 CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
623 CORBA::Boolean createPolygons,
624 CORBA::Boolean createPolyedrs)
625 throw (SALOME::SALOME_Exception);
627 SMESH::SMESH_MeshEditor::Sew_Error
628 SewFreeBorders(CORBA::Long FirstNodeID1,
629 CORBA::Long SecondNodeID1,
630 CORBA::Long LastNodeID1,
631 CORBA::Long FirstNodeID2,
632 CORBA::Long SecondNodeID2,
633 CORBA::Long LastNodeID2,
634 CORBA::Boolean CreatePolygons,
635 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
636 SMESH::SMESH_MeshEditor::Sew_Error
637 SewConformFreeBorders(CORBA::Long FirstNodeID1,
638 CORBA::Long SecondNodeID1,
639 CORBA::Long LastNodeID1,
640 CORBA::Long FirstNodeID2,
641 CORBA::Long SecondNodeID2) throw (SALOME::SALOME_Exception);
642 SMESH::SMESH_MeshEditor::Sew_Error
643 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
644 CORBA::Long SecondNodeIDOnFreeBorder,
645 CORBA::Long LastNodeIDOnFreeBorder,
646 CORBA::Long FirstNodeIDOnSide,
647 CORBA::Long LastNodeIDOnSide,
648 CORBA::Boolean CreatePolygons,
649 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
650 SMESH::SMESH_MeshEditor::Sew_Error
651 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
652 const SMESH::long_array& IDsOfSide2Elements,
653 CORBA::Long NodeID1OfSide1ToMerge,
654 CORBA::Long NodeID1OfSide2ToMerge,
655 CORBA::Long NodeID2OfSide1ToMerge,
656 CORBA::Long NodeID2OfSide2ToMerge) throw (SALOME::SALOME_Exception);
659 * Set new nodes for given element.
660 * If number of nodes is not corresponded to type of
661 * element - returns false
663 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
664 throw (SALOME::SALOME_Exception);
666 SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
667 const char* theGroupName)
668 throw (SALOME::SALOME_Exception);
670 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
671 const SMESH::long_array& theModifiedElems )
672 throw (SALOME::SALOME_Exception);
674 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
675 const SMESH::long_array& theModifiedElems )
676 throw (SALOME::SALOME_Exception);
678 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
679 SMESH::SMESH_GroupBase_ptr theModifiedElems )
680 throw (SALOME::SALOME_Exception);
683 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
684 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
685 * \param theNodes - group of nodes to be doubled.
686 * \param theModifiedElems - group of elements to be updated.
687 * \return a new group with newly created nodes
688 * \sa DoubleNodeGroup()
690 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
691 SMESH::SMESH_GroupBase_ptr theModifiedElems )
692 throw (SALOME::SALOME_Exception);
694 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
695 const SMESH::ListOfGroups& theModifiedElems )
696 throw (SALOME::SALOME_Exception);
698 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
699 const SMESH::ListOfGroups& theModifiedElems )
700 throw (SALOME::SALOME_Exception);
703 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
704 * \param theElems - the list of elements (edges or faces) to be replicated
705 * The nodes for duplication could be found from these elements
706 * \param theNodesNot - list of nodes to NOT replicate
707 * \param theAffectedElems - the list of elements (cells and edges) to which the
708 * replicated nodes should be associated to.
709 * \return TRUE if operation has been completed successfully, FALSE otherwise
710 * \sa DoubleNodeGroup(), DoubleNodeGroups()
712 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
713 const SMESH::long_array& theNodesNot,
714 const SMESH::long_array& theAffectedElems )
715 throw (SALOME::SALOME_Exception);
718 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
719 * \param theElems - the list of elements (edges or faces) to be replicated
720 * The nodes for duplication could be found from these elements
721 * \param theNodesNot - list of nodes to NOT replicate
722 * \param theShape - shape to detect affected elements (element which geometric center
723 * located on or inside shape).
724 * The replicated nodes should be associated to affected elements.
725 * \return TRUE if operation has been completed successfully, FALSE otherwise
726 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
728 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
729 const SMESH::long_array& theNodesNot,
730 GEOM::GEOM_Object_ptr theShape )
731 throw (SALOME::SALOME_Exception);
734 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
735 * \param theElems - group of of elements (edges or faces) to be replicated
736 * \param theNodesNot - group of nodes not to replicated
737 * \param theAffectedElems - group of elements to which the replicated nodes
738 * should be associated to.
739 * \return TRUE if operation has been completed successfully, FALSE otherwise
740 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
742 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
743 SMESH::SMESH_GroupBase_ptr theNodesNot,
744 SMESH::SMESH_GroupBase_ptr theAffectedElems )
745 throw (SALOME::SALOME_Exception);
748 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
749 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
750 * \param theElems - group of of elements (edges or faces) to be replicated
751 * \param theNodesNot - group of nodes not to replicated
752 * \param theAffectedElems - group of elements to which the replicated nodes
753 * should be associated to.
754 * \return a new group with newly created elements
755 * \sa DoubleNodeElemGroup()
757 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
758 SMESH::SMESH_GroupBase_ptr theNodesNot,
759 SMESH::SMESH_GroupBase_ptr theAffectedElems )
760 throw (SALOME::SALOME_Exception);
762 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
763 SMESH::SMESH_GroupBase_ptr theNodesNot,
764 SMESH::SMESH_GroupBase_ptr theAffectedElems,
765 CORBA::Boolean theElemGroupNeeded,
766 CORBA::Boolean theNodeGroupNeeded)
767 throw (SALOME::SALOME_Exception);
770 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
771 * \param theElems - group of of elements (edges or faces) to be replicated
772 * \param theNodesNot - group of nodes not to replicated
773 * \param theShape - shape to detect affected elements (element which geometric center
774 * located on or inside shape).
775 * The replicated nodes should be associated to affected elements.
776 * \return TRUE if operation has been completed successfully, FALSE otherwise
777 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
779 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
780 SMESH::SMESH_GroupBase_ptr theNodesNot,
781 GEOM::GEOM_Object_ptr theShape )
782 throw (SALOME::SALOME_Exception);
785 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
786 * This method provided for convenience works as DoubleNodes() described above.
787 * \param theElems - list of groups of elements (edges or faces) to be replicated
788 * \param theNodesNot - list of groups of nodes not to replicated
789 * \param theAffectedElems - group of elements to which the replicated nodes
790 * should be associated to.
791 * \return TRUE if operation has been completed successfully, FALSE otherwise
792 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
794 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
795 const SMESH::ListOfGroups& theNodesNot,
796 const SMESH::ListOfGroups& theAffectedElems )
797 throw (SALOME::SALOME_Exception);
800 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
801 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
802 * \param theElems - list of groups of elements (edges or faces) to be replicated
803 * \param theNodesNot - list of groups of nodes not to replicated
804 * \param theAffectedElems - group of elements to which the replicated nodes
805 * should be associated to.
806 * \return a new group with newly created elements
807 * \sa DoubleNodeElemGroups()
809 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
810 const SMESH::ListOfGroups& theNodesNot,
811 const SMESH::ListOfGroups& theAffectedElems )
812 throw (SALOME::SALOME_Exception);
814 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
815 const SMESH::ListOfGroups& theNodesNot,
816 const SMESH::ListOfGroups& theAffectedElems,
817 CORBA::Boolean theElemGroupNeeded,
818 CORBA::Boolean theNodeGroupNeeded)
819 throw (SALOME::SALOME_Exception);
822 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
823 * This method provided for convenience works as DoubleNodes() described above.
824 * \param theElems - list of groups of elements (edges or faces) to be replicated
825 * \param theNodesNot - list of groups of nodes not to replicated
826 * \param theShape - shape to detect affected elements (element which geometric center
827 * located on or inside shape).
828 * The replicated nodes should be associated to affected elements.
829 * \return TRUE if operation has been completed successfully, FALSE otherwise
830 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
832 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
833 const SMESH::ListOfGroups& theNodesNot,
834 GEOM::GEOM_Object_ptr theShape )
835 throw (SALOME::SALOME_Exception);
838 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
839 * This method is the first step of DoubleNodeElemGroupsInRegion.
840 * \param theElems - list of groups of elements (edges or faces) to be replicated
841 * \param theNodesNot - list of groups of nodes not to replicated
842 * \param theShape - shape to detect affected elements (element which geometric center
843 * located on or inside shape).
844 * The replicated nodes should be associated to affected elements.
845 * \return groups of affected elements
846 * \sa DoubleNodeElemGroupsInRegion()
848 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
849 const SMESH::ListOfGroups& theNodesNot,
850 GEOM::GEOM_Object_ptr theShape )
851 throw (SALOME::SALOME_Exception);
854 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
855 * The list of groups must describe a partition of the mesh volumes.
856 * The nodes of the internal faces at the boundaries of the groups are doubled.
857 * In option, the internal faces are replaced by flat elements.
858 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
859 * \param theDomains - list of groups of volumes
860 * \param createJointElems - if TRUE, create the elements
861 * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
862 * the boundary between \a theDomains and the rest mesh
863 * \return TRUE if operation has been completed successfully, FALSE otherwise
865 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
866 CORBA::Boolean createJointElems,
867 CORBA::Boolean onAllBoundaries )
868 throw (SALOME::SALOME_Exception);
870 * \brief Double nodes on some external faces and create flat elements.
871 * Flat elements are mainly used by some types of mechanic calculations.
873 * Each group of the list must be constituted of faces.
874 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
875 * @param theGroupsOfFaces - list of groups of faces
876 * @return TRUE if operation has been completed successfully, FALSE otherwise
878 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces )
879 throw (SALOME::SALOME_Exception);
882 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
883 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
884 * groups of faces to remove insidethe object, (idem edges).
885 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
887 void CreateHoleSkin(CORBA::Double radius,
888 GEOM::GEOM_Object_ptr theShape,
889 const char* groupName,
890 const SMESH::double_array& theNodesCoords,
891 SMESH::array_of_long_array_out GroupsOfNodes)
892 throw (SALOME::SALOME_Exception);
895 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
896 * The created 2D mesh elements based on nodes of free faces of boundary volumes
897 * \return TRUE if operation has been completed successfully, FALSE otherwise
899 CORBA::Boolean Make2DMeshFrom3D()
900 throw (SALOME::SALOME_Exception);
902 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
903 SMESH::Bnd_Dimension dimension,
904 const char* groupName,
905 const char* meshName,
906 CORBA::Boolean toCopyElements,
907 CORBA::Boolean toCopyMissingBondary,
908 SMESH::SMESH_Group_out group)
909 throw (SALOME::SALOME_Exception);
911 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
912 const char* groupName,
913 const char* meshName,
914 CORBA::Boolean toCopyAll,
915 const SMESH::ListOfIDSources& groups,
916 SMESH::SMESH_Mesh_out mesh,
917 SMESH::SMESH_Group_out group)
918 throw (SALOME::SALOME_Exception);
921 * \brief Create a polyline consisting of 1D mesh elements each lying on a 2D element of
922 * the initial mesh. Positions of new nodes are found by cutting the mesh by the
923 * plane passing through pairs of points specified by each PolySegment structure.
924 * If there are several paths connecting a pair of points, the shortest path is
925 * selected by the module. Position of the cutting plane is defined by the two
926 * points and an optional vector lying on the plane specified by a PolySegment.
927 * By default the vector is defined by Mesh module as following. A middle point
928 * of the two given points is computed. The middle point is projected to the mesh.
929 * The vector goes from the middle point to the projection point. In case of planar
930 * mesh, the vector is normal to the mesh.
931 * \param [inout] segments - PolySegment's defining positions of cutting planes.
932 * Return the used vector and position of the middle point.
933 * \param [in] groupName - optional name of a group where created mesh segments will
936 void MakePolyLine(SMESH::ListOfPolySegments& segments,
937 const char* groupName)
938 throw (SALOME::SALOME_Exception);
941 * \brief Create a slot of given width around given 1D elements lying on a triangle mesh.
942 * The slot is consrtucted by cutting faces by cylindrical surfaces made
943 * around each segment. Segments are expected to be created by MakePolyLine().
944 * \return Edges located at the slot boundary
946 SMESH::ListOfEdges* MakeSlot(SMESH::SMESH_GroupBase_ptr segments,
948 throw (SALOME::SALOME_Exception);
951 private: //!< private methods
953 ::SMESH_MeshEditor& getEditor();
955 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
957 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
959 void declareMeshModified( bool isReComputeSafe );
962 * \brief Clear myLastCreated* or myPreviewData
964 void initData(bool deleteSearchers=true);
967 * \brief Return groups by their IDs
969 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
970 throw (SALOME::SALOME_Exception);
972 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
973 const SMESH::AxisStruct & Axis,
974 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
977 ::SMESH_Mesh* TargetMesh=0)
978 throw (SALOME::SALOME_Exception);
979 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
980 const SMESH::DirStruct & Vector,
983 ::SMESH_Mesh* TargetMesh=0)
984 throw (SALOME::SALOME_Exception);
985 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
986 const SMESH::AxisStruct & Axis,
990 ::SMESH_Mesh* TargetMesh=0)
991 throw (SALOME::SALOME_Exception);
993 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
994 const SMESH::PointStruct& thePoint,
995 const SMESH::double_array& theScaleFact,
996 CORBA::Boolean theCopy,
998 ::SMESH_Mesh* theTargetMesh=0)
999 throw (SALOME::SALOME_Exception);
1001 void convertToQuadratic(CORBA::Boolean theForce3d,
1002 CORBA::Boolean theToBiQuad,
1003 SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil())
1004 throw (SALOME::SALOME_Exception);
1006 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
1008 void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
1009 const SMESH::ListOfGroups * theGroupList);
1011 void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
1014 enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
1016 bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
1017 const SMESHDS_Mesh* theMeshDS,
1018 TIDSortedElemSet& theElemSet,
1019 const SMDSAbs_ElementType theType,
1020 const bool emptyIfIsMesh = false,
1021 IDSource_Error* error = 0);
1023 void findCoincidentNodes( TIDSortedNodeSet & Nodes,
1024 CORBA::Double Tolerance,
1025 SMESH::array_of_long_array_out GroupsOfNodes,
1026 CORBA::Boolean SeparateCornersAndMedium);
1030 private: //!< fields
1032 SMESH_Mesh_i* myMesh_i;
1033 SMESH_Mesh * myMesh;
1034 ::SMESH_MeshEditor myEditor;
1036 bool myIsPreviewMode;
1037 MeshEditor_I::TPreviewMesh * myPreviewMesh;
1038 ::SMESH_MeshEditor * myPreviewEditor;
1039 SMESH::MeshPreviewStruct_var myPreviewData;
1041 // temporary IDSources