1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| /**test_restart.c
The restore() function is restting the value of N to 1.
Make your favourite dump file called test_restart
and then try and read it in here.
A possible code for making a dump file is:
//********************************************
#include "saint-venant.h"
#define MAXLEVEL 7
int main (){
init_grid(1<<MAXLEVEL);
run();
}
event init(i=0){
foreach(){
zb[] = 1.-x * x - y * y;
h[] = max(0.0, 0.5 - zb[]);
}
}
// Output a dump file
event output(t = 0.){
dump(file = "test_restart");
output_ppm(zb, file="bathymetry0.ppm");
output_ppm(h, file="h0.ppm");
}
//***********************************************
*/
#include "saint-venant.h"
#define MAXLEVEL 7
int main (){
init_grid( 1 << MAXLEVEL );
run();
}
event init(i=0){
printf("Before restore, N = %d\n",N);
restore(file = "test_restart");
printf("After restore, N= %d\n",N);
/* If you uncomment the next line it resets the value of N to what it should be
and the .ppm files are output correctly
*/
// N=1<<MAXLEVEL;
}
event output(i=1){
output_ppm(zb, file="bathymetryRS.ppm");
output_ppm(h,file="hRS.ppm");
}
|