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"
37 class SMESH_MeshEditor;
39 class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
42 SMESH_MeshEditor_i(SMESH_Mesh * theMesh, bool isPreview);
44 virtual ~ SMESH_MeshEditor_i();
47 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
48 CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
51 * Methods for creation new elements.
52 * Returns ID of created element or 0 if element not created
54 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
55 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
56 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
57 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
58 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
59 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
60 const SMESH::long_array & Quantities);
61 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
63 CORBA::Boolean MoveNode(CORBA::Long NodeID,
64 CORBA::Double x, CORBA::Double y, CORBA::Double z);
66 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
67 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
68 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
69 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
72 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
73 SMESH::NumericalFunctor_ptr Criterion,
74 CORBA::Double MaxAngle);
75 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
76 SMESH::NumericalFunctor_ptr Criterion,
77 CORBA::Double MaxAngle);
78 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
79 SMESH::NumericalFunctor_ptr Criterion);
80 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
81 SMESH::NumericalFunctor_ptr Criterion);
82 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
83 CORBA::Boolean Diag13);
84 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
85 CORBA::Boolean Diag13);
86 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
87 SMESH::NumericalFunctor_ptr Criterion);
89 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
90 const SMESH::long_array & IDsOfFixedNodes,
91 CORBA::Long MaxNbOfIterations,
92 CORBA::Double MaxAspectRatio,
93 SMESH::SMESH_MeshEditor::Smooth_Method Method);
94 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
95 const SMESH::long_array & IDsOfFixedNodes,
96 CORBA::Long MaxNbOfIterations,
97 CORBA::Double MaxAspectRatio,
98 SMESH::SMESH_MeshEditor::Smooth_Method Method);
99 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
100 const SMESH::long_array & IDsOfFixedNodes,
101 CORBA::Long MaxNbOfIterations,
102 CORBA::Double MaxAspectRatio,
103 SMESH::SMESH_MeshEditor::Smooth_Method Method);
104 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
105 const SMESH::long_array & IDsOfFixedNodes,
106 CORBA::Long MaxNbOfIterations,
107 CORBA::Double MaxAspectRatio,
108 SMESH::SMESH_MeshEditor::Smooth_Method Method);
109 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
110 const SMESH::long_array & IDsOfFixedNodes,
111 CORBA::Long MaxNbOfIterations,
112 CORBA::Double MaxAspectRatio,
113 SMESH::SMESH_MeshEditor::Smooth_Method Method,
115 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
116 const SMESH::long_array & IDsOfFixedNodes,
117 CORBA::Long MaxNbOfIterations,
118 CORBA::Double MaxAspectRatio,
119 SMESH::SMESH_MeshEditor::Smooth_Method Method,
123 void ConvertToQuadratic(CORBA::Boolean Force3d);
124 CORBA::Boolean ConvertFromQuadratic();
126 void RenumberNodes();
127 void RenumberElements();
129 void RotationSweep(const SMESH::long_array & IDsOfElements,
130 const SMESH::AxisStruct & Axis,
131 CORBA::Double AngleInRadians,
132 CORBA::Long NbOfSteps,
133 CORBA::Double Tolerance);
134 void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
135 const SMESH::AxisStruct & Axis,
136 CORBA::Double AngleInRadians,
137 CORBA::Long NbOfSteps,
138 CORBA::Double Tolerance);
140 void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
141 const SMESH::DirStruct & StepVector,
142 CORBA::Long NbOfSteps);
143 void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
144 const SMESH::DirStruct & StepVector,
145 CORBA::Long NbOfSteps);
146 void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
147 const SMESH::DirStruct & StepVector,
148 CORBA::Long NbOfSteps);
149 void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
150 const SMESH::DirStruct & StepVector,
151 CORBA::Long NbOfSteps);
152 void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
153 const SMESH::DirStruct & theStepVector,
154 CORBA::Long theNbOfSteps,
155 CORBA::Long theExtrFlags,
156 CORBA::Double theSewTolerance);
158 SMESH::SMESH_MeshEditor::Extrusion_Error
159 ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
160 SMESH::SMESH_Mesh_ptr PathMesh,
161 GEOM::GEOM_Object_ptr PathShape,
162 CORBA::Long NodeStart,
163 CORBA::Boolean HasAngles,
164 const SMESH::double_array & Angles,
165 CORBA::Boolean HasRefPoint,
166 const SMESH::PointStruct & RefPoint);
168 SMESH::SMESH_MeshEditor::Extrusion_Error
169 ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
170 SMESH::SMESH_Mesh_ptr PathMesh,
171 GEOM::GEOM_Object_ptr PathShape,
172 CORBA::Long NodeStart,
173 CORBA::Boolean HasAngles,
174 const SMESH::double_array & Angles,
175 CORBA::Boolean HasRefPoint,
176 const SMESH::PointStruct & RefPoint);
178 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
179 GEOM::GEOM_Object_ptr PathShape,
180 const SMESH::double_array & Angles);
182 void Mirror(const SMESH::long_array & IDsOfElements,
183 const SMESH::AxisStruct & Axis,
184 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
185 CORBA::Boolean Copy);
186 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
187 const SMESH::AxisStruct & Axis,
188 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
189 CORBA::Boolean Copy);
190 void Translate(const SMESH::long_array & IDsOfElements,
191 const SMESH::DirStruct & Vector,
192 CORBA::Boolean Copy);
193 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
194 const SMESH::DirStruct & Vector,
195 CORBA::Boolean Copy);
196 void Rotate(const SMESH::long_array & IDsOfElements,
197 const SMESH::AxisStruct & Axis,
199 CORBA::Boolean Copy);
200 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
201 const SMESH::AxisStruct & Axis,
203 CORBA::Boolean Copy);
205 void FindCoincidentNodes (CORBA::Double Tolerance,
206 SMESH::array_of_long_array_out GroupsOfNodes);
207 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
208 void MergeEqualElements();
209 CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
216 SMESH::SMESH_MeshEditor::Sew_Error
217 SewFreeBorders(CORBA::Long FirstNodeID1,
218 CORBA::Long SecondNodeID1,
219 CORBA::Long LastNodeID1,
220 CORBA::Long FirstNodeID2,
221 CORBA::Long SecondNodeID2,
222 CORBA::Long LastNodeID2,
223 CORBA::Boolean CreatePolygons,
224 CORBA::Boolean CreatePolyedrs);
225 SMESH::SMESH_MeshEditor::Sew_Error
226 SewConformFreeBorders(CORBA::Long FirstNodeID1,
227 CORBA::Long SecondNodeID1,
228 CORBA::Long LastNodeID1,
229 CORBA::Long FirstNodeID2,
230 CORBA::Long SecondNodeID2);
231 SMESH::SMESH_MeshEditor::Sew_Error
232 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
233 CORBA::Long SecondNodeIDOnFreeBorder,
234 CORBA::Long LastNodeIDOnFreeBorder,
235 CORBA::Long FirstNodeIDOnSide,
236 CORBA::Long LastNodeIDOnSide,
237 CORBA::Boolean CreatePolygons,
238 CORBA::Boolean CreatePolyedrs);
239 SMESH::SMESH_MeshEditor::Sew_Error
240 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
241 const SMESH::long_array& IDsOfSide2Elements,
242 CORBA::Long NodeID1OfSide1ToMerge,
243 CORBA::Long NodeID1OfSide2ToMerge,
244 CORBA::Long NodeID2OfSide1ToMerge,
245 CORBA::Long NodeID2OfSide2ToMerge);
248 * Set new nodes for given element.
249 * If number of nodes is not corresponded to type of
250 * element - returns false
252 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
255 * Return data of mesh edition preview
257 SMESH::MeshPreviewStruct* GetPreviewData();
260 * If during last operation of MeshEditor some nodes were
261 * created this method returns list of it's IDs, if new nodes
262 * not creared - returns empty list
264 SMESH::long_array* GetLastCreatedNodes();
267 * If during last operation of MeshEditor some elements were
268 * created this method returns list of it's IDs, if new elements
269 * not creared - returns empty list
271 SMESH::long_array* GetLastCreatedElems();
278 * \brief Update myLastCreated* or myPreviewData
279 * \param anEditor - it contains edition results
281 void StoreResult(::SMESH_MeshEditor& anEditor);
284 * \brief Return edited mesh ID
285 * \retval int - mesh ID
287 int GetMeshId() const { return myMesh->GetId(); }
291 SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
296 SMESH::long_array_var myLastCreatedElems;
297 SMESH::long_array_var myLastCreatedNodes;
299 SMESH::MeshPreviewStruct_var myPreviewData;