1 // Copyright (C) 2007-2012 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.
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 calsses
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"
43 class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
46 SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
48 virtual ~ SMESH_MeshEditor_i();
50 * \brief Return edited mesh ID
51 * \retval int - mesh ID
53 int GetMeshId() const { return myMesh->GetId(); }
58 * Return data of mesh edition preview
60 SMESH::MeshPreviewStruct* GetPreviewData();
62 * If during last operation of MeshEditor some nodes were
63 * created this method returns list of their IDs, if new nodes
64 * not created - returns an empty list
66 SMESH::long_array* GetLastCreatedNodes();
68 * If during last operation of MeshEditor some elements were
69 * created this method returns list of their IDs, if new elements
70 * not created - returns an empty list
72 SMESH::long_array* GetLastCreatedElems();
74 * \brief Returns description of an error/warning occured during the last operation
76 SMESH::ComputeError* GetLastError();
79 * \brief Wrap a sequence of ids in a SMESH_IDSource
81 SMESH::SMESH_IDSource_ptr MakeIDSource(const SMESH::long_array& IDsOfElements,
82 SMESH::ElementType type);
83 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
84 CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
85 CORBA::Long RemoveOrphanNodes();
88 * Methods for creation new elements.
89 * Returns ID of created element or 0 if element not created
91 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
92 CORBA::Long Add0DElement(CORBA::Long IDOfNode);
93 CORBA::Long AddBall(CORBA::Long IDOfNodem, CORBA::Double diameter)
94 throw (SALOME::SALOME_Exception);
95 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
96 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
97 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
98 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
99 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
100 const SMESH::long_array & Quantities);
101 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
104 * \brief Create 0D elements on all nodes of the given object except those
105 * nodes on which a 0D element already exists.
106 * \param theObject object on whose nodes 0D elements will be created.
107 * \param theGroupName optional name of a group to add 0D elements created
108 * and/or found on nodes of \a theObject.
109 * \return an object (a new group or a temporary SMESH_IDSource) holding
110 * ids of new and/or found 0D elements.
112 SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
113 const char* theGroupName)
114 throw (SALOME::SALOME_Exception);
117 * \brief Bind a node to a vertex
118 * \param NodeID - node ID
119 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
121 void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
122 throw (SALOME::SALOME_Exception);
124 * \brief Store node position on an edge
125 * \param NodeID - node ID
126 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
127 * \param paramOnEdge - parameter on edge where the node is located
129 void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
130 CORBA::Double paramOnEdge)
131 throw (SALOME::SALOME_Exception);
133 * \brief Store node position on a face
134 * \param NodeID - node ID
135 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
136 * \param u - U parameter on face where the node is located
137 * \param v - V parameter on face where the node is located
139 void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
140 CORBA::Double u, CORBA::Double v)
141 throw (SALOME::SALOME_Exception);
143 * \brief Bind a node to a solid
144 * \param NodeID - node ID
145 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
147 void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
148 throw (SALOME::SALOME_Exception);
150 * \brief Bind an element to a shape
151 * \param ElementID - element ID
152 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
154 void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
155 throw (SALOME::SALOME_Exception);
158 CORBA::Boolean MoveNode(CORBA::Long NodeID,
159 CORBA::Double x, CORBA::Double y, CORBA::Double z);
161 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
162 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
163 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
164 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
166 * \brief Reorient faces contained in \a the2Dgroup.
167 * \param the2Dgroup - the mesh or its part to reorient
168 * \param theDirection - desired direction of normal of \a theFace
169 * \param theFace - ID of face whose orientation is checked.
170 * It can be < 1 then \a thePoint is used to find a face.
171 * \param thePoint - is used to find a face if \a theFace < 1.
172 * \return number of reoriented elements.
174 CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
175 const SMESH::DirStruct& theDirection,
177 const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
180 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
181 SMESH::NumericalFunctor_ptr Criterion,
182 CORBA::Double MaxAngle);
183 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
184 SMESH::NumericalFunctor_ptr Criterion,
185 CORBA::Double MaxAngle);
186 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
187 SMESH::NumericalFunctor_ptr Criterion);
188 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
189 SMESH::NumericalFunctor_ptr Criterion);
190 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
191 CORBA::Boolean Diag13);
192 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
193 CORBA::Boolean Diag13);
194 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
195 SMESH::NumericalFunctor_ptr Criterion);
196 void SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems,
197 CORBA::Short methodFlags) throw (SALOME::SALOME_Exception);
199 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
200 const SMESH::long_array & IDsOfFixedNodes,
201 CORBA::Long MaxNbOfIterations,
202 CORBA::Double MaxAspectRatio,
203 SMESH::SMESH_MeshEditor::Smooth_Method Method);
204 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
205 const SMESH::long_array & IDsOfFixedNodes,
206 CORBA::Long MaxNbOfIterations,
207 CORBA::Double MaxAspectRatio,
208 SMESH::SMESH_MeshEditor::Smooth_Method Method);
209 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
210 const SMESH::long_array & IDsOfFixedNodes,
211 CORBA::Long MaxNbOfIterations,
212 CORBA::Double MaxAspectRatio,
213 SMESH::SMESH_MeshEditor::Smooth_Method Method);
214 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
215 const SMESH::long_array & IDsOfFixedNodes,
216 CORBA::Long MaxNbOfIterations,
217 CORBA::Double MaxAspectRatio,
218 SMESH::SMESH_MeshEditor::Smooth_Method Method);
219 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
220 const SMESH::long_array & IDsOfFixedNodes,
221 CORBA::Long MaxNbOfIterations,
222 CORBA::Double MaxAspectRatio,
223 SMESH::SMESH_MeshEditor::Smooth_Method Method,
225 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
226 const SMESH::long_array & IDsOfFixedNodes,
227 CORBA::Long MaxNbOfIterations,
228 CORBA::Double MaxAspectRatio,
229 SMESH::SMESH_MeshEditor::Smooth_Method Method,
233 void ConvertToQuadratic(CORBA::Boolean Force3d);
234 CORBA::Boolean ConvertFromQuadratic();
235 void ConvertToQuadraticObject(CORBA::Boolean theForce3d,
236 SMESH::SMESH_IDSource_ptr theObject)
237 throw (SALOME::SALOME_Exception);
238 void ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr theObject)
239 throw (SALOME::SALOME_Exception);
241 void RenumberNodes();
242 void RenumberElements();
244 void RotationSweep(const SMESH::long_array & IDsOfElements,
245 const SMESH::AxisStruct & Axis,
246 CORBA::Double AngleInRadians,
247 CORBA::Long NbOfSteps,
248 CORBA::Double Tolerance);
249 void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
250 const SMESH::AxisStruct & Axis,
251 CORBA::Double AngleInRadians,
252 CORBA::Long NbOfSteps,
253 CORBA::Double Tolerance);
254 void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
255 const SMESH::AxisStruct & Axis,
256 CORBA::Double AngleInRadians,
257 CORBA::Long NbOfSteps,
258 CORBA::Double Tolerance);
259 void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
260 const SMESH::AxisStruct & Axis,
261 CORBA::Double AngleInRadians,
262 CORBA::Long NbOfSteps,
263 CORBA::Double Tolerance);
265 void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
266 const SMESH::DirStruct & StepVector,
267 CORBA::Long NbOfSteps);
268 void ExtrusionSweep0D(const SMESH::long_array & IDsOfElements,
269 const SMESH::DirStruct & StepVector,
270 CORBA::Long NbOfSteps);
272 void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
273 const SMESH::DirStruct & StepVector,
274 CORBA::Long NbOfSteps);
276 void ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
277 const SMESH::DirStruct & StepVector,
278 CORBA::Long NbOfSteps);
279 void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
280 const SMESH::DirStruct & StepVector,
281 CORBA::Long NbOfSteps);
282 void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
283 const SMESH::DirStruct & StepVector,
284 CORBA::Long NbOfSteps);
285 void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
286 const SMESH::DirStruct & theStepVector,
287 CORBA::Long theNbOfSteps,
288 CORBA::Long theExtrFlags,
289 CORBA::Double theSewTolerance);
291 SMESH::SMESH_MeshEditor::Extrusion_Error
292 ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
293 SMESH::SMESH_Mesh_ptr PathMesh,
294 GEOM::GEOM_Object_ptr PathShape,
295 CORBA::Long NodeStart,
296 CORBA::Boolean HasAngles,
297 const SMESH::double_array & Angles,
298 CORBA::Boolean HasRefPoint,
299 const SMESH::PointStruct & RefPoint);
301 SMESH::SMESH_MeshEditor::Extrusion_Error
302 ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
303 SMESH::SMESH_Mesh_ptr PathMesh,
304 GEOM::GEOM_Object_ptr PathShape,
305 CORBA::Long NodeStart,
306 CORBA::Boolean HasAngles,
307 const SMESH::double_array & Angles,
308 CORBA::Boolean HasRefPoint,
309 const SMESH::PointStruct & RefPoint);
310 SMESH::SMESH_MeshEditor::Extrusion_Error
311 ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
312 SMESH::SMESH_Mesh_ptr PathMesh,
313 GEOM::GEOM_Object_ptr PathShape,
314 CORBA::Long NodeStart,
315 CORBA::Boolean HasAngles,
316 const SMESH::double_array & Angles,
317 CORBA::Boolean HasRefPoint,
318 const SMESH::PointStruct & RefPoint);
319 SMESH::SMESH_MeshEditor::Extrusion_Error
320 ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
321 SMESH::SMESH_Mesh_ptr PathMesh,
322 GEOM::GEOM_Object_ptr PathShape,
323 CORBA::Long NodeStart,
324 CORBA::Boolean HasAngles,
325 const SMESH::double_array & Angles,
326 CORBA::Boolean HasRefPoint,
327 const SMESH::PointStruct & RefPoint);
329 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
330 GEOM::GEOM_Object_ptr PathShape,
331 const SMESH::double_array & Angles);
333 void Mirror(const SMESH::long_array & IDsOfElements,
334 const SMESH::AxisStruct & Axis,
335 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
336 CORBA::Boolean Copy);
337 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
338 const SMESH::AxisStruct & Axis,
339 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
340 CORBA::Boolean Copy);
341 void Translate(const SMESH::long_array & IDsOfElements,
342 const SMESH::DirStruct & Vector,
343 CORBA::Boolean Copy);
344 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
345 const SMESH::DirStruct & Vector,
346 CORBA::Boolean Copy);
347 void Rotate(const SMESH::long_array & IDsOfElements,
348 const SMESH::AxisStruct & Axis,
350 CORBA::Boolean Copy);
351 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
352 const SMESH::AxisStruct & Axis,
354 CORBA::Boolean Copy);
356 SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
357 const SMESH::AxisStruct& Axix,
358 CORBA::Double AngleInRadians,
359 CORBA::Long NbOfSteps,
360 CORBA::Double Tolerance);
361 SMESH::ListOfGroups* RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
362 const SMESH::AxisStruct& Axix,
363 CORBA::Double AngleInRadians,
364 CORBA::Long NbOfSteps,
365 CORBA::Double Tolerance);
366 SMESH::ListOfGroups* RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
367 const SMESH::AxisStruct& Axix,
368 CORBA::Double AngleInRadians,
369 CORBA::Long NbOfSteps,
370 CORBA::Double Tolerance);
371 SMESH::ListOfGroups* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
372 const SMESH::AxisStruct& Axix,
373 CORBA::Double AngleInRadians,
374 CORBA::Long NbOfSteps,
375 CORBA::Double Tolerance);
376 SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
377 const SMESH::DirStruct& StepVector,
378 CORBA::Long NbOfSteps);
379 SMESH::ListOfGroups* ExtrusionSweepMakeGroups0D(const SMESH::long_array& IDsOfElements,
380 const SMESH::DirStruct& StepVector,
381 CORBA::Long NbOfSteps);
383 SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
384 const SMESH::DirStruct& StepVector,
385 CORBA::Long NbOfSteps,
386 CORBA::Long ExtrFlags,
387 CORBA::Double SewTolerance);
388 SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
389 const SMESH::DirStruct& StepVector,
390 CORBA::Long NbOfSteps);
391 SMESH::ListOfGroups* ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
392 const SMESH::DirStruct& StepVector,
393 CORBA::Long NbOfSteps);
394 SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
395 const SMESH::DirStruct& StepVector,
396 CORBA::Long NbOfSteps);
397 SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
398 const SMESH::DirStruct& StepVector,
399 CORBA::Long NbOfSteps);
400 SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array& IDsOfElements,
401 SMESH::SMESH_Mesh_ptr PathMesh,
402 GEOM::GEOM_Object_ptr PathShape,
403 CORBA::Long NodeStart,
404 CORBA::Boolean HasAngles,
405 const SMESH::double_array& Angles,
406 CORBA::Boolean HasRefPoint,
407 const SMESH::PointStruct& RefPoint,
408 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
409 SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
410 SMESH::SMESH_Mesh_ptr PathMesh,
411 GEOM::GEOM_Object_ptr PathShape,
412 CORBA::Long NodeStart,
413 CORBA::Boolean HasAngles,
414 const SMESH::double_array& Angles,
415 CORBA::Boolean HasRefPoint,
416 const SMESH::PointStruct& RefPoint,
417 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
418 SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
419 SMESH::SMESH_Mesh_ptr PathMesh,
420 GEOM::GEOM_Object_ptr PathShape,
421 CORBA::Long NodeStart,
422 CORBA::Boolean HasAngles,
423 const SMESH::double_array& Angles,
424 CORBA::Boolean HasRefPoint,
425 const SMESH::PointStruct& RefPoint,
426 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
427 SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
428 SMESH::SMESH_Mesh_ptr PathMesh,
429 GEOM::GEOM_Object_ptr PathShape,
430 CORBA::Long NodeStart,
431 CORBA::Boolean HasAngles,
432 const SMESH::double_array& Angles,
433 CORBA::Boolean HasRefPoint,
434 const SMESH::PointStruct& RefPoint,
435 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
438 SMESH::ListOfGroups* ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
439 SMESH::SMESH_IDSource_ptr Path,
440 CORBA::Long NodeStart,
441 CORBA::Boolean HasAngles,
442 const SMESH::double_array& Angles,
443 CORBA::Boolean LinearVariation,
444 CORBA::Boolean HasRefPoint,
445 const SMESH::PointStruct& RefPoint,
446 CORBA::Boolean MakeGroups,
447 SMESH::ElementType ElemType,
448 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
449 SMESH::ListOfGroups* ExtrusionAlongPathX(const SMESH::long_array& IDsOfElements,
450 SMESH::SMESH_IDSource_ptr Path,
451 CORBA::Long NodeStart,
452 CORBA::Boolean HasAngles,
453 const SMESH::double_array& Angles,
454 CORBA::Boolean LinearVariation,
455 CORBA::Boolean HasRefPoint,
456 const SMESH::PointStruct& RefPoint,
457 CORBA::Boolean MakeGroups,
458 SMESH::ElementType ElemType,
459 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
461 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
462 const SMESH::AxisStruct& Mirror,
463 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
464 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
465 const SMESH::AxisStruct& Mirror,
466 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
467 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
468 const SMESH::DirStruct& Vector);
469 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
470 const SMESH::DirStruct& Vector);
471 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
472 const SMESH::AxisStruct& Axis,
473 CORBA::Double AngleInRadians);
474 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
475 const SMESH::AxisStruct& Axis,
476 CORBA::Double AngleInRadians);
478 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
479 const SMESH::AxisStruct& Mirror,
480 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
481 CORBA::Boolean CopyGroups,
482 const char* MeshName);
483 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
484 const SMESH::AxisStruct& Mirror,
485 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
486 CORBA::Boolean CopyGroups,
487 const char* MeshName);
488 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
489 const SMESH::DirStruct& Vector,
490 CORBA::Boolean CopyGroups,
491 const char* MeshName);
492 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
493 const SMESH::DirStruct& Vector,
494 CORBA::Boolean CopyGroups,
495 const char* MeshName);
496 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
497 const SMESH::AxisStruct& Axis,
498 CORBA::Double AngleInRadians,
499 CORBA::Boolean CopyGroups,
500 const char* MeshName);
501 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
502 const SMESH::AxisStruct& Axis,
503 CORBA::Double AngleInRadians,
504 CORBA::Boolean CopyGroups,
505 const char* MeshName);
507 void Scale(SMESH::SMESH_IDSource_ptr theObject,
508 const SMESH::PointStruct& thePoint,
509 const SMESH::double_array& theScaleFact,
510 CORBA::Boolean theCopy);
512 SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
513 const SMESH::PointStruct& thePoint,
514 const SMESH::double_array& theScaleFact);
516 SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
517 const SMESH::PointStruct& Point,
518 const SMESH::double_array& theScaleFact,
519 CORBA::Boolean CopyGroups,
520 const char* MeshName);
522 void FindCoincidentNodes (CORBA::Double Tolerance,
523 SMESH::array_of_long_array_out GroupsOfNodes);
524 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
525 CORBA::Double Tolerance,
526 SMESH::array_of_long_array_out GroupsOfNodes);
527 void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr Object,
528 CORBA::Double Tolerance,
529 SMESH::array_of_long_array_out GroupsOfNodes,
530 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups);
531 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
532 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
533 SMESH::array_of_long_array_out GroupsOfElementsID);
534 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
535 void MergeEqualElements();
536 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
541 * \brief Return ID of node closest to a given point
543 CORBA::Long FindNodeClosestTo(CORBA::Double x,
547 * Return elements of given type where the given point is IN or ON.
548 * 'ALL' type means elements of any type excluding nodes
550 SMESH::long_array* FindElementsByPoint(CORBA::Double x,
553 SMESH::ElementType type);
555 * Searching among the given elements, return elements of given type
556 * where the given point is IN or ON.
557 * 'ALL' type means elements of any type excluding nodes
559 SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
563 SMESH::ElementType type);
566 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
567 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
569 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z);
571 SMESH::SMESH_MeshEditor::Sew_Error
572 SewFreeBorders(CORBA::Long FirstNodeID1,
573 CORBA::Long SecondNodeID1,
574 CORBA::Long LastNodeID1,
575 CORBA::Long FirstNodeID2,
576 CORBA::Long SecondNodeID2,
577 CORBA::Long LastNodeID2,
578 CORBA::Boolean CreatePolygons,
579 CORBA::Boolean CreatePolyedrs);
580 SMESH::SMESH_MeshEditor::Sew_Error
581 SewConformFreeBorders(CORBA::Long FirstNodeID1,
582 CORBA::Long SecondNodeID1,
583 CORBA::Long LastNodeID1,
584 CORBA::Long FirstNodeID2,
585 CORBA::Long SecondNodeID2);
586 SMESH::SMESH_MeshEditor::Sew_Error
587 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
588 CORBA::Long SecondNodeIDOnFreeBorder,
589 CORBA::Long LastNodeIDOnFreeBorder,
590 CORBA::Long FirstNodeIDOnSide,
591 CORBA::Long LastNodeIDOnSide,
592 CORBA::Boolean CreatePolygons,
593 CORBA::Boolean CreatePolyedrs);
594 SMESH::SMESH_MeshEditor::Sew_Error
595 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
596 const SMESH::long_array& IDsOfSide2Elements,
597 CORBA::Long NodeID1OfSide1ToMerge,
598 CORBA::Long NodeID1OfSide2ToMerge,
599 CORBA::Long NodeID2OfSide1ToMerge,
600 CORBA::Long NodeID2OfSide2ToMerge);
603 * Set new nodes for given element.
604 * If number of nodes is not corresponded to type of
605 * element - returns false
607 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
609 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
610 const SMESH::long_array& theModifiedElems );
612 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
613 const SMESH::long_array& theModifiedElems );
615 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
616 SMESH::SMESH_GroupBase_ptr theModifiedElems );
619 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
620 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
621 * \param theNodes - group of nodes to be doubled.
622 * \param theModifiedElems - group of elements to be updated.
623 * \return a new group with newly created nodes
624 * \sa DoubleNodeGroup()
626 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
627 SMESH::SMESH_GroupBase_ptr theModifiedElems );
629 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
630 const SMESH::ListOfGroups& theModifiedElems );
632 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
633 const SMESH::ListOfGroups& theModifiedElems );
636 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
637 * \param theElems - the list of elements (edges or faces) to be replicated
638 * The nodes for duplication could be found from these elements
639 * \param theNodesNot - list of nodes to NOT replicate
640 * \param theAffectedElems - the list of elements (cells and edges) to which the
641 * replicated nodes should be associated to.
642 * \return TRUE if operation has been completed successfully, FALSE otherwise
643 * \sa DoubleNodeGroup(), DoubleNodeGroups()
645 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
646 const SMESH::long_array& theNodesNot,
647 const SMESH::long_array& theAffectedElems );
650 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
651 * \param theElems - the list of elements (edges or faces) to be replicated
652 * The nodes for duplication could be found from these elements
653 * \param theNodesNot - list of nodes to NOT replicate
654 * \param theShape - shape to detect affected elements (element which geometric center
655 * located on or inside shape).
656 * The replicated nodes should be associated to affected elements.
657 * \return TRUE if operation has been completed successfully, FALSE otherwise
658 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
660 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
661 const SMESH::long_array& theNodesNot,
662 GEOM::GEOM_Object_ptr theShape );
665 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
666 * \param theElems - group of of elements (edges or faces) to be replicated
667 * \param theNodesNot - group of nodes not to replicated
668 * \param theAffectedElems - group of elements to which the replicated nodes
669 * should be associated to.
670 * \return TRUE if operation has been completed successfully, FALSE otherwise
671 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
673 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
674 SMESH::SMESH_GroupBase_ptr theNodesNot,
675 SMESH::SMESH_GroupBase_ptr theAffectedElems );
678 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
679 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
680 * \param theElems - group of of elements (edges or faces) to be replicated
681 * \param theNodesNot - group of nodes not to replicated
682 * \param theAffectedElems - group of elements to which the replicated nodes
683 * should be associated to.
684 * \return a new group with newly created elements
685 * \sa DoubleNodeElemGroup()
687 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
688 SMESH::SMESH_GroupBase_ptr theNodesNot,
689 SMESH::SMESH_GroupBase_ptr theAffectedElems );
691 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
692 SMESH::SMESH_GroupBase_ptr theNodesNot,
693 SMESH::SMESH_GroupBase_ptr theAffectedElems,
694 CORBA::Boolean theElemGroupNeeded,
695 CORBA::Boolean theNodeGroupNeeded);
698 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
699 * \param theElems - group of of elements (edges or faces) to be replicated
700 * \param theNodesNot - group of nodes not to replicated
701 * \param theShape - shape to detect affected elements (element which geometric center
702 * located on or inside shape).
703 * The replicated nodes should be associated to affected elements.
704 * \return TRUE if operation has been completed successfully, FALSE otherwise
705 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
707 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
708 SMESH::SMESH_GroupBase_ptr theNodesNot,
709 GEOM::GEOM_Object_ptr theShape );
712 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
713 * This method provided for convenience works as DoubleNodes() described above.
714 * \param theElems - list of groups of elements (edges or faces) to be replicated
715 * \param theNodesNot - list of groups of nodes not to replicated
716 * \param theAffectedElems - group of elements to which the replicated nodes
717 * should be associated to.
718 * \return TRUE if operation has been completed successfully, FALSE otherwise
719 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
721 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
722 const SMESH::ListOfGroups& theNodesNot,
723 const SMESH::ListOfGroups& theAffectedElems );
726 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
727 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
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 theAffectedElems - group of elements to which the replicated nodes
731 * should be associated to.
732 * \return a new group with newly created elements
733 * \sa DoubleNodeElemGroups()
735 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
736 const SMESH::ListOfGroups& theNodesNot,
737 const SMESH::ListOfGroups& theAffectedElems );
739 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
740 const SMESH::ListOfGroups& theNodesNot,
741 const SMESH::ListOfGroups& theAffectedElems,
742 CORBA::Boolean theElemGroupNeeded,
743 CORBA::Boolean theNodeGroupNeeded);
746 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
747 * This method provided for convenience works as DoubleNodes() described above.
748 * \param theElems - list of groups of elements (edges or faces) to be replicated
749 * \param theNodesNot - list of groups of nodes not to replicated
750 * \param theShape - shape to detect affected elements (element which geometric center
751 * located on or inside shape).
752 * The replicated nodes should be associated to affected elements.
753 * \return TRUE if operation has been completed successfully, FALSE otherwise
754 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
756 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
757 const SMESH::ListOfGroups& theNodesNot,
758 GEOM::GEOM_Object_ptr theShape );
761 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
762 * This method is the first step of DoubleNodeElemGroupsInRegion.
763 * \param theElems - list of groups of elements (edges or faces) to be replicated
764 * \param theNodesNot - list of groups of nodes not to replicated
765 * \param theShape - shape to detect affected elements (element which geometric center
766 * located on or inside shape).
767 * The replicated nodes should be associated to affected elements.
768 * \return groups of affected elements
769 * \sa DoubleNodeElemGroupsInRegion()
771 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
772 const SMESH::ListOfGroups& theNodesNot,
773 GEOM::GEOM_Object_ptr theShape );
776 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
777 * The list of groups must describe a partition of the mesh volumes.
778 * The nodes of the internal faces at the boundaries of the groups are doubled.
779 * In option, the internal faces are replaced by flat elements.
780 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
781 * @param theDomains - list of groups of volumes
782 * @param createJointElems - if TRUE, create the elements
783 * @return TRUE if operation has been completed successfully, FALSE otherwise
785 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
786 CORBA::Boolean createJointElems )
787 throw (SALOME::SALOME_Exception);
789 * \brief Double nodes on some external faces and create flat elements.
790 * Flat elements are mainly used by some types of mechanic calculations.
792 * Each group of the list must be constituted of faces.
793 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
794 * @param theGroupsOfFaces - list of groups of faces
795 * @return TRUE if operation has been completed successfully, FALSE otherwise
797 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces );
800 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
801 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
802 * groups of faces to remove insidethe object, (idem edges).
803 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
805 void CreateHoleSkin(CORBA::Double radius,
806 GEOM::GEOM_Object_ptr theShape,
807 const char* groupName,
808 const SMESH::double_array& theNodesCoords,
809 SMESH::array_of_long_array_out GroupsOfNodes)
810 throw (SALOME::SALOME_Exception);
813 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
814 * The created 2D mesh elements based on nodes of free faces of boundary volumes
815 * \return TRUE if operation has been completed successfully, FALSE otherwise
817 CORBA::Boolean Make2DMeshFrom3D();
819 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
820 SMESH::Bnd_Dimension dimension,
821 const char* groupName,
822 const char* meshName,
823 CORBA::Boolean toCopyElements,
824 CORBA::Boolean toCopyMissingBondary,
825 SMESH::SMESH_Group_out group);
827 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
828 const char* groupName,
829 const char* meshName,
830 CORBA::Boolean toCopyAll,
831 const SMESH::ListOfIDSources& groups,
832 SMESH::SMESH_Mesh_out mesh,
833 SMESH::SMESH_Group_out group)
834 throw (SALOME::SALOME_Exception);
836 private: //!< private methods
838 SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
841 * \brief Update myLastCreated* or myPreviewData
842 * \param anEditor - it contains edition results
844 void storeResult(::SMESH_MeshEditor& anEditor);
846 * \brief Clear myLastCreated* or myPreviewData
848 void initData(bool deleteSearchers=true);
851 * \brief Return groups by their IDs
853 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
855 SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
856 const SMESH::AxisStruct & Axis,
857 CORBA::Double AngleInRadians,
858 CORBA::Long NbOfSteps,
859 CORBA::Double Tolerance,
860 const bool MakeGroups,
861 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
862 SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
863 const SMESH::DirStruct & StepVector,
864 CORBA::Long NbOfSteps,
866 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
867 SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
868 const SMESH::DirStruct & theStepVector,
869 CORBA::Long theNbOfSteps,
870 CORBA::Long theExtrFlags,
871 CORBA::Double theSewTolerance,
872 const bool MakeGroups);
873 SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
874 SMESH::SMESH_Mesh_ptr PathMesh,
875 GEOM::GEOM_Object_ptr PathShape,
876 CORBA::Long NodeStart,
877 CORBA::Boolean HasAngles,
878 const SMESH::double_array & Angles,
879 CORBA::Boolean HasRefPoint,
880 const SMESH::PointStruct & RefPoint,
881 const bool MakeGroups,
882 SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
883 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
884 SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array & IDsOfElements,
885 SMESH::SMESH_IDSource_ptr Path,
886 CORBA::Long NodeStart,
887 CORBA::Boolean HasAngles,
888 const SMESH::double_array& Angles,
889 CORBA::Boolean LinearVariation,
890 CORBA::Boolean HasRefPoint,
891 const SMESH::PointStruct& RefPoint,
893 const SMDSAbs_ElementType ElementType,
894 SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
895 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
896 const SMESH::AxisStruct & Axis,
897 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
900 ::SMESH_Mesh* TargetMesh=0);
901 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
902 const SMESH::DirStruct & Vector,
905 ::SMESH_Mesh* TargetMesh=0);
906 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
907 const SMESH::AxisStruct & Axis,
911 ::SMESH_Mesh* TargetMesh=0);
913 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
914 const SMESH::PointStruct& thePoint,
915 const SMESH::double_array& theScaleFact,
916 CORBA::Boolean theCopy,
918 ::SMESH_Mesh* theTargetMesh=0);
920 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
922 void DumpGroupsList(SMESH::TPythonDump & theDumpPython,
923 const SMESH::ListOfGroups * theGroupList);
925 string generateGroupName(const string& thePrefix);
929 SMESH_Mesh_i* myMesh_i;
931 ::SMESH_MeshEditor myEditor;
933 SMESH::MeshPreviewStruct_var myPreviewData;
936 // temporary IDSources
938 std::list< _IDSource* > myAuxIDSources;
939 void deleteAuxIDSources();