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_Mesh)
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);
44 virtual ~ SMESH_MeshEditor_i()
49 CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements);
50 CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes);
53 * Methods for creation new elements.
54 * Returns ID of created element or 0 if element not created
56 CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
57 CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
58 CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
59 CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
60 CORBA::Long AddVolume(const SMESH::long_array & IDsOfNodes);
61 CORBA::Long AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
62 const SMESH::long_array & Quantities);
63 CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
65 CORBA::Boolean MoveNode(CORBA::Long NodeID,
66 CORBA::Double x, CORBA::Double y, CORBA::Double z);
68 CORBA::Boolean InverseDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
69 CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
70 CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
71 CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
74 CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
75 SMESH::NumericalFunctor_ptr Criterion,
76 CORBA::Double MaxAngle);
77 CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
78 SMESH::NumericalFunctor_ptr Criterion,
79 CORBA::Double MaxAngle);
80 CORBA::Boolean QuadToTri (const SMESH::long_array & IDsOfElements,
81 SMESH::NumericalFunctor_ptr Criterion);
82 CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
83 SMESH::NumericalFunctor_ptr Criterion);
84 CORBA::Boolean SplitQuad (const SMESH::long_array & IDsOfElements,
85 CORBA::Boolean Diag13);
86 CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
87 CORBA::Boolean Diag13);
88 CORBA::Long BestSplit (CORBA::Long IDOfQuad,
89 SMESH::NumericalFunctor_ptr Criterion);
91 CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,
92 const SMESH::long_array & IDsOfFixedNodes,
93 CORBA::Long MaxNbOfIterations,
94 CORBA::Double MaxAspectRatio,
95 SMESH::SMESH_MeshEditor::Smooth_Method Method);
96 CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
97 const SMESH::long_array & IDsOfFixedNodes,
98 CORBA::Long MaxNbOfIterations,
99 CORBA::Double MaxAspectRatio,
100 SMESH::SMESH_MeshEditor::Smooth_Method Method);
101 CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements,
102 const SMESH::long_array & IDsOfFixedNodes,
103 CORBA::Long MaxNbOfIterations,
104 CORBA::Double MaxAspectRatio,
105 SMESH::SMESH_MeshEditor::Smooth_Method Method);
106 CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
107 const SMESH::long_array & IDsOfFixedNodes,
108 CORBA::Long MaxNbOfIterations,
109 CORBA::Double MaxAspectRatio,
110 SMESH::SMESH_MeshEditor::Smooth_Method Method);
111 CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements,
112 const SMESH::long_array & IDsOfFixedNodes,
113 CORBA::Long MaxNbOfIterations,
114 CORBA::Double MaxAspectRatio,
115 SMESH::SMESH_MeshEditor::Smooth_Method Method,
117 CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject,
118 const SMESH::long_array & IDsOfFixedNodes,
119 CORBA::Long MaxNbOfIterations,
120 CORBA::Double MaxAspectRatio,
121 SMESH::SMESH_MeshEditor::Smooth_Method Method,
125 void ConvertToQuadratic(CORBA::Boolean Force3d);
126 CORBA::Boolean ConvertFromQuadratic();
128 void RenumberNodes();
129 void RenumberElements();
131 void RotationSweep(const SMESH::long_array & IDsOfElements,
132 const SMESH::AxisStruct & Axis,
133 CORBA::Double AngleInRadians,
134 CORBA::Long NbOfSteps,
135 CORBA::Double Tolerance);
136 void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
137 const SMESH::AxisStruct & Axis,
138 CORBA::Double AngleInRadians,
139 CORBA::Long NbOfSteps,
140 CORBA::Double Tolerance);
142 void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
143 const SMESH::DirStruct & StepVector,
144 CORBA::Long NbOfSteps);
145 void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
146 const SMESH::DirStruct & StepVector,
147 CORBA::Long NbOfSteps);
148 void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
149 const SMESH::DirStruct & StepVector,
150 CORBA::Long NbOfSteps);
151 void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
152 const SMESH::DirStruct & StepVector,
153 CORBA::Long NbOfSteps);
154 void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
155 const SMESH::DirStruct & theStepVector,
156 CORBA::Long theNbOfSteps,
157 CORBA::Long theExtrFlags,
158 CORBA::Double theSewTolerance);
160 SMESH::SMESH_MeshEditor::Extrusion_Error
161 ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
162 SMESH::SMESH_Mesh_ptr PathMesh,
163 GEOM::GEOM_Object_ptr PathShape,
164 CORBA::Long NodeStart,
165 CORBA::Boolean HasAngles,
166 const SMESH::double_array & Angles,
167 CORBA::Boolean HasRefPoint,
168 const SMESH::PointStruct & RefPoint);
170 SMESH::SMESH_MeshEditor::Extrusion_Error
171 ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
172 SMESH::SMESH_Mesh_ptr PathMesh,
173 GEOM::GEOM_Object_ptr PathShape,
174 CORBA::Long NodeStart,
175 CORBA::Boolean HasAngles,
176 const SMESH::double_array & Angles,
177 CORBA::Boolean HasRefPoint,
178 const SMESH::PointStruct & RefPoint);
180 SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
181 GEOM::GEOM_Object_ptr PathShape,
182 const SMESH::double_array & Angles);
184 void Mirror(const SMESH::long_array & IDsOfElements,
185 const SMESH::AxisStruct & Axis,
186 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
187 CORBA::Boolean Copy);
188 void MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
189 const SMESH::AxisStruct & Axis,
190 SMESH::SMESH_MeshEditor::MirrorType MirrorType,
191 CORBA::Boolean Copy);
192 void Translate(const SMESH::long_array & IDsOfElements,
193 const SMESH::DirStruct & Vector,
194 CORBA::Boolean Copy);
195 void TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
196 const SMESH::DirStruct & Vector,
197 CORBA::Boolean Copy);
198 void Rotate(const SMESH::long_array & IDsOfElements,
199 const SMESH::AxisStruct & Axis,
201 CORBA::Boolean Copy);
202 void RotateObject(SMESH::SMESH_IDSource_ptr theObject,
203 const SMESH::AxisStruct & Axis,
205 CORBA::Boolean Copy);
207 void FindCoincidentNodes (CORBA::Double Tolerance,
208 SMESH::array_of_long_array_out GroupsOfNodes);
209 void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
210 void MergeEqualElements();
213 SMESH::SMESH_MeshEditor::Sew_Error
214 SewFreeBorders(CORBA::Long FirstNodeID1,
215 CORBA::Long SecondNodeID1,
216 CORBA::Long LastNodeID1,
217 CORBA::Long FirstNodeID2,
218 CORBA::Long SecondNodeID2,
219 CORBA::Long LastNodeID2,
220 CORBA::Boolean CreatePolygons,
221 CORBA::Boolean CreatePolyedrs);
222 SMESH::SMESH_MeshEditor::Sew_Error
223 SewConformFreeBorders(CORBA::Long FirstNodeID1,
224 CORBA::Long SecondNodeID1,
225 CORBA::Long LastNodeID1,
226 CORBA::Long FirstNodeID2,
227 CORBA::Long SecondNodeID2);
228 SMESH::SMESH_MeshEditor::Sew_Error
229 SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
230 CORBA::Long SecondNodeIDOnFreeBorder,
231 CORBA::Long LastNodeIDOnFreeBorder,
232 CORBA::Long FirstNodeIDOnSide,
233 CORBA::Long LastNodeIDOnSide,
234 CORBA::Boolean CreatePolygons,
235 CORBA::Boolean CreatePolyedrs);
236 SMESH::SMESH_MeshEditor::Sew_Error
237 SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
238 const SMESH::long_array& IDsOfSide2Elements,
239 CORBA::Long NodeID1OfSide1ToMerge,
240 CORBA::Long NodeID1OfSide2ToMerge,
241 CORBA::Long NodeID2OfSide1ToMerge,
242 CORBA::Long NodeID2OfSide2ToMerge);
245 * Set new nodes for given element.
246 * If number of nodes is not corresponded to type of
247 * element - returns false
249 CORBA::Boolean ChangeElemNodes(CORBA::Long ide, const SMESH::long_array& newIDs);
252 * If during last operation of MeshEditor some nodes were
253 * created this method returns list of it's IDs, if new nodes
254 * not creared - returns empty list
256 SMESH::long_array* GetLastCreatedNodes();
259 * If during last operation of MeshEditor some elements were
260 * created this method returns list of it's IDs, if new elements
261 * not creared - returns empty list
263 SMESH::long_array* GetLastCreatedElems();
270 * \brief Update myLastCreatedNodes and myLastCreatedElems
271 * \param anEditor - it contains edition results
273 void UpdateLastResult(::SMESH_MeshEditor& anEditor);
276 * \brief Return edited mesh ID
277 * \retval int - mesh ID
279 int GetMeshId() const { return _myMesh->GetId(); }
282 SMESHDS_Mesh * GetMeshDS() { return _myMesh->GetMeshDS(); }
284 SMESH::long_array_var myLastCreatedElems;
285 SMESH::long_array_var myLastCreatedNodes;