-
Notifications
You must be signed in to change notification settings - Fork 3
/
bmi.hxx
76 lines (61 loc) · 2.82 KB
/
bmi.hxx
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
#ifndef BMI_HXX
#define BMI_HXX
namespace bmi {
const int BMI_SUCCESS = 0;
const int BMI_FAILURE = 1;
const int MAX_COMPONENT_NAME = 2048;
const int MAX_VAR_NAME = 2048;
const int MAX_UNITS_NAME = 2048;
const int MAX_TYPE_NAME = 2048;
class Bmi {
public:
// Model control functions.
virtual void Initialize(std::string config_file) = 0;
virtual void Update() = 0;
virtual void UpdateUntil(double time) = 0;
virtual void Finalize() = 0;
// Model information functions.
virtual std::string GetComponentName() = 0;
virtual int GetInputItemCount() = 0;
virtual int GetOutputItemCount() = 0;
virtual std::vector<std::string> GetInputVarNames() = 0;
virtual std::vector<std::string> GetOutputVarNames() = 0;
// Variable information functions
virtual int GetVarGrid(std::string name) = 0;
virtual std::string GetVarType(std::string name) = 0;
virtual std::string GetVarUnits(std::string name) = 0;
virtual int GetVarItemsize(std::string name) = 0;
virtual int GetVarNbytes(std::string name) = 0;
virtual std::string GetVarLocation(std::string name) = 0;
virtual double GetCurrentTime() = 0;
virtual double GetStartTime() = 0;
virtual double GetEndTime() = 0;
virtual std::string GetTimeUnits() = 0;
virtual double GetTimeStep() = 0;
// Variable getters
virtual void GetValue(std::string name, void *dest) = 0;
virtual void *GetValuePtr(std::string name) = 0;
virtual void GetValueAtIndices(std::string name, void *dest, int *inds, int count) = 0;
// Variable setters
virtual void SetValue(std::string name, void *src) = 0;
virtual void SetValueAtIndices(std::string name, int *inds, int count, void *src) = 0;
// Grid information functions
virtual int GetGridRank(const int grid) = 0;
virtual int GetGridSize(const int grid) = 0;
virtual std::string GetGridType(const int grid) = 0;
virtual void GetGridShape(const int grid, int *shape) = 0;
virtual void GetGridSpacing(const int grid, double *spacing) = 0;
virtual void GetGridOrigin(const int grid, double *origin) = 0;
virtual void GetGridX(const int grid, double *x) = 0;
virtual void GetGridY(const int grid, double *y) = 0;
virtual void GetGridZ(const int grid, double *z) = 0;
virtual int GetGridNodeCount(const int grid) = 0;
virtual int GetGridEdgeCount(const int grid) = 0;
virtual int GetGridFaceCount(const int grid) = 0;
virtual void GetGridEdgeNodes(const int grid, int *edge_nodes) = 0;
virtual void GetGridFaceEdges(const int grid, int *face_edges) = 0;
virtual void GetGridFaceNodes(const int grid, int *face_nodes) = 0;
virtual void GetGridNodesPerFace(const int grid, int *nodes_per_face) = 0;
};
}
#endif