programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
mei
mei_node.h
Go to the documentation of this file.
1
#ifndef __MEI_NODE_H__
2
#define __MEI_NODE_H__
3
10
/*
11
This file is part of Code_Saturne, a general-purpose CFD tool.
12
13
Copyright (C) 1998-2013 EDF S.A.
14
15
This program is free software; you can redistribute it and/or modify it under
16
the terms of the GNU General Public License as published by the Free Software
17
Foundation; either version 2 of the License, or (at your option) any later
18
version.
19
20
This program is distributed in the hope that it will be useful, but WITHOUT
21
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23
details.
24
25
You should have received a copy of the GNU General Public License along with
26
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
27
Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
*/
29
30
/*----------------------------------------------------------------------------*/
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
/* __cplusplus */
35
36
37
/*----------------------------------------------------------------------------
38
* Local headers
39
*----------------------------------------------------------------------------*/
40
41
#include "
mei_hash_table.h
"
42
43
/*============================================================================
44
* Type definitions
45
*============================================================================*/
46
51
typedef
struct
52
{
53
double
value
;
54
}
const_node_t
;
55
60
typedef
struct
61
{
62
char
*
i
;
63
int
l
;
64
int
c
;
65
}
id_node_t
;
66
71
typedef
struct
72
{
73
char
*
name
;
74
int
l
;
75
int
c
;
76
struct
_mei_node_t
*
op
;
77
}
func_node_t
;
78
83
typedef
struct
84
{
85
char
*
name
;
86
int
l
;
87
int
c
;
88
int
nops
;
89
struct
_mei_node_t
*op[];
90
}
func2_node_t
;
91
96
typedef
struct
97
{
98
char
*
name
;
99
char
*
data
;
100
int
l
;
101
int
c
;
102
int
col1
;
103
int
col2
;
104
struct
_mei_node_t
*
op
;
105
}
interp1d_node_t
;
106
111
typedef
struct
112
{
113
int
oper
;
114
int
nops
;
115
struct
_mei_node_t
*op[];
116
}
opr_node_t
;
117
122
typedef
union
123
{
124
const_node_t
con
;
/* constants */
125
id_node_t
id
;
/* identifiers */
126
func_node_t
func
;
/* function with one argument */
127
func2_node_t
funcx
;
/* function with two, three, or four arguments */
128
interp1d_node_t
interp1d
;
/* function of 1D interpolation */
129
opr_node_t
opr
;
/* operators */
130
}
node_type_t
;
131
136
/* union must be last entry in _mei_node_t */
137
/* because operNodeType may dynamically increase */
138
139
struct
_mei_node_t
140
{
141
mei_flag_t
flag
;
142
hash_table_t *
ht
;
143
node_type_t
*
type
;
144
};
145
150
typedef
struct
_mei_node_t
mei_node_t;
151
152
/*============================================================================
153
* Public function prototypes
154
*============================================================================*/
155
156
/*----------------------------------------------------------------------------*/
157
/* Build a node for a constant.
158
*
159
* param [in] value real value of the constant
160
*
161
* return built node
162
*/
163
/*----------------------------------------------------------------------------*/
164
165
mei_node_t *
166
mei_const_node
(
const
double
value);
167
168
/*----------------------------------------------------------------------------*/
169
/* Build a node for a variable.
170
*
171
* param [in] variable label of the variable
172
*
173
* return built node
174
*/
175
/*----------------------------------------------------------------------------*/
176
177
mei_node_t *
178
mei_id_node
(
const
char
*variable);
179
180
/*----------------------------------------------------------------------------*/
181
/* Build a node for a function of a single variable.
182
*
183
* param [in] function label of the function
184
* param [in] expr node that represents the variable of the function
185
*
186
* return built node
187
*/
188
/*----------------------------------------------------------------------------*/
189
190
mei_node_t *
191
mei_func_node
(
const
char
*
const
,
192
mei_node_t *
const
expr);
193
194
/*----------------------------------------------------------------------------*/
195
/* Build a node for a function of a several variables.
196
*
197
* param [in] function label of the function
198
* param [in] nops number of variables
199
* param [in] ... list of nodes which represent variables of the function
200
*
201
* return built node
202
*/
203
/*----------------------------------------------------------------------------*/
204
205
mei_node_t *
206
mei_funcx_node
(
const
char
*
function
,
207
const
int
nops,
208
...);
209
210
/*----------------------------------------------------------------------------*/
211
/* Build a node for an 1D interpolation.
212
*
213
* param [in] function interp1d
214
* param [in] data name of the file which contains data
215
* param [in] col1 abscissa for interpolation
216
* param [in] col2 ordinate for interpolation
217
* param [in] expr node that represents the variable to be interpolate
218
*
219
* return built node
220
*/
221
/*----------------------------------------------------------------------------*/
222
223
mei_node_t *
224
mei_interp1d_node
(
const
char
*
function
,
225
const
mei_node_t *data,
226
const
mei_node_t *col1,
227
const
mei_node_t *col2,
228
const
mei_node_t *expr);
229
230
/*----------------------------------------------------------------------------*/
231
/*
232
* Build a node for an operators and its operands.
233
*
234
* param [in] oper operator
235
* param [in] nops number of operand
236
* param [in] ... list of nodes which represent operands
237
*
238
* return built node
239
*/
240
/*----------------------------------------------------------------------------*/
241
242
mei_node_t *
243
mei_opr_node
(
const
int
oper,
244
const
int
nops,
245
...);
246
247
/*----------------------------------------------------------------------------*/
248
/*
249
* Return label of a node.
250
*
251
* param [in] n node
252
*
253
* return label of a node
254
*/
255
/*----------------------------------------------------------------------------*/
256
257
char
*
258
mei_label_node
(mei_node_t *p);
259
260
/*----------------------------------------------------------------------------*/
261
/*
262
* Free memory.
263
*
264
* param [in] n node
265
*/
266
/*----------------------------------------------------------------------------*/
267
268
void
269
mei_free_node
(mei_node_t *p);
270
271
/*----------------------------------------------------------------------------*/
272
273
#ifdef __cplusplus
274
}
275
#endif
/* __cplusplus */
276
277
#endif
/* __NODE_H__ */
278
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1