-
Notifications
You must be signed in to change notification settings - Fork 1
/
bmi.h
86 lines (58 loc) · 2.06 KB
/
bmi.h
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* -*- c-file-style: "stroustrup" -*- */
/* Please use the stroustrup coding standard: */
#ifndef BMI_API_H
#define BMI_API_H
#define BMI_API_VERSION_MAJOR 1
#define BMI_API_VERSION_MINOR 0
#if defined _WIN32
#define BMI_API __declspec(dllexport)
/* Calling convention, stdcall in windows, cdecl in the rest of the world */
#define CALLCONV __stdcall
#else
#define BMI_API
#define CALLCONV
#endif
#define MAXSTRINGLEN 1024
#define MAXDIMS 6
#include <stddef.h>
typedef enum {
LEVEL_ALL,
LEVEL_DEBUG,
LEVEL_INFO,
LEVEL_WARNING,
LEVEL_ERROR,
LEVEL_FATAL,
LEVEL_NONE
} Level;
#ifdef __cplusplus
extern "C" {
#endif
/* control functions. These return an error code. */
BMI_API int initialize(const char *config_file);
BMI_API int update(double dt);
BMI_API int finalize();
/* time control functions */
BMI_API void get_start_time(double *t);
BMI_API void get_end_time(double *t);
BMI_API void get_current_time(double *t);
BMI_API void get_time_step(double *dt);
/* variable info */
BMI_API void get_var_shape(const char *name, int shape[MAXDIMS]);
BMI_API void get_var_rank(const char *name, int *rank);
BMI_API void get_var_type(const char *name, char *type);
BMI_API void get_var_count(int *count);
BMI_API void get_var_name(int index, char *name);
/* get a pointer pointer - a reference to a multidimensional array */
BMI_API void get_var(const char *name, void **ptr);
/* Set the variable from contiguous memory referenced to by ptr */
BMI_API void set_var(const char *name, const void *ptr);
/* Set a slice of the variable from contiguous memory using start / count multi-dimensional indices */
BMI_API void set_var_slice(const char *name, const int *start, const int *count, const void *ptr);
/* logger to be set from outside so we can log messages */
typedef void (CALLCONV *Logger)(Level level, const char *msg);
/* set logger by setting a pointer to the log function */
BMI_API void set_logger(Logger logger);
#ifdef __cplusplus
}
#endif
#endif