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