~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to include/base/cs_calcium.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*============================================================================
2
 
 *
3
 
 *     This file is part of the Code_Saturne Kernel, element of the
4
 
 *     Code_Saturne CFD tool.
5
 
 *
6
 
 *     Copyright (C) 1998-2009 EDF S.A., France
7
 
 *
8
 
 *     contact: saturne-support@edf.fr
9
 
 *
10
 
 *     The Code_Saturne Kernel is free software; you can redistribute it
11
 
 *     and/or modify it under the terms of the GNU General Public License
12
 
 *     as published by the Free Software Foundation; either version 2 of
13
 
 *     the License, or (at your option) any later version.
14
 
 *
15
 
 *     The Code_Saturne Kernel is distributed in the hope that it will be
16
 
 *     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17
 
 *     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 *     GNU General Public License for more details.
19
 
 *
20
 
 *     You should have received a copy of the GNU General Public License
21
 
 *     along with the Code_Saturne Kernel; if not, write to the
22
 
 *     Free Software Foundation, Inc.,
23
 
 *     51 Franklin St, Fifth Floor,
24
 
 *     Boston, MA  02110-1301  USA
25
 
 *
26
 
 *============================================================================*/
27
 
 
28
 
#ifndef __CS_CALCIUM_H__
29
 
#define __CS_CALCIUM_H__
30
 
 
31
 
/*============================================================================
32
 
 * Basic CALCIUM-mappable functions for code coupling using SALOME's YACS
33
 
 *============================================================================*/
34
 
 
35
 
/*----------------------------------------------------------------------------
36
 
 *  Local headers
37
 
 *----------------------------------------------------------------------------*/
38
 
 
39
 
#include "cs_base.h"
40
 
 
41
 
/*----------------------------------------------------------------------------*/
42
 
 
43
 
BEGIN_C_DECLS
44
 
 
45
 
/*=============================================================================
46
 
 * Local Macro Definitions
47
 
 *============================================================================*/
48
 
 
49
 
/* Instance continuation directive */
50
 
 
51
 
#define CS_CALCIUM_CONTINUE  20
52
 
#define CS_CALCIUM_STOP      22
53
 
 
54
 
/* Maximum string Lengths (based on CALCIUM's limits) */
55
 
 
56
 
#define CS_CALCIUM_INSTANCE_LEN 72
57
 
#define CS_CALCIUM_VARIABLE_LEN 144
58
 
 
59
 
/*=============================================================================
60
 
 * Type Definitions
61
 
 *============================================================================*/
62
 
 
63
 
/* CALCIUM Variable type dependency */
64
 
 
65
 
typedef enum {
66
 
 
67
 
  CALCIUM_time,         /* Physical time */
68
 
  CALCIUM_iteration     /* Iteration number */
69
 
 
70
 
} cs_calcium_timedep_t;
71
 
 
72
 
/* CALCIUM Variable type dependency */
73
 
 
74
 
typedef enum {
75
 
 
76
 
  CALCIUM_continue,     /* Use last values after disconnect */
77
 
  CALCIUM_stop          /* Stop after disconnect */
78
 
 
79
 
} cs_calcium_continuation_t;
80
 
 
81
 
/*=============================================================================
82
 
 * Public function prototypes
83
 
 *============================================================================*/
84
 
 
85
 
/*----------------------------------------------------------------------------
86
 
 * Connection
87
 
 *
88
 
 * parameters:
89
 
 *   comp_id <-- id of component to connect (0 to n-1, Code_Saturne local)
90
 
 *   s       --> name of calling instance
91
 
 *               (CS_CALCIUM_INSTANCE_LEN chars max)
92
 
 *
93
 
 * returns:
94
 
 *   0 in case of success, error code otherwise
95
 
 *----------------------------------------------------------------------------*/
96
 
 
97
 
int
98
 
cs_calcium_connect(int   comp_id,
99
 
                   char *s);
100
 
 
101
 
/*----------------------------------------------------------------------------
102
 
 * Disconnection
103
 
 *
104
 
 * parameters:
105
 
 *   comp_id <-- id of component to connect (0 to n-1, Code_Saturne local)
106
 
 *   cont    --> continuation directive (continue with last values or stop)
107
 
 *
108
 
 * returns:
109
 
 *   0 in case of success, error code otherwise
110
 
 *----------------------------------------------------------------------------*/
111
 
 
112
 
int
113
 
cs_calcium_disconnect(int                       comp_id,
114
 
                      cs_calcium_continuation_t cont);
115
 
 
116
 
/*----------------------------------------------------------------------------
117
 
 * Read values, blocking until they are available.
118
 
 *
119
 
 * parameters:
120
 
 *   comp_id    <-- id of component to connect (0 to n-1, Code_Saturne local)
121
 
 *   time_dep   <-- type of time dependency (time or iteration)
122
 
 *   min_time   <-> lower bound of read interval
123
 
 *   max_time   <-- upper bound of read interval
124
 
 *   iteration  <-> iteration number of read
125
 
 *   var_name   <-- name of the variable to read
126
 
 *   n_val_max  <-- maximum number of values to read
127
 
 *   n_val_read <-- maximum number of values to read
128
 
 *   val        --> values read
129
 
 *
130
 
 * returns:
131
 
 *   0 in case of success, error code otherwise
132
 
 *----------------------------------------------------------------------------*/
133
 
 
134
 
int
135
 
cs_calcium_read_int(int                    comp_id,
136
 
                    cs_calcium_timedep_t   time_dep,
137
 
                    double                *min_time,
138
 
                    double                *max_time,
139
 
                    int                   *iteration,
140
 
                    const char            *var_name,
141
 
                    int                    n_val_max,
142
 
                    int                   *n_val_read,
143
 
                    int                    val[]);
144
 
 
145
 
int
146
 
cs_calcium_read_float(int                    comp_id,
147
 
                      cs_calcium_timedep_t   time_dep,
148
 
                      double                *min_time,
149
 
                      double                *max_time,
150
 
                      int                   *iteration,
151
 
                      const char            *var_name,
152
 
                      int                    n_val_max,
153
 
                      int                   *n_val_read,
154
 
                      float                  val[]);
155
 
 
156
 
int
157
 
cs_calcium_read_double(int                    comp_id,
158
 
                       cs_calcium_timedep_t   time_dep,
159
 
                       double                *min_time,
160
 
                       double                *max_time,
161
 
                       int                   *iteration,
162
 
                       const char            *var_name,
163
 
                       int                    n_val_max,
164
 
                       int                   *n_val_read,
165
 
                       double                 val[]);
166
 
 
167
 
/*----------------------------------------------------------------------------
168
 
 * Write values.
169
 
 *
170
 
 * parameters:
171
 
 *   comp_id    <-- id of component to connect (0 to n-1, Code_Saturne local)
172
 
 *   time_dep   <-- type of time dependency (time or iteration)
173
 
 *   cur_time   <-- current time
174
 
 *   iteration  <-- iteration number
175
 
 *   var_name   <-- name of the variable to read
176
 
 *   n_val      <-- number of values to read
177
 
 *   val        <-- values written
178
 
 *
179
 
 * returns:
180
 
 *   0 in case of success, error code otherwise
181
 
 *----------------------------------------------------------------------------*/
182
 
 
183
 
int
184
 
cs_calcium_write_int(int                    comp_id,
185
 
                     cs_calcium_timedep_t   time_dep,
186
 
                     double                 cur_time,
187
 
                     int                    iteration,
188
 
                     const char            *var_name,
189
 
                     int                    n_val,
190
 
                     const int              val[]);
191
 
 
192
 
int
193
 
cs_calcium_write_float(int                    comp_id,
194
 
                       cs_calcium_timedep_t   time_dep,
195
 
                       double                 cur_time,
196
 
                       int                    iteration,
197
 
                       const char            *var_name,
198
 
                       int                    n_val,
199
 
                       const float            val[]);
200
 
 
201
 
int
202
 
cs_calcium_write_double(int                    comp_id,
203
 
                        cs_calcium_timedep_t   time_dep,
204
 
                        double                 cur_time,
205
 
                        int                    iteration,
206
 
                        const char            *var_name,
207
 
                        int                    n_val,
208
 
                        const double           val[]);
209
 
 
210
 
/*----------------------------------------------------------------------------
211
 
 * Assign a component and its id
212
 
 *
213
 
 * parameters:
214
 
 *   comp_id <-- id of component (0 to n-1, Code_Saturne local)
215
 
 *   comp    <-- pointer to component
216
 
 *----------------------------------------------------------------------------*/
217
 
 
218
 
void
219
 
cs_calcium_set_component(int    comp_id,
220
 
                         void  *comp);
221
 
 
222
 
/*----------------------------------------------------------------------------
223
 
 * Set proxy IPC communication mode
224
 
 *----------------------------------------------------------------------------*/
225
 
 
226
 
void
227
 
cs_calcium_set_comm_proxy(void);
228
 
 
229
 
/*----------------------------------------------------------------------------
230
 
 * Set the CALCIUM-mappable function's verbosity
231
 
 *
232
 
 * parameters:
233
 
 *   n_echo <-- verbosity (none if -1, headers if 0,
234
 
 *              headers + n first and last elements if > 0.
235
 
 *----------------------------------------------------------------------------*/
236
 
 
237
 
void
238
 
cs_calcium_set_verbosity(int  n_echo);
239
 
 
240
 
/*----------------------------------------------------------------------------
241
 
 * Load YACS and corresponding Calcium functions.
242
 
 *
243
 
 * parameters:
244
 
 *   lib_path <-- path to shared library containing the yacsinit() function.
245
 
 *----------------------------------------------------------------------------*/
246
 
 
247
 
void
248
 
cs_calcium_load_yacs(const char *lib_path);
249
 
 
250
 
/*----------------------------------------------------------------------------
251
 
 * Unload YACS and corresponding Calcium functions
252
 
 *----------------------------------------------------------------------------*/
253
 
 
254
 
void
255
 
cs_calcium_unload_yacs(void);
256
 
 
257
 
/*----------------------------------------------------------------------------
258
 
 * Initialize YACS component and enter event loop.
259
 
 *
260
 
 * This must be called after cs_calcium_load_yacs().
261
 
 *
262
 
 * Note that the YACS event loop does not return, sot the YACS component
263
 
 * description should ensure that the code's main run() method (or similar)
264
 
 * is called in the component body.
265
 
 *----------------------------------------------------------------------------*/
266
 
 
267
 
void
268
 
cs_calcium_start_yacs(void);
269
 
 
270
 
/*----------------------------------------------------------------------------*/
271
 
 
272
 
END_C_DECLS
273
 
 
274
 
#endif /* __CS_CALCIUM_H__ */
275