-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_initialize_from_file.c
65 lines (47 loc) · 1.17 KB
/
test_initialize_from_file.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
56
57
58
59
60
61
62
63
64
65
#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);
{
fprintf (stdout, "Initializing... ");
status = model->initialize(model, "config.txt");
if (status == BMI_FAILURE)
return BMI_FAILURE;
fprintf (stdout, "PASS\n");
}
{
char name[BMI_MAX_COMPONENT_NAME];
status = model->get_component_name(model, name);
if (status == BMI_FAILURE)
return BMI_FAILURE;
fprintf (stdout, "%s\n", name);
}
{
double dt, t_end;
status = model->get_time_step(model, &dt);
if (status == BMI_FAILURE)
return BMI_FAILURE;
else
fprintf (stdout, "Time step dt = %f\n", dt);
status = model->get_end_time(model, &t_end);
if (status == BMI_FAILURE)
return BMI_FAILURE;
else
fprintf (stdout, "End time t_end = %f\n", t_end);
}
fprintf (stdout, "Finalizing... ");
status = model->finalize(model);
if (status == BMI_FAILURE)
return BMI_FAILURE;
fprintf (stdout, "PASS\n");
free (model);
return BMI_SUCCESS;
}