-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_reinitialize.c
55 lines (43 loc) · 1.02 KB
/
test_reinitialize.c
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
54
55
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <heat.h>
#include <bmi.h>
#include <bmi_heat.h>
int
main (void)
{
int status = BMI_SUCCESS;
Bmi * model = (Bmi*)malloc (sizeof(Bmi));
register_bmi_heat(model);
{
int i;
const int n_steps = 3;
for (i = 0; i < n_steps; i++)
{
fprintf (stdout, "Reinitialize %d\n", i+1);
fprintf (stdout, "Initializing... ");
status = model->initialize(model, NULL);
if (status == BMI_FAILURE)
return BMI_FAILURE;
else
fprintf(stdout, "PASS\n");
{
char name[BMI_MAX_COMPONENT_NAME];
status = model->get_component_name(model, name);
if (status == BMI_FAILURE)
return BMI_FAILURE;
else
fprintf(stdout, "%s\n", name);
}
fprintf (stdout, "Finalizing... ");
status = model->finalize(model);
if (status == BMI_FAILURE)
return BMI_FAILURE;
else
fprintf(stdout, "PASS\n");
}
}
free(model);
return BMI_SUCCESS;
}