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
base
cs_restart.h
Go to the documentation of this file.
1
#ifndef __CS_RESTART_H__
2
#define __CS_RESTART_H__
3
4
/*============================================================================
5
* Manage checkpoint / restart files
6
*============================================================================*/
7
8
/*
9
This file is part of Code_Saturne, a general-purpose CFD tool.
10
11
Copyright (C) 1998-2013 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
* Standard C library headers
32
*----------------------------------------------------------------------------*/
33
34
/*----------------------------------------------------------------------------
35
* Local headers
36
*----------------------------------------------------------------------------*/
37
38
#include "
cs_defs.h
"
39
#include "
cs_time_step.h
"
40
41
/*----------------------------------------------------------------------------*/
42
43
BEGIN_C_DECLS
44
45
/*============================================================================
46
* Macro definitions
47
*============================================================================*/
48
49
/* Error codes */
50
51
#define CS_RESTART_SUCCESS 0
/* Success */
52
#define CS_RESTART_ERR_FILE_NUM -1
/* No restart file for the given number */
53
#define CS_RESTART_ERR_LOCATION -2
/* Undefined location / incorrect size */
54
#define CS_RESTART_ERR_VAL_TYPE -3
/* Unknown or unexpected value type */
55
#define CS_RESTART_ERR_N_VALS -4
/* Number of values does not match */
56
#define CS_RESTART_ERR_MODE -5
/* Incompatible access mode */
57
#define CS_RESTART_ERR_EXISTS -6
/* Section not available */
58
59
/*============================================================================
60
* Local type definitions
61
*============================================================================*/
62
63
/* Read or write mode */
64
65
typedef
enum
{
66
67
CS_RESTART_MODE_READ
,
/* Read mode */
68
CS_RESTART_MODE_WRITE
/* Write mode */
69
70
}
cs_restart_mode_t
;
71
72
/* Datatype enumeration to transmit a data's type to a function */
73
74
typedef
enum
{
75
CS_TYPE_cs_int_t
,
76
CS_TYPE_cs_gnum_t
,
77
CS_TYPE_cs_real_t
,
78
}
cs_restart_val_type_t
;
79
80
/*
81
Pointer associated with a restart file structure. The structure itself
82
is defined in "cs_restart.c", and is opaque outside that unit.
83
*/
84
85
typedef
struct
_cs_restart_t cs_restart_t;
86
87
/*=============================================================================
88
* Global variables
89
*============================================================================*/
90
91
/*============================================================================
92
* Public Fortran function prototypes
93
*============================================================================*/
94
95
/*----------------------------------------------------------------------------
96
* Indicate if a restart directory is present.
97
*
98
* Fortran interface
99
*
100
* subroutine dflsui (ntsuit, ttsuit, wtsuit)
101
* *****************
102
*
103
* integer ntsuit : <-- : > 0: checkpoint time step interval
104
* : : 0: default interval
105
* : : -1: checkpoint at end
106
* : : -2: no checkpoint
107
* double precision ttsuit : <-- : if> 0, checkpoint time interval
108
* double precision wtsuit : <-- : if> 0, checkpoint wall time interval
109
*----------------------------------------------------------------------------*/
110
111
void
CS_PROCF
(
dflsui
, DFLSUI)
112
(
113
cs_int_t
*ntsuit,
114
cs_real_t
*ttsuit,
115
cs_real_t
*wtsuit
116
);
117
118
/*----------------------------------------------------------------------------
119
* Check if checkpointing is recommended at a given time.
120
*
121
* Fortran interface
122
*
123
* subroutine reqsui (iisuit)
124
* *****************
125
*
126
* integer iisuit : --> : 0 if no restart required, 1 otherwise
127
*----------------------------------------------------------------------------*/
128
129
void
CS_PROCF
(
reqsui
, RESSUI)
130
(
131
cs_int_t
*iisuit
132
);
133
134
/*----------------------------------------------------------------------------
135
* Indicate checkpointing has been done at a given time.
136
*
137
* This updates the status for future checks to determine
138
* if checkpointing is recommended at a given time.
139
*
140
* Fortran interface
141
*
142
* subroutine stusui
143
* *****************
144
*----------------------------------------------------------------------------*/
145
146
void
CS_PROCF
(
stusui
, STUSUI)
147
(
148
void
149
);
150
151
/*----------------------------------------------------------------------------
152
* Indicate if a restart directory is present.
153
*
154
* Fortran interface
155
*
156
* subroutine indsui (isuite)
157
* *****************
158
*
159
* integer isuite : --> : 1 for restart, 0 otherwise
160
*----------------------------------------------------------------------------*/
161
162
void
CS_PROCF
(
indsui
, INDSUI)
163
(
164
cs_int_t
*isuite
165
);
166
167
/*----------------------------------------------------------------------------
168
* Open a restart file
169
*
170
* Fortran interface
171
*
172
* subroutine opnsui (nomsui, lngnom, ireawr, numsui, ierror)
173
* *****************
174
*
175
* character* nomsui : <-- : Restart file name
176
* integer lngnom : <-- : Restart file name length
177
* integer ireawr : <-- : 1: read; 2: write
178
* integer numsui : --> : Number of opened restart file
179
* integer ierror : --> : 0: success; < 0: error code
180
*----------------------------------------------------------------------------*/
181
182
void
CS_PROCF
(
opnsui
, OPNSUI)
183
(
184
const
char
*nomsui,
185
const
cs_int_t
*lngnom,
186
const
cs_int_t
*ireawr,
187
cs_int_t
*numsui,
188
cs_int_t
*ierror
189
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
190
by many Fortran compilers) */
191
);
192
193
/*----------------------------------------------------------------------------
194
* Close a restart file
195
*
196
* Fortran interface
197
*
198
* subroutine clssui (numsui)
199
* *****************
200
*
201
* integer numsui : <-> : Number of restart file to close
202
* integer ierror : --> : 0: success; < 0: error code
203
*----------------------------------------------------------------------------*/
204
205
void
CS_PROCF
(
clssui
, CLSSUI)
206
(
207
const
cs_int_t
*numsui,
208
cs_int_t
*ierror
209
);
210
211
/*----------------------------------------------------------------------------
212
* Check the locations associated with a restart file.
213
*
214
* For each type of entity, return 1 if the associated number of entities
215
* matches the current value (and so that we consider the mesh locations are
216
* the same), 0 otherwise.
217
*
218
* Fortran interface
219
*
220
* subroutine tstsui (numsui, indcel, indfac, indfbr, indsom)
221
* *****************
222
*
223
* integer numsui : <-- : Restart file number
224
* integer indcel : --> : Matching cells flag
225
* integer indfac : --> : Matching interior faces flag
226
* integer indfbr : --> : Matching boundary faces flag
227
* integer indsom : --> : Matching vertices flag
228
*----------------------------------------------------------------------------*/
229
230
void
CS_PROCF
(
tstsui
, TSTSUI)
231
(
232
const
cs_int_t
*numsui,
233
cs_int_t
*indcel,
234
cs_int_t
*indfac,
235
cs_int_t
*indfbr,
236
cs_int_t
*indsom
237
);
238
239
/*----------------------------------------------------------------------------
240
* Print index associated with a restart file in read mode
241
*
242
* Fortran interface
243
*
244
* SUBROUTINE INFSUI (NUMSUI)
245
* *****************
246
*
247
* INTEGER NUMSUI : <-- : Restart file number
248
*----------------------------------------------------------------------------*/
249
250
void
CS_PROCF
(
infsui
, INFSUI)
251
(
252
const
cs_int_t
*numsui
253
);
254
255
/*----------------------------------------------------------------------------
256
* Read a section from a restart file
257
*
258
* Fortran interface
259
*
260
* subroutine lecsui (numsui, nomrub, lngnom, itysup, nbvent, irtype, tabvar)
261
* *****************
262
*
263
* integer numsui : <-- : Restart file number
264
* character* nomrub : <-- : Section name
265
* integer lngnom : <-- : Section name length
266
* integer itysup : <-- : Location type:
267
* : : 0: scalar (no location)
268
* : : 1: cells
269
* : : 2: interior faces
270
* : : 3: boundary faces
271
* : : 4: vertices (if available)
272
* integer nbvent : <-- : N. values per location entity
273
* integer irtype : <-- : 1 for integers, 2 for double precision
274
* (?) tabvar : <-> : Array of values to read
275
* integer ierror : --> : 0: success, < 0: error code
276
*----------------------------------------------------------------------------*/
277
278
void
CS_PROCF
(
lecsui
, LECSUI)
279
(
280
const
cs_int_t
*numsui,
281
const
char
*nomrub,
282
const
cs_int_t
*lngnom,
283
const
cs_int_t
*itysup,
284
const
cs_int_t
*nbvent,
285
const
cs_int_t
*irtype,
286
void
*tabvar,
287
cs_int_t
*ierror
288
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
289
by many Fortran compilers) */
290
);
291
292
/*----------------------------------------------------------------------------
293
* Write a section to a restart file
294
*
295
* Fortran interface
296
*
297
* subroutine ecrsui (numsui, nomrub, lngnom, itysup, nbvent, irtype, tabvar)
298
* *****************
299
*
300
* integer numsui : <-- : Restart file number
301
* character* nomrub : <-- : Section name
302
* integer lngnom : <-- : Section name length
303
* integer itysup : <-- : Location type:
304
* : : 0: scalar (no location)
305
* : : 1: cells
306
* : : 2: interior faces
307
* : : 3: boundary faces
308
* : : 4: vertices (if available)
309
* integer nbvent : <-- : N. values per location entity
310
* integer irtype : <-- : 1 for integers, 2 for double precision
311
* (?) tabvar : <-- : Array of values to write
312
*----------------------------------------------------------------------------*/
313
314
void
CS_PROCF
(
ecrsui
, ECRSUI)
315
(
316
const
cs_int_t
*numsui,
317
const
char
*nomrub,
318
const
cs_int_t
*lngnom,
319
const
cs_int_t
*itysup,
320
const
cs_int_t
*nbvent,
321
const
cs_int_t
*irtype,
322
const
void
*tabvar
323
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
324
by many Fortran compilers) */
325
);
326
327
/*----------------------------------------------------------------------------
328
* Read basic particles information from a restart file.
329
*
330
* Fortran interface
331
*
332
* subroutine lipsui (numsui, nomrub, lngnom, itysup, nbvent, irtype, tabvar)
333
* *****************
334
*
335
* integer numsui : <-- : Restart file number
336
* character* nomrub : <-- : Particles location name
337
* integer lngnom : <-- : Particles location name length
338
* integer nbpart : --> : Number of particles
339
* integer itysup : --> : Particles location id,
340
* or -1 in case of error
341
*----------------------------------------------------------------------------*/
342
343
void
CS_PROCF
(
lipsui
, LIPSUI)
344
(
345
const
cs_int_t
*numsui,
346
const
char
*nomrub,
347
const
cs_int_t
*lngnom,
348
cs_int_t
*nbpart,
349
cs_int_t
*itysup
350
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
351
by many Fortran compilers) */
352
);
353
354
/*----------------------------------------------------------------------------
355
* Read basic particles information from a restart file.
356
*
357
* Fortran interface
358
*
359
* subroutine lepsui (numsui, nomrub, lngnom, inmcoo, nbpart, ipcell,
360
* *****************
361
* coopar, itysup, ierror)
362
*
363
* integer numsui : <-- : Restart file number
364
* integer ipcell : --> : Particle -> cell number
365
* double precision coopar : --> : Particle coordinate
366
* integer ipsup : <-- : Particles location id
367
* integer ierror : --> : 0: success, < 0: error code
368
*----------------------------------------------------------------------------*/
369
370
void
CS_PROCF
(
lepsui
, LEPSUI)
371
(
372
const
cs_int_t
*numsui,
373
cs_int_t
*ipcell,
374
cs_real_t
*coopar,
375
const
cs_int_t
*itysup,
376
cs_int_t
*ierror
377
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
378
by many Fortran compilers) */
379
);
380
381
/*----------------------------------------------------------------------------
382
* Write basic particles information to a restart file.
383
*
384
* This includes defining a matching location and associated global numbering,
385
* then writing particle coordinates and cell ids.
386
*
387
* Fortran interface
388
*
389
* subroutine ecpsui (numsui, nomrub, lngnom, inmcoo, nbpart, ipcell,
390
* *****************
391
* coopar, itysup, ierror)
392
*
393
* integer numsui : <-- : Restart file number
394
* character* nomrub : <-- : Particles location name
395
* integer lngnom : <-- : Particles location name length
396
* integer inmcoo : <-- : Number by coords
397
* integer nbpart : <-- : Number of particles
398
* integer ipcell : <-- : Particle -> cell number
399
* double precision coopar : <-- : Particle coordinates
400
* integer ipsup : --> : Particles location id
401
*----------------------------------------------------------------------------*/
402
403
void
CS_PROCF
(
ecpsui
, ECPSUI)
404
(
405
const
cs_int_t
*numsui,
406
const
char
*nomrub,
407
const
cs_int_t
*lngnom,
408
const
cs_int_t
*inmcoo,
409
const
cs_int_t
*nbpart,
410
const
cs_int_t
*ipcell,
411
const
cs_real_t
*coopar,
412
cs_int_t
*itysup
413
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
414
by many Fortran compilers) */
415
);
416
417
/*----------------------------------------------------------------------------
418
* Read a referenced location id section from a restart file.
419
*
420
* The section read from file contains the global ids matching the local
421
* element ids of a given location. Global id's are transformed to local
422
* ids by this function.
423
*
424
* In case global ids read do not match those of local elements,
425
* id_base - 1 is assigned to the corresponding local ids.
426
*
427
* Fortran interface
428
*
429
* subroutine leisui (numsui, nomrub, lngnom, itysup, irfsup, idbase, tabid, &
430
* *****************
431
* ierror)
432
*
433
* integer numsui : <-- : Restart file number
434
* character* nomrub : <-- : Section name
435
* integer lngnom : <-- : Section name length
436
* integer itysup : <-- : Location type:
437
* : : 0: scalar (no location)
438
* : : 1: cells
439
* : : 2: interior faces
440
* : : 3: boundary faces
441
* : : 4: vertices (if available)
442
* integer irfsup : <-- : Referenced location type:
443
* : : 0: scalar (no location)
444
* : : 1: cells
445
* : : 2: interior faces
446
* : : 3: boundary faces
447
* : : 4: vertices (if available)
448
* integer idbase : <-- : base of referenced entity id numbers
449
* : : (usually 0 or 1)
450
* (?) tabid : <-> : Array of ids to read
451
* integer ierror : --> : 0: success, < 0: error code
452
*----------------------------------------------------------------------------*/
453
454
void
CS_PROCF
(
leisui
, LEISUI)
455
(
456
const
cs_int_t
*numsui,
457
const
char
*nomrub,
458
const
cs_int_t
*lngnom,
459
const
cs_int_t
*itysup,
460
const
cs_int_t
*irfsup,
461
const
cs_int_t
*idbase,
462
void
*tabid,
463
cs_int_t
*ierror
464
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
465
by many Fortran compilers) */
466
);
467
468
/*----------------------------------------------------------------------------
469
* Write a referenced location id section to a restart file.
470
*
471
* The section written to file contains the global ids matching the
472
* local element ids of a given location.
473
*
474
* Fortran interface
475
*
476
* subroutine ecisui (numsui, nomrub, lngnom, itysup, irfsup, idbase, tabid, &
477
* *****************
478
* ierror)
479
*
480
* integer numsui : <-- : Restart file number
481
* character* nomrub : <-- : Section name
482
* integer lngnom : <-- : Section name length
483
* integer itysup : <-- : Location type:
484
* : : 0: scalar (no location)
485
* : : 1: cells
486
* : : 2: interior faces
487
* : : 3: boundary faces
488
* : : 4: vertices (if available)
489
* integer irfsup : <-- : Referenced location type:
490
* : : 0: scalar (no location)
491
* : : 1: cells
492
* : : 2: interior faces
493
* : : 3: boundary faces
494
* : : 4: vertices (if available)
495
* integer idbase : <-- : base of referenced entity id numbers
496
* : : (usually 0 or 1)
497
* (?) tabid : <-- : Array of ids to write
498
* integer ierror : --> : 0: success, < 0: error code
499
*----------------------------------------------------------------------------*/
500
501
void
CS_PROCF
(
ecisui
, ECISUI)
502
(
503
const
cs_int_t
*numsui,
504
const
char
*nomrub,
505
const
cs_int_t
*lngnom,
506
const
cs_int_t
*itysup,
507
const
cs_int_t
*irfsup,
508
const
cs_int_t
*idbase,
509
const
cs_int_t
*tabid
510
CS_ARGF_SUPP_CHAINE
/* (possible 'length' arguments added
511
by many Fortran compilers) */
512
);
513
514
/*============================================================================
515
* Public function prototypes
516
*============================================================================*/
517
518
/*----------------------------------------------------------------------------
519
* Define default checkpoint interval.
520
*
521
* parameters
522
* nt_interval <-- if > 0 time step interval for checkpoint
523
* if 0, default of 4 checkpoints per run
524
* if -1, checkpoint at end
525
* if -2, no checkpointing
526
* t_interval <-- if > 0, time value interval for checkpoint
527
* wt_interval <-- if > 0, wall-clock interval for checkpoints
528
*----------------------------------------------------------------------------*/
529
530
void
531
cs_restart_checkpoint_set_defaults
(
int
nt_interval,
532
double
t_interval,
533
double
wt_interval);
534
535
/*----------------------------------------------------------------------------
536
* Define next forced checkpoint time step
537
*
538
* parameters
539
* nt_next <-- next time step for forced checkpoint
540
*----------------------------------------------------------------------------*/
541
542
void
543
cs_restart_checkpoint_set_next_ts
(
int
nt_next);
544
545
/*----------------------------------------------------------------------------
546
* Define next forced checkpoint time value
547
*
548
* parameters
549
* t_next <-- next time value for forced checkpoint
550
*----------------------------------------------------------------------------*/
551
552
void
553
cs_restart_checkpoint_set_next_tv
(
double
t_next);
554
555
/*----------------------------------------------------------------------------
556
* Define next forced checkpoint wall-clock time value
557
*
558
* parameters
559
* wt_next <-- next wall-clock time value for forced checkpoint
560
*----------------------------------------------------------------------------*/
561
562
void
563
cs_restart_checkpoint_set_next_wt
(
double
wt_next);
564
565
/*----------------------------------------------------------------------------
566
* Check if checkpointing is recommended at a given time.
567
*
568
* parameters
569
* ts <-- time step status structure
570
*
571
* returns:
572
* true if checkpointing is recommended, 0 otherwise
573
*----------------------------------------------------------------------------*/
574
575
bool
576
cs_restart_checkpoint_required
(
const
cs_time_step_t
*ts);
577
578
/*----------------------------------------------------------------------------
579
* Indicate checkpointing has been done at a given time.
580
*
581
* This updates the status for future checks to determine
582
* if checkpointing is recommended at a given time.
583
*
584
* parameters
585
* ts <-- time step status structure
586
*----------------------------------------------------------------------------*/
587
588
void
589
cs_restart_checkpoint_done
(
const
cs_time_step_t
*ts);
590
591
/*----------------------------------------------------------------------------
592
* Check if we have a restart directory.
593
*
594
* returns:
595
* 1 if a restart directory is present, 0 otherwise.
596
*----------------------------------------------------------------------------*/
597
598
int
599
cs_restart_present
(
void
);
600
601
/*----------------------------------------------------------------------------
602
* Initialize a restart file
603
*
604
* parameters:
605
* name <-- file name
606
* path <-- optional directory name for output
607
* (directory automatically created if necessary)
608
* mode <-- read or write
609
*
610
* returns:
611
* pointer to initialized restart file structure
612
*----------------------------------------------------------------------------*/
613
614
cs_restart_t *
615
cs_restart_create
(
const
char
*name,
616
const
char
*path,
617
cs_restart_mode_t
mode);
618
619
/*----------------------------------------------------------------------------
620
* Destroy structure associated with a restart file (and close the file).
621
*
622
* parameters:
623
* restart <-- pointer to restart file structure
624
*
625
* returns:
626
* NULL pointer
627
*----------------------------------------------------------------------------*/
628
629
cs_restart_t *
630
cs_restart_destroy
(cs_restart_t *restart);
631
632
/*----------------------------------------------------------------------------
633
* Check the locations associated with a restart file.
634
*
635
* For each type of entity, the corresponding flag is set to true if the
636
* associated number of entities matches the current value (and so that we
637
* consider the mesh locations are the same), false otherwise.
638
*
639
* parameters:
640
* restart <-- associated restart file pointer
641
* match_cell <-- matching cells flag
642
* match_i_face <-- matching interior faces flag
643
* match_b_face <-- matching boundary faces flag
644
* match_vertex <-- matching vertices flag
645
*----------------------------------------------------------------------------*/
646
647
void
648
cs_restart_check_base_location
(
const
cs_restart_t *restart,
649
bool
*match_cell,
650
bool
*match_i_face,
651
bool
*match_b_face,
652
bool
*match_vertex);
653
654
/*----------------------------------------------------------------------------
655
* Add a location definition.
656
*
657
* parameters:
658
* restart <-- associated restart file pointer
659
* location_name <-- name associated with the location
660
* n_glob_ents <-- global number of entities
661
* n_ents <-- local number of entities
662
* ent_global_num <-- global entity numbers, or NULL
663
*
664
* returns:
665
* the location id assigned, or -1 in case of error
666
*----------------------------------------------------------------------------*/
667
668
int
669
cs_restart_add_location
(cs_restart_t *restart,
670
const
char
*location_name,
671
cs_gnum_t
n_glob_ents,
672
cs_lnum_t
n_ents,
673
const
cs_gnum_t
*ent_global_num);
674
675
/*----------------------------------------------------------------------------
676
* Print the index associated with a restart file in read mode
677
*
678
* parameters:
679
* restart <-- associated restart file pointer
680
*----------------------------------------------------------------------------*/
681
682
void
683
cs_restart_dump_index
(
const
cs_restart_t *restart);
684
685
/*----------------------------------------------------------------------------
686
* Read a section from a restart file.
687
*
688
* parameters:
689
* restart <-- associated restart file pointer
690
* sec_name <-- section name
691
* location_id <-- id of corresponding location
692
* n_location_vals <-- number of values per location (interlaced)
693
* val_type <-- value type
694
* val --> array of values
695
*
696
* returns: 0 (CS_RESTART_SUCCESS) in case of success,
697
* or error code (CS_RESTART_ERR_xxx) in case of error
698
*----------------------------------------------------------------------------*/
699
700
int
701
cs_restart_read_section
(cs_restart_t *restart,
702
const
char
*sec_name,
703
int
location_id,
704
cs_int_t
n_location_vals,
705
cs_restart_val_type_t
val_type,
706
void
*val);
707
708
/*----------------------------------------------------------------------------
709
* Write a section to a restart file.
710
*
711
* parameters:
712
* restart <-- associated restart file pointer
713
* sec_name <-- section name
714
* location_id <-- id of corresponding location
715
* n_location_vals <-- number of values per location (interlaced)
716
* val_type <-- value type
717
* val <-- array of values
718
*----------------------------------------------------------------------------*/
719
720
void
721
cs_restart_write_section
(cs_restart_t *restart,
722
const
char
*sec_name,
723
int
location_id,
724
cs_int_t
n_location_vals,
725
cs_restart_val_type_t
val_type,
726
const
void
*val);
727
728
/*----------------------------------------------------------------------------
729
* Read basic particles information from a restart file.
730
*
731
* This includes building a matching location and associated global numbering.
732
*
733
* parameters:
734
* restart <-- associated restart file pointer
735
* name <-- name of particles set
736
* n_particles --> number of particles, or NULL
737
*
738
* returns:
739
* the location id assigned to the particles, or -1 in case of error
740
*----------------------------------------------------------------------------*/
741
742
int
743
cs_restart_read_particles_info
(cs_restart_t *restart,
744
const
char
*name,
745
cs_lnum_t
*n_particles);
746
747
/*----------------------------------------------------------------------------
748
* Read basic particles information from a restart file.
749
*
750
* parameters:
751
* restart <-- associated restart file pointer
752
* particles_location_id <-- location id of particles set
753
* particle_cell_id --> local cell id to which particles belong
754
* particle_coords --> local particle coordinates (interleaved)
755
*
756
* returns: 0 (CS_RESTART_SUCCESS) in case of success,
757
* or error code (CS_RESTART_ERR_xxx) in case of error
758
*----------------------------------------------------------------------------*/
759
760
int
761
cs_restart_read_particles
(cs_restart_t *restart,
762
int
particles_location_id,
763
cs_lnum_t
*particle_cell_id,
764
cs_real_t
*particle_coords);
765
766
/*----------------------------------------------------------------------------
767
* Write basic particles information to a restart file.
768
*
769
* This includes defining a matching location and associated global numbering,
770
* then writing particle coordinates and cell ids.
771
*
772
* parameters:
773
* restart <-- associated restart file pointer
774
* name <-- name of particles set
775
* number_by_coords <-- if true, numbering is based on current coordinates;
776
* otherwise, it is simply based on local numbers,
777
* plus the sum of particles on lower MPI ranks
778
* n_particles <-- local number of particles
779
* particle_cell_num <-- local cell number (1 to n) to which particles
780
* belong; 0 for untracked particles
781
* particle_coords <-- local particle coordinates (interleaved)
782
*
783
* returns:
784
* the location id assigned to the particles
785
*----------------------------------------------------------------------------*/
786
787
int
788
cs_restart_write_particles
(cs_restart_t *restart,
789
const
char
*name,
790
bool
number_by_coords,
791
cs_lnum_t
n_particles,
792
const
cs_lnum_t
*particle_cell_num,
793
const
cs_real_t
*particle_coords);
794
795
/*----------------------------------------------------------------------------
796
* Read a referenced location id section from a restart file.
797
*
798
* The section read from file contains the global ids matching the local
799
* element ids of a given location. Global id's are transformed to local
800
* ids by this function.
801
*
802
* In case global referenced ids read do not match those of local elements,
803
* id_base - 1 is assigned to the corresponding local ids.
804
*
805
* parameters:
806
* restart <-- associated restart file pointer
807
* sec_name <-- section name
808
* location_id <-- id of location on which id_ref is defined
809
* ref_location_id <-- id of referenced location
810
* ref_id_base <-- base of location entity id numbers (usually 0 or 1)
811
* ref_id --> array of location entity ids
812
*
813
* returns: 0 (CS_RESTART_SUCCESS) in case of success,
814
* or error code (CS_RESTART_ERR_xxx) in case of error
815
*----------------------------------------------------------------------------*/
816
817
int
818
cs_restart_read_ids
(cs_restart_t *restart,
819
const
char
*sec_name,
820
int
location_id,
821
int
ref_location_id,
822
cs_lnum_t
ref_id_base,
823
cs_lnum_t
*ref_id);
824
825
/*----------------------------------------------------------------------------
826
* Write a referenced location id section to a restart file.
827
*
828
* The section written to file contains the global ids matching the
829
* local element ids of a given location.
830
*
831
* parameters:
832
* restart <-- associated restart file pointer
833
* sec_name <-- section name
834
* location_id <-- id of location on which id_ref is defined
835
* ref_location_id <-- id of referenced location
836
* ref_id_base <-- base of location entity id numbers (usually 0 or 1)
837
* ref_id <-- array of location entity ids
838
*----------------------------------------------------------------------------*/
839
840
void
841
cs_restart_write_ids
(cs_restart_t *restart,
842
const
char
*sec_name,
843
int
location_id,
844
int
ref_location_id,
845
cs_lnum_t
ref_id_base,
846
const
cs_lnum_t
*ref_id);
847
848
/*----------------------------------------------------------------------------
849
* Read a section from a restart file, when that section may have used a
850
* different name in a previous version.
851
*
852
* parameters:
853
* restart <-- associated restart file pointer
854
* sec_name <-- section name
855
* location_id <-- id of corresponding location
856
* n_location_vals <-- number of values per location (interlaced)
857
* val_type <-- value type
858
* val --> array of values
859
*
860
* returns: 0 (CS_RESTART_SUCCESS) in case of success,
861
* or error code (CS_RESTART_ERR_xxx) in case of error
862
*----------------------------------------------------------------------------*/
863
864
int
865
cs_restart_read_section_compat
(cs_restart_t *restart,
866
const
char
*sec_name,
867
const
char
*old_name,
868
int
location_id,
869
int
n_location_vals,
870
cs_restart_val_type_t
val_type,
871
void
*val);
872
873
/*----------------------------------------------------------------------------
874
* Read a cs_real_t section from a restart file, when that section may
875
* have used a different name in a previous version.
876
*
877
* parameters:
878
* restart <-- associated restart file pointer
879
* sec_name <-- section name
880
* location_id <-- id of corresponding location
881
* n_location_vals <-- number of values per location (interlaced)
882
* val --> array of values
883
*
884
* returns: 0 (CS_RESTART_SUCCESS) in case of success,
885
* or error code (CS_RESTART_ERR_xxx) in case of error
886
*----------------------------------------------------------------------------*/
887
888
int
889
cs_restart_read_real_t_compat
(cs_restart_t *restart,
890
const
char
*sec_name,
891
const
char
*old_name,
892
int
location_id,
893
int
n_location_vals,
894
cs_real_t
*val);
895
896
/*----------------------------------------------------------------------------
897
* Read a cs_real_3_t vector section from a restart file, when that
898
* section may have used a different name and been non-interleaved
899
* in a previous version.
900
*
901
* This file assumes a mesh-base location (i.e. location_id > 0)
902
*
903
* parameters:
904
* restart <-- associated restart file pointer
905
* sec_name <-- section name
906
* old_name_x <-- old name, x component
907
* old_name_y <-- old name, y component
908
* old_name_y <-- old name, z component
909
* location_id <-- id of corresponding location
910
* val --> array of values
911
*
912
* returns: 0 (CS_RESTART_SUCCESS) in case of success,
913
* or error code (CS_RESTART_ERR_xxx) in case of error
914
*----------------------------------------------------------------------------*/
915
916
int
917
cs_restart_read_real_3_t_compat
(cs_restart_t *restart,
918
const
char
*sec_name,
919
const
char
*old_name_x,
920
const
char
*old_name_y,
921
const
char
*old_name_z,
922
int
location_id,
923
cs_real_3_t
*val);
924
925
/*----------------------------------------------------------------------------
926
* Print statistics associated with restart files
927
*----------------------------------------------------------------------------*/
928
929
void
930
cs_restart_print_stats
(
void
);
931
932
/*----------------------------------------------------------------------------*/
933
934
END_C_DECLS
935
936
#endif
/* __CS_RESTART_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1