Salome HOME
1b626ad5e965fc44f97772d381347ddd9903e3eb
[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      * Create nodes and elements in <theMesh> using nodes
84      * coordinates computed by either of Apply...() methods
85      */
86     boolean MakeMesh(in SMESH_Mesh theMesh);
87
88     /*!
89      * Return the loaded pattern in the string form to be saved in file
90      */
91     string GetString();
92
93     /*!
94      * error code of the last of one of above operations
95      */
96     enum ErrorCode {
97       ERR_OK,
98       // Load(file)
99       ERR_READ_NB_POINTS, // couldn't read nb of points
100       ERR_READ_POINT_COORDS, // invalid nb of point coordinates
101       ERR_READ_TOO_FEW_POINTS,  // too few points in a pattern
102       ERR_READ_3D_COORD,  // coordinate of 3D point out of [0,1] range
103       ERR_READ_NO_KEYPOINT, // no key-points in 2D pattern
104       ERR_READ_BAD_INDEX, // invalid point index
105       ERR_READ_ELEM_POINTS, // invalid nb of points in element
106       ERR_READ_NO_ELEMS, // no elements in a pattern
107       ERR_READ_BAD_KEY_POINT, // a key-point not on a boundary
108       // Save(file)
109       ERR_SAVE_NOT_LOADED, // pattern was not loaded
110       // Load(shape)
111       ERR_LOAD_EMPTY_SUBMESH, // no elements to load
112       // Load(face)
113       ERR_LOADF_NARROW_FACE, // too narrow face
114       ERR_LOADF_CLOSED_FACE, // closed face
115       // Load(volume)
116       ERR_LOADV_BAD_SHAPE, // volume is not a brick of 6 faces
117       ERR_LOADV_COMPUTE_PARAMS, // cant compute point parameters
118       // Apply(shape)
119       ERR_APPL_NOT_LOADED, // pattern was not loaded
120       ERR_APPL_BAD_DIMENTION, // wrong shape dimention
121       ERR_APPL_BAD_NB_VERTICES, // keypoints - vertices mismatch
122       // Apply(face)
123       ERR_APPLF_BAD_TOPOLOGY, // bad pattern topology
124       ERR_APPLF_BAD_VERTEX, // first vertex not on an outer face boundary
125       ERR_APPLF_INTERNAL_EEROR, // program error
126       // Apply(volume)
127       ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
128       // MakeMesh
129       ERR_MAKEM_NOT_COMPUTED // mapping failed
130       };
131
132     /*!
133      * Return error code of the last operation
134      */
135     ErrorCode GetErrorCode();
136
137     /*!
138      * Return true if the loaded pattern is a 2D one
139      */
140     boolean Is2D();
141
142     /*!
143      * Return coordinates of pattern points
144      */
145     point_array GetPoints();
146
147     /*!
148      * Return indices of key-points within the arrays returned by
149      * GetPoints()
150      */
151     long_array GetKeyPoints();
152
153     /*!
154      * Return nodal connectivity of the elements of the pattern
155      */
156     array_of_long_array GetElementPoints();
157   };
158 };
159
160 #endif