1 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
3 // Copyright (C) 2003 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
24 // File : SMESH_MeshEditor_i.hxx
25 // Author : Nicolas REJNERI
29 #ifndef _SMESH_MESHEDITOR_I_HXX_
30 #define _SMESH_MESHEDIOTR_I_HXX_
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
37 #include "SMESH_Mesh.hxx"
38 #include "SMESH_PythonDump.hxx"
41 class SMESH_MeshEditor;
44 class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
47 SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
49 virtual ~ SMESH_MeshEditor_i();
52 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
53 CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
56 * Methods for creation new elements.
57 * Returns ID of created element or 0 if element not created
59 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
60 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
61 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
62 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
63 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
64 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
65 const SMESH::long_array & Quantities);
66 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
69 * \brief Bind a node to a vertex
70 * \param NodeID - node ID
71 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
73 void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
74 throw (SALOME::SALOME_Exception);
76 * \brief Store node position on an edge
77 * \param NodeID - node ID
78 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
79 * \param paramOnEdge - parameter on edge where the node is located
81 void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
82 CORBA::Double paramOnEdge)
83 throw (SALOME::SALOME_Exception);
85 * \brief Store node position on a face
86 * \param NodeID - node ID
87 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
88 * \param u - U parameter on face where the node is located
89 * \param v - V parameter on face where the node is located
91 void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
92 CORBA::Double u, CORBA::Double v)
93 throw (SALOME::SALOME_Exception);
95 * \brief Bind a node to a solid
96 * \param NodeID - node ID
97 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
99 void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
100 throw (SALOME::SALOME_Exception);
102 * \brief Bind an element to a shape
103 * \param ElementID - element ID
104 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
106 void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
107 throw (SALOME::SALOME_Exception);
110 CORBA::Boolean MoveNode(CORBA::Long NodeID,
111 CORBA::Double x, CORBA::Double y, CORBA::Double z);
113 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
114 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
115 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
116 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
119 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
120 SMESH::NumericalFunctor_ptr Criterion,
121 CORBA::Double MaxAngle);
122 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
123 SMESH::NumericalFunctor_ptr Criterion,
124 CORBA::Double MaxAngle);
125 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
126 SMESH::NumericalFunctor_ptr Criterion);
127 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
128 SMESH::NumericalFunctor_ptr Criterion);
129 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
130 CORBA::Boolean Diag13);
131 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
132 CORBA::Boolean Diag13);
133 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
134 SMESH::NumericalFunctor_ptr Criterion);
136 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
137 const SMESH::long_array & IDsOfFixedNodes,
138 CORBA::Long MaxNbOfIterations,
139 CORBA::Double MaxAspectRatio,
140 SMESH::SMESH_MeshEditor::Smooth_Method Method);
141 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
142 const SMESH::long_array & IDsOfFixedNodes,
143 CORBA::Long MaxNbOfIterations,
144 CORBA::Double MaxAspectRatio,
145 SMESH::SMESH_MeshEditor::Smooth_Method Method);
146 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
147 const SMESH::long_array & IDsOfFixedNodes,
148 CORBA::Long MaxNbOfIterations,
149 CORBA::Double MaxAspectRatio,
150 SMESH::SMESH_MeshEditor::Smooth_Method Method);
151 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
152 const SMESH::long_array & IDsOfFixedNodes,
153 CORBA::Long MaxNbOfIterations,
154 CORBA::Double MaxAspectRatio,
155 SMESH::SMESH_MeshEditor::Smooth_Method Method);
156 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
157 const SMESH::long_array & IDsOfFixedNodes,
158 CORBA::Long MaxNbOfIterations,
159 CORBA::Double MaxAspectRatio,
160 SMESH::SMESH_MeshEditor::Smooth_Method Method,
162 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
163 const SMESH::long_array & IDsOfFixedNodes,
164 CORBA::Long MaxNbOfIterations,
165 CORBA::Double MaxAspectRatio,
166 SMESH::SMESH_MeshEditor::Smooth_Method Method,
170 void ConvertToQuadratic(CORBA::Boolean Force3d);
171 CORBA::Boolean ConvertFromQuadratic();
173 void RenumberNodes();
174 void RenumberElements();
176 void RotationSweep(const SMESH::long_array & IDsOfElements,
177 const SMESH::AxisStruct & Axis,
178 CORBA::Double AngleInRadians,
179 CORBA::Long NbOfSteps,
180 CORBA::Double Tolerance);
181 void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
182 const SMESH::AxisStruct & Axis,
183 CORBA::Double AngleInRadians,
184 CORBA::Long NbOfSteps,
185 CORBA::Double Tolerance);
187 void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
188 const SMESH::DirStruct & StepVector,
189 CORBA::Long NbOfSteps);
190 void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
191 const SMESH::DirStruct & StepVector,
192 CORBA::Long NbOfSteps);
193 void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
194 const SMESH::DirStruct & StepVector,
195 CORBA::Long NbOfSteps);
196 void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
197 const SMESH::DirStruct & StepVector,
198 CORBA::Long NbOfSteps);
199 void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
200 const SMESH::DirStruct & theStepVector,
201 CORBA::Long theNbOfSteps,
202 CORBA::Long theExtrFlags,
203 CORBA::Double theSewTolerance);
205 SMESH::SMESH_MeshEditor::Extrusion_Error
206 ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
207 SMESH::SMESH_Mesh_ptr PathMesh,
208 GEOM::GEOM_Object_ptr PathShape,
209 CORBA::Long NodeStart,
210 CORBA::Boolean HasAngles,
211 const SMESH::double_array & Angles,
212 CORBA::Boolean HasRefPoint,
213 const SMESH::PointStruct & RefPoint);
215 SMESH::SMESH_MeshEditor::Extrusion_Error
216 ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
217 SMESH::SMESH_Mesh_ptr PathMesh,
218 GEOM::GEOM_Object_ptr PathShape,
219 CORBA::Long NodeStart,
220 CORBA::Boolean HasAngles,
221 const SMESH::double_array & Angles,
222 CORBA::Boolean HasRefPoint,
223 const SMESH::PointStruct & RefPoint);
225 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
226 GEOM::GEOM_Object_ptr PathShape,
227 const SMESH::double_array & Angles);
229 void Mirror(const SMESH::long_array & IDsOfElements,
230 const SMESH::AxisStruct & Axis,
231 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
232 CORBA::Boolean Copy);
233 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
234 const SMESH::AxisStruct & Axis,
235 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
236 CORBA::Boolean Copy);
237 void Translate(const SMESH::long_array & IDsOfElements,
238 const SMESH::DirStruct & Vector,
239 CORBA::Boolean Copy);
240 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
241 const SMESH::DirStruct & Vector,
242 CORBA::Boolean Copy);
243 void Rotate(const SMESH::long_array & IDsOfElements,
244 const SMESH::AxisStruct & Axis,
246 CORBA::Boolean Copy);
247 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
248 const SMESH::AxisStruct & Axis,
250 CORBA::Boolean Copy);
252 SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
253 const SMESH::AxisStruct& Axix,
254 CORBA::Double AngleInRadians,
255 CORBA::Long NbOfSteps,
256 CORBA::Double Tolerance);
257 SMESH::ListOfGroups* RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
258 const SMESH::AxisStruct& Axix,
259 CORBA::Double AngleInRadians,
260 CORBA::Long NbOfSteps,
261 CORBA::Double Tolerance);
262 SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
263 const SMESH::DirStruct& StepVector,
264 CORBA::Long NbOfSteps);
265 SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
266 const SMESH::DirStruct& StepVector,
267 CORBA::Long NbOfSteps,
268 CORBA::Long ExtrFlags,
269 CORBA::Double SewTolerance);
270 SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
271 const SMESH::DirStruct& StepVector,
272 CORBA::Long NbOfSteps);
273 SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
274 const SMESH::DirStruct& StepVector,
275 CORBA::Long NbOfSteps);
276 SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
277 const SMESH::DirStruct& StepVector,
278 CORBA::Long NbOfSteps);
279 SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array& IDsOfElements,
280 SMESH::SMESH_Mesh_ptr PathMesh,
281 GEOM::GEOM_Object_ptr PathShape,
282 CORBA::Long NodeStart,
283 CORBA::Boolean HasAngles,
284 const SMESH::double_array& Angles,
285 CORBA::Boolean HasRefPoint,
286 const SMESH::PointStruct& RefPoint,
287 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
288 SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
289 SMESH::SMESH_Mesh_ptr PathMesh,
290 GEOM::GEOM_Object_ptr PathShape,
291 CORBA::Long NodeStart,
292 CORBA::Boolean HasAngles,
293 const SMESH::double_array& Angles,
294 CORBA::Boolean HasRefPoint,
295 const SMESH::PointStruct& RefPoint,
296 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
297 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
298 const SMESH::AxisStruct& Mirror,
299 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
300 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
301 const SMESH::AxisStruct& Mirror,
302 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
303 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
304 const SMESH::DirStruct& Vector);
305 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
306 const SMESH::DirStruct& Vector);
307 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
308 const SMESH::AxisStruct& Axis,
309 CORBA::Double AngleInRadians);
310 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
311 const SMESH::AxisStruct& Axis,
312 CORBA::Double AngleInRadians);
314 SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
315 const SMESH::AxisStruct& Mirror,
316 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
317 CORBA::Boolean CopyGroups,
318 const char* MeshName);
319 SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
320 const SMESH::AxisStruct& Mirror,
321 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
322 CORBA::Boolean CopyGroups,
323 const char* MeshName);
324 SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
325 const SMESH::DirStruct& Vector,
326 CORBA::Boolean CopyGroups,
327 const char* MeshName);
328 SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
329 const SMESH::DirStruct& Vector,
330 CORBA::Boolean CopyGroups,
331 const char* MeshName);
332 SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
333 const SMESH::AxisStruct& Axis,
334 CORBA::Double AngleInRadians,
335 CORBA::Boolean CopyGroups,
336 const char* MeshName);
337 SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
338 const SMESH::AxisStruct& Axis,
339 CORBA::Double AngleInRadians,
340 CORBA::Boolean CopyGroups,
341 const char* MeshName);
343 void FindCoincidentNodes (CORBA::Double Tolerance,
344 SMESH::array_of_long_array_out GroupsOfNodes);
345 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
346 CORBA::Double Tolerance,
347 SMESH::array_of_long_array_out GroupsOfNodes);
348 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
349 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
350 SMESH::array_of_long_array_out GroupsOfElementsID);
351 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
352 void MergeEqualElements();
353 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
360 SMESH::SMESH_MeshEditor::Sew_Error
361 SewFreeBorders(CORBA::Long FirstNodeID1,
362 CORBA::Long SecondNodeID1,
363 CORBA::Long LastNodeID1,
364 CORBA::Long FirstNodeID2,
365 CORBA::Long SecondNodeID2,
366 CORBA::Long LastNodeID2,
367 CORBA::Boolean CreatePolygons,
368 CORBA::Boolean CreatePolyedrs);
369 SMESH::SMESH_MeshEditor::Sew_Error
370 SewConformFreeBorders(CORBA::Long FirstNodeID1,
371 CORBA::Long SecondNodeID1,
372 CORBA::Long LastNodeID1,
373 CORBA::Long FirstNodeID2,
374 CORBA::Long SecondNodeID2);
375 SMESH::SMESH_MeshEditor::Sew_Error
376 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
377 CORBA::Long SecondNodeIDOnFreeBorder,
378 CORBA::Long LastNodeIDOnFreeBorder,
379 CORBA::Long FirstNodeIDOnSide,
380 CORBA::Long LastNodeIDOnSide,
381 CORBA::Boolean CreatePolygons,
382 CORBA::Boolean CreatePolyedrs);
383 SMESH::SMESH_MeshEditor::Sew_Error
384 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
385 const SMESH::long_array& IDsOfSide2Elements,
386 CORBA::Long NodeID1OfSide1ToMerge,
387 CORBA::Long NodeID1OfSide2ToMerge,
388 CORBA::Long NodeID2OfSide1ToMerge,
389 CORBA::Long NodeID2OfSide2ToMerge);
392 * Set new nodes for given element.
393 * If number of nodes is not corresponded to type of
394 * element - returns false
396 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
399 * Return data of mesh edition preview
401 SMESH::MeshPreviewStruct* GetPreviewData();
404 * If during last operation of MeshEditor some nodes were
405 * created this method returns list of it's IDs, if new nodes
406 * not creared - returns empty list
408 SMESH::long_array* GetLastCreatedNodes();
411 * If during last operation of MeshEditor some elements were
412 * created this method returns list of it's IDs, if new elements
413 * not creared - returns empty list
415 SMESH::long_array* GetLastCreatedElems();
418 * \brief Return edited mesh ID
419 * \retval int - mesh ID
421 int GetMeshId() const { return myMesh->GetId(); }
424 private: //!< private methods
426 SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
429 * \brief Update myLastCreated* or myPreviewData
430 * \param anEditor - it contains edition results
432 void storeResult(::SMESH_MeshEditor& anEditor);
434 * \brief Clear myLastCreated* or myPreviewData
439 * \brief Return groups by their IDs
441 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
443 SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
444 const SMESH::AxisStruct & Axis,
445 CORBA::Double AngleInRadians,
446 CORBA::Long NbOfSteps,
447 CORBA::Double Tolerance,
448 const bool MakeGroups);
449 SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
450 const SMESH::DirStruct & StepVector,
451 CORBA::Long NbOfSteps,
452 const bool MakeGroups,
453 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
454 SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
455 const SMESH::DirStruct & theStepVector,
456 CORBA::Long theNbOfSteps,
457 CORBA::Long theExtrFlags,
458 CORBA::Double theSewTolerance,
459 const bool MakeGroups);
460 SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
461 SMESH::SMESH_Mesh_ptr PathMesh,
462 GEOM::GEOM_Object_ptr PathShape,
463 CORBA::Long NodeStart,
464 CORBA::Boolean HasAngles,
465 const SMESH::double_array & Angles,
466 CORBA::Boolean HasRefPoint,
467 const SMESH::PointStruct & RefPoint,
468 const bool MakeGroups,
469 SMESH::SMESH_MeshEditor::Extrusion_Error & Error);
470 SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
471 const SMESH::AxisStruct & Axis,
472 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
474 const bool MakeGroups,
475 ::SMESH_Mesh* TargetMesh=0);
476 SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
477 const SMESH::DirStruct & Vector,
479 const bool MakeGroups,
480 ::SMESH_Mesh* TargetMesh=0);
481 SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
482 const SMESH::AxisStruct & Axis,
485 const bool MakeGroups,
486 ::SMESH_Mesh* TargetMesh=0);
488 SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
490 void DumpGroupsList(SMESH::TPythonDump & theDumpPython,
491 const SMESH::ListOfGroups * theGroupList);
495 SMESH_Mesh_i* myMesh_i;
498 SMESH::long_array_var myLastCreatedElems;
499 SMESH::long_array_var myLastCreatedNodes;
501 SMESH::MeshPreviewStruct_var myPreviewData;