123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- #include "oasis-cpp-interface.h"
- #include "config.h"
- #include "shell.h"
- #ifdef WIN32
- // For windows testing
- int OASISMCT::init_comp(int * compid, std::string model_name)
- {
- return 0;
- };
- int OASISMCT::create_couplcomm(int myrank, int lcomm, int * ccomm)
- {
- return 0;
- };
- int OASISMCT::get_localcomm(int &localcompid)
- {
- return 0;
- };
- int OASISMCT::terminate(void)
- {
- return 0;
- };
- int OASISMCT::abort(int compid, std::string routine_name, std::string abort_message, int return_code)
- {
- return 0;
- };
- int OASISMCT::def_partition(int * il_part_id, int * ig_paral, int ig_paral_len)
- {
- return 0;
- };
- int OASISMCT::def_var(int * var_id,std::string name, int il_part_id, int * var_nodims, int kinout, int * var_actual_shape, int var_type)
- {
- return 0;
- };
- int OASISMCT::enddef(void)
- {
- return 0;
- };
- int OASISMCT::put_1d(int var_id, int date, double * field_array, int field_array_len)
- {
- return 0;
- };
- int OASISMCT::put_2d(int var_id, int date, double * field_array, int field_array_len_x, int field_array_len_y)
- {
- return 0; // I.e. OK
- };
- int OASISMCT::get_1d(int var_id, int date, double * field_array, int field_array_len)
- {
- return 0;
- };
- int OASISMCT::get_2d(int var_id, int date, double * field_array, int field_array_len_x, int field_array_len_y)
- {
- // For testing:
- // printf(" OASISMCT::get_2d -- for date %i\n",date);
- return 0;
- };
- #else
- // Non-Windows platforms
- extern "C"
- {
- int fortfunc_(void);
- int oasismct_init_comp_(int *, const char *);
- int oasismct_terminate_(void);
- int oasismct_abort_(int , std::string, std::string ,int );
- // ecev3
- int oasismct_create_couplcomm_(int *, int *, int *);
- int oasismct_get_localcomm_(int *);
- int oasismct_def_partition_(int *, int *, int *);
- int oasismct_def_var_(int *, const char *, int *, int *, int *, int *, int *);
- int oasismct_enddef_(void);
- int oasismct_put_1d_(int *, int *, double *, int *);
- int oasismct_put_2d_(int *, int *, double *, int *, int *);
- int oasismct_get_1d_(int *, int *, double *, int *);
- int oasismct_get_2d_(int *, int *, double *, int *, int *);
- };
- int OASISMCT::init_comp(int * compid, std::string model_name)
- {
- return oasismct_init_comp_(compid, model_name.c_str());
- };
- int OASISMCT::create_couplcomm(int myrank, int lcomm, int * ccomm)
- {
- return oasismct_create_couplcomm_(&myrank, &lcomm, ccomm);
- };
- int OASISMCT::get_localcomm(int &localcompid)
- {
- int lcid = 0;
- int isok = oasismct_get_localcomm_(&lcid);
- dprintf("oasismct_get_localcomm returned isok %i, and lcid %ii \n",isok,lcid);
- localcompid = lcid;
- return isok;
- };
- int OASISMCT::terminate(void)
- {
- return oasismct_terminate_();
- };
- int OASISMCT::abort(int compid,std::string routine_name,std::string abort_message,int return_code)
- {
- return oasismct_abort_(compid, routine_name, abort_message, return_code);
- };
- int OASISMCT::def_partition(int * il_part_id, int * ig_paral, int ig_paral_len)
- {
- return oasismct_def_partition_(il_part_id,ig_paral,&ig_paral_len);
- };
- int OASISMCT::def_var(int * var_id,std::string name, int il_part_id, int * var_nodims, int kinout, int * var_actual_shape, int var_type)
- {
- return oasismct_def_var_(var_id,name.c_str(),&il_part_id,var_nodims,&kinout,var_actual_shape,&var_type);
- };
- int OASISMCT::enddef(void)
- {
- dprintf("calling oasismct_enddef \n");
- int isok = oasismct_enddef_();
- dprintf("oasismct_enddef_ returned isok %i \n",isok);
- return isok;
- };
- int OASISMCT::put_1d(int var_id, int date, double * field_array, int field_array_len)
- {
- return oasismct_put_1d_(&var_id,&date,field_array,&field_array_len);
- };
- int OASISMCT::put_2d(int var_id, int date, double * field_array, int field_array_len_x, int field_array_len_y)
- {
- return oasismct_put_2d_(&var_id,&date,field_array,&field_array_len_x,&field_array_len_y);
- };
- int OASISMCT::get_1d(int var_id, int date, double * field_array, int field_array_len)
- {
- return oasismct_get_1d_(&var_id,&date,field_array,&field_array_len);
- };
- int OASISMCT::get_2d(int var_id, int date, double * field_array, int field_array_len_x, int field_array_len_y)
- {
- // For testing:
- // printf(" OASISMCT::get_2d -- for date %i\n",date);
- return oasismct_get_2d_(&var_id,&date,field_array,&field_array_len_x,&field_array_len_y);
- };
- #endif
|