Skip to content

Commit

Permalink
adding nc_get_iosystem()
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 14, 2019
1 parent cc3d531 commit f71c1e9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/clib/pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,12 @@ extern "C" {
int nc_init_intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int rearr,
int *iosysidp);

/* Set the default IOsystem ID. */
int nc_set_iosystem(int iosysid);

/* Get the default IOsystem ID. */
int nc_get_iosystem(int *iosysid);

int nc_free_iosystem(int iosysid);

int nc_init_decomp(int iosysid, int pio_type, int ndims, const int *gdimlen,
Expand Down
3 changes: 2 additions & 1 deletion src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ PIOc_strerror(int pioerr, char *errmsg)
PLOG((1, "PIOc_strerror pioerr = %d", pioerr));

/* Caller must provide this. */
pioassert(errmsg, "pointer to errmsg string must be provided", __FILE__, __LINE__);
pioassert(errmsg, "pointer to errmsg string must be provided", __FILE__,
__LINE__);

/* System error? NetCDF and pNetCDF errors are always negative. */
if (pioerr > 0)
Expand Down
23 changes: 23 additions & 0 deletions src/ncint/ncint_pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ nc_init_intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int
/**
* Set the default iosystemID.
*
* @param iosysid The IO system ID to set.
*
* @return PIO_NOERR for success.
* @author Ed Hartnett
*/
int
Expand All @@ -52,6 +55,26 @@ nc_set_iosystem(int iosysid)
return PIO_NOERR;
}

/**
* Get the default iosystemID.
*
* @param iosysid Pointer that gets The IO system ID.
*
* @return PIO_NOERR for success.
* @author Ed Hartnett
*/
int
nc_get_iosystem(int *iosysid)
{
pioassert(iosysid, "pointer to iosysid must be provided", __FILE__,
__LINE__);

/* Remember the io system id. */
*iosysid = diosysid;

return PIO_NOERR;
}

/**
* Same as PIOc_free_iosystem().
*
Expand Down
10 changes: 10 additions & 0 deletions tests/ncint/tst_pio_udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ main(int argc, char **argv)
if (MPI_Comm_size(MPI_COMM_WORLD, &ntasks)) ERR;

printf("\n*** Testing netCDF integration layer.\n");
printf("*** testing getting/setting of default iosystemid...");
{
int iosysid;

if (nc_set_iosystem(TEST_VAL_42)) ERR;
if (nc_get_iosystem(&iosysid)) ERR;
if (iosysid != TEST_VAL_42) ERR;
}
SUMMARIZE_ERR;

printf("*** testing simple use of netCDF integration layer format...");
{
int ncid, ioid;
Expand Down

0 comments on commit f71c1e9

Please sign in to comment.