Skip to content

Update the waves and cem BMI to v2 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: v0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b843048
remove self, add data member to BMI_Model
mcflugen Feb 25, 2025
c17e7d1
first argument of bmi functions are BMI_Model*
mcflugen Feb 25, 2025
40c4513
add new_cem_model to bmi_cem.h
mcflugen Feb 25, 2025
048081c
add waves_new to bmi_waves.h
mcflugen Feb 25, 2025
9895365
change first argument to bmi functions to BMI_Model
mcflugen Feb 25, 2025
3c04346
use self->data for passing CemModel to cem functions
mcflugen Feb 25, 2025
7a6669e
initialize self->data with new_cem_model
mcflugen Feb 25, 2025
ff56312
pass cem_initialize an already-created CemModel
mcflugen Feb 25, 2025
275abf4
declare cem_initialize to use an already-created CemModel
mcflugen Feb 25, 2025
5fe984b
change first argument to waves bmi function to BMI_Model*
mcflugen Feb 25, 2025
961128c
use the self->data member of BMI_Model in waves bmi functions
mcflugen Feb 25, 2025
6e1998a
initialize data member with waves_new in initialize function
mcflugen Feb 25, 2025
6555f62
frist argument of bmi functions is BMI_Model in cem_main
mcflugen Feb 25, 2025
8fa707f
frist argument of bmi functions is BMI_Model in waves_main
mcflugen Feb 25, 2025
e653cd9
frist argument of bmi functions is BMI_Model in deltas_main
mcflugen Feb 25, 2025
924ec63
rename BMI_Model to Bmi in bmi.h
mcflugen Feb 25, 2025
4772450
rename BMI_Model to Bmi in bmi_cem.c
mcflugen Feb 25, 2025
1de462d
rename BMI_Model to Bmi in bmi_waves.c
mcflugen Feb 25, 2025
68136e8
remove run_model bmi function
mcflugen Feb 25, 2025
b8ffd19
rename BMI_Model to Bmi in cem_main.c
mcflugen Feb 25, 2025
be22407
rename BMI_Model to Bmi in waves_main.c
mcflugen Feb 25, 2025
43a136b
rename BMI_Model to Bmi in bmi_cem.h
mcflugen Feb 25, 2025
387f167
rename BMI_Model to Bmi in bmi_waves.h
mcflugen Feb 25, 2025
ea74514
rename BMI_Model to Bmi in deltas_api.c
mcflugen Feb 25, 2025
de33657
rename BMI_Model to Bmi in deltas_main.c
mcflugen Feb 25, 2025
e4fa469
rename BMI_Model to Bmi in deltas_api.h
mcflugen Feb 25, 2025
6d21130
rename input/output var_name to item for cem
mcflugen Feb 26, 2025
1fb0188
rename input/output var_name to item for waves
mcflugen Feb 26, 2025
4cbf9bc
add const to bmi functions for waves
mcflugen Feb 26, 2025
499f4a0
add const to bmi function declarations
mcflugen Feb 26, 2025
255a1cd
remove update_frac as a bmi function in cem
mcflugen Feb 26, 2025
957cd77
remove set_value_ptr as a bmi function in cem
mcflugen Feb 26, 2025
e3cb440
remove update_frac from bmi functions for waves
mcflugen Feb 26, 2025
0735921
remove set_value_ptr from bmi functions for waves
mcflugen Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions bmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,61 @@ extern "C" {
#define BMI_MAX_VAR_NAME (2048)


typedef struct {
void * self;

int (* initialize)(const char *, void**);
int (* update)(void*);
int (* update_until)(void *, double);
int (* update_frac)(void *, double);
int (* finalize)(void *);
int (* run_model)(void *);

int (* get_component_name)(void *, char *);
int (* get_input_var_name_count)(void *, int *);
int (* get_output_var_name_count)(void *, int *);
int (* get_input_var_names)(void *, char **);
int (* get_output_var_names)(void *, char **);

int (* get_var_grid)(void *, const char *, int *);
int (* get_var_type)(void *, const char *, char *);
int (* get_var_units)(void *, const char *, char *);
int (* get_var_itemsize)(void *, const char *, int *);
int (* get_var_nbytes)(void *, const char *, int *);
int (* get_var_location)(void *, const char *, char *);
int (* get_current_time)(void *, double *);
int (* get_start_time)(void *, double *);
int (* get_end_time)(void *, double *);
int (* get_time_units)(void *, char *);
int (* get_time_step)(void *, double *);
typedef struct Bmi {
void * data;

int (*initialize)(struct Bmi* self, const char* config_file);
int (* update)(struct Bmi*);
int (* update_until)(struct Bmi *, const double);
int (* update_frac)(struct Bmi *, const double);
int (* finalize)(struct Bmi *);

int (* get_component_name)(struct Bmi *, char * const);
int (* get_input_item_count)(struct Bmi *, int *);
int (* get_output_item_count)(struct Bmi *, int *);
int (* get_input_var_names)(struct Bmi *, char **);
int (* get_output_var_names)(struct Bmi *, char **);

int (* get_var_grid)(struct Bmi *, const char *, int *);
int (* get_var_type)(struct Bmi *, const char *, char *);
int (* get_var_units)(struct Bmi *, const char *, char *);
int (* get_var_itemsize)(struct Bmi *, const char *, int *);
int (* get_var_nbytes)(struct Bmi *, const char *, int *);
int (* get_var_location)(struct Bmi *, const char *, char * const);
int (* get_current_time)(struct Bmi *, double *);
int (* get_start_time)(struct Bmi *, double *);
int (* get_end_time)(struct Bmi *, double *);
int (* get_time_units)(struct Bmi *, char * const);
int (* get_time_step)(struct Bmi *, double *);

/* Variable getter and setter functions */
int (* get_value)(void *, const char *, void *);
int (* get_value_ptr)(void *, const char *, void **);
int (* get_value_at_indices)(void *, const char *, void *, int *, int);
int (* get_value)(struct Bmi *, const char *, void *const);
int (* get_value_ptr)(struct Bmi *, const char *, void **);
int (* get_value_at_indices)(struct Bmi *, const char *, void *const, const int *, const int);

int (* set_value)(void *, const char *, void *);
int (* set_value_ptr)(void *, const char *, void **);
int (* set_value_at_indices)(void *, const char *, int *, int, void *);
int (* set_value)(struct Bmi *, const char *, void *const);
int (* set_value_ptr)(struct Bmi *, const char *, void **);
int (* set_value_at_indices)(struct Bmi *, const char *, const int *, const int, void * const );

/* Grid information functions */
int (* get_grid_rank)(void *, int, int *);
int (* get_grid_size)(void *, int, int *);
int (* get_grid_type)(void *, int, char *);
int (* get_grid_shape)(void *, int, int *);
int (* get_grid_spacing)(void *, int, double *);
int (* get_grid_origin)(void *, int, double *);

int (* get_grid_x)(void *, int, double *);
int (* get_grid_y)(void *, int, double *);
int (* get_grid_z)(void *, int, double *);

int (* get_grid_face_count)(void *, int, int *);
int (* get_grid_point_count)(void *, int, int *);
int (* get_grid_vertex_count)(void *, int, int *);

int (* get_grid_connectivity)(void *, int, int *);
int (* get_grid_offset)(void *, int, int *);
} BMI_Model;
int (* get_grid_rank)(struct Bmi *, const int, int *);
int (* get_grid_size)(struct Bmi *, const int, int *);
int (* get_grid_type)(struct Bmi *, const int, char *const);
int (* get_grid_shape)(struct Bmi *, const int, int *const);
int (* get_grid_spacing)(struct Bmi *, const int, double *const);
int (* get_grid_origin)(struct Bmi *, const int, double *const);

int (* get_grid_x)(struct Bmi *, const int, double *const);
int (* get_grid_y)(struct Bmi *, const int, double *const);
int (* get_grid_z)(struct Bmi *, const int, double *const);

int (* get_grid_face_count)(struct Bmi *, const int, int * const);
int (* get_grid_node_count)(struct Bmi *, const int, int * const);
int (* get_grid_vertex_count)(struct Bmi *, const int, int * const);

int (* get_grid_connectivity)(struct Bmi *, int, int *);
int (* get_grid_offset)(struct Bmi *, int, int *);
} Bmi;


#if defined(__cplusplus)
Expand Down
Loading