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 static bool IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource );
88 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
89 CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
90 CORBA::Long RemoveOrphanNodes();
93 * Methods for creation new elements.
94 * Returns ID of created element or 0 if element not created
96 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
97 CORBA::Long Add0DElement(CORBA::Long IDOfNode);
98 CORBA::Long AddBall(CORBA::Long IDOfNodem, CORBA::Double diameter)
99 throw (SALOME::SALOME_Exception);
100 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
101 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
102 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
103 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
104 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
105 const SMESH::long_array & Quantities);
106 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
109 * \brief Create 0D elements on all nodes of the given object except those
110 * nodes on which a 0D element already exists.
111 * \param theObject object on whose nodes 0D elements will be created.
112 * \param theGroupName optional name of a group to add 0D elements created
113 * and/or found on nodes of \a theObject.
114 * \return an object (a new group or a temporary SMESH_IDSource) holding
115 * ids of new and/or found 0D elements.
117 SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
118 const char* theGroupName)
119 throw (SALOME::SALOME_Exception);
122 * \brief Bind a node to a vertex
123 * \param NodeID - node ID
124 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
126 void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
127 throw (SALOME::SALOME_Exception);
129 * \brief Store node position on an edge
130 * \param NodeID - node ID
131 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
132 * \param paramOnEdge - parameter on edge where the node is located
134 void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
135 CORBA::Double paramOnEdge)
136 throw (SALOME::SALOME_Exception);
138 * \brief Store node position on a face
139 * \param NodeID - node ID
140 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
141 * \param u - U parameter on face where the node is located
142 * \param v - V parameter on face where the node is located
144 void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
145 CORBA::Double u, CORBA::Double v)
146 throw (SALOME::SALOME_Exception);
148 * \brief Bind a node to a solid
149 * \param NodeID - node ID
150 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
152 void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
153 throw (SALOME::SALOME_Exception);
155 * \brief Bind an element to a shape
156 * \param ElementID - element ID
157 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
159 void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
160 throw (SALOME::SALOME_Exception);
163 CORBA::Boolean MoveNode(CORBA::Long NodeID,
164 CORBA::Double x, CORBA::Double y, CORBA::Double z);
166 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
167 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
168 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
169 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
171 * \brief Reorient faces contained in \a the2Dgroup.
172 * \param the2Dgroup - the mesh or its part to reorient
173 * \param theDirection - desired direction of normal of \a theFace
174 * \param theFace - ID of face whose orientation is checked.
175 * It can be < 1 then \a thePoint is used to find a face.
176 * \param thePoint - is used to find a face if \a theFace < 1.
177 * \return number of reoriented elements.
179 CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
180 const SMESH::DirStruct& theDirection,
182 const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
185 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
186 SMESH::NumericalFunctor_ptr Criterion,
187 CORBA::Double MaxAngle);
188 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
189 SMESH::NumericalFunctor_ptr Criterion,
190 CORBA::Double MaxAngle);
191 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
192 SMESH::NumericalFunctor_ptr Criterion);
193 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
194 SMESH::NumericalFunctor_ptr Criterion);
195 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
196 CORBA::Boolean Diag13);
197 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
198 CORBA::Boolean Diag13);
199 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
200 SMESH::NumericalFunctor_ptr Criterion);
201 void SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems,
202 CORBA::Short methodFlags) throw (SALOME::SALOME_Exception);
204 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
205 const SMESH::long_array & IDsOfFixedNodes,
206 CORBA::Long MaxNbOfIterations,
207 CORBA::Double MaxAspectRatio,
208 SMESH::SMESH_MeshEditor::Smooth_Method Method);
209 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
210 const SMESH::long_array & IDsOfFixedNodes,
211 CORBA::Long MaxNbOfIterations,
212 CORBA::Double MaxAspectRatio,
213 SMESH::SMESH_MeshEditor::Smooth_Method Method);
214 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
215 const SMESH::long_array & IDsOfFixedNodes,
216 CORBA::Long MaxNbOfIterations,
217 CORBA::Double MaxAspectRatio,
218 SMESH::SMESH_MeshEditor::Smooth_Method Method);
219 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
220 const SMESH::long_array & IDsOfFixedNodes,
221 CORBA::Long MaxNbOfIterations,
222 CORBA::Double MaxAspectRatio,
223 SMESH::SMESH_MeshEditor::Smooth_Method Method);
224 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
225 const SMESH::long_array & IDsOfFixedNodes,
226 CORBA::Long MaxNbOfIterations,
227 CORBA::Double MaxAspectRatio,
228 SMESH::SMESH_MeshEditor::Smooth_Method Method,
230 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
231 const SMESH::long_array & IDsOfFixedNodes,
232 CORBA::Long MaxNbOfIterations,
233 CORBA::Double MaxAspectRatio,
234 SMESH::SMESH_MeshEditor::Smooth_Method Method,
238 void ConvertToQuadratic(CORBA::Boolean Force3d);
239 CORBA::Boolean ConvertFromQuadratic();
240 void ConvertToQuadraticObject(CORBA::Boolean theForce3d,
241 SMESH::SMESH_IDSource_ptr theObject)
242 throw (SALOME::SALOME_Exception);
243 void ConvertFromQuadraticObject(SMESH::SMESH_IDSource_ptr theObject)
244 throw (SALOME::SALOME_Exception);
246 void RenumberNodes();
247 void RenumberElements();
249 void RotationSweep(const SMESH::long_array & IDsOfElements,
250 const SMESH::AxisStruct & Axis,
251 CORBA::Double AngleInRadians,
252 CORBA::Long NbOfSteps,
253 CORBA::Double Tolerance);
254 void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
255 const SMESH::AxisStruct & Axis,
256 CORBA::Double AngleInRadians,
257 CORBA::Long NbOfSteps,
258 CORBA::Double Tolerance);
259 void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
260 const SMESH::AxisStruct & Axis,
261 CORBA::Double AngleInRadians,
262 CORBA::Long NbOfSteps,
263 CORBA::Double Tolerance);
264 void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
265 const SMESH::AxisStruct & Axis,
266 CORBA::Double AngleInRadians,
267 CORBA::Long NbOfSteps,
268 CORBA::Double Tolerance);
270 void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
271 const SMESH::DirStruct & StepVector,
272 CORBA::Long NbOfSteps);
273 void ExtrusionSweep0D(const SMESH::long_array & IDsOfElements,
274 const SMESH::DirStruct & StepVector,
275 CORBA::Long NbOfSteps);
277 void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
278 const SMESH::DirStruct & StepVector,
279 CORBA::Long NbOfSteps);
281 void ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
282 const SMESH::DirStruct & StepVector,
283 CORBA::Long NbOfSteps);
284 void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
285 const SMESH::DirStruct & StepVector,
286 CORBA::Long NbOfSteps);
287 void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
288 const SMESH::DirStruct & StepVector,
289 CORBA::Long NbOfSteps);
290 void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
291 const SMESH::DirStruct & theStepVector,
292 CORBA::Long theNbOfSteps,
293 CORBA::Long theExtrFlags,
294 CORBA::Double theSewTolerance);
296 SMESH::SMESH_MeshEditor::Extrusion_Error
297 ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
298 SMESH::SMESH_Mesh_ptr PathMesh,
299 GEOM::GEOM_Object_ptr PathShape,
300 CORBA::Long NodeStart,
301 CORBA::Boolean HasAngles,
302 const SMESH::double_array & Angles,
303 CORBA::Boolean HasRefPoint,
304 const SMESH::PointStruct & RefPoint);
306 SMESH::SMESH_MeshEditor::Extrusion_Error
307 ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
308 SMESH::SMESH_Mesh_ptr PathMesh,
309 GEOM::GEOM_Object_ptr PathShape,
310 CORBA::Long NodeStart,
311 CORBA::Boolean HasAngles,
312 const SMESH::double_array & Angles,
313 CORBA::Boolean HasRefPoint,
314 const SMESH::PointStruct & RefPoint);
315 SMESH::SMESH_MeshEditor::Extrusion_Error
316 ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
317 SMESH::SMESH_Mesh_ptr PathMesh,
318 GEOM::GEOM_Object_ptr PathShape,
319 CORBA::Long NodeStart,
320 CORBA::Boolean HasAngles,
321 const SMESH::double_array & Angles,
322 CORBA::Boolean HasRefPoint,
323 const SMESH::PointStruct & RefPoint);
324 SMESH::SMESH_MeshEditor::Extrusion_Error
325 ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
326 SMESH::SMESH_Mesh_ptr PathMesh,
327 GEOM::GEOM_Object_ptr PathShape,
328 CORBA::Long NodeStart,
329 CORBA::Boolean HasAngles,
330 const SMESH::double_array & Angles,
331 CORBA::Boolean HasRefPoint,
332 const SMESH::PointStruct & RefPoint);
334 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
335 GEOM::GEOM_Object_ptr PathShape,
336 const SMESH::double_array & Angles);
338 void Mirror(const SMESH::long_array & IDsOfElements,
339 const SMESH::AxisStruct & Axis,
340 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
341 CORBA::Boolean Copy);
342 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
343 const SMESH::AxisStruct & Axis,
344 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
345 CORBA::Boolean Copy);
346 void Translate(const SMESH::long_array & IDsOfElements,
347 const SMESH::DirStruct & Vector,
348 CORBA::Boolean Copy);
349 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
350 const SMESH::DirStruct & Vector,
351 CORBA::Boolean Copy);
352 void Rotate(const SMESH::long_array & IDsOfElements,
353 const SMESH::AxisStruct & Axis,
355 CORBA::Boolean Copy);
356 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
357 const SMESH::AxisStruct & Axis,
359 CORBA::Boolean Copy);
361 SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
362 const SMESH::AxisStruct& Axix,
363 CORBA::Double AngleInRadians,
364 CORBA::Long NbOfSteps,
365 CORBA::Double Tolerance);
366 SMESH::ListOfGroups* RotationSweepObjectMakeGroups(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* RotationSweepObject1DMakeGroups(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* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
377 const SMESH::AxisStruct& Axix,
378 CORBA::Double AngleInRadians,
379 CORBA::Long NbOfSteps,
380 CORBA::Double Tolerance);
381 SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
382 const SMESH::DirStruct& StepVector,
383 CORBA::Long NbOfSteps);
384 SMESH::ListOfGroups* ExtrusionSweepMakeGroups0D(const SMESH::long_array& IDsOfElements,
385 const SMESH::DirStruct& StepVector,
386 CORBA::Long NbOfSteps);
388 SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
389 const SMESH::DirStruct& StepVector,
390 CORBA::Long NbOfSteps,
391 CORBA::Long ExtrFlags,
392 CORBA::Double SewTolerance);
393 SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
394 const SMESH::DirStruct& StepVector,
395 CORBA::Long NbOfSteps);
396 SMESH::ListOfGroups* ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
397 const SMESH::DirStruct& StepVector,
398 CORBA::Long NbOfSteps);
399 SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
400 const SMESH::DirStruct& StepVector,
401 CORBA::Long NbOfSteps);
402 SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
403 const SMESH::DirStruct& StepVector,
404 CORBA::Long NbOfSteps);
405 SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array& IDsOfElements,
406 SMESH::SMESH_Mesh_ptr PathMesh,
407 GEOM::GEOM_Object_ptr PathShape,
408 CORBA::Long NodeStart,
409 CORBA::Boolean HasAngles,
410 const SMESH::double_array& Angles,
411 CORBA::Boolean HasRefPoint,
412 const SMESH::PointStruct& RefPoint,
413 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
414 SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
415 SMESH::SMESH_Mesh_ptr PathMesh,
416 GEOM::GEOM_Object_ptr PathShape,
417 CORBA::Long NodeStart,
418 CORBA::Boolean HasAngles,
419 const SMESH::double_array& Angles,
420 CORBA::Boolean HasRefPoint,
421 const SMESH::PointStruct& RefPoint,
422 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
423 SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
424 SMESH::SMESH_Mesh_ptr PathMesh,
425 GEOM::GEOM_Object_ptr PathShape,
426 CORBA::Long NodeStart,
427 CORBA::Boolean HasAngles,
428 const SMESH::double_array& Angles,
429 CORBA::Boolean HasRefPoint,
430 const SMESH::PointStruct& RefPoint,
431 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
432 SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
433 SMESH::SMESH_Mesh_ptr PathMesh,
434 GEOM::GEOM_Object_ptr PathShape,
435 CORBA::Long NodeStart,
436 CORBA::Boolean HasAngles,
437 const SMESH::double_array& Angles,
438 CORBA::Boolean HasRefPoint,
439 const SMESH::PointStruct& RefPoint,
440 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
443 SMESH::ListOfGroups* ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
444 SMESH::SMESH_IDSource_ptr Path,
445 CORBA::Long NodeStart,
446 CORBA::Boolean HasAngles,
447 const SMESH::double_array& Angles,
448 CORBA::Boolean LinearVariation,
449 CORBA::Boolean HasRefPoint,
450 const SMESH::PointStruct& RefPoint,
451 CORBA::Boolean MakeGroups,
452 SMESH::ElementType ElemType,
453 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
454 SMESH::ListOfGroups* ExtrusionAlongPathX(const SMESH::long_array& IDsOfElements,
455 SMESH::SMESH_IDSource_ptr Path,
456 CORBA::Long NodeStart,
457 CORBA::Boolean HasAngles,
458 const SMESH::double_array& Angles,
459 CORBA::Boolean LinearVariation,
460 CORBA::Boolean HasRefPoint,
461 const SMESH::PointStruct& RefPoint,
462 CORBA::Boolean MakeGroups,
463 SMESH::ElementType ElemType,
464 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
466 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
467 const SMESH::AxisStruct& Mirror,
468 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
469 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
470 const SMESH::AxisStruct& Mirror,
471 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
472 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
473 const SMESH::DirStruct& Vector);
474 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
475 const SMESH::DirStruct& Vector);
476 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
477 const SMESH::AxisStruct& Axis,
478 CORBA::Double AngleInRadians);
479 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
480 const SMESH::AxisStruct& Axis,
481 CORBA::Double AngleInRadians);
483 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
484 const SMESH::AxisStruct& Mirror,
485 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
486 CORBA::Boolean CopyGroups,
487 const char* MeshName);
488 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
489 const SMESH::AxisStruct& Mirror,
490 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
491 CORBA::Boolean CopyGroups,
492 const char* MeshName);
493 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
494 const SMESH::DirStruct& Vector,
495 CORBA::Boolean CopyGroups,
496 const char* MeshName);
497 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
498 const SMESH::DirStruct& Vector,
499 CORBA::Boolean CopyGroups,
500 const char* MeshName);
501 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
502 const SMESH::AxisStruct& Axis,
503 CORBA::Double AngleInRadians,
504 CORBA::Boolean CopyGroups,
505 const char* MeshName);
506 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
507 const SMESH::AxisStruct& Axis,
508 CORBA::Double AngleInRadians,
509 CORBA::Boolean CopyGroups,
510 const char* MeshName);
512 void Scale(SMESH::SMESH_IDSource_ptr theObject,
513 const SMESH::PointStruct& thePoint,
514 const SMESH::double_array& theScaleFact,
515 CORBA::Boolean theCopy);
517 SMESH::ListOfGroups* ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
518 const SMESH::PointStruct& thePoint,
519 const SMESH::double_array& theScaleFact);
521 SMESH::SMESH_Mesh_ptr ScaleMakeMesh(SMESH::SMESH_IDSource_ptr Object,
522 const SMESH::PointStruct& Point,
523 const SMESH::double_array& theScaleFact,
524 CORBA::Boolean CopyGroups,
525 const char* MeshName);
527 void FindCoincidentNodes (CORBA::Double Tolerance,
528 SMESH::array_of_long_array_out GroupsOfNodes);
529 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
530 CORBA::Double Tolerance,
531 SMESH::array_of_long_array_out GroupsOfNodes);
532 void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr Object,
533 CORBA::Double Tolerance,
534 SMESH::array_of_long_array_out GroupsOfNodes,
535 const SMESH::ListOfIDSources& ExceptSubMeshOrGroups);
536 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
537 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
538 SMESH::array_of_long_array_out GroupsOfElementsID);
539 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
540 void MergeEqualElements();
541 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
546 * \brief Return ID of node closest to a given point
548 CORBA::Long FindNodeClosestTo(CORBA::Double x,
552 * Return elements of given type where the given point is IN or ON.
553 * 'ALL' type means elements of any type excluding nodes
555 SMESH::long_array* FindElementsByPoint(CORBA::Double x,
558 SMESH::ElementType type);
560 * Searching among the given elements, return elements of given type
561 * where the given point is IN or ON.
562 * 'ALL' type means elements of any type excluding nodes
564 SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
568 SMESH::ElementType type);
571 * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
572 * TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
574 CORBA::Short GetPointState(CORBA::Double x, CORBA::Double y, CORBA::Double z);
576 SMESH::SMESH_MeshEditor::Sew_Error
577 SewFreeBorders(CORBA::Long FirstNodeID1,
578 CORBA::Long SecondNodeID1,
579 CORBA::Long LastNodeID1,
580 CORBA::Long FirstNodeID2,
581 CORBA::Long SecondNodeID2,
582 CORBA::Long LastNodeID2,
583 CORBA::Boolean CreatePolygons,
584 CORBA::Boolean CreatePolyedrs);
585 SMESH::SMESH_MeshEditor::Sew_Error
586 SewConformFreeBorders(CORBA::Long FirstNodeID1,
587 CORBA::Long SecondNodeID1,
588 CORBA::Long LastNodeID1,
589 CORBA::Long FirstNodeID2,
590 CORBA::Long SecondNodeID2);
591 SMESH::SMESH_MeshEditor::Sew_Error
592 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
593 CORBA::Long SecondNodeIDOnFreeBorder,
594 CORBA::Long LastNodeIDOnFreeBorder,
595 CORBA::Long FirstNodeIDOnSide,
596 CORBA::Long LastNodeIDOnSide,
597 CORBA::Boolean CreatePolygons,
598 CORBA::Boolean CreatePolyedrs);
599 SMESH::SMESH_MeshEditor::Sew_Error
600 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
601 const SMESH::long_array& IDsOfSide2Elements,
602 CORBA::Long NodeID1OfSide1ToMerge,
603 CORBA::Long NodeID1OfSide2ToMerge,
604 CORBA::Long NodeID2OfSide1ToMerge,
605 CORBA::Long NodeID2OfSide2ToMerge);
608 * Set new nodes for given element.
609 * If number of nodes is not corresponded to type of
610 * element - returns false
612 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
614 CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes,
615 const SMESH::long_array& theModifiedElems );
617 CORBA::Boolean DoubleNode( CORBA::Long theNodeId,
618 const SMESH::long_array& theModifiedElems );
620 CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes,
621 SMESH::SMESH_GroupBase_ptr theModifiedElems );
624 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
625 * Works as DoubleNodeGroup(), but returns a new group with newly created nodes.
626 * \param theNodes - group of nodes to be doubled.
627 * \param theModifiedElems - group of elements to be updated.
628 * \return a new group with newly created nodes
629 * \sa DoubleNodeGroup()
631 SMESH::SMESH_Group_ptr DoubleNodeGroupNew( SMESH::SMESH_GroupBase_ptr theNodes,
632 SMESH::SMESH_GroupBase_ptr theModifiedElems );
634 CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
635 const SMESH::ListOfGroups& theModifiedElems );
637 SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
638 const SMESH::ListOfGroups& theModifiedElems );
641 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
642 * \param theElems - the list of elements (edges or faces) to be replicated
643 * The nodes for duplication could be found from these elements
644 * \param theNodesNot - list of nodes to NOT replicate
645 * \param theAffectedElems - the list of elements (cells and edges) to which the
646 * replicated nodes should be associated to.
647 * \return TRUE if operation has been completed successfully, FALSE otherwise
648 * \sa DoubleNodeGroup(), DoubleNodeGroups()
650 CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems,
651 const SMESH::long_array& theNodesNot,
652 const SMESH::long_array& theAffectedElems );
655 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
656 * \param theElems - the list of elements (edges or faces) to be replicated
657 * The nodes for duplication could be found from these elements
658 * \param theNodesNot - list of nodes to NOT replicate
659 * \param theShape - shape to detect affected elements (element which geometric center
660 * located on or inside shape).
661 * The replicated nodes should be associated to affected elements.
662 * \return TRUE if operation has been completed successfully, FALSE otherwise
663 * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
665 CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems,
666 const SMESH::long_array& theNodesNot,
667 GEOM::GEOM_Object_ptr theShape );
670 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
671 * \param theElems - group of of elements (edges or faces) to be replicated
672 * \param theNodesNot - group of nodes not to replicated
673 * \param theAffectedElems - group of elements to which the replicated nodes
674 * should be associated to.
675 * \return TRUE if operation has been completed successfully, FALSE otherwise
676 * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
678 CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
679 SMESH::SMESH_GroupBase_ptr theNodesNot,
680 SMESH::SMESH_GroupBase_ptr theAffectedElems );
683 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
684 * Works as DoubleNodeElemGroup(), but returns a new group with newly created elements.
685 * \param theElems - group of of elements (edges or faces) to be replicated
686 * \param theNodesNot - group of nodes not to replicated
687 * \param theAffectedElems - group of elements to which the replicated nodes
688 * should be associated to.
689 * \return a new group with newly created elements
690 * \sa DoubleNodeElemGroup()
692 SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
693 SMESH::SMESH_GroupBase_ptr theNodesNot,
694 SMESH::SMESH_GroupBase_ptr theAffectedElems );
696 SMESH::ListOfGroups* DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
697 SMESH::SMESH_GroupBase_ptr theNodesNot,
698 SMESH::SMESH_GroupBase_ptr theAffectedElems,
699 CORBA::Boolean theElemGroupNeeded,
700 CORBA::Boolean theNodeGroupNeeded);
703 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
704 * \param theElems - group of of elements (edges or faces) to be replicated
705 * \param theNodesNot - group of nodes not to replicated
706 * \param theShape - shape to detect affected elements (element which geometric center
707 * located on or inside shape).
708 * The replicated nodes should be associated to affected elements.
709 * \return TRUE if operation has been completed successfully, FALSE otherwise
710 * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
712 CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems,
713 SMESH::SMESH_GroupBase_ptr theNodesNot,
714 GEOM::GEOM_Object_ptr theShape );
717 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
718 * This method provided for convenience works as DoubleNodes() described above.
719 * \param theElems - list of groups of elements (edges or faces) to be replicated
720 * \param theNodesNot - list of groups of nodes not to replicated
721 * \param theAffectedElems - group of elements to which the replicated nodes
722 * should be associated to.
723 * \return TRUE if operation has been completed successfully, FALSE otherwise
724 * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
726 CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
727 const SMESH::ListOfGroups& theNodesNot,
728 const SMESH::ListOfGroups& theAffectedElems );
731 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
732 * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
733 * \param theElems - list of groups of elements (edges or faces) to be replicated
734 * \param theNodesNot - list of groups of nodes not to replicated
735 * \param theAffectedElems - group of elements to which the replicated nodes
736 * should be associated to.
737 * \return a new group with newly created elements
738 * \sa DoubleNodeElemGroups()
740 SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
741 const SMESH::ListOfGroups& theNodesNot,
742 const SMESH::ListOfGroups& theAffectedElems );
744 SMESH::ListOfGroups* DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
745 const SMESH::ListOfGroups& theNodesNot,
746 const SMESH::ListOfGroups& theAffectedElems,
747 CORBA::Boolean theElemGroupNeeded,
748 CORBA::Boolean theNodeGroupNeeded);
751 * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
752 * This method provided for convenience works as DoubleNodes() described above.
753 * \param theElems - list of groups of elements (edges or faces) to be replicated
754 * \param theNodesNot - list of groups of nodes not to replicated
755 * \param theShape - shape to detect affected elements (element which geometric center
756 * located on or inside shape).
757 * The replicated nodes should be associated to affected elements.
758 * \return TRUE if operation has been completed successfully, FALSE otherwise
759 * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
761 CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
762 const SMESH::ListOfGroups& theNodesNot,
763 GEOM::GEOM_Object_ptr theShape );
766 * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
767 * This method is the first step of DoubleNodeElemGroupsInRegion.
768 * \param theElems - list of groups of elements (edges or faces) to be replicated
769 * \param theNodesNot - list of groups of nodes not to replicated
770 * \param theShape - shape to detect affected elements (element which geometric center
771 * located on or inside shape).
772 * The replicated nodes should be associated to affected elements.
773 * \return groups of affected elements
774 * \sa DoubleNodeElemGroupsInRegion()
776 SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
777 const SMESH::ListOfGroups& theNodesNot,
778 GEOM::GEOM_Object_ptr theShape );
781 * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
782 * The list of groups must describe a partition of the mesh volumes.
783 * The nodes of the internal faces at the boundaries of the groups are doubled.
784 * In option, the internal faces are replaced by flat elements.
785 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
786 * @param theDomains - list of groups of volumes
787 * @param createJointElems - if TRUE, create the elements
788 * @return TRUE if operation has been completed successfully, FALSE otherwise
790 CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
791 CORBA::Boolean createJointElems )
792 throw (SALOME::SALOME_Exception);
794 * \brief Double nodes on some external faces and create flat elements.
795 * Flat elements are mainly used by some types of mechanic calculations.
797 * Each group of the list must be constituted of faces.
798 * Triangles are transformed in prisms, and quadrangles in hexahedrons.
799 * @param theGroupsOfFaces - list of groups of faces
800 * @return TRUE if operation has been completed successfully, FALSE otherwise
802 CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces );
805 * \brief identify all the elements around a geom shape, get the faces delimiting the hole
806 * Build groups of volume to remove, groups of faces to replace on the skin of the object,
807 * groups of faces to remove insidethe object, (idem edges).
808 * Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
810 void CreateHoleSkin(CORBA::Double radius,
811 GEOM::GEOM_Object_ptr theShape,
812 const char* groupName,
813 const SMESH::double_array& theNodesCoords,
814 SMESH::array_of_long_array_out GroupsOfNodes)
815 throw (SALOME::SALOME_Exception);
818 * \brief Generated skin mesh (containing 2D cells) from 3D mesh
819 * The created 2D mesh elements based on nodes of free faces of boundary volumes
820 * \return TRUE if operation has been completed successfully, FALSE otherwise
822 CORBA::Boolean Make2DMeshFrom3D();
824 SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
825 SMESH::Bnd_Dimension dimension,
826 const char* groupName,
827 const char* meshName,
828 CORBA::Boolean toCopyElements,
829 CORBA::Boolean toCopyMissingBondary,
830 SMESH::SMESH_Group_out group);
832 CORBA::Long MakeBoundaryElements(SMESH::Bnd_Dimension dimension,
833 const char* groupName,
834 const char* meshName,
835 CORBA::Boolean toCopyAll,
836 const SMESH::ListOfIDSources& groups,
837 SMESH::SMESH_Mesh_out mesh,
838 SMESH::SMESH_Group_out group)
839 throw (SALOME::SALOME_Exception);
841 private: //!< private methods
843 ::SMESH_MeshEditor& getEditor();
845 SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
847 MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
850 * \brief Update myLastCreated* or myPreviewData
851 * \param anEditor - it contains edition results
853 //void storeResult(::SMESH_MeshEditor& anEditor);
855 * \brief Clear myLastCreated* or myPreviewData
857 void initData(bool deleteSearchers=true);
860 * \brief Return groups by their IDs
862 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
864 SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
865 const SMESH::AxisStruct & Axis,
866 CORBA::Double AngleInRadians,
867 CORBA::Long NbOfSteps,
868 CORBA::Double Tolerance,
869 const bool MakeGroups,
870 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
871 SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
872 const SMESH::DirStruct & StepVector,
873 CORBA::Long NbOfSteps,
875 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
876 SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
877 const SMESH::DirStruct & theStepVector,
878 CORBA::Long theNbOfSteps,
879 CORBA::Long theExtrFlags,
880 CORBA::Double theSewTolerance,
881 const bool MakeGroups);
882 SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
883 SMESH::SMESH_Mesh_ptr PathMesh,
884 GEOM::GEOM_Object_ptr PathShape,
885 CORBA::Long NodeStart,
886 CORBA::Boolean HasAngles,
887 const SMESH::double_array & Angles,
888 CORBA::Boolean HasRefPoint,
889 const SMESH::PointStruct & RefPoint,
890 const bool MakeGroups,
891 SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
892 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
893 SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array & IDsOfElements,
894 SMESH::SMESH_IDSource_ptr Path,
895 CORBA::Long NodeStart,
896 CORBA::Boolean HasAngles,
897 const SMESH::double_array& Angles,
898 CORBA::Boolean LinearVariation,
899 CORBA::Boolean HasRefPoint,
900 const SMESH::PointStruct& RefPoint,
902 const SMDSAbs_ElementType ElementType,
903 SMESH::SMESH_MeshEditor::Extrusion_Error & theError);
904 SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
905 const SMESH::AxisStruct & Axis,
906 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
909 ::SMESH_Mesh* TargetMesh=0);
910 SMESH::ListOfGroups* translate(TIDSortedElemSet & IDsOfElements,
911 const SMESH::DirStruct & Vector,
914 ::SMESH_Mesh* TargetMesh=0);
915 SMESH::ListOfGroups* rotate(TIDSortedElemSet & IDsOfElements,
916 const SMESH::AxisStruct & Axis,
920 ::SMESH_Mesh* TargetMesh=0);
922 SMESH::ListOfGroups* scale(SMESH::SMESH_IDSource_ptr theObject,
923 const SMESH::PointStruct& thePoint,
924 const SMESH::double_array& theScaleFact,
925 CORBA::Boolean theCopy,
927 ::SMESH_Mesh* theTargetMesh=0);
929 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
931 void DumpGroupsList(SMESH::TPythonDump & theDumpPython,
932 const SMESH::ListOfGroups * theGroupList);
934 string generateGroupName(const string& thePrefix);
938 SMESH_Mesh_i* myMesh_i;
940 ::SMESH_MeshEditor myEditor;
942 bool myIsPreviewMode;
943 MeshEditor_I::TPreviewMesh * myPreviewMesh;
944 ::SMESH_MeshEditor * myPreviewEditor;
945 SMESH::MeshPreviewStruct_var myPreviewData;
947 // temporary IDSources
949 std::list< _IDSource* > myAuxIDSources;
950 void deleteAuxIDSources();