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"
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 void FindCoincidentNodes (CORBA::Double Tolerance,
315 SMESH::array_of_long_array_out GroupsOfNodes);
316 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
317 CORBA::Double Tolerance,
318 SMESH::array_of_long_array_out GroupsOfNodes);
319 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
320 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
321 SMESH::array_of_long_array_out GroupsOfElementsID);
322 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
323 void MergeEqualElements();
324 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
331 SMESH::SMESH_MeshEditor::Sew_Error
332 SewFreeBorders(CORBA::Long FirstNodeID1,
333 CORBA::Long SecondNodeID1,
334 CORBA::Long LastNodeID1,
335 CORBA::Long FirstNodeID2,
336 CORBA::Long SecondNodeID2,
337 CORBA::Long LastNodeID2,
338 CORBA::Boolean CreatePolygons,
339 CORBA::Boolean CreatePolyedrs);
340 SMESH::SMESH_MeshEditor::Sew_Error
341 SewConformFreeBorders(CORBA::Long FirstNodeID1,
342 CORBA::Long SecondNodeID1,
343 CORBA::Long LastNodeID1,
344 CORBA::Long FirstNodeID2,
345 CORBA::Long SecondNodeID2);
346 SMESH::SMESH_MeshEditor::Sew_Error
347 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
348 CORBA::Long SecondNodeIDOnFreeBorder,
349 CORBA::Long LastNodeIDOnFreeBorder,
350 CORBA::Long FirstNodeIDOnSide,
351 CORBA::Long LastNodeIDOnSide,
352 CORBA::Boolean CreatePolygons,
353 CORBA::Boolean CreatePolyedrs);
354 SMESH::SMESH_MeshEditor::Sew_Error
355 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
356 const SMESH::long_array& IDsOfSide2Elements,
357 CORBA::Long NodeID1OfSide1ToMerge,
358 CORBA::Long NodeID1OfSide2ToMerge,
359 CORBA::Long NodeID2OfSide1ToMerge,
360 CORBA::Long NodeID2OfSide2ToMerge);
363 * Set new nodes for given element.
364 * If number of nodes is not corresponded to type of
365 * element - returns false
367 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
370 * Return data of mesh edition preview
372 SMESH::MeshPreviewStruct* GetPreviewData();
375 * If during last operation of MeshEditor some nodes were
376 * created this method returns list of it's IDs, if new nodes
377 * not creared - returns empty list
379 SMESH::long_array* GetLastCreatedNodes();
382 * If during last operation of MeshEditor some elements were
383 * created this method returns list of it's IDs, if new elements
384 * not creared - returns empty list
386 SMESH::long_array* GetLastCreatedElems();
389 * \brief Return edited mesh ID
390 * \retval int - mesh ID
392 int GetMeshId() const { return myMesh->GetId(); }
395 private: //!< private methods
397 SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
400 * \brief Update myLastCreated* or myPreviewData
401 * \param anEditor - it contains edition results
403 void storeResult(::SMESH_MeshEditor& anEditor);
405 * \brief Clear myLastCreated* or myPreviewData
410 * \brief Return groups by their IDs
412 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
414 SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
415 const SMESH::AxisStruct & Axis,
416 CORBA::Double AngleInRadians,
417 CORBA::Long NbOfSteps,
418 CORBA::Double Tolerance,
419 const bool MakeGroups);
420 SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
421 const SMESH::DirStruct & StepVector,
422 CORBA::Long NbOfSteps,
423 const bool MakeGroups,
424 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
425 SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
426 const SMESH::DirStruct & theStepVector,
427 CORBA::Long theNbOfSteps,
428 CORBA::Long theExtrFlags,
429 CORBA::Double theSewTolerance,
430 const bool MakeGroups);
431 SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
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 const bool MakeGroups,
440 SMESH::SMESH_MeshEditor::Extrusion_Error & Error);
441 SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
442 const SMESH::AxisStruct & Axis,
443 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
445 const bool MakeGroups);
446 SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
447 const SMESH::DirStruct & Vector,
449 const bool MakeGroups);
450 SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
451 const SMESH::AxisStruct & Axis,
454 const bool MakeGroups);
458 SMESH_Mesh_i* myMesh_i;
461 SMESH::long_array_var myLastCreatedElems;
462 SMESH::long_array_var myLastCreatedNodes;
464 SMESH::MeshPreviewStruct_var myPreviewData;