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::ElementType type,
564 SMESH::SMESH_IDSource_ptr meshObject,
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 * Partition given 1D elements into groups of contiguous edges.
589 * A node where number of meeting edges != 2 is a group end.
590 * An optional startNode is used to orient groups it belongs to.
591 * \return a list of edge groups and a list of corresponding node groups.
592 * If a group is closed, the first and last nodes of the group are same.
594 SMESH::array_of_long_array* Get1DBranches( SMESH::SMESH_IDSource_ptr edges,
595 CORBA::Long startNode,
596 SMESH::array_of_long_array_out nodeGroups)
597 throw (SALOME::SALOME_Exception);
600 * Return sharp edges of faces and non-manifold ones. Optionally adds existing edges.
602 SMESH::ListOfEdges* FindSharpEdges(CORBA::Double angle, CORBA::Boolean addExisting)
603 throw (SALOME::SALOME_Exception);
606 * Returns all or only closed FreeBorder's.
608 SMESH::ListOfFreeBorders* FindFreeBorders(CORBA::Boolean closedOnly)
609 throw (SALOME::SALOME_Exception);
612 * Fill with 2D elements a hole defined by a FreeBorder.
613 * Optionally add new faces to a given group, which is returned
615 SMESH::SMESH_Group_ptr FillHole(const SMESH::FreeBorder& hole,
616 const char* groupName)
617 throw (SALOME::SALOME_Exception);
619 SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
620 CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
621 CORBA::Boolean createPolygons,
622 CORBA::Boolean createPolyedrs)
623 throw (SALOME::SALOME_Exception);
625 SMESH::SMESH_MeshEditor::Sew_Error
626 SewFreeBorders(CORBA::Long FirstNodeID1,
627 CORBA::Long SecondNodeID1,
628 CORBA::Long LastNodeID1,
629 CORBA::Long FirstNodeID2,
630 CORBA::Long SecondNodeID2,
631 CORBA::Long LastNodeID2,
632 CORBA::Boolean CreatePolygons,
633 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
634 SMESH::SMESH_MeshEditor::Sew_Error
635 SewConformFreeBorders(CORBA::Long FirstNodeID1,
636 CORBA::Long SecondNodeID1,
637 CORBA::Long LastNodeID1,
638 CORBA::Long FirstNodeID2,
639 CORBA::Long SecondNodeID2) throw (SALOME::SALOME_Exception);
640 SMESH::SMESH_MeshEditor::Sew_Error
641 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
642 CORBA::Long SecondNodeIDOnFreeBorder,
643 CORBA::Long LastNodeIDOnFreeBorder,
644 CORBA::Long FirstNodeIDOnSide,
645 CORBA::Long LastNodeIDOnSide,
646 CORBA::Boolean CreatePolygons,
647 CORBA::Boolean CreatePolyedrs) throw (SALOME::SALOME_Exception);
648 SMESH::SMESH_MeshEditor::Sew_Error
649 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
650 const SMESH::long_array& IDsOfSide2Elements,
651 CORBA::Long NodeID1OfSide1ToMerge,
652 CORBA::Long NodeID1OfSide2ToMerge,
653 CORBA::Long NodeID2OfSide1ToMerge,
654 CORBA::Long NodeID2OfSide2ToMerge) throw (SALOME::SALOME_Exception);
657 * Set new nodes for given element.
658 * If number of nodes is not corresponded to type of
659 * element - returns false
661 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
662 throw (SALOME::SALOME_Exception);
664 SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
665 const char* theGroupName)
666 throw (SALOME::SALOME_Exception);
668 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
669 const SMESH::long_array& theModifiedElems )
670 throw (SALOME::SALOME_Exception);
672 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
673 const SMESH::long_array& theModifiedElems )
674 throw (SALOME::SALOME_Exception);
676 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
677 SMESH::SMESH_GroupBase_ptr theModifiedElems )
678 throw (SALOME::SALOME_Exception);
681 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
682 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
683 * \param theNodes - group of nodes to be doubled.
684 * \param theModifiedElems - group of elements to be updated.
685 * \return a new group with newly created nodes
686 * \sa DoubleNodeGroup()
688 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
689 SMESH::SMESH_GroupBase_ptr theModifiedElems )
690 throw (SALOME::SALOME_Exception);
692 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
693 const SMESH::ListOfGroups& theModifiedElems )
694 throw (SALOME::SALOME_Exception);
696 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
697 const SMESH::ListOfGroups& theModifiedElems )
698 throw (SALOME::SALOME_Exception);
701 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
702 * \param theElems - the list of elements (edges or faces) to be replicated
703 * The nodes for duplication could be found from these elements
704 * \param theNodesNot - list of nodes to NOT replicate
705 * \param theAffectedElems - the list of elements (cells and edges) to which the
706 * replicated nodes should be associated to.
707 * \return TRUE if operation has been completed successfully, FALSE otherwise
708 * \sa DoubleNodeGroup(), DoubleNodeGroups()
710 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
711 const SMESH::long_array& theNodesNot,
712 const SMESH::long_array& theAffectedElems )
713 throw (SALOME::SALOME_Exception);
716 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
717 * \param theElems - the list of elements (edges or faces) to be replicated
718 * The nodes for duplication could be found from these elements
719 * \param theNodesNot - list of nodes to NOT replicate
720 * \param theShape - shape to detect affected elements (element which geometric center
721 * located on or inside shape).
722 * The replicated nodes should be associated to affected elements.
723 * \return TRUE if operation has been completed successfully, FALSE otherwise
724 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
726 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
727 const SMESH::long_array& theNodesNot,
728 GEOM::GEOM_Object_ptr theShape )
729 throw (SALOME::SALOME_Exception);
732 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
733 * \param theElems - group of of elements (edges or faces) to be replicated
734 * \param theNodesNot - group of nodes not to replicated
735 * \param theAffectedElems - group of elements to which the replicated nodes
736 * should be associated to.
737 * \return TRUE if operation has been completed successfully, FALSE otherwise
738 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
740 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
741 SMESH::SMESH_GroupBase_ptr theNodesNot,
742 SMESH::SMESH_GroupBase_ptr theAffectedElems )
743 throw (SALOME::SALOME_Exception);
746 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
747 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
748 * \param theElems - group of of elements (edges or faces) to be replicated
749 * \param theNodesNot - group of nodes not to replicated
750 * \param theAffectedElems - group of elements to which the replicated nodes
751 * should be associated to.
752 * \return a new group with newly created elements
753 * \sa DoubleNodeElemGroup()
755 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
756 SMESH::SMESH_GroupBase_ptr theNodesNot,
757 SMESH::SMESH_GroupBase_ptr theAffectedElems )
758 throw (SALOME::SALOME_Exception);
760 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
761 SMESH::SMESH_GroupBase_ptr theNodesNot,
762 SMESH::SMESH_GroupBase_ptr theAffectedElems,
763 CORBA::Boolean theElemGroupNeeded,
764 CORBA::Boolean theNodeGroupNeeded)
765 throw (SALOME::SALOME_Exception);
768 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
769 * \param theElems - group of of elements (edges or faces) to be replicated
770 * \param theNodesNot - group of nodes not to replicated
771 * \param theShape - shape to detect affected elements (element which geometric center
772 * located on or inside shape).
773 * The replicated nodes should be associated to affected elements.
774 * \return TRUE if operation has been completed successfully, FALSE otherwise
775 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
777 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
778 SMESH::SMESH_GroupBase_ptr theNodesNot,
779 GEOM::GEOM_Object_ptr theShape )
780 throw (SALOME::SALOME_Exception);
783 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
784 * This method provided for convenience works as DoubleNodes() described above.
785 * \param theElems - list of groups of elements (edges or faces) to be replicated
786 * \param theNodesNot - list of groups of nodes not to replicated
787 * \param theAffectedElems - group of elements to which the replicated nodes
788 * should be associated to.
789 * \return TRUE if operation has been completed successfully, FALSE otherwise
790 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
792 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
793 const SMESH::ListOfGroups& theNodesNot,
794 const SMESH::ListOfGroups& theAffectedElems )
795 throw (SALOME::SALOME_Exception);
798 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
799 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
800 * \param theElems - list of groups of elements (edges or faces) to be replicated
801 * \param theNodesNot - list of groups of nodes not to replicated
802 * \param theAffectedElems - group of elements to which the replicated nodes
803 * should be associated to.
804 * \return a new group with newly created elements
805 * \sa DoubleNodeElemGroups()
807 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
808 const SMESH::ListOfGroups& theNodesNot,
809 const SMESH::ListOfGroups& theAffectedElems )
810 throw (SALOME::SALOME_Exception);
812 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
813 const SMESH::ListOfGroups& theNodesNot,
814 const SMESH::ListOfGroups& theAffectedElems,
815 CORBA::Boolean theElemGroupNeeded,
816 CORBA::Boolean theNodeGroupNeeded)
817 throw (SALOME::SALOME_Exception);
820 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
821 * This method provided for convenience works as DoubleNodes() described above.
822 * \param theElems - list of groups of elements (edges or faces) to be replicated
823 * \param theNodesNot - list of groups of nodes not to replicated
824 * \param theShape - shape to detect affected elements (element which geometric center
825 * located on or inside shape).
826 * The replicated nodes should be associated to affected elements.
827 * \return TRUE if operation has been completed successfully, FALSE otherwise
828 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
830 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
831 const SMESH::ListOfGroups& theNodesNot,
832 GEOM::GEOM_Object_ptr theShape )
833 throw (SALOME::SALOME_Exception);
836 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
837 * This method is the first step of DoubleNodeElemGroupsInRegion.
838 * \param theElems - list of groups of elements (edges or faces) to be replicated
839 * \param theNodesNot - list of groups of nodes not to replicated
840 * \param theShape - shape to detect affected elements (element which geometric center
841 * located on or inside shape).
842 * The replicated nodes should be associated to affected elements.
843 * \return groups of affected elements
844 * \sa DoubleNodeElemGroupsInRegion()
846 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
847 const SMESH::ListOfGroups& theNodesNot,
848 GEOM::GEOM_Object_ptr theShape )
849 throw (SALOME::SALOME_Exception);
852 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
853 * The list of groups must describe a partition of the mesh volumes.
854 * The nodes of the internal faces at the boundaries of the groups are doubled.
855 * In option, the internal faces are replaced by flat elements.
856 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
857 * \param theDomains - list of groups of volumes
858 * \param createJointElems - if TRUE, create the elements
859 * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
860 * the boundary between \a theDomains and the rest mesh
861 * \return TRUE if operation has been completed successfully, FALSE otherwise
863 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
864 CORBA::Boolean createJointElems,
865 CORBA::Boolean onAllBoundaries )
866 throw (SALOME::SALOME_Exception);
868 * \brief Double nodes on some external faces and create flat elements.
869 * Flat elements are mainly used by some types of mechanic calculations.
871 * Each group of the list must be constituted of faces.
872 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
873 * @param theGroupsOfFaces - list of groups of faces
874 * @return TRUE if operation has been completed successfully, FALSE otherwise
876 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces )
877 throw (SALOME::SALOME_Exception);
880 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
881 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
882 * groups of faces to remove insidethe object, (idem edges).
883 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
885 void CreateHoleSkin(CORBA::Double radius,
886 GEOM::GEOM_Object_ptr theShape,
887 const char* groupName,
888 const SMESH::double_array& theNodesCoords,
889 SMESH::array_of_long_array_out GroupsOfNodes)
890 throw (SALOME::SALOME_Exception);
893 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
894 * The created 2D mesh elements based on nodes of free faces of boundary volumes
895 * \return TRUE if operation has been completed successfully, FALSE otherwise
897 CORBA::Boolean Make2DMeshFrom3D()
898 throw (SALOME::SALOME_Exception);
900 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
901 SMESH::Bnd_Dimension dimension,
902 const char* groupName,
903 const char* meshName,
904 CORBA::Boolean toCopyElements,
905 CORBA::Boolean toCopyMissingBondary,
906 SMESH::SMESH_Group_out group)
907 throw (SALOME::SALOME_Exception);
909 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
910 const char* groupName,
911 const char* meshName,
912 CORBA::Boolean toCopyAll,
913 const SMESH::ListOfIDSources& groups,
914 SMESH::SMESH_Mesh_out mesh,
915 SMESH::SMESH_Group_out group)
916 throw (SALOME::SALOME_Exception);
919 * \brief Create a polyline consisting of 1D mesh elements each lying on a 2D element of
920 * the initial mesh. Positions of new nodes are found by cutting the mesh by the
921 * plane passing through pairs of points specified by each PolySegment structure.
922 * If there are several paths connecting a pair of points, the shortest path is
923 * selected by the module. Position of the cutting plane is defined by the two
924 * points and an optional vector lying on the plane specified by a PolySegment.
925 * By default the vector is defined by Mesh module as following. A middle point
926 * of the two given points is computed. The middle point is projected to the mesh.
927 * The vector goes from the middle point to the projection point. In case of planar
928 * mesh, the vector is normal to the mesh.
929 * \param [inout] segments - PolySegment's defining positions of cutting planes.
930 * Return the used vector and position of the middle point.
931 * \param [in] groupName - optional name of a group where created mesh segments will
934 void MakePolyLine(SMESH::ListOfPolySegments& segments,
935 const char* groupName)
936 throw (SALOME::SALOME_Exception);
939 * \brief Create a slot of given width around given 1D elements lying on a triangle mesh.
940 * The slot is consrtucted by cutting faces by cylindrical surfaces made
941 * around each segment. Segments are expected to be created by MakePolyLine().
942 * \return Edges located at the slot boundary
944 SMESH::ListOfEdges* MakeSlot(SMESH::SMESH_GroupBase_ptr segments,
946 throw (SALOME::SALOME_Exception);
949 private: //!< private methods
951 ::SMESH_MeshEditor& getEditor();
953 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
955 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
957 void declareMeshModified( bool isReComputeSafe );
960 * \brief Clear myLastCreated* or myPreviewData
962 void initData(bool deleteSearchers=true);
965 * \brief Return groups by their IDs
967 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
968 throw (SALOME::SALOME_Exception);
970 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
971 const SMESH::AxisStruct & Axis,
972 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
975 ::SMESH_Mesh* TargetMesh=0)
976 throw (SALOME::SALOME_Exception);
977 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
978 const SMESH::DirStruct & Vector,
981 ::SMESH_Mesh* TargetMesh=0)
982 throw (SALOME::SALOME_Exception);
983 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
984 const SMESH::AxisStruct & Axis,
988 ::SMESH_Mesh* TargetMesh=0)
989 throw (SALOME::SALOME_Exception);
991 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
992 const SMESH::PointStruct& thePoint,
993 const SMESH::double_array& theScaleFact,
994 CORBA::Boolean theCopy,
996 ::SMESH_Mesh* theTargetMesh=0)
997 throw (SALOME::SALOME_Exception);
999 void convertToQuadratic(CORBA::Boolean theForce3d,
1000 CORBA::Boolean theToBiQuad,
1001 SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil())
1002 throw (SALOME::SALOME_Exception);
1004 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
1006 void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
1007 const SMESH::ListOfGroups * theGroupList);
1009 void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
1012 enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
1014 bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
1015 const SMESHDS_Mesh* theMeshDS,
1016 TIDSortedElemSet& theElemSet,
1017 const SMDSAbs_ElementType theType,
1018 const bool emptyIfIsMesh = false,
1019 IDSource_Error* error = 0);
1021 void findCoincidentNodes( TIDSortedNodeSet & Nodes,
1022 CORBA::Double Tolerance,
1023 SMESH::array_of_long_array_out GroupsOfNodes,
1024 CORBA::Boolean SeparateCornersAndMedium);
1028 private: //!< fields
1030 SMESH_Mesh_i* myMesh_i;
1031 SMESH_Mesh * myMesh;
1032 ::SMESH_MeshEditor myEditor;
1034 bool myIsPreviewMode;
1035 MeshEditor_I::TPreviewMesh * myPreviewMesh;
1036 ::SMESH_MeshEditor * myPreviewEditor;
1037 SMESH::MeshPreviewStruct_var myPreviewData;
1039 // temporary IDSources