1 // Copyright (C) 2007-2021 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::smIdType_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::smIdType_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::smIdType_array& IDsOfElements,
94 SMESH::ElementType type);
95 static bool IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource );
96 static SMESH::smIdType* GetTemporaryIDs( SMESH::SMESH_IDSource_ptr& idSource, SMESH::smIdType& nbIds );
99 * \brief Generates the unique group name
101 std::string GenerateGroupName(const std::string& thePrefix);
103 CORBA::Boolean RemoveElements(const SMESH::smIdType_array & IDsOfElements);
104 CORBA::Boolean RemoveNodes (const SMESH::smIdType_array & IDsOfNodes);
105 SMESH::smIdType RemoveOrphanNodes();
108 * Methods for creation new elements.
109 * Returns ID of created element or 0 if element not created
111 SMESH::smIdType AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
112 SMESH::smIdType Add0DElement(SMESH::smIdType IDOfNode, CORBA::Boolean DuplicateElements);
113 SMESH::smIdType AddBall(SMESH::smIdType IDOfNodem, CORBA::Double diameter);
114 SMESH::smIdType AddEdge(const SMESH::smIdType_array & IDsOfNodes);
115 SMESH::smIdType AddFace(const SMESH::smIdType_array & IDsOfNodes);
116 SMESH::smIdType AddPolygonalFace(const SMESH::smIdType_array & IDsOfNodes);
117 SMESH::smIdType AddQuadPolygonalFace(const SMESH::smIdType_array & IDsOfNodes);
118 SMESH::smIdType AddVolume(const SMESH::smIdType_array & IDsOfNodes);
119 SMESH::smIdType AddPolyhedralVolume(const SMESH::smIdType_array & IDsOfNodes,
120 const SMESH::long_array & Quantities);
121 SMESH::smIdType AddPolyhedralVolumeByFaces(const SMESH::smIdType_array & IdsOfFaces);
124 * \brief Create 0D elements on all nodes of the given object except those
125 * nodes on which a 0D element already exists.
126 * \param theObject object on whose nodes 0D elements will be created.
127 * \param theGroupName optional name of a group to add 0D elements created
128 * and/or found on nodes of \a theObject.
129 * \param theDuplicateElements to add one more 0D element to a node or not
130 * \return an object (a new group or a temporary SMESH_IDSource) holding
131 * ids of new and/or found 0D elements.
133 SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
134 const char* theGroupName,
135 CORBA::Boolean theDuplicateElements);
138 * \brief Bind a node to a vertex
139 * \param NodeID - node ID
140 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
142 void SetNodeOnVertex(SMESH::smIdType NodeID, CORBA::Long VertexID);
144 * \brief Store node position on an edge
145 * \param NodeID - node ID
146 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
147 * \param paramOnEdge - parameter on edge where the node is located
149 void SetNodeOnEdge(SMESH::smIdType NodeID, CORBA::Long EdgeID,
150 CORBA::Double paramOnEdge);
152 * \brief Store node position on a face
153 * \param NodeID - node ID
154 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
155 * \param u - U parameter on face where the node is located
156 * \param v - V parameter on face where the node is located
158 void SetNodeOnFace(SMESH::smIdType NodeID, CORBA::Long FaceID,
159 CORBA::Double u, CORBA::Double v);
161 * \brief Bind a node to a solid
162 * \param NodeID - node ID
163 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
165 void SetNodeInVolume(SMESH::smIdType NodeID, CORBA::Long SolidID);
167 * \brief Bind an element to a shape
168 * \param ElementID - element ID
169 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
171 void SetMeshElementOnShape(SMESH::smIdType ElementID, CORBA::Long ShapeID);
174 CORBA::Boolean MoveNode(SMESH::smIdType NodeID,
175 CORBA::Double x, CORBA::Double y, CORBA::Double z);
177 CORBA::Boolean InverseDiag(SMESH::smIdType NodeID1, SMESH::smIdType NodeID2);
178 CORBA::Boolean DeleteDiag(SMESH::smIdType NodeID1, SMESH::smIdType NodeID2);
179 CORBA::Boolean Reorient(const SMESH::smIdType_array & IDsOfElements);
180 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
183 * \brief Reorient faces contained in \a the2Dgroup.
184 * \param the2Dgroup - the mesh or its part to reorient
185 * \param theDirection - desired direction of normal of \a theFace
186 * \param theFace - ID of face whose orientation is checked.
187 * It can be < 1 then \a thePoint is used to find a face.
188 * \param thePoint - is used to find a face if \a theFace < 1.
189 * \return number of reoriented elements.
191 CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
192 const SMESH::DirStruct& theDirection,
194 const SMESH::PointStruct& thePoint);
196 * \brief Reorient faces contained in a list of \a objectFaces
197 * equally to faces contained in a list of \a referenceFaces.
198 * \param objectFaces - faces to reorient in a list including either
199 * the whole mesh or groups and/or sub-meshes.
200 * \param referenceFaces - correctly oriented faces in a list of groups and/or sub-meshes.
201 * It can be empty, then the 1st face in \a objectFaces is used as the reference.
202 * \return number of reoriented faces.
204 CORBA::Long Reorient2DByNeighbours(const SMESH::ListOfIDSources& objectFaces,
205 const SMESH::ListOfIDSources& referenceFaces);
207 * \brief Reorient faces basing on orientation of adjacent volumes.
208 * \param faces - a list of objects containing face to reorient
209 * \param volumes - an object containing volumes.
210 * \param outsideNormal - to orient faces to have their normal
211 * pointing either \a outside or \a inside the adjacent volumes.
212 * \return number of reoriented faces.
214 CORBA::Long Reorient2DBy3D(const SMESH::ListOfIDSources & faces,
215 SMESH::SMESH_IDSource_ptr volumes,
216 CORBA::Boolean outsideNormal);
219 CORBA::Boolean TriToQuad (const SMESH::smIdType_array & IDsOfElements,
220 SMESH::NumericalFunctor_ptr Criterion,
221 CORBA::Double MaxAngle);
222 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
223 SMESH::NumericalFunctor_ptr Criterion,
224 CORBA::Double MaxAngle);
225 CORBA::Boolean QuadToTri (const SMESH::smIdType_array & IDsOfElements,
226 SMESH::NumericalFunctor_ptr Criterion);
227 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
228 SMESH::NumericalFunctor_ptr Criterion);
229 void QuadTo4Tri (SMESH::SMESH_IDSource_ptr theObject);
230 CORBA::Boolean SplitQuad (const SMESH::smIdType_array & IDsOfElements,
231 CORBA::Boolean Diag13);
232 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
233 CORBA::Boolean Diag13);
234 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
235 SMESH::NumericalFunctor_ptr Criterion);
236 void SplitVolumesIntoTetra(SMESH::SMESH_IDSource_ptr elems,
237 CORBA::Short methodFlags);
238 void SplitHexahedraIntoPrisms(SMESH::SMESH_IDSource_ptr elems,
239 const SMESH::PointStruct & startHexPoint,
240 const SMESH::DirStruct& facetToSplitNormal,
241 CORBA::Short methodFlags,
242 CORBA::Boolean allDomains);
243 void SplitBiQuadraticIntoLinear(const SMESH::ListOfIDSources& elems);
245 CORBA::Boolean Smooth(const SMESH::smIdType_array & IDsOfElements,
246 const SMESH::smIdType_array & IDsOfFixedNodes,
247 CORBA::Short MaxNbOfIterations,
248 CORBA::Double MaxAspectRatio,
249 SMESH::SMESH_MeshEditor::Smooth_Method Method);
250 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
251 const SMESH::smIdType_array & IDsOfFixedNodes,
252 CORBA::Short MaxNbOfIterations,
253 CORBA::Double MaxAspectRatio,
254 SMESH::SMESH_MeshEditor::Smooth_Method Method);
255 CORBA::Boolean SmoothParametric(const SMESH::smIdType_array & IDsOfElements,
256 const SMESH::smIdType_array & IDsOfFixedNodes,
257 CORBA::Short MaxNbOfIterations,
258 CORBA::Double MaxAspectRatio,
259 SMESH::SMESH_MeshEditor::Smooth_Method Method) ;
260 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
261 const SMESH::smIdType_array & IDsOfFixedNodes,
262 CORBA::Short MaxNbOfIterations,
263 CORBA::Double MaxAspectRatio,
264 SMESH::SMESH_MeshEditor::Smooth_Method Method);
265 CORBA::Boolean smooth(const SMESH::smIdType_array & IDsOfElements,
266 const SMESH::smIdType_array & IDsOfFixedNodes,
267 CORBA::Short MaxNbOfIterations,
268 CORBA::Double MaxAspectRatio,
269 SMESH::SMESH_MeshEditor::Smooth_Method Method,
271 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
272 const SMESH::smIdType_array & IDsOfFixedNodes,
273 CORBA::Short MaxNbOfIterations,
274 CORBA::Double MaxAspectRatio,
275 SMESH::SMESH_MeshEditor::Smooth_Method Method,
278 CORBA::Boolean ConvertFromQuadratic();
279 void ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr theObject);
280 void ConvertToQuadratic(CORBA::Boolean Force3d);
281 void ConvertToQuadraticObject(CORBA::Boolean theForce3d,
282 SMESH::SMESH_IDSource_ptr theObject);
283 void ConvertToBiQuadratic(CORBA::Boolean theForce3d,
284 SMESH::SMESH_IDSource_ptr theObject);
286 void RenumberNodes();
287 void RenumberElements();
289 SMESH::ListOfGroups* RotationSweepObjects(const SMESH::ListOfIDSources & Nodes,
290 const SMESH::ListOfIDSources & Edges,
291 const SMESH::ListOfIDSources & Faces,
292 const SMESH::AxisStruct & Axis,
293 CORBA::Double AngleInRadians,
294 CORBA::Long NbOfSteps,
295 CORBA::Double Tolerance,
296 CORBA::Boolean ToMakeGroups);
298 SMESH::ListOfGroups* ExtrusionSweepObjects(const SMESH::ListOfIDSources & Nodes,
299 const SMESH::ListOfIDSources & Edges,
300 const SMESH::ListOfIDSources & Faces,
301 const SMESH::DirStruct & StepVector,
302 CORBA::Long NbOfSteps,
303 CORBA::Boolean ToMakeGroups,
304 const SMESH::double_array & ScaleFactors,
305 CORBA::Boolean ScalesVariation,
306 const SMESH::double_array & BasePoint,
307 const SMESH::double_array & Angles,
308 CORBA::Boolean AnglesVariation);
310 SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
311 CORBA::Double stepSize,
312 CORBA::Long nbOfSteps,
313 CORBA::Boolean byAverageNormal,
314 CORBA::Boolean useInputElemsOnly,
315 CORBA::Boolean makeGroups,
317 SMESH::ListOfGroups* AdvancedExtrusion(const SMESH::smIdType_array & theIDsOfElements,
318 const SMESH::DirStruct & theStepVector,
319 CORBA::Long theNbOfSteps,
320 CORBA::Long theExtrFlags,
321 CORBA::Double theSewTolerance,
322 CORBA::Boolean theMakeGroups);
325 ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & Nodes,
326 const SMESH::ListOfIDSources & Edges,
327 const SMESH::ListOfIDSources & Faces,
328 SMESH::SMESH_IDSource_ptr PathMesh,
329 GEOM::GEOM_Object_ptr PathShape,
330 SMESH::smIdType NodeStart,
331 CORBA::Boolean HasAngles,
332 const SMESH::double_array & Angles,
333 CORBA::Boolean AnglesVariation,
334 CORBA::Boolean HasRefPoint,
335 const SMESH::PointStruct & RefPoint,
337 const SMESH::double_array & ScaleFactors,
338 CORBA::Boolean ScalesVariation,
339 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
341 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
342 GEOM::GEOM_Object_ptr PathShape,
343 const SMESH::double_array & Angles);
345 void Mirror(const SMESH::smIdType_array & IDsOfElements,
346 const SMESH::AxisStruct & Axis,
347 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
348 CORBA::Boolean Copy);
349 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
350 const SMESH::AxisStruct & Axis,
351 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
352 CORBA::Boolean Copy);
353 void Translate(const SMESH::smIdType_array & IDsOfElements,
354 const SMESH::DirStruct & Vector,
355 CORBA::Boolean Copy);
356 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
357 const SMESH::DirStruct & Vector,
358 CORBA::Boolean Copy);
359 void Rotate(const SMESH::smIdType_array & IDsOfElements,
360 const SMESH::AxisStruct & Axis,
362 CORBA::Boolean Copy);
363 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
364 const SMESH::AxisStruct & Axis,
366 CORBA::Boolean Copy);
368 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::smIdType_array& IDsOfElements,
369 const SMESH::AxisStruct& Mirror,
370 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
371 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
372 const SMESH::AxisStruct& Mirror,
373 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
374 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::smIdType_array& IDsOfElements,
375 const SMESH::DirStruct& Vector);
376 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
377 const SMESH::DirStruct& Vector);
378 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::smIdType_array& IDsOfElements,
379 const SMESH::AxisStruct& Axis,
380 CORBA::Double AngleInRadians);
381 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
382 const SMESH::AxisStruct& Axis,
383 CORBA::Double AngleInRadians);
385 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::smIdType_array& IDsOfElements,
386 const SMESH::AxisStruct& Mirror,
387 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
388 CORBA::Boolean CopyGroups,
389 const char* MeshName);
390 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
391 const SMESH::AxisStruct& Mirror,
392 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
393 CORBA::Boolean CopyGroups,
394 const char* MeshName);
395 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::smIdType_array& IDsOfElements,
396 const SMESH::DirStruct& Vector,
397 CORBA::Boolean CopyGroups,
398 const char* MeshName);
399 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
400 const SMESH::DirStruct& Vector,
401 CORBA::Boolean CopyGroups,
402 const char* MeshName);
403 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::smIdType_array& IDsOfElements,
404 const SMESH::AxisStruct& Axis,
405 CORBA::Double AngleInRadians,
406 CORBA::Boolean CopyGroups,
407 const char* MeshName);
408 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
409 const SMESH::AxisStruct& Axis,
410 CORBA::Double AngleInRadians,
411 CORBA::Boolean CopyGroups,
412 const char* MeshName);
414 void Scale(SMESH::SMESH_IDSource_ptr theObject,
415 const SMESH::PointStruct& thePoint,
416 const SMESH::double_array& theScaleFact,
417 CORBA::Boolean theCopy);
419 SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
420 const SMESH::PointStruct& thePoint,
421 const SMESH::double_array& theScaleFact);
423 SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
424 const SMESH::PointStruct& Point,
425 const SMESH::double_array& theScaleFact,
426 CORBA::Boolean CopyGroups,
427 const char* MeshName);
429 SMESH::SMESH_Mesh_ptr Offset( SMESH::SMESH_IDSource_ptr theObject,
431 CORBA::Boolean CopyGroups,
432 CORBA::Boolean CopyElements,
433 const char* MeshName,
434 SMESH::ListOfGroups_out Groups);
436 void FindCoincidentNodes (CORBA::Double Tolerance,
437 SMESH::array_of_long_array_out GroupsOfNodes,
438 CORBA::Boolean SeparateCornersAndMedium);
439 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
440 CORBA::Double Tolerance,
441 SMESH::array_of_long_array_out GroupsOfNodes,
442 CORBA::Boolean SeparateCornersAndMedium);
443 void FindCoincidentNodesOnPartBut(const SMESH::ListOfIDSources& Objects,
444 CORBA::Double Tolerance,
445 SMESH::array_of_long_array_out GroupsOfNodes,
446 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
447 CORBA::Boolean SeparateCornersAndMedium);
448 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes,
449 const SMESH::ListOfIDSources& NodesToKeep,
450 CORBA::Boolean AvoidMakingHoles );
451 void FindEqualElements(const SMESH::ListOfIDSources& Objects,
452 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
453 SMESH::array_of_long_array_out GroupsOfElementsID);
454 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID,
455 const SMESH::ListOfIDSources& ElementsToKeep);
456 void MergeEqualElements();
457 SMESH::smIdType MoveClosestNodeToPoint(CORBA::Double x,
460 SMESH::smIdType nodeID);
462 * \brief Return ID of node closest to a given point
464 SMESH::smIdType FindNodeClosestTo(CORBA::Double x,
468 * Return elements of given type where the given point is IN or ON.
469 * 'ALL' type means elements of any type excluding nodes
471 SMESH::smIdType_array* FindElementsByPoint(CORBA::Double x,
474 SMESH::ElementType type);
476 * Searching among the given elements, return elements of given type
477 * where the given point is IN or ON.
478 * 'ALL' type means elements of any type excluding nodes
480 SMESH::smIdType_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
484 SMESH::ElementType type);
487 * Project a point to a mesh object.
488 * Return ID of an element of given type where the given point is projected
489 * and coordinates of the projection point.
490 * In the case if nothing found, return -1 and []
492 SMESH::smIdType ProjectPoint(CORBA::Double x,
495 SMESH::ElementType type,
496 SMESH::SMESH_IDSource_ptr meshObject,
497 SMESH::double_array_out projecton);
500 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
501 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
503 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z);
506 * Check if a 2D mesh is manifold
508 CORBA::Boolean IsManifold();
511 * Check if orientation of 2D elements is coherent
513 CORBA::Boolean IsCoherentOrientation2D();
516 * Partition given 1D elements into groups of contiguous edges.
517 * A node where number of meeting edges != 2 is a group end.
518 * An optional startNode is used to orient groups it belongs to.
519 * \return a list of edge groups and a list of corresponding node groups.
520 * If a group is closed, the first and last nodes of the group are same.
522 SMESH::array_of_long_array* Get1DBranches( SMESH::SMESH_IDSource_ptr edges,
523 SMESH::smIdType startNode,
524 SMESH::array_of_long_array_out nodeGroups);
527 * Return sharp edges of faces and non-manifold ones. Optionally adds existing edges.
529 SMESH::ListOfEdges* FindSharpEdges(CORBA::Double angle, CORBA::Boolean addExisting);
532 * Returns all or only closed FreeBorder's.
534 SMESH::ListOfFreeBorders* FindFreeBorders(CORBA::Boolean closedOnly);
537 * Fill with 2D elements a hole defined by a FreeBorder.
538 * Optionally add new faces to a given group, which is returned
540 SMESH::SMESH_Group_ptr FillHole(const SMESH::FreeBorder& hole,
541 const char* groupName);
543 SMESH::CoincidentFreeBorders* FindCoincidentFreeBorders(CORBA::Double tolerance);
544 CORBA::Short SewCoincidentFreeBorders(const SMESH::CoincidentFreeBorders& freeBorders,
545 CORBA::Boolean createPolygons,
546 CORBA::Boolean createPolyedrs);
548 SMESH::SMESH_MeshEditor::Sew_Error
549 SewFreeBorders(SMESH::smIdType FirstNodeID1,
550 SMESH::smIdType SecondNodeID1,
551 SMESH::smIdType LastNodeID1,
552 SMESH::smIdType FirstNodeID2,
553 SMESH::smIdType SecondNodeID2,
554 SMESH::smIdType LastNodeID2,
555 CORBA::Boolean CreatePolygons,
556 CORBA::Boolean CreatePolyedrs);
557 SMESH::SMESH_MeshEditor::Sew_Error
558 SewConformFreeBorders(SMESH::smIdType FirstNodeID1,
559 SMESH::smIdType SecondNodeID1,
560 SMESH::smIdType LastNodeID1,
561 SMESH::smIdType FirstNodeID2,
562 SMESH::smIdType SecondNodeID2);
563 SMESH::SMESH_MeshEditor::Sew_Error
564 SewBorderToSide(SMESH::smIdType FirstNodeIDOnFreeBorder,
565 SMESH::smIdType SecondNodeIDOnFreeBorder,
566 SMESH::smIdType LastNodeIDOnFreeBorder,
567 SMESH::smIdType FirstNodeIDOnSide,
568 SMESH::smIdType LastNodeIDOnSide,
569 CORBA::Boolean CreatePolygons,
570 CORBA::Boolean CreatePolyedrs);
571 SMESH::SMESH_MeshEditor::Sew_Error
572 SewSideElements(const SMESH::smIdType_array& IDsOfSide1Elements,
573 const SMESH::smIdType_array& IDsOfSide2Elements,
574 SMESH::smIdType NodeID1OfSide1ToMerge,
575 SMESH::smIdType NodeID1OfSide2ToMerge,
576 SMESH::smIdType NodeID2OfSide1ToMerge,
577 SMESH::smIdType NodeID2OfSide2ToMerge);
580 * Set new nodes for given element.
581 * If number of nodes is not corresponded to type of
582 * element - returns false
584 CORBA::Boolean ChangeElemNodes(SMESH::smIdType ide, const SMESH::smIdType_array& newIDs);
586 SMESH::SMESH_Group_ptr DoubleElements(SMESH::SMESH_IDSource_ptr theElements,
587 const char* theGroupName);
589 CORBA::Boolean DoubleNodes( const SMESH::smIdType_array& theNodes,
590 const SMESH::smIdType_array& theModifiedElems );
592 CORBA::Boolean DoubleNode( SMESH::smIdType theNodeId,
593 const SMESH::smIdType_array& theModifiedElems );
595 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
596 SMESH::SMESH_GroupBase_ptr theModifiedElems );
599 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
600 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
601 * \param theNodes - group of nodes to be doubled.
602 * \param theModifiedElems - group of elements to be updated.
603 * \return a new group with newly created nodes
604 * \sa DoubleNodeGroup()
606 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
607 SMESH::SMESH_GroupBase_ptr theModifiedElems );
609 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
610 const SMESH::ListOfGroups& theModifiedElems );
612 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
613 const SMESH::ListOfGroups& theModifiedElems );
616 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
617 * \param theElems - the list of elements (edges or faces) to be replicated
618 * The nodes for duplication could be found from these elements
619 * \param theNodesNot - list of nodes to NOT replicate
620 * \param theAffectedElems - the list of elements (cells and edges) to which the
621 * replicated nodes should be associated to.
622 * \return TRUE if operation has been completed successfully, FALSE otherwise
623 * \sa DoubleNodeGroup(), DoubleNodeGroups()
625 CORBA::Boolean DoubleNodeElem( const SMESH::smIdType_array& theElems,
626 const SMESH::smIdType_array& theNodesNot,
627 const SMESH::smIdType_array& theAffectedElems );
630 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
631 * \param theElems - the list of elements (edges or faces) to be replicated
632 * The nodes for duplication could be found from these elements
633 * \param theNodesNot - list of nodes to NOT replicate
634 * \param theShape - shape to detect affected elements (element which geometric center
635 * located on or inside shape).
636 * The replicated nodes should be associated to affected elements.
637 * \return TRUE if operation has been completed successfully, FALSE otherwise
638 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
640 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::smIdType_array& theElems,
641 const SMESH::smIdType_array& theNodesNot,
642 GEOM::GEOM_Object_ptr theShape );
645 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
646 * \param theElems - group of of elements (edges or faces) to be replicated
647 * \param theNodesNot - group of nodes not to replicated
648 * \param theAffectedElems - group of elements to which the replicated nodes
649 * should be associated to.
650 * \return TRUE if operation has been completed successfully, FALSE otherwise
651 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
653 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
654 SMESH::SMESH_GroupBase_ptr theNodesNot,
655 SMESH::SMESH_GroupBase_ptr theAffectedElems );
658 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
659 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
660 * \param theElems - group of of elements (edges or faces) to be replicated
661 * \param theNodesNot - group of nodes not to replicated
662 * \param theAffectedElems - group of elements to which the replicated nodes
663 * should be associated to.
664 * \return a new group with newly created elements
665 * \sa DoubleNodeElemGroup()
667 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
668 SMESH::SMESH_GroupBase_ptr theNodesNot,
669 SMESH::SMESH_GroupBase_ptr theAffectedElems );
671 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
672 SMESH::SMESH_GroupBase_ptr theNodesNot,
673 SMESH::SMESH_GroupBase_ptr theAffectedElems,
674 CORBA::Boolean theElemGroupNeeded,
675 CORBA::Boolean theNodeGroupNeeded);
678 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
679 * \param theElems - group of of elements (edges or faces) to be replicated
680 * \param theNodesNot - group of nodes not to replicated
681 * \param theShape - shape to detect affected elements (element which geometric center
682 * located on or inside shape).
683 * The replicated nodes should be associated to affected elements.
684 * \return TRUE if operation has been completed successfully, FALSE otherwise
685 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
687 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
688 SMESH::SMESH_GroupBase_ptr theNodesNot,
689 GEOM::GEOM_Object_ptr theShape );
692 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
693 * This method provided for convenience works as DoubleNodes() described above.
694 * \param theElems - list of groups of elements (edges or faces) to be replicated
695 * \param theNodesNot - list of groups of nodes not to replicated
696 * \param theAffectedElems - group of elements to which the replicated nodes
697 * should be associated to.
698 * \return TRUE if operation has been completed successfully, FALSE otherwise
699 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
701 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
702 const SMESH::ListOfGroups& theNodesNot,
703 const SMESH::ListOfGroups& theAffectedElems );
706 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
707 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
708 * \param theElems - list of groups of elements (edges or faces) to be replicated
709 * \param theNodesNot - list of groups of nodes not to replicated
710 * \param theAffectedElems - group of elements to which the replicated nodes
711 * should be associated to.
712 * \return a new group with newly created elements
713 * \sa DoubleNodeElemGroups()
715 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
716 const SMESH::ListOfGroups& theNodesNot,
717 const SMESH::ListOfGroups& theAffectedElems );
719 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
720 const SMESH::ListOfGroups& theNodesNot,
721 const SMESH::ListOfGroups& theAffectedElems,
722 CORBA::Boolean theElemGroupNeeded,
723 CORBA::Boolean theNodeGroupNeeded);
726 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
727 * This method provided for convenience works as DoubleNodes() described above.
728 * \param theElems - list of groups of elements (edges or faces) to be replicated
729 * \param theNodesNot - list of groups of nodes not to replicated
730 * \param theShape - shape to detect affected elements (element which geometric center
731 * located on or inside shape).
732 * The replicated nodes should be associated to affected elements.
733 * \return TRUE if operation has been completed successfully, FALSE otherwise
734 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
736 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
737 const SMESH::ListOfGroups& theNodesNot,
738 GEOM::GEOM_Object_ptr theShape );
741 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
742 * This method is the first step of DoubleNodeElemGroupsInRegion.
743 * \param theElems - list of groups of elements (edges or faces) to be replicated
744 * \param theNodesNot - list of groups of nodes not to replicated
745 * \param theShape - shape to detect affected elements (element which geometric center
746 * located on or inside shape).
747 * The replicated nodes should be associated to affected elements.
748 * \return groups of affected elements
749 * \sa DoubleNodeElemGroupsInRegion()
751 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
752 const SMESH::ListOfGroups& theNodesNot,
753 GEOM::GEOM_Object_ptr theShape );
756 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
757 * The list of groups must describe a partition of the mesh volumes.
758 * The nodes of the internal faces at the boundaries of the groups are doubled.
759 * In option, the internal faces are replaced by flat elements.
760 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
761 * \param theDomains - list of groups of volumes
762 * \param createJointElems - if TRUE, create the elements
763 * \param onAllBoundaries - if TRUE, the nodes and elements are also create on
764 * the boundary between \a theDomains and the rest mesh
765 * \return TRUE if operation has been completed successfully, FALSE otherwise
767 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
768 CORBA::Boolean createJointElems,
769 CORBA::Boolean onAllBoundaries );
771 * \brief Double nodes on some external faces and create flat elements.
772 * Flat elements are mainly used by some types of mechanic calculations.
774 * Each group of the list must be constituted of faces.
775 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
776 * @param theGroupsOfFaces - list of groups of faces
777 * @return TRUE if operation has been completed successfully, FALSE otherwise
779 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces );
782 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
783 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
784 * groups of faces to remove insidethe object, (idem edges).
785 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
787 void CreateHoleSkin(CORBA::Double radius,
788 GEOM::GEOM_Object_ptr theShape,
789 const char* groupName,
790 const SMESH::double_array& theNodesCoords,
791 SMESH::array_of_long_array_out GroupsOfNodes);
794 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
795 * The created 2D mesh elements based on nodes of free faces of boundary volumes
796 * \return TRUE if operation has been completed successfully, FALSE otherwise
798 CORBA::Boolean Make2DMeshFrom3D();
800 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
801 SMESH::Bnd_Dimension dimension,
802 const char* groupName,
803 const char* meshName,
804 CORBA::Boolean toCopyElements,
805 CORBA::Boolean toCopyMissingBondary,
806 SMESH::SMESH_Group_out group);
808 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
809 const char* groupName,
810 const char* meshName,
811 CORBA::Boolean toCopyAll,
812 const SMESH::ListOfIDSources& groups,
813 SMESH::SMESH_Mesh_out mesh,
814 SMESH::SMESH_Group_out group);
817 * \brief Create a polyline consisting of 1D mesh elements each lying on a 2D element of
818 * the initial mesh. Positions of new nodes are found by cutting the mesh by the
819 * plane passing through pairs of points specified by each PolySegment structure.
820 * If there are several paths connecting a pair of points, the shortest path is
821 * selected by the module. Position of the cutting plane is defined by the two
822 * points and an optional vector lying on the plane specified by a PolySegment.
823 * By default the vector is defined by Mesh module as following. A middle point
824 * of the two given points is computed. The middle point is projected to the mesh.
825 * The vector goes from the middle point to the projection point. In case of planar
826 * mesh, the vector is normal to the mesh.
827 * \param [inout] segments - PolySegment's defining positions of cutting planes.
828 * Return the used vector and position of the middle point.
829 * \param [in] groupName - optional name of a group where created mesh segments will
832 void MakePolyLine(SMESH::ListOfPolySegments& segments,
833 const char* groupName);
836 * \brief Create a slot of given width around given 1D elements lying on a triangle mesh.
837 * The slot is constructed by cutting faces by cylindrical surfaces made
838 * around each segment. Segments are expected to be created by MakePolyLine().
839 * \return Edges located at the slot boundary
841 SMESH::ListOfEdges* MakeSlot(SMESH::SMESH_GroupBase_ptr segments,
842 CORBA::Double width);
845 private: //!< private methods
847 ::SMESH_MeshEditor& getEditor();
849 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
851 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
853 void declareMeshModified( bool isReComputeSafe );
856 * \brief Clear myLastCreated* or myPreviewData
858 void initData(bool deleteSearchers=true);
861 * \brief Return groups by their IDs
863 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
865 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
866 const SMESH::AxisStruct & Axis,
867 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
870 ::SMESH_Mesh* TargetMesh=0);
871 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
872 const SMESH::DirStruct & Vector,
875 ::SMESH_Mesh* TargetMesh=0);
876 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
877 const SMESH::AxisStruct & Axis,
881 ::SMESH_Mesh* TargetMesh=0);
883 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
884 const SMESH::PointStruct& thePoint,
885 const SMESH::double_array& theScaleFact,
886 CORBA::Boolean theCopy,
888 ::SMESH_Mesh* theTargetMesh=0);
890 void convertToQuadratic(CORBA::Boolean theForce3d,
891 CORBA::Boolean theToBiQuad,
892 SMESH::SMESH_IDSource_ptr theObject = SMESH::SMESH_IDSource::_nil());
894 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
896 void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
897 const SMESH::ListOfGroups * theGroupList);
899 void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
902 enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
904 bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
905 const SMESHDS_Mesh* theMeshDS,
906 TIDSortedElemSet& theElemSet,
907 const SMDSAbs_ElementType theType,
908 const bool emptyIfIsMesh = false,
909 IDSource_Error* error = 0);
911 void findCoincidentNodes( TIDSortedNodeSet & Nodes,
912 CORBA::Double Tolerance,
913 SMESH::array_of_long_array_out GroupsOfNodes,
914 CORBA::Boolean SeparateCornersAndMedium);
920 SMESH_Mesh_i* myMesh_i;
922 ::SMESH_MeshEditor myEditor;
924 bool myIsPreviewMode;
925 MeshEditor_I::TPreviewMesh * myPreviewMesh;
926 ::SMESH_MeshEditor * myPreviewEditor;
927 SMESH::MeshPreviewStruct_var myPreviewData;
929 // temporary IDSources