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_
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
35 #include "SMESH_Mesh.hxx"
39 class SMESH_MeshEditor;
42 class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
45 SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
47 virtual ~ SMESH_MeshEditor_i();
50 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
51 CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
54 * Methods for creation new elements.
55 * Returns ID of created element or 0 if element not created
57 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
58 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
59 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
60 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
61 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
62 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
63 const SMESH::long_array & Quantities);
64 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
67 * \brief Bind a node to a vertex
68 * \param NodeID - node ID
69 * \param VertexID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
71 void SetNodeOnVertex(CORBA::Long NodeID, CORBA::Long VertexID)
72 throw (SALOME::SALOME_Exception);
74 * \brief Store node position on an edge
75 * \param NodeID - node ID
76 * \param EdgeID - edge ID available through GEOM_Object.GetSubShapeIndices()[0]
77 * \param paramOnEdge - parameter on edge where the node is located
79 void SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
80 CORBA::Double paramOnEdge)
81 throw (SALOME::SALOME_Exception);
83 * \brief Store node position on a face
84 * \param NodeID - node ID
85 * \param FaceID - face ID available through GEOM_Object.GetSubShapeIndices()[0]
86 * \param u - U parameter on face where the node is located
87 * \param v - V parameter on face where the node is located
89 void SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
90 CORBA::Double u, CORBA::Double v)
91 throw (SALOME::SALOME_Exception);
93 * \brief Bind a node to a solid
94 * \param NodeID - node ID
95 * \param SolidID - vertex ID available through GEOM_Object.GetSubShapeIndices()[0]
97 void SetNodeInVolume(CORBA::Long NodeID, CORBA::Long SolidID)
98 throw (SALOME::SALOME_Exception);
100 * \brief Bind an element to a shape
101 * \param ElementID - element ID
102 * \param ShapeID - shape ID available through GEOM_Object.GetSubShapeIndices()[0]
104 void SetMeshElementOnShape(CORBA::Long ElementID, CORBA::Long ShapeID)
105 throw (SALOME::SALOME_Exception);
108 CORBA::Boolean MoveNode(CORBA::Long NodeID,
109 CORBA::Double x, CORBA::Double y, CORBA::Double z);
111 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
112 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
113 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
114 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
117 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
118 SMESH::NumericalFunctor_ptr Criterion,
119 CORBA::Double MaxAngle);
120 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
121 SMESH::NumericalFunctor_ptr Criterion,
122 CORBA::Double MaxAngle);
123 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
124 SMESH::NumericalFunctor_ptr Criterion);
125 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
126 SMESH::NumericalFunctor_ptr Criterion);
127 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
128 CORBA::Boolean Diag13);
129 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
130 CORBA::Boolean Diag13);
131 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
132 SMESH::NumericalFunctor_ptr Criterion);
134 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
135 const SMESH::long_array & IDsOfFixedNodes,
136 CORBA::Long MaxNbOfIterations,
137 CORBA::Double MaxAspectRatio,
138 SMESH::SMESH_MeshEditor::Smooth_Method Method);
139 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
140 const SMESH::long_array & IDsOfFixedNodes,
141 CORBA::Long MaxNbOfIterations,
142 CORBA::Double MaxAspectRatio,
143 SMESH::SMESH_MeshEditor::Smooth_Method Method);
144 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
145 const SMESH::long_array & IDsOfFixedNodes,
146 CORBA::Long MaxNbOfIterations,
147 CORBA::Double MaxAspectRatio,
148 SMESH::SMESH_MeshEditor::Smooth_Method Method);
149 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
150 const SMESH::long_array & IDsOfFixedNodes,
151 CORBA::Long MaxNbOfIterations,
152 CORBA::Double MaxAspectRatio,
153 SMESH::SMESH_MeshEditor::Smooth_Method Method);
154 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
155 const SMESH::long_array & IDsOfFixedNodes,
156 CORBA::Long MaxNbOfIterations,
157 CORBA::Double MaxAspectRatio,
158 SMESH::SMESH_MeshEditor::Smooth_Method Method,
160 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
161 const SMESH::long_array & IDsOfFixedNodes,
162 CORBA::Long MaxNbOfIterations,
163 CORBA::Double MaxAspectRatio,
164 SMESH::SMESH_MeshEditor::Smooth_Method Method,
168 void ConvertToQuadratic(CORBA::Boolean Force3d);
169 CORBA::Boolean ConvertFromQuadratic();
171 void RenumberNodes();
172 void RenumberElements();
174 void RotationSweep(const SMESH::long_array & IDsOfElements,
175 const SMESH::AxisStruct & Axis,
176 CORBA::Double AngleInRadians,
177 CORBA::Long NbOfSteps,
178 CORBA::Double Tolerance);
179 void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
180 const SMESH::AxisStruct & Axis,
181 CORBA::Double AngleInRadians,
182 CORBA::Long NbOfSteps,
183 CORBA::Double Tolerance);
185 void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
186 const SMESH::DirStruct & StepVector,
187 CORBA::Long NbOfSteps);
188 void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
189 const SMESH::DirStruct & StepVector,
190 CORBA::Long NbOfSteps);
191 void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
192 const SMESH::DirStruct & StepVector,
193 CORBA::Long NbOfSteps);
194 void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
195 const SMESH::DirStruct & StepVector,
196 CORBA::Long NbOfSteps);
197 void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
198 const SMESH::DirStruct & theStepVector,
199 CORBA::Long theNbOfSteps,
200 CORBA::Long theExtrFlags,
201 CORBA::Double theSewTolerance);
203 SMESH::SMESH_MeshEditor::Extrusion_Error
204 ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
205 SMESH::SMESH_Mesh_ptr PathMesh,
206 GEOM::GEOM_Object_ptr PathShape,
207 CORBA::Long NodeStart,
208 CORBA::Boolean HasAngles,
209 const SMESH::double_array & Angles,
210 CORBA::Boolean HasRefPoint,
211 const SMESH::PointStruct & RefPoint);
213 SMESH::SMESH_MeshEditor::Extrusion_Error
214 ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
215 SMESH::SMESH_Mesh_ptr PathMesh,
216 GEOM::GEOM_Object_ptr PathShape,
217 CORBA::Long NodeStart,
218 CORBA::Boolean HasAngles,
219 const SMESH::double_array & Angles,
220 CORBA::Boolean HasRefPoint,
221 const SMESH::PointStruct & RefPoint);
223 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
224 GEOM::GEOM_Object_ptr PathShape,
225 const SMESH::double_array & Angles);
227 void Mirror(const SMESH::long_array & IDsOfElements,
228 const SMESH::AxisStruct & Axis,
229 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
230 CORBA::Boolean Copy);
231 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
232 const SMESH::AxisStruct & Axis,
233 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
234 CORBA::Boolean Copy);
235 void Translate(const SMESH::long_array & IDsOfElements,
236 const SMESH::DirStruct & Vector,
237 CORBA::Boolean Copy);
238 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
239 const SMESH::DirStruct & Vector,
240 CORBA::Boolean Copy);
241 void Rotate(const SMESH::long_array & IDsOfElements,
242 const SMESH::AxisStruct & Axis,
244 CORBA::Boolean Copy);
245 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
246 const SMESH::AxisStruct & Axis,
248 CORBA::Boolean Copy);
250 SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
251 const SMESH::AxisStruct& Axix,
252 CORBA::Double AngleInRadians,
253 CORBA::Long NbOfSteps,
254 CORBA::Double Tolerance);
255 SMESH::ListOfGroups* RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
256 const SMESH::AxisStruct& Axix,
257 CORBA::Double AngleInRadians,
258 CORBA::Long NbOfSteps,
259 CORBA::Double Tolerance);
260 SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
261 const SMESH::DirStruct& StepVector,
262 CORBA::Long NbOfSteps);
263 SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
264 const SMESH::DirStruct& StepVector,
265 CORBA::Long NbOfSteps,
266 CORBA::Long ExtrFlags,
267 CORBA::Double SewTolerance);
268 SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
269 const SMESH::DirStruct& StepVector,
270 CORBA::Long NbOfSteps);
271 SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
272 const SMESH::DirStruct& StepVector,
273 CORBA::Long NbOfSteps);
274 SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
275 const SMESH::DirStruct& StepVector,
276 CORBA::Long NbOfSteps);
277 SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array& IDsOfElements,
278 SMESH::SMESH_Mesh_ptr PathMesh,
279 GEOM::GEOM_Object_ptr PathShape,
280 CORBA::Long NodeStart,
281 CORBA::Boolean HasAngles,
282 const SMESH::double_array& Angles,
283 CORBA::Boolean HasRefPoint,
284 const SMESH::PointStruct& RefPoint,
285 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
286 SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
287 SMESH::SMESH_Mesh_ptr PathMesh,
288 GEOM::GEOM_Object_ptr PathShape,
289 CORBA::Long NodeStart,
290 CORBA::Boolean HasAngles,
291 const SMESH::double_array& Angles,
292 CORBA::Boolean HasRefPoint,
293 const SMESH::PointStruct& RefPoint,
294 SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
295 SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
296 const SMESH::AxisStruct& Mirror,
297 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
298 SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
299 const SMESH::AxisStruct& Mirror,
300 SMESH::SMESH_MeshEditor::MirrorType MirrorType);
301 SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
302 const SMESH::DirStruct& Vector);
303 SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
304 const SMESH::DirStruct& Vector);
305 SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
306 const SMESH::AxisStruct& Axis,
307 CORBA::Double AngleInRadians);
308 SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
309 const SMESH::AxisStruct& Axis,
310 CORBA::Double AngleInRadians);
312 void FindCoincidentNodes (CORBA::Double Tolerance,
313 SMESH::array_of_long_array_out GroupsOfNodes);
314 void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
315 CORBA::Double Tolerance,
316 SMESH::array_of_long_array_out GroupsOfNodes);
317 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
318 void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
319 SMESH::array_of_long_array_out GroupsOfElementsID);
320 void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
321 void MergeEqualElements();
322 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
329 SMESH::SMESH_MeshEditor::Sew_Error
330 SewFreeBorders(CORBA::Long FirstNodeID1,
331 CORBA::Long SecondNodeID1,
332 CORBA::Long LastNodeID1,
333 CORBA::Long FirstNodeID2,
334 CORBA::Long SecondNodeID2,
335 CORBA::Long LastNodeID2,
336 CORBA::Boolean CreatePolygons,
337 CORBA::Boolean CreatePolyedrs);
338 SMESH::SMESH_MeshEditor::Sew_Error
339 SewConformFreeBorders(CORBA::Long FirstNodeID1,
340 CORBA::Long SecondNodeID1,
341 CORBA::Long LastNodeID1,
342 CORBA::Long FirstNodeID2,
343 CORBA::Long SecondNodeID2);
344 SMESH::SMESH_MeshEditor::Sew_Error
345 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
346 CORBA::Long SecondNodeIDOnFreeBorder,
347 CORBA::Long LastNodeIDOnFreeBorder,
348 CORBA::Long FirstNodeIDOnSide,
349 CORBA::Long LastNodeIDOnSide,
350 CORBA::Boolean CreatePolygons,
351 CORBA::Boolean CreatePolyedrs);
352 SMESH::SMESH_MeshEditor::Sew_Error
353 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
354 const SMESH::long_array& IDsOfSide2Elements,
355 CORBA::Long NodeID1OfSide1ToMerge,
356 CORBA::Long NodeID1OfSide2ToMerge,
357 CORBA::Long NodeID2OfSide1ToMerge,
358 CORBA::Long NodeID2OfSide2ToMerge);
361 * Set new nodes for given element.
362 * If number of nodes is not corresponded to type of
363 * element - returns false
365 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
368 * Return data of mesh edition preview
370 SMESH::MeshPreviewStruct* GetPreviewData();
373 * If during last operation of MeshEditor some nodes were
374 * created this method returns list of it's IDs, if new nodes
375 * not creared - returns empty list
377 SMESH::long_array* GetLastCreatedNodes();
380 * If during last operation of MeshEditor some elements were
381 * created this method returns list of it's IDs, if new elements
382 * not creared - returns empty list
384 SMESH::long_array* GetLastCreatedElems();
387 * \brief Return edited mesh ID
388 * \retval int - mesh ID
390 int GetMeshId() const { return myMesh->GetId(); }
393 private: //!< private methods
395 SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
398 * \brief Update myLastCreated* or myPreviewData
399 * \param anEditor - it contains edition results
401 void storeResult(::SMESH_MeshEditor& anEditor);
403 * \brief Clear myLastCreated* or myPreviewData
408 * \brief Return groups by their IDs
410 SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
412 SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
413 const SMESH::AxisStruct & Axis,
414 CORBA::Double AngleInRadians,
415 CORBA::Long NbOfSteps,
416 CORBA::Double Tolerance,
417 const bool MakeGroups);
418 SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
419 const SMESH::DirStruct & StepVector,
420 CORBA::Long NbOfSteps,
421 const bool MakeGroups,
422 const SMDSAbs_ElementType ElementType=SMDSAbs_All);
423 SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
424 const SMESH::DirStruct & theStepVector,
425 CORBA::Long theNbOfSteps,
426 CORBA::Long theExtrFlags,
427 CORBA::Double theSewTolerance,
428 const bool MakeGroups);
429 SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
430 SMESH::SMESH_Mesh_ptr PathMesh,
431 GEOM::GEOM_Object_ptr PathShape,
432 CORBA::Long NodeStart,
433 CORBA::Boolean HasAngles,
434 const SMESH::double_array & Angles,
435 CORBA::Boolean HasRefPoint,
436 const SMESH::PointStruct & RefPoint,
437 const bool MakeGroups,
438 SMESH::SMESH_MeshEditor::Extrusion_Error & Error);
439 SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
440 const SMESH::AxisStruct & Axis,
441 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
443 const bool MakeGroups);
444 SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
445 const SMESH::DirStruct & Vector,
447 const bool MakeGroups);
448 SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
449 const SMESH::AxisStruct & Axis,
452 const bool MakeGroups);
456 SMESH_Mesh_i* myMesh_i;
459 SMESH::long_array_var myLastCreatedElems;
460 SMESH::long_array_var myLastCreatedNodes;
462 SMESH::MeshPreviewStruct_var myPreviewData;