Salome HOME
Improvement of extrusion functionality
[modules/smesh.git] / idl / SMESH_Pattern.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 //
20 //
21 //
22 // File    : SMESH_Pattern.idl
23 // Created : Mon Aug  2 10:48:36 2004
24 // Author  : Edward AGAPOV (eap)
25 //  $Header:
26
27 #ifndef _SMESH_PATTERN_IDL_
28 #define _SMESH_PATTERN_IDL_
29
30 #include "SMESH_Mesh.idl"
31
32 module SMESH
33 {
34   
35   typedef sequence<SMESH::PointStruct> point_array;
36
37   /*!
38    * SMESH_Pattern: interface of mesh pattern
39    */
40   interface SMESH_Pattern {
41
42     /*!
43      * Load a pattern from the string <theFileContents>
44      */
45     boolean LoadFromFile(in string theFileContents);
46
47     /*!
48      * Create a pattern from the mesh built on <theFace>.
49      * <theProject>==true makes override nodes positions
50      * on <theFace> computed by mesher
51      */
52     boolean LoadFromFace(in SMESH_Mesh        theMesh,
53                          in GEOM::GEOM_Object theFace,
54                          in boolean           theProject);
55
56     /*!
57      * Create a pattern from the mesh built on <theBlock>
58      */
59     boolean LoadFrom3DBlock(in SMESH_Mesh        theMesh,
60                             in GEOM::GEOM_Object theBlock);
61
62     /*!
63      * Compute nodes coordinates applying
64      * the loaded pattern to <theFace>. The first key-point
65      * will be mapped into <theVertexOnKeyPoint1>, which must
66      * be in the outer wire of theFace
67      */
68     point_array  ApplyToFace(in GEOM::GEOM_Object theFace,
69                              in GEOM::GEOM_Object theVertexOnKeyPoint1,
70                              in boolean           theReverse);
71
72     /*!
73      * Compute nodes coordinates applying
74      * the loaded pattern to <theBlock>. The (0,0,0) key-point
75      * will be mapped into <theVertex000>. The (0,0,1) 
76      * key-point will be mapped into <theVertex001>.
77      */
78     point_array  ApplyTo3DBlock(in GEOM::GEOM_Object theBlock,
79                                 in GEOM::GEOM_Object theVertex000,
80                                 in GEOM::GEOM_Object theVertex001);
81
82     /*!
83      * Compute nodes coordinates applying
84      * the loaded pattern to mesh faces. The first key-point
85      * will be mapped into <theNodeIndexOnKeyPoint1>-th node of each face
86      */
87     point_array  ApplyToMeshFaces(in SMESH_Mesh theMesh,
88                                   in long_array theFacesIDs,
89                                   in long       theNodeIndexOnKeyPoint1,
90                                   in boolean    theReverse);
91
92     /*!
93      * Compute nodes coordinates applying
94      * the loaded pattern to hexahedrons. The (0,0,0) key-point
95      * will be mapped into <theNode000Index>-th node of each volume.
96      * The (0,0,1) key-point will be mapped into <theNode001Index>-th
97      * node of each volume.
98      */
99     point_array  ApplyToHexahedrons(in SMESH_Mesh theMesh,
100                                     in long_array theVolumesIDs,
101                                     in long       theNode000Index,
102                                     in long       theNode001Index);
103
104     /*!
105      * Create nodes and elements in <theMesh> using nodes
106      * coordinates computed by either of Apply...() methods.
107      * If CreatePolygons is TRUE, replace adjacent faces by polygons
108      * to keep mesh conformity.
109      * If CreatePolyedrs is TRUE, replace adjacent volumes by polyedrs
110      * to keep mesh conformity.
111      */
112     boolean MakeMesh (in SMESH_Mesh theMesh,
113                       in boolean    CreatePolygons,
114                       in boolean    CreatePolyedrs);
115
116     /*!
117      * Return the loaded pattern in the string form to be saved in file
118      */
119     string GetString();
120
121     /*!
122      * error code of the last of one of above operations
123      */
124     enum ErrorCode {
125       ERR_OK,
126       // Load(file)
127       ERR_READ_NB_POINTS, // couldn't read nb of points
128       ERR_READ_POINT_COORDS, // invalid nb of point coordinates
129       ERR_READ_TOO_FEW_POINTS,  // too few points in a pattern
130       ERR_READ_3D_COORD,  // coordinate of 3D point out of [0,1] range
131       ERR_READ_NO_KEYPOINT, // no key-points in 2D pattern
132       ERR_READ_BAD_INDEX, // invalid point index
133       ERR_READ_ELEM_POINTS, // invalid nb of points in element
134       ERR_READ_NO_ELEMS, // no elements in a pattern
135       ERR_READ_BAD_KEY_POINT, // a key-point not on a boundary
136       // Save(file)
137       ERR_SAVE_NOT_LOADED, // pattern was not loaded
138       // Load(shape)
139       ERR_LOAD_EMPTY_SUBMESH, // no elements to load
140       // Load(face)
141       ERR_LOADF_NARROW_FACE, // too narrow face
142       ERR_LOADF_CLOSED_FACE, // closed face
143       // Load(volume)
144       ERR_LOADV_BAD_SHAPE, // volume is not a brick of 6 faces
145       ERR_LOADV_COMPUTE_PARAMS, // cant compute point parameters
146       // Apply(shape)
147       ERR_APPL_NOT_LOADED, // pattern was not loaded
148       ERR_APPL_BAD_DIMENTION, // wrong shape dimention
149       ERR_APPL_BAD_NB_VERTICES, // keypoints - vertices mismatch
150       // Apply(face)
151       ERR_APPLF_BAD_TOPOLOGY, // bad pattern topology
152       ERR_APPLF_BAD_VERTEX, // first vertex not on an outer face boundary
153       ERR_APPLF_INTERNAL_EEROR, // program error
154       // Apply(volume)
155       ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
156       // MakeMesh
157       ERR_MAKEM_NOT_COMPUTED // mapping failed
158       };
159
160     /*!
161      * Return error code of the last operation
162      */
163     ErrorCode GetErrorCode();
164
165     /*!
166      * Return true if the loaded pattern is a 2D one
167      */
168     boolean Is2D();
169
170     /*!
171      * Return coordinates of pattern points
172      */
173     point_array GetPoints();
174
175     /*!
176      * Return indices of key-points within the arrays returned by
177      * GetPoints()
178      */
179     long_array GetKeyPoints();
180
181     /*!
182      * Return nodal connectivity of the elements of the pattern
183      * or of all elements to be crated
184      */
185     array_of_long_array GetElementPoints(in boolean all);
186   };
187 };
188
189 #endif