programmer's documentation
cs_restart_default.h
Go to the documentation of this file.
1 #ifndef __CS_RESTART_DEFAULT_H__
2 #define __CS_RESTART_DEFAULT_H__
3 
4 /*============================================================================
5  * Checkpoint/restart handling for default application.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2015 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 #include "cs_field.h"
36 #include "cs_map.h"
37 #include "cs_restart.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*=============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
47 /*============================================================================
48  * Type definitions
49  *============================================================================*/
50 
51 /*=============================================================================
52  * Public function prototypes
53  *============================================================================*/
54 
55 /*----------------------------------------------------------------------------
56  * Read field metadata from checkpoint.
57  *
58  * Old ids associated to each field are determined for future use.
59  * Note that when reading legacy files (Code_Saturne version 3.3 and below),
60  * the old id will actually be the old scalar id (-1 for others).
61  *
62  * parameters:
63  * r <-> associated restart file pointer
64  * old_field_map --> name to id map of fields in restart file
65  *----------------------------------------------------------------------------*/
66 
67 void
69  cs_map_name_to_id_t **old_field_map);
70 
71 /*----------------------------------------------------------------------------
72  * Write field metadata to checkpoint.
73  *
74  * parameters:
75  * r <-> associated restart file pointer
76  *----------------------------------------------------------------------------*/
77 
78 void
80 
81 /*----------------------------------------------------------------------------
82  * Read variables from checkpoint.
83  *
84  * parameters:
85  * r <-> associated restart file pointer
86  * old_field_map <-- name to id map of fields in restart file
87  * t_id_flag <-- -1: all time values; 0: current values;
88  * > 0: previous values
89  * read_flag <-- optional flag to track fields read, or NULL;
90  * set to sum of 2^time_id for fields read (size: n_fields)
91  *----------------------------------------------------------------------------*/
92 
93 void
95  const cs_map_name_to_id_t *old_field_map,
96  int t_id_flag,
97  int read_flag[]);
98 
99 /*----------------------------------------------------------------------------
100  * Write variables to checkpoint.
101  *
102  * parameters:
103  * r <-> associated restart file pointer
104  * t_id_flag <-- -1: all time values; 0: current values;
105  * > 0: previous values
106  * write_flag <-- optional flag to track fields written, or NULL;
107  * set to sum of 2^time_id for fields written (size: n_fields)
108 *----------------------------------------------------------------------------*/
109 
110 void
112  int t_id_flag,
113  int write_flag[]);
114 
115 /*----------------------------------------------------------------------------
116  * Read fields depending on others from checkpoint.
117  *
118  * Old ids associate to each field are determined for future use.
119  * Note that when reading legacy files (Code_Saturne version 3.3 and below),
120  * the old id will actually be the old scalar id (-1 for others).
121  *
122  * parameters:
123  * r <-> associated restart file pointer
124  * old_field_map <-- name to id map of fields in restart file
125  * key <-- key for field association
126  * read_flag <-- optional flag to track fields read, or NULL;
127  * set to sum of 2^time_id for fields read, -1 for fields
128  * failed to read (size: n_fields)
129  *----------------------------------------------------------------------------*/
130 
131 void
133  const cs_map_name_to_id_t *old_field_map,
134  const char *key,
135  int read_flag[]);
136 
137 /*----------------------------------------------------------------------------
138  * Write fields depending on others to checkpoint.
139  *
140  * Write field metadata to main checkpoint.
141  *
142  * parameters:
143  * r <-> associated restart file pointer
144  * key <-- key for field association
145  * write_flag <-- optional flag to track fields written, or NULL;
146  * set to sum of 2^time_id for fields written (size: n_fields)
147  *
148  * returns:
149  * number of fields written
150  *----------------------------------------------------------------------------*/
151 
152 int
154  const char *key,
155  int write_flag[]);
156 
157 /*----------------------------------------------------------------------------
158  * Read boundary condition coefficients for all fields from checkpoint.
159  *
160  * parameters:
161  * r <-> associated restart file pointer
162  *----------------------------------------------------------------------------*/
163 
164 void
166 
167 /*----------------------------------------------------------------------------
168  * Write boundary condition coefficients for all fields to checkpoint.
169  *
170  * parameters:
171  * r <-> associated restart file pointer
172  *----------------------------------------------------------------------------*/
173 
174 void
176 
177 /*----------------------------------------------------------------------------
178  * Read field values from checkpoint.
179  *
180  * If the values are not found using the default rules based on the
181  * field's name, its name itself, or a "restart_rename" keyed string value,
182  * an old name may be used for compatibility with older files.
183  * For cell-based fields, the old name base is appended automatically with
184  * "_ce_phase01", except for scalars, where the name uses a different scheme,
185  * based on "scalaire_ce_%04" % s_num;
186  *
187  * parameters:
188  * r <-> associated restart file pointer
189  * f_id <-- field id
190  * t_id <-- time id (0 for current, 1 for previous, ...)
191  *
192  * returns:
193  * CS_RESTART_SUCCESS in case of success, CS_RESTART_ERR_... otherwise
194  *----------------------------------------------------------------------------*/
195 
196 int
198  int f_id,
199  int t_id);
200 
201 /*----------------------------------------------------------------------------
202  * Write field values to checkpoint.
203  *
204  * parameters:
205  * r <-> associated restart file pointer
206  * f_id <-- field id
207  * t_id <-- time id (0 for current, 1 for previous, ...)
208  *----------------------------------------------------------------------------*/
209 
210 void
212  int f_id,
213  int t_id);
214 
215 /*----------------------------------------------------------------------------
216  * Read restart time step info.
217  *
218  * parameters:
219  * r <-> associated restart file pointer
220  *----------------------------------------------------------------------------*/
221 
222 void
224 
225 /*----------------------------------------------------------------------------*/
226 
228 
229 #endif /* __CS_RESTART_DEFAULT_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
void cs_restart_write_variables(cs_restart_t *r, int t_id_flag, int write_flag[])
Write variables to checkpoint.
Definition: cs_restart_default.c:1761
void cs_restart_write_field_info(cs_restart_t *r)
Write field metadata to main checkpoint.
Definition: cs_restart_default.c:1548
struct _cs_map_name_to_id_t cs_map_name_to_id_t
Definition: cs_map.h:48
void cs_restart_read_time_step_info(cs_restart_t *r)
Read restart time step info.
Definition: cs_restart_default.c:2572
struct _cs_restart_t cs_restart_t
Definition: cs_restart.h:86
void cs_restart_read_variables(cs_restart_t *r, const cs_map_name_to_id_t *old_field_map, int t_id_flag, int read_flag[])
Read variables from checkpoint.
Definition: cs_restart_default.c:1629
int cs_restart_write_linked_fields(cs_restart_t *r, const char *key, int write_flag[])
Write fields depending on others to checkpoint.
Definition: cs_restart_default.c:2057
void cs_restart_write_bc_coeffs(cs_restart_t *r)
Write boundary condition coefficients for all fields to checkpoint.
Definition: cs_restart_default.c:2326
void cs_restart_read_bc_coeffs(cs_restart_t *r)
Read boundary condition coefficients for all fields from checkpoint.
Definition: cs_restart_default.c:2149
#define END_C_DECLS
Definition: cs_defs.h:430
void cs_restart_read_linked_fields(cs_restart_t *r, const cs_map_name_to_id_t *old_field_map, const char *key, int read_flag[])
Read fields depending on others from checkpoint.
Definition: cs_restart_default.c:1889
void cs_restart_read_field_info(cs_restart_t *r, cs_map_name_to_id_t **old_field_map)
Read field metadata from checkpoint.
Definition: cs_restart_default.c:1408
int cs_restart_read_field_vals(cs_restart_t *r, int f_id, int t_id)
Read field values from checkpoint.
Definition: cs_restart_default.c:2451
void cs_restart_write_field_vals(cs_restart_t *r, int f_id, int t_id)
Write field values to checkpoint.
Definition: cs_restart_default.c:2546