1 // Copyright (C) 2007-2020 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() ;
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() ;
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() ;
82 * \brief Clears sequences of last created elements and nodes
84 void ClearLastCreated() ;
86 * \brief Returns description of an error/warning occurred during the last operation
88 SMESH::ComputeError* GetLastError() ;
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)
105 CORBA::Boolean RemoveNodes (const SMESH::long_array & IDsOfNodes)
107 CORBA::Long RemoveOrphanNodes()
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)
116 CORBA::Long Add0DElement(CORBA::Long IDOfNode, CORBA::Boolean DuplicateElements)
118 CORBA::Long AddBall(CORBA::Long IDOfNodem, CORBA::Double diameter)
120 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes)
122 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes)
124 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes)
126 CORBA::Long AddQuadPolygonalFace(const SMESH::long_array & IDsOfNodes)
128 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes)
130 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
131 const SMESH::long_array & Quantities)
133 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces)
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)
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)
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)
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)
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)
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)
193 CORBA::Boolean MoveNode(CORBA::Long NodeID,
194 CORBA::Double x, CORBA::Double y, CORBA::Double z)
197 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2)
199 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2)
201 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements)
203 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject)
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) ;
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)
233 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
234 SMESH::NumericalFunctor_ptr Criterion,
235 CORBA::Double MaxAngle)
237 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
238 SMESH::NumericalFunctor_ptr Criterion,
239 CORBA::Double MaxAngle)
241 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
242 SMESH::NumericalFunctor_ptr Criterion)
244 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
245 SMESH::NumericalFunctor_ptr Criterion)
247 void QuadTo4Tri (SMESH::SMESH_IDSource_ptr theObject)
249 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
250 CORBA::Boolean Diag13)
252 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
253 CORBA::Boolean Diag13)
255 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
256 SMESH::NumericalFunctor_ptr Criterion)
258 void SplitVolumesIntoTetra(SMESH::SMESH_IDSource_ptr elems,
259 CORBA::Short methodFlags)
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)
267 void SplitBiQuadraticIntoLinear(const SMESH::ListOfIDSources& elems)
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)
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)
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)
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)
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,
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,
309 CORBA::Boolean ConvertFromQuadratic()
311 void ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr theObject)
313 void ConvertToQuadratic(CORBA::Boolean Force3d)
315 void ConvertToQuadraticObject(CORBA::Boolean theForce3d,
316 SMESH::SMESH_IDSource_ptr theObject)
318 void ConvertToBiQuadratic(CORBA::Boolean theForce3d,
319 SMESH::SMESH_IDSource_ptr theObject)
322 void RenumberNodes() ;
323 void RenumberElements() ;
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)
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 CORBA::Boolean ToMakeGroups,
341 const SMESH::double_array & ScaleFactors,
342 CORBA::Boolean ScalesVariation,
343 const SMESH::double_array & BasePoint,
344 const SMESH::double_array & Angles,
345 CORBA::Boolean AnglesVariation)
348 SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
349 CORBA::Double stepSize,
350 CORBA::Long nbOfSteps,
351 CORBA::Boolean byAverageNormal,
352 CORBA::Boolean useInputElemsOnly,
353 CORBA::Boolean makeGroups,
356 SMESH::ListOfGroups* AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
357 const SMESH::DirStruct & theStepVector,
358 CORBA::Long theNbOfSteps,
359 CORBA::Long theExtrFlags,
360 CORBA::Double theSewTolerance,
361 CORBA::Boolean theMakeGroups)
365 ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & Nodes,
366 const SMESH::ListOfIDSources & Edges,
367 const SMESH::ListOfIDSources & Faces,
368 SMESH::SMESH_IDSource_ptr PathMesh,
369 GEOM::GEOM_Object_ptr PathShape,
370 CORBA::Long NodeStart,
371 CORBA::Boolean HasAngles,
372 const SMESH::double_array & Angles,
373 CORBA::Boolean AnglesVariation,
374 CORBA::Boolean HasRefPoint,
375 const SMESH::PointStruct & RefPoint,
377 const SMESH::double_array & ScaleFactors,
378 CORBA::Boolean ScalesVariation,
379 SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
382 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
383 GEOM::GEOM_Object_ptr PathShape,
384 const SMESH::double_array & Angles);
386 void Mirror(const SMESH::long_array & IDsOfElements,
387 const SMESH::AxisStruct & Axis,
388 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
391 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
392 const SMESH::AxisStruct & Axis,
393 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
396 void Translate(const SMESH::long_array & IDsOfElements,
397 const SMESH::DirStruct & Vector,
400 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
401 const SMESH::DirStruct & Vector,
404 void Rotate(const SMESH::long_array & IDsOfElements,
405 const SMESH::AxisStruct & Axis,
409 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
410 const SMESH::AxisStruct & Axis,
415 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
416 const SMESH::AxisStruct& Mirror,
417 SMESH::SMESH_MeshEditor::MirrorType MirrorType)
419 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
420 const SMESH::AxisStruct& Mirror,
421 SMESH::SMESH_MeshEditor::MirrorType MirrorType)
423 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
424 const SMESH::DirStruct& Vector)
426 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
427 const SMESH::DirStruct& Vector)
429 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
430 const SMESH::AxisStruct& Axis,
431 CORBA::Double AngleInRadians)
433 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
434 const SMESH::AxisStruct& Axis,
435 CORBA::Double AngleInRadians)
438 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
439 const SMESH::AxisStruct& Mirror,
440 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
441 CORBA::Boolean CopyGroups,
442 const char* MeshName)
444 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
445 const SMESH::AxisStruct& Mirror,
446 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
447 CORBA::Boolean CopyGroups,
448 const char* MeshName)
450 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
451 const SMESH::DirStruct& Vector,
452 CORBA::Boolean CopyGroups,
453 const char* MeshName)
455 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
456 const SMESH::DirStruct& Vector,
457 CORBA::Boolean CopyGroups,
458 const char* MeshName)
460 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
461 const SMESH::AxisStruct& Axis,
462 CORBA::Double AngleInRadians,
463 CORBA::Boolean CopyGroups,
464 const char* MeshName)
466 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
467 const SMESH::AxisStruct& Axis,
468 CORBA::Double AngleInRadians,
469 CORBA::Boolean CopyGroups,
470 const char* MeshName)
473 void Scale(SMESH::SMESH_IDSource_ptr theObject,
474 const SMESH::PointStruct& thePoint,
475 const SMESH::double_array& theScaleFact,
476 CORBA::Boolean theCopy)
479 SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
480 const SMESH::PointStruct& thePoint,
481 const SMESH::double_array& theScaleFact)
484 SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
485 const SMESH::PointStruct& Point,
486 const SMESH::double_array& theScaleFact,
487 CORBA::Boolean CopyGroups,
488 const char* MeshName)
491 SMESH::SMESH_Mesh_ptr Offset( SMESH::SMESH_IDSource_ptr theObject,
493 CORBA::Boolean CopyGroups,
494 CORBA::Boolean CopyElements,
495 const char* MeshName,
496 SMESH::ListOfGroups_out Groups)
499 void FindCoincidentNodes (CORBA::Double Tolerance,
500 SMESH::array_of_long_array_out GroupsOfNodes,
501 CORBA::Boolean SeparateCornersAndMedium)
503 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
504 CORBA::Double Tolerance,
505 SMESH::array_of_long_array_out GroupsOfNodes,
506 CORBA::Boolean SeparateCornersAndMedium)
508 void FindCoincidentNodesOnPartBut(const SMESH::ListOfIDSources& Objects,
509 CORBA::Double Tolerance,
510 SMESH::array_of_long_array_out GroupsOfNodes,
511 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
512 CORBA::Boolean SeparateCornersAndMedium)
514 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes,
515 const SMESH::ListOfIDSources& NodesToKeep,
516 CORBA::Boolean AvoidMakingHoles )
518 void FindEqualElements(const SMESH::ListOfIDSources& Objects,
519 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
520 SMESH::array_of_long_array_out GroupsOfElementsID)
522 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID,
523 const SMESH::ListOfIDSources& ElementsToKeep)
525 void MergeEqualElements()
527 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
533 * \brief Return ID of node closest to a given point
535 CORBA::Long FindNodeClosestTo(CORBA::Double x,
540 * Return elements of given type where the given point is IN or ON.
541 * 'ALL' type means elements of any type excluding nodes
543 SMESH::long_array* FindElementsByPoint(CORBA::Double x,
546 SMESH::ElementType type)
549 * Searching among the given elements, return elements of given type
550 * where the given point is IN or ON.
551 * 'ALL' type means elements of any type excluding nodes
553 SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
557 SMESH::ElementType type)
561 * Project a point to a mesh object.
562 * Return ID of an element of given type where the given point is projected
563 * and coordinates of the projection point.
564 * In the case if nothing found, return -1 and []
566 CORBA::Long ProjectPoint(CORBA::Double x,
569 SMESH::ElementType type,
570 SMESH::SMESH_IDSource_ptr meshObject,
571 SMESH::double_array_out projecton)
575 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
576 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
578 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z)
582 * Check if a 2D mesh is manifold
584 CORBA::Boolean IsManifold()
588 * Check if orientation of 2D elements is coherent
590 CORBA::Boolean IsCoherentOrientation2D()
594 * Partition given 1D elements into groups of contiguous edges.
595 * A node where number of meeting edges != 2 is a group end.
596 * An optional startNode is used to orient groups it belongs to.
597 * \return a list of edge groups and a list of corresponding node groups.
598 * If a group is closed, the first and last nodes of the group are same.
600 SMESH::array_of_long_array* Get1DBranches( SMESH::SMESH_IDSource_ptr edges,
601 CORBA::Long startNode,
602 SMESH::array_of_long_array_out nodeGroups)
606 * Return sharp edges of faces and non-manifold ones. Optionally adds existing edges.
608 SMESH::ListOfEdges* FindSharpEdges(CORBA::Double angle, CORBA::Boolean addExisting)
612 * Returns all or only closed FreeBorder's.
614 SMESH::ListOfFreeBorders* FindFreeBorders(CORBA::Boolean closedOnly)
618 * Fill with 2D elements a hole defined by a FreeBorder.
619 * Optionally add new faces to a given group, which is returned
621 SMESH::SMESH_Group_ptr FillHole(const SMESH::FreeBorder& hole,
622 const char* groupName)
625 SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
626 CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
627 CORBA::Boolean createPolygons,
628 CORBA::Boolean createPolyedrs)
631 SMESH::SMESH_MeshEditor::Sew_Error
632 SewFreeBorders(CORBA::Long FirstNodeID1,
633 CORBA::Long SecondNodeID1,
634 CORBA::Long LastNodeID1,
635 CORBA::Long FirstNodeID2,
636 CORBA::Long SecondNodeID2,
637 CORBA::Long LastNodeID2,
638 CORBA::Boolean CreatePolygons,
639 CORBA::Boolean CreatePolyedrs) ;
640 SMESH::SMESH_MeshEditor::Sew_Error
641 SewConformFreeBorders(CORBA::Long FirstNodeID1,
642 CORBA::Long SecondNodeID1,
643 CORBA::Long LastNodeID1,
644 CORBA::Long FirstNodeID2,
645 CORBA::Long SecondNodeID2) ;
646 SMESH::SMESH_MeshEditor::Sew_Error
647 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
648 CORBA::Long SecondNodeIDOnFreeBorder,
649 CORBA::Long LastNodeIDOnFreeBorder,
650 CORBA::Long FirstNodeIDOnSide,
651 CORBA::Long LastNodeIDOnSide,
652 CORBA::Boolean CreatePolygons,
653 CORBA::Boolean CreatePolyedrs) ;
654 SMESH::SMESH_MeshEditor::Sew_Error
655 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
656 const SMESH::long_array& IDsOfSide2Elements,
657 CORBA::Long NodeID1OfSide1ToMerge,
658 CORBA::Long NodeID1OfSide2ToMerge,
659 CORBA::Long NodeID2OfSide1ToMerge,
660 CORBA::Long NodeID2OfSide2ToMerge) ;
663 * Set new nodes for given element.
664 * If number of nodes is not corresponded to type of
665 * element - returns false
667 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs)
670 SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
671 const char* theGroupName)
674 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
675 const SMESH::long_array& theModifiedElems )
678 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
679 const SMESH::long_array& theModifiedElems )
682 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
683 SMESH::SMESH_GroupBase_ptr theModifiedElems )
687 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
688 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
689 * \param theNodes - group of nodes to be doubled.
690 * \param theModifiedElems - group of elements to be updated.
691 * \return a new group with newly created nodes
692 * \sa DoubleNodeGroup()
694 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
695 SMESH::SMESH_GroupBase_ptr theModifiedElems )
698 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
699 const SMESH::ListOfGroups& theModifiedElems )
702 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
703 const SMESH::ListOfGroups& theModifiedElems )
707 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
708 * \param theElems - the list of elements (edges or faces) to be replicated
709 * The nodes for duplication could be found from these elements
710 * \param theNodesNot - list of nodes to NOT replicate
711 * \param theAffectedElems - the list of elements (cells and edges) to which the
712 * replicated nodes should be associated to.
713 * \return TRUE if operation has been completed successfully, FALSE otherwise
714 * \sa DoubleNodeGroup(), DoubleNodeGroups()
716 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
717 const SMESH::long_array& theNodesNot,
718 const SMESH::long_array& theAffectedElems )
722 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
723 * \param theElems - the list of elements (edges or faces) to be replicated
724 * The nodes for duplication could be found from these elements
725 * \param theNodesNot - list of nodes to NOT replicate
726 * \param theShape - shape to detect affected elements (element which geometric center
727 * located on or inside shape).
728 * The replicated nodes should be associated to affected elements.
729 * \return TRUE if operation has been completed successfully, FALSE otherwise
730 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
732 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
733 const SMESH::long_array& theNodesNot,
734 GEOM::GEOM_Object_ptr theShape )
738 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
739 * \param theElems - group of of elements (edges or faces) to be replicated
740 * \param theNodesNot - group of nodes not to replicated
741 * \param theAffectedElems - group of elements to which the replicated nodes
742 * should be associated to.
743 * \return TRUE if operation has been completed successfully, FALSE otherwise
744 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
746 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
747 SMESH::SMESH_GroupBase_ptr theNodesNot,
748 SMESH::SMESH_GroupBase_ptr theAffectedElems )
752 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
753 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
754 * \param theElems - group of of elements (edges or faces) to be replicated
755 * \param theNodesNot - group of nodes not to replicated
756 * \param theAffectedElems - group of elements to which the replicated nodes
757 * should be associated to.
758 * \return a new group with newly created elements
759 * \sa DoubleNodeElemGroup()
761 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
762 SMESH::SMESH_GroupBase_ptr theNodesNot,
763 SMESH::SMESH_GroupBase_ptr theAffectedElems )
766 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
767 SMESH::SMESH_GroupBase_ptr theNodesNot,
768 SMESH::SMESH_GroupBase_ptr theAffectedElems,
769 CORBA::Boolean theElemGroupNeeded,
770 CORBA::Boolean theNodeGroupNeeded)
774 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
775 * \param theElems - group of of elements (edges or faces) to be replicated
776 * \param theNodesNot - group of nodes not to replicated
777 * \param theShape - shape to detect affected elements (element which geometric center
778 * located on or inside shape).
779 * The replicated nodes should be associated to affected elements.
780 * \return TRUE if operation has been completed successfully, FALSE otherwise
781 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
783 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
784 SMESH::SMESH_GroupBase_ptr theNodesNot,
785 GEOM::GEOM_Object_ptr theShape )
789 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
790 * This method provided for convenience works as DoubleNodes() described above.
791 * \param theElems - list of groups of elements (edges or faces) to be replicated
792 * \param theNodesNot - list of groups of nodes not to replicated
793 * \param theAffectedElems - group of elements to which the replicated nodes
794 * should be associated to.
795 * \return TRUE if operation has been completed successfully, FALSE otherwise
796 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
798 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
799 const SMESH::ListOfGroups& theNodesNot,
800 const SMESH::ListOfGroups& theAffectedElems )
804 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
805 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
806 * \param theElems - list of groups of elements (edges or faces) to be replicated
807 * \param theNodesNot - list of groups of nodes not to replicated
808 * \param theAffectedElems - group of elements to which the replicated nodes
809 * should be associated to.
810 * \return a new group with newly created elements
811 * \sa DoubleNodeElemGroups()
813 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
814 const SMESH::ListOfGroups& theNodesNot,
815 const SMESH::ListOfGroups& theAffectedElems )
818 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
819 const SMESH::ListOfGroups& theNodesNot,
820 const SMESH::ListOfGroups& theAffectedElems,
821 CORBA::Boolean theElemGroupNeeded,
822 CORBA::Boolean theNodeGroupNeeded)
826 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
827 * This method provided for convenience works as DoubleNodes() described above.
828 * \param theElems - list of groups of elements (edges or faces) to be replicated
829 * \param theNodesNot - list of groups of nodes not to replicated
830 * \param theShape - shape to detect affected elements (element which geometric center
831 * located on or inside shape).
832 * The replicated nodes should be associated to affected elements.
833 * \return TRUE if operation has been completed successfully, FALSE otherwise
834 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
836 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
837 const SMESH::ListOfGroups& theNodesNot,
838 GEOM::GEOM_Object_ptr theShape )
842 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
843 * This method is the first step of DoubleNodeElemGroupsInRegion.
844 * \param theElems - list of groups of elements (edges or faces) to be replicated
845 * \param theNodesNot - list of groups of nodes not to replicated
846 * \param theShape - shape to detect affected elements (element which geometric center
847 * located on or inside shape).
848 * The replicated nodes should be associated to affected elements.
849 * \return groups of affected elements
850 * \sa DoubleNodeElemGroupsInRegion()
852 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
853 const SMESH::ListOfGroups& theNodesNot,
854 GEOM::GEOM_Object_ptr theShape )
858 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
859 * The list of groups must describe a partition of the mesh volumes.
860 * The nodes of the internal faces at the boundaries of the groups are doubled.
861 * In option, the internal faces are replaced by flat elements.
862 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
863 * \param theDomains - list of groups of volumes
864 * \param createJointElems - if TRUE, create the elements
865 * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
866 * the boundary between \a theDomains and the rest mesh
867 * \return TRUE if operation has been completed successfully, FALSE otherwise
869 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
870 CORBA::Boolean createJointElems,
871 CORBA::Boolean onAllBoundaries )
874 * \brief Double nodes on some external faces and create flat elements.
875 * Flat elements are mainly used by some types of mechanic calculations.
877 * Each group of the list must be constituted of faces.
878 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
879 * @param theGroupsOfFaces - list of groups of faces
880 * @return TRUE if operation has been completed successfully, FALSE otherwise
882 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces )
886 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
887 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
888 * groups of faces to remove insidethe object, (idem edges).
889 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
891 void CreateHoleSkin(CORBA::Double radius,
892 GEOM::GEOM_Object_ptr theShape,
893 const char* groupName,
894 const SMESH::double_array& theNodesCoords,
895 SMESH::array_of_long_array_out GroupsOfNodes)
899 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
900 * The created 2D mesh elements based on nodes of free faces of boundary volumes
901 * \return TRUE if operation has been completed successfully, FALSE otherwise
903 CORBA::Boolean Make2DMeshFrom3D()
906 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
907 SMESH::Bnd_Dimension dimension,
908 const char* groupName,
909 const char* meshName,
910 CORBA::Boolean toCopyElements,
911 CORBA::Boolean toCopyMissingBondary,
912 SMESH::SMESH_Group_out group)
915 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
916 const char* groupName,
917 const char* meshName,
918 CORBA::Boolean toCopyAll,
919 const SMESH::ListOfIDSources& groups,
920 SMESH::SMESH_Mesh_out mesh,
921 SMESH::SMESH_Group_out group)
925 * \brief Create a polyline consisting of 1D mesh elements each lying on a 2D element of
926 * the initial mesh. Positions of new nodes are found by cutting the mesh by the
927 * plane passing through pairs of points specified by each PolySegment structure.
928 * If there are several paths connecting a pair of points, the shortest path is
929 * selected by the module. Position of the cutting plane is defined by the two
930 * points and an optional vector lying on the plane specified by a PolySegment.
931 * By default the vector is defined by Mesh module as following. A middle point
932 * of the two given points is computed. The middle point is projected to the mesh.
933 * The vector goes from the middle point to the projection point. In case of planar
934 * mesh, the vector is normal to the mesh.
935 * \param [inout] segments - PolySegment's defining positions of cutting planes.
936 * Return the used vector and position of the middle point.
937 * \param [in] groupName - optional name of a group where created mesh segments will
940 void MakePolyLine(SMESH::ListOfPolySegments& segments,
941 const char* groupName)
945 * \brief Create a slot of given width around given 1D elements lying on a triangle mesh.
946 * The slot is constructed by cutting faces by cylindrical surfaces made
947 * around each segment. Segments are expected to be created by MakePolyLine().
948 * \return Edges located at the slot boundary
950 SMESH::ListOfEdges* MakeSlot(SMESH::SMESH_GroupBase_ptr segments,
955 private: //!< private methods
957 ::SMESH_MeshEditor& getEditor();
959 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
961 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
963 void declareMeshModified( bool isReComputeSafe );
966 * \brief Clear myLastCreated* or myPreviewData
968 void initData(bool deleteSearchers=true);
971 * \brief Return groups by their IDs
973 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
976 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
977 const SMESH::AxisStruct & Axis,
978 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
981 ::SMESH_Mesh* TargetMesh=0)
983 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
984 const SMESH::DirStruct & Vector,
987 ::SMESH_Mesh* TargetMesh=0)
989 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
990 const SMESH::AxisStruct & Axis,
994 ::SMESH_Mesh* TargetMesh=0)
997 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
998 const SMESH::PointStruct& thePoint,
999 const SMESH::double_array& theScaleFact,
1000 CORBA::Boolean theCopy,
1002 ::SMESH_Mesh* theTargetMesh=0)
1005 void convertToQuadratic(CORBA::Boolean theForce3d,
1006 CORBA::Boolean theToBiQuad,
1007 SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil())
1010 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
1012 void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
1013 const SMESH::ListOfGroups * theGroupList);
1015 void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
1018 enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
1020 bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
1021 const SMESHDS_Mesh* theMeshDS,
1022 TIDSortedElemSet& theElemSet,
1023 const SMDSAbs_ElementType theType,
1024 const bool emptyIfIsMesh = false,
1025 IDSource_Error* error = 0);
1027 void findCoincidentNodes( TIDSortedNodeSet & Nodes,
1028 CORBA::Double Tolerance,
1029 SMESH::array_of_long_array_out GroupsOfNodes,
1030 CORBA::Boolean SeparateCornersAndMedium);
1034 private: //!< fields
1036 SMESH_Mesh_i* myMesh_i;
1037 SMESH_Mesh * myMesh;
1038 ::SMESH_MeshEditor myEditor;
1040 bool myIsPreviewMode;
1041 MeshEditor_I::TPreviewMesh * myPreviewMesh;
1042 ::SMESH_MeshEditor * myPreviewEditor;
1043 SMESH::MeshPreviewStruct_var myPreviewData;
1045 // temporary IDSources