1
/*============================================================================
3
* This file is part of the Code_Saturne Kernel, element of the
4
* Code_Saturne CFD tool.
6
* Copyright (C) 1998-2009 EDF S.A., France
8
* contact: saturne-support@edf.fr
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.
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.
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
26
*============================================================================*/
28
#ifndef __CS_CALCIUM_H__
29
#define __CS_CALCIUM_H__
31
/*============================================================================
32
* Basic CALCIUM-mappable functions for code coupling using SALOME's YACS
33
*============================================================================*/
35
/*----------------------------------------------------------------------------
37
*----------------------------------------------------------------------------*/
41
/*----------------------------------------------------------------------------*/
45
/*=============================================================================
46
* Local Macro Definitions
47
*============================================================================*/
49
/* Instance continuation directive */
51
#define CS_CALCIUM_CONTINUE 20
52
#define CS_CALCIUM_STOP 22
54
/* Maximum string Lengths (based on CALCIUM's limits) */
56
#define CS_CALCIUM_INSTANCE_LEN 72
57
#define CS_CALCIUM_VARIABLE_LEN 144
59
/*=============================================================================
61
*============================================================================*/
63
/* CALCIUM Variable type dependency */
67
CALCIUM_time, /* Physical time */
68
CALCIUM_iteration /* Iteration number */
70
} cs_calcium_timedep_t;
72
/* CALCIUM Variable type dependency */
76
CALCIUM_continue, /* Use last values after disconnect */
77
CALCIUM_stop /* Stop after disconnect */
79
} cs_calcium_continuation_t;
81
/*=============================================================================
82
* Public function prototypes
83
*============================================================================*/
85
/*----------------------------------------------------------------------------
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)
94
* 0 in case of success, error code otherwise
95
*----------------------------------------------------------------------------*/
98
cs_calcium_connect(int comp_id,
101
/*----------------------------------------------------------------------------
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)
109
* 0 in case of success, error code otherwise
110
*----------------------------------------------------------------------------*/
113
cs_calcium_disconnect(int comp_id,
114
cs_calcium_continuation_t cont);
116
/*----------------------------------------------------------------------------
117
* Read values, blocking until they are available.
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
131
* 0 in case of success, error code otherwise
132
*----------------------------------------------------------------------------*/
135
cs_calcium_read_int(int comp_id,
136
cs_calcium_timedep_t time_dep,
140
const char *var_name,
146
cs_calcium_read_float(int comp_id,
147
cs_calcium_timedep_t time_dep,
151
const char *var_name,
157
cs_calcium_read_double(int comp_id,
158
cs_calcium_timedep_t time_dep,
162
const char *var_name,
167
/*----------------------------------------------------------------------------
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
180
* 0 in case of success, error code otherwise
181
*----------------------------------------------------------------------------*/
184
cs_calcium_write_int(int comp_id,
185
cs_calcium_timedep_t time_dep,
188
const char *var_name,
193
cs_calcium_write_float(int comp_id,
194
cs_calcium_timedep_t time_dep,
197
const char *var_name,
202
cs_calcium_write_double(int comp_id,
203
cs_calcium_timedep_t time_dep,
206
const char *var_name,
210
/*----------------------------------------------------------------------------
211
* Assign a component and its id
214
* comp_id <-- id of component (0 to n-1, Code_Saturne local)
215
* comp <-- pointer to component
216
*----------------------------------------------------------------------------*/
219
cs_calcium_set_component(int comp_id,
222
/*----------------------------------------------------------------------------
223
* Set proxy IPC communication mode
224
*----------------------------------------------------------------------------*/
227
cs_calcium_set_comm_proxy(void);
229
/*----------------------------------------------------------------------------
230
* Set the CALCIUM-mappable function's verbosity
233
* n_echo <-- verbosity (none if -1, headers if 0,
234
* headers + n first and last elements if > 0.
235
*----------------------------------------------------------------------------*/
238
cs_calcium_set_verbosity(int n_echo);
240
/*----------------------------------------------------------------------------
241
* Load YACS and corresponding Calcium functions.
244
* lib_path <-- path to shared library containing the yacsinit() function.
245
*----------------------------------------------------------------------------*/
248
cs_calcium_load_yacs(const char *lib_path);
250
/*----------------------------------------------------------------------------
251
* Unload YACS and corresponding Calcium functions
252
*----------------------------------------------------------------------------*/
255
cs_calcium_unload_yacs(void);
257
/*----------------------------------------------------------------------------
258
* Initialize YACS component and enter event loop.
260
* This must be called after cs_calcium_load_yacs().
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
*----------------------------------------------------------------------------*/
268
cs_calcium_start_yacs(void);
270
/*----------------------------------------------------------------------------*/
274
#endif /* __CS_CALCIUM_H__ */