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