Salome HOME
Implementation of new pattern mapping algorthm (mesh refinement)
[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      */
108     boolean MakeMesh(in SMESH_Mesh theMesh);
109
110     /*!
111      * Return the loaded pattern in the string form to be saved in file
112      */
113     string GetString();
114
115     /*!
116      * error code of the last of one of above operations
117      */
118     enum ErrorCode {
119       ERR_OK,
120       // Load(file)
121       ERR_READ_NB_POINTS, // couldn't read nb of points
122       ERR_READ_POINT_COORDS, // invalid nb of point coordinates
123       ERR_READ_TOO_FEW_POINTS,  // too few points in a pattern
124       ERR_READ_3D_COORD,  // coordinate of 3D point out of [0,1] range
125       ERR_READ_NO_KEYPOINT, // no key-points in 2D pattern
126       ERR_READ_BAD_INDEX, // invalid point index
127       ERR_READ_ELEM_POINTS, // invalid nb of points in element
128       ERR_READ_NO_ELEMS, // no elements in a pattern
129       ERR_READ_BAD_KEY_POINT, // a key-point not on a boundary
130       // Save(file)
131       ERR_SAVE_NOT_LOADED, // pattern was not loaded
132       // Load(shape)
133       ERR_LOAD_EMPTY_SUBMESH, // no elements to load
134       // Load(face)
135       ERR_LOADF_NARROW_FACE, // too narrow face
136       ERR_LOADF_CLOSED_FACE, // closed face
137       // Load(volume)
138       ERR_LOADV_BAD_SHAPE, // volume is not a brick of 6 faces
139       ERR_LOADV_COMPUTE_PARAMS, // cant compute point parameters
140       // Apply(shape)
141       ERR_APPL_NOT_LOADED, // pattern was not loaded
142       ERR_APPL_BAD_DIMENTION, // wrong shape dimention
143       ERR_APPL_BAD_NB_VERTICES, // keypoints - vertices mismatch
144       // Apply(face)
145       ERR_APPLF_BAD_TOPOLOGY, // bad pattern topology
146       ERR_APPLF_BAD_VERTEX, // first vertex not on an outer face boundary
147       ERR_APPLF_INTERNAL_EEROR, // program error
148       // Apply(volume)
149       ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
150       // MakeMesh
151       ERR_MAKEM_NOT_COMPUTED // mapping failed
152       };
153
154     /*!
155      * Return error code of the last operation
156      */
157     ErrorCode GetErrorCode();
158
159     /*!
160      * Return true if the loaded pattern is a 2D one
161      */
162     boolean Is2D();
163
164     /*!
165      * Return coordinates of pattern points
166      */
167     point_array GetPoints();
168
169     /*!
170      * Return indices of key-points within the arrays returned by
171      * GetPoints()
172      */
173     long_array GetKeyPoints();
174
175     /*!
176      * Return nodal connectivity of the elements of the pattern
177      * or of all elements to be crated
178      */
179     array_of_long_array GetElementPoints(in boolean all);
180   };
181 };
182
183 #endif