From c68712d20d725ef058dda4a9297be9a2146d9e17 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 6 Jul 2019 12:39:00 -0600 Subject: [PATCH 1/6] more functions for netcdf integration layer --- src/ncint/ncintdispatch.c | 112 +++++++++++++++++++++++++++++++++++--- src/ncint/ncintdispatch.h | 8 +++ 2 files changed, 111 insertions(+), 9 deletions(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index 3bc9a7e6668..34d3583d0a6 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -59,10 +59,10 @@ NC_Dispatch NCINT_dispatcher = { PIO_NCINT_put_att, PIO_NCINT_def_var, - NC4_inq_varid, - NC_RO_rename_var, + PIO_NCINT_inq_varid, + PIO_NCINT_rename_var, PIO_NCINT_get_vara, - NC_RO_put_vara, + PIO_NCINT_put_vara, NCDEFAULT_get_vars, NCDEFAULT_put_vars, NCDEFAULT_get_varm, @@ -438,6 +438,106 @@ PIO_NCINT_def_var(int ncid, const char *name, nc_type xtype, int ndims, return PIOc_def_var(ncid, name, xtype, ndims, dimidsp, varidp); } +/** + * @internal Find the ID of a variable, from the name. This function + * is called by nc_inq_varid(). + * + * @param ncid File ID. + * @param name Name of the variable. + * @param varidp Gets variable ID. + + * @returns ::NC_NOERR No error. + * @returns ::NC_EBADID Bad ncid. + * @returns ::NC_ENOTVAR Bad variable ID. + */ +int +PIO_NCINT_inq_varid(int ncid, const char *name, int *varidp) +{ + return PIOc_inq_varid(ncid, name, varidp); +} + +/** + * @internal Rename a var to "bubba," for example. This is called by + * nc_rename_var() for netCDF-4 files. This results in complexities + * when coordinate variables are involved. + + * Whenever a var has the same name as a dim, and also uses that dim + * as its first dimension, then that var is aid to be a coordinate + * variable for that dimensions. Coordinate variables are represented + * in the HDF5 by making them dimscales. Dimensions without coordinate + * vars are represented by datasets which are dimscales, but have a + * special attribute marking them as dimscales without associated + * coordinate variables. + * + * When a var is renamed, we must detect whether it has become a + * coordinate var (by being renamed to the same name as a dim that is + * also its first dimension), or whether it is no longer a coordinate + * var. These cause flags to be set in NC_VAR_INFO_T which are used at + * enddef time to make changes in the HDF5 file. + * + * @param ncid File ID. + * @param varid Variable ID + * @param name New name of the variable. + * + * @returns ::NC_NOERR No error. + * @returns ::NC_EBADID Bad ncid. + * @returns ::NC_ENOTVAR Invalid variable ID. + * @returns ::NC_EBADNAME Bad name. + * @returns ::NC_EMAXNAME Name is too long. + * @returns ::NC_ENAMEINUSE Name in use. + * @returns ::NC_ENOMEM Out of memory. + * @author Ed Hartnett + */ +int +PIO_NCINT_rename_var(int ncid, int varid, const char *name) +{ + return PIOc_rename_var(ncid, varid, name); +} + +/** + * @internal Read an array of data to a variable. + * + * @param ncid File ID. + * @param varid Variable ID. + * @param startp Array of start indices. + * @param countp Array of counts. + * @param op pointer that gets the data. + * @param memtype The type of these data in memory. + * + * @returns ::NC_NOERR for success + * @author Ed Hartnett, Dennis Heimbigner + */ +int +PIO_NCINT_get_vara(int ncid, int varid, const size_t *start, + const size_t *count, void *value, nc_type t) +{ + return PIOc_get_vars_tc(ncid, varid, (PIO_Offset *)start, + (PIO_Offset *)count, NULL, t, value); +} + +/** + * @internal Write an array of data to a variable. This is called by + * nc_put_vara() and other nc_put_vara_* functions, for netCDF-4 + * files. + * + * @param ncid File ID. + * @param varid Variable ID. + * @param startp Array of start indices. + * @param countp Array of counts. + * @param op pointer that gets the data. + * @param memtype The type of these data in memory. + * + * @returns ::NC_NOERR for success + * @author Ed Hartnett, Dennis Heimbigner + */ +int +PIO_NCINT_put_vara(int ncid, int varid, const size_t *startp, + const size_t *countp, const void *op, int memtype) +{ + return PIOc_put_vars_tc(ncid, varid, (PIO_Offset *)startp, + (PIO_Offset *)countp, NULL, memtype, op); +} + /** * @internal This just calls nc_enddef, ignoring the extra parameters. * @@ -572,9 +672,3 @@ PIO_NCINT_inq_type(int ncid, nc_type typeid1, char *name, size_t *size) return PIOc_inq_type(ncid, typeid1, name, (PIO_Offset *)size); } -int -PIO_NCINT_get_vara(int ncid, int varid, const size_t *start, const size_t *count, - void *value, nc_type t) -{ - return TEST_VAL_42; -} diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index 52727fc8dd7..ffa75ed1508 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -122,11 +122,19 @@ extern "C" { PIO_NCINT_put_att(int ncid, int varid, const char *name, nc_type file_type, size_t len, const void *data, nc_type mem_type); + extern int + PIO_NCINT_inq_varid(int ncid, const char *name, int *varidp); + + extern int + PIO_NCINT_rename_var(int ncid, int varid, const char *name); extern int PIO_NCINT_get_vara(int ncid, int varid, const size_t *start, const size_t *count, void *value, nc_type t); + extern int + PIO_NCINT_put_vara(int ncid, int varid, const size_t *startp, + const size_t *countp, const void *op, int memtype); #if defined(__cplusplus) } From c9842994316274884271369869ae55d41df37e0f Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 6 Jul 2019 13:17:33 -0600 Subject: [PATCH 2/6] more PIO_NCINT functions --- src/ncint/ncintdispatch.c | 291 +++++++++++++++++++++----------------- src/ncint/ncintdispatch.h | 5 + 2 files changed, 169 insertions(+), 127 deletions(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index 34d3583d0a6..08cf1633fd8 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -63,7 +63,7 @@ NC_Dispatch NCINT_dispatcher = { PIO_NCINT_rename_var, PIO_NCINT_get_vara, PIO_NCINT_put_vara, - NCDEFAULT_get_vars, + PIO_NCINT_get_vars, NCDEFAULT_put_vars, NCDEFAULT_get_varm, NCDEFAULT_put_varm, @@ -217,6 +217,140 @@ PIO_NCINT_open(const char *path, int mode, int basepe, size_t *chunksizehintp, return NC_NOERR; } +/** + * @internal This just calls nc_enddef, ignoring the extra parameters. + * + * @param ncid File and group ID. + * @param h_minfree Ignored. + * @param v_align Ignored. + * @param v_minfree Ignored. + * @param r_align Ignored. + * + * @return ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +PIO_NCINT__enddef(int ncid, size_t h_minfree, size_t v_align, + size_t v_minfree, size_t r_align) +{ + return PIOc_enddef(ncid); +} + +/** + * @internal Put the file back in redef mode. This is done + * automatically for netcdf-4 files, if the user forgets. + * + * @param ncid File and group ID. + * + * @return ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +PIO_NCINT_redef(int ncid) +{ + return PIOc_redef(ncid); +} + +/** + * @internal Flushes all buffers associated with the file, after + * writing all changed metadata. This may only be called in data mode. + * + * @param ncid File and group ID. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_EINDEFINE Classic model file is in define mode. + * @author Ed Hartnett + */ +int +PIO_NCINT_sync(int ncid) +{ + return PIOc_sync(ncid); +} + +int +PIO_NCINT_abort(int ncid) +{ + return TEST_VAL_42; +} + +int +PIO_NCINT_close(int ncid, void *v) +{ + return PIOc_closefile(ncid); +} + +/** + * @internal Set fill mode. + * + * @param ncid File ID. + * @param fillmode File mode. + * @param old_modep Pointer that gets old mode. Ignored if NULL. + * + * @return ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +PIO_NCINT_set_fill(int ncid, int fillmode, int *old_modep) +{ + return PIOc_set_fill(ncid, fillmode, old_modep); +} + +int +PIO_NCINT_inq_format(int ncid, int *formatp) +{ + return TEST_VAL_42; +} + +int +PIO_NCINT_inq_format_extended(int ncid, int *formatp, int *modep) +{ + return TEST_VAL_42; +} + +/** + * @internal Learn number of dimensions, variables, global attributes, + * and the ID of the first unlimited dimension (if any). + * + * @note It's possible for any of these pointers to be NULL, in which + * case don't try to figure out that value. + * + * @param ncid File and group ID. + * @param ndimsp Pointer that gets number of dimensions. + * @param nvarsp Pointer that gets number of variables. + * @param nattsp Pointer that gets number of global attributes. + * @param unlimdimidp Pointer that gets first unlimited dimension ID, + * or -1 if there are no unlimied dimensions. + * + * @return ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +PIO_NCINT_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp) +{ + return PIOc_inq(ncid, ndimsp, nvarsp, nattsp, unlimdimidp); +} + +/** + * @internal Get the name and size of a type. For strings, 1 is + * returned. For VLEN the base type len is returned. + * + * @param ncid File and group ID. + * @param typeid1 Type ID. + * @param name Gets the name of the type. + * @param size Gets the size of one element of the type in bytes. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_EBADTYPE Type not found. + * @author Ed Hartnett + */ +int +PIO_NCINT_inq_type(int ncid, nc_type typeid1, char *name, size_t *size) +{ + return PIOc_inq_type(ncid, typeid1, name, (PIO_Offset *)size); +} + int PIO_NCINT_def_dim(int ncid, const char *name, size_t len, int *idp) { @@ -539,136 +673,39 @@ PIO_NCINT_put_vara(int ncid, int varid, const size_t *startp, } /** - * @internal This just calls nc_enddef, ignoring the extra parameters. - * - * @param ncid File and group ID. - * @param h_minfree Ignored. - * @param v_align Ignored. - * @param v_minfree Ignored. - * @param r_align Ignored. - * - * @return ::NC_NOERR No error. - * @author Ed Hartnett - */ -int -PIO_NCINT__enddef(int ncid, size_t h_minfree, size_t v_align, - size_t v_minfree, size_t r_align) -{ - return PIOc_enddef(ncid); -} - -/** - * @internal Put the file back in redef mode. This is done - * automatically for netcdf-4 files, if the user forgets. - * - * @param ncid File and group ID. - * - * @return ::NC_NOERR No error. - * @author Ed Hartnett - */ -int -PIO_NCINT_redef(int ncid) -{ - return PIOc_redef(ncid); -} - -/** - * @internal Flushes all buffers associated with the file, after - * writing all changed metadata. This may only be called in data mode. - * - * @param ncid File and group ID. - * - * @return ::NC_NOERR No error. - * @return ::NC_EBADID Bad ncid. - * @return ::NC_EINDEFINE Classic model file is in define mode. - * @author Ed Hartnett - */ -int -PIO_NCINT_sync(int ncid) -{ - return PIOc_sync(ncid); -} - -int -PIO_NCINT_abort(int ncid) -{ - return TEST_VAL_42; -} - -int -PIO_NCINT_close(int ncid, void *v) -{ - return PIOc_closefile(ncid); -} - -/** - * @internal Set fill mode. + * @internal Read a strided array of data from a variable. This is + * called by nc_get_vars() for netCDF-4 files, as well as all the + * other nc_get_vars_* functions. * * @param ncid File ID. - * @param fillmode File mode. - * @param old_modep Pointer that gets old mode. Ignored if NULL. - * - * @return ::NC_NOERR No error. - * @author Ed Hartnett - */ -int -PIO_NCINT_set_fill(int ncid, int fillmode, int *old_modep) -{ - return PIOc_set_fill(ncid, fillmode, old_modep); -} - -int -PIO_NCINT_inq_format(int ncid, int *formatp) -{ - return TEST_VAL_42; -} - -int -PIO_NCINT_inq_format_extended(int ncid, int *formatp, int *modep) -{ - return TEST_VAL_42; -} - -/** - * @internal Learn number of dimensions, variables, global attributes, - * and the ID of the first unlimited dimension (if any). - * - * @note It's possible for any of these pointers to be NULL, in which - * case don't try to figure out that value. - * - * @param ncid File and group ID. - * @param ndimsp Pointer that gets number of dimensions. - * @param nvarsp Pointer that gets number of variables. - * @param nattsp Pointer that gets number of global attributes. - * @param unlimdimidp Pointer that gets first unlimited dimension ID, - * or -1 if there are no unlimied dimensions. - * - * @return ::NC_NOERR No error. - * @author Ed Hartnett - */ -int -PIO_NCINT_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp) -{ - return PIOc_inq(ncid, ndimsp, nvarsp, nattsp, unlimdimidp); -} - -/** - * @internal Get the name and size of a type. For strings, 1 is - * returned. For VLEN the base type len is returned. - * - * @param ncid File and group ID. - * @param typeid1 Type ID. - * @param name Gets the name of the type. - * @param size Gets the size of one element of the type in bytes. + * @param varid Variable ID. + * @param startp Array of start indices. Must be provided for + * non-scalar vars. + * @param countp Array of counts. Will default to counts of extent of + * dimension if NULL. + * @param stridep Array of strides. Will default to strides of 1 if + * NULL. + * @param data The data to be written. + * @param mem_nc_type The type of the data in memory. (Convert to this + * type from file type.) * - * @return ::NC_NOERR No error. - * @return ::NC_EBADID Bad ncid. - * @return ::NC_EBADTYPE Type not found. - * @author Ed Hartnett + * @returns ::NC_NOERR No error. + * @returns ::NC_EBADID Bad ncid. + * @returns ::NC_ENOTVAR Var not found. + * @returns ::NC_EHDFERR HDF5 function returned error. + * @returns ::NC_EINVALCOORDS Incorrect start. + * @returns ::NC_EEDGE Incorrect start/count. + * @returns ::NC_ENOMEM Out of memory. + * @returns ::NC_EMPI MPI library error (parallel only) + * @returns ::NC_ECANTEXTEND Can't extend dimension for write. + * @returns ::NC_ERANGE Data conversion error. + * @author Ed Hartnett, Dennis Heimbigner */ int -PIO_NCINT_inq_type(int ncid, nc_type typeid1, char *name, size_t *size) +PIO_NCINT_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, + const ptrdiff_t *stridep, void *data, nc_type mem_nc_type) { - return PIOc_inq_type(ncid, typeid1, name, (PIO_Offset *)size); + return PIOc_get_vars_tc(ncid, varid, (PIO_Offset *)startp, + (PIO_Offset *)countp, (PIO_Offset *)stridep, + mem_nc_type, data); } - diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index ffa75ed1508..1f8788b5ab0 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -136,6 +136,11 @@ extern "C" { PIO_NCINT_put_vara(int ncid, int varid, const size_t *startp, const size_t *countp, const void *op, int memtype); + extern int + PIO_NCINT_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, + const ptrdiff_t *stridep, void *data, nc_type mem_nc_type); + + #if defined(__cplusplus) } #endif From e0051779ebf1034618ea3d8832d953acebd71885 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 6 Jul 2019 13:23:16 -0600 Subject: [PATCH 3/6] more PIO_NCINT functions --- src/ncint/ncintdispatch.c | 53 +++++++++++++++++++++++++-------------- src/ncint/ncintdispatch.h | 5 ++++ 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index 08cf1633fd8..073ac609202 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -64,7 +64,7 @@ NC_Dispatch NCINT_dispatcher = { PIO_NCINT_get_vara, PIO_NCINT_put_vara, PIO_NCINT_get_vars, - NCDEFAULT_put_vars, + PIO_NCINT_put_vars, NCDEFAULT_get_varm, NCDEFAULT_put_varm, @@ -583,6 +583,7 @@ PIO_NCINT_def_var(int ncid, const char *name, nc_type xtype, int ndims, * @returns ::NC_NOERR No error. * @returns ::NC_EBADID Bad ncid. * @returns ::NC_ENOTVAR Bad variable ID. + * @author Ed Hartnett */ int PIO_NCINT_inq_varid(int ncid, const char *name, int *varidp) @@ -614,12 +615,6 @@ PIO_NCINT_inq_varid(int ncid, const char *name, int *varidp) * @param name New name of the variable. * * @returns ::NC_NOERR No error. - * @returns ::NC_EBADID Bad ncid. - * @returns ::NC_ENOTVAR Invalid variable ID. - * @returns ::NC_EBADNAME Bad name. - * @returns ::NC_EMAXNAME Name is too long. - * @returns ::NC_ENAMEINUSE Name in use. - * @returns ::NC_ENOMEM Out of memory. * @author Ed Hartnett */ int @@ -639,7 +634,7 @@ PIO_NCINT_rename_var(int ncid, int varid, const char *name) * @param memtype The type of these data in memory. * * @returns ::NC_NOERR for success - * @author Ed Hartnett, Dennis Heimbigner + * @author Ed Hartnett */ int PIO_NCINT_get_vara(int ncid, int varid, const size_t *start, @@ -662,7 +657,7 @@ PIO_NCINT_get_vara(int ncid, int varid, const size_t *start, * @param memtype The type of these data in memory. * * @returns ::NC_NOERR for success - * @author Ed Hartnett, Dennis Heimbigner + * @author Ed Hartnett */ int PIO_NCINT_put_vara(int ncid, int varid, const size_t *startp, @@ -690,16 +685,7 @@ PIO_NCINT_put_vara(int ncid, int varid, const size_t *startp, * type from file type.) * * @returns ::NC_NOERR No error. - * @returns ::NC_EBADID Bad ncid. - * @returns ::NC_ENOTVAR Var not found. - * @returns ::NC_EHDFERR HDF5 function returned error. - * @returns ::NC_EINVALCOORDS Incorrect start. - * @returns ::NC_EEDGE Incorrect start/count. - * @returns ::NC_ENOMEM Out of memory. - * @returns ::NC_EMPI MPI library error (parallel only) - * @returns ::NC_ECANTEXTEND Can't extend dimension for write. - * @returns ::NC_ERANGE Data conversion error. - * @author Ed Hartnett, Dennis Heimbigner + * @author Ed Hartnett */ int PIO_NCINT_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, @@ -709,3 +695,32 @@ PIO_NCINT_get_vars(int ncid, int varid, const size_t *startp, const size_t *coun (PIO_Offset *)countp, (PIO_Offset *)stridep, mem_nc_type, data); } + +/** + * @internal Write a strided array of data to a variable. This is + * called by nc_put_vars() and other nc_put_vars_* functions, for + * netCDF-4 files. Also the nc_put_vara() calls end up calling this + * with a NULL stride parameter. + * + * @param ncid File ID. + * @param varid Variable ID. + * @param startp Array of start indices. Must always be provided by + * caller for non-scalar vars. + * @param countp Array of counts. Will default to counts of full + * dimension size if NULL. + * @param stridep Array of strides. Will default to strides of 1 if + * NULL. + * @param data The data to be written. + * @param mem_nc_type The type of the data in memory. + * + * @returns ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +PIO_NCINT_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, + const ptrdiff_t *stridep, const void *data, nc_type mem_nc_type) +{ + return PIOc_put_vars_tc(ncid, varid, (PIO_Offset *)startp, + (PIO_Offset *)countp, (PIO_Offset *)stridep, + mem_nc_type, data); +} diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index 1f8788b5ab0..e430368c869 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -140,6 +140,11 @@ extern "C" { PIO_NCINT_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, void *data, nc_type mem_nc_type); + extern int + PIO_NCINT_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp, + const ptrdiff_t *stridep, const void *data, nc_type mem_nc_type); + + #if defined(__cplusplus) } From 42f58b2b37aa4f3e50b4aed429c7e3ff44cd6c23 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 6 Jul 2019 13:28:09 -0600 Subject: [PATCH 4/6] more PIO_NCINT functions --- src/ncint/ncintdispatch.c | 47 +++++++++++++++++++++++++++++++++++---- src/ncint/ncintdispatch.h | 7 ++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index 073ac609202..a286e2fa2d0 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -68,7 +68,7 @@ NC_Dispatch NCINT_dispatcher = { NCDEFAULT_get_varm, NCDEFAULT_put_varm, - NC4_inq_var_all, + PIO_NCINT_inq_var_all, NC_NOTNC4_var_par_access, NC_RO_def_var_fill, @@ -455,7 +455,7 @@ PIO_NCINT_rename_dim(int ncid, int dimid, const char *name) */ int PIO_NCINT_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, - size_t *lenp) + size_t *lenp) { return PIOc_inq_att(ncid, varid, name, xtypep, (PIO_Offset *)lenp); } @@ -546,7 +546,7 @@ PIO_NCINT_del_att(int ncid, int varid, const char *name) */ int PIO_NCINT_get_att(int ncid, int varid, const char *name, void *value, - nc_type memtype) + nc_type memtype) { return PIOc_get_att_tc(ncid, varid, name, memtype, value); } @@ -559,7 +559,7 @@ PIO_NCINT_get_att(int ncid, int varid, const char *name, void *value, */ int PIO_NCINT_put_att(int ncid, int varid, const char *name, nc_type file_type, - size_t len, const void *data, nc_type mem_type) + size_t len, const void *data, nc_type mem_type) { return PIOc_put_att_tc(ncid, varid, name, file_type, (PIO_Offset)len, mem_type, data); @@ -724,3 +724,42 @@ PIO_NCINT_put_vars(int ncid, int varid, const size_t *startp, const size_t *coun (PIO_Offset *)countp, (PIO_Offset *)stridep, mem_nc_type, data); } +/** + * @internal Get all the information about a variable. Pass NULL for + * whatever you don't care about. + * + * @param ncid File ID. + * @param varid Variable ID. + * @param name Gets name. + * @param xtypep Gets type. + * @param ndimsp Gets number of dims. + * @param dimidsp Gets array of dim IDs. + * @param nattsp Gets number of attributes. + * @param shufflep Gets shuffle setting. + * @param deflatep Gets deflate setting. + * @param deflate_levelp Gets deflate level. + * @param fletcher32p Gets fletcher32 setting. + * @param contiguousp Gets contiguous setting. + * @param chunksizesp Gets chunksizes. + * @param no_fill Gets fill mode. + * @param fill_valuep Gets fill value. + * @param endiannessp Gets one of ::NC_ENDIAN_BIG ::NC_ENDIAN_LITTLE + * ::NC_ENDIAN_NATIVE + * @param idp Pointer to memory to store filter id. + * @param nparamsp Pointer to memory to store filter parameter count. + * @param params Pointer to vector of unsigned integers into which + * to store filter parameters. + * + * @returns ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +PIO_NCINT_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, + int *ndimsp, int *dimidsp, int *nattsp, + int *shufflep, int *deflatep, int *deflate_levelp, + int *fletcher32p, int *contiguousp, size_t *chunksizesp, + int *no_fill, void *fill_valuep, int *endiannessp, + unsigned int *idp, size_t *nparamsp, unsigned int *params) +{ + return PIOc_inq_var(ncid, varid, name, xtypep, ndimsp, dimidsp, nattsp); +} diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index e430368c869..12df101c53a 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -145,6 +145,13 @@ extern "C" { const ptrdiff_t *stridep, const void *data, nc_type mem_nc_type); + extern int + PIO_NCINT_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, + int *ndimsp, int *dimidsp, int *nattsp, + int *shufflep, int *deflatep, int *deflate_levelp, + int *fletcher32p, int *contiguousp, size_t *chunksizesp, + int *no_fill, void *fill_valuep, int *endiannessp, + unsigned int *idp, size_t *nparamsp, unsigned int *params); #if defined(__cplusplus) } From f5cc645f4661936a04d09d52c9a0f3f7f13d855e Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 6 Jul 2019 13:30:44 -0600 Subject: [PATCH 5/6] more PIO_NCINT functions --- src/ncint/ncintdispatch.c | 21 ++++++++++++++++++++- src/ncint/ncintdispatch.h | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index a286e2fa2d0..e5ec53cea6c 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -71,7 +71,7 @@ NC_Dispatch NCINT_dispatcher = { PIO_NCINT_inq_var_all, NC_NOTNC4_var_par_access, - NC_RO_def_var_fill, + PIO_NCINT_def_var_fill, NC4_show_metadata, NC4_inq_unlimdims, @@ -763,3 +763,22 @@ PIO_NCINT_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, { return PIOc_inq_var(ncid, varid, name, xtypep, ndimsp, dimidsp, nattsp); } + +/** + * @internal This functions sets fill value and no_fill mode for a + * netCDF-4 variable. It is called by nc_def_var_fill(). + * + * @note All pointer parameters may be NULL, in which case they are ignored. + * @param ncid File ID. + * @param varid Variable ID. + * @param no_fill No_fill setting. + * @param fill_value Pointer to fill value. + * + * @returns ::NC_NOERR for success + * @author Ed Hartnett + */ +int +PIO_NCINT_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) +{ + return PIOc_def_var_fill(ncid, varid, no_fill, fill_value); +} diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index 12df101c53a..0c722fdbce6 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -153,6 +153,10 @@ extern "C" { int *no_fill, void *fill_valuep, int *endiannessp, unsigned int *idp, size_t *nparamsp, unsigned int *params); + extern int + PIO_NCINT_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value); + + #if defined(__cplusplus) } #endif From acb666d768de549314fc847d7c19ae5ac7295050 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 6 Jul 2019 13:34:04 -0600 Subject: [PATCH 6/6] more PIO_NCINT functions --- src/ncint/ncintdispatch.c | 23 ++++++++++++++++++++++- src/ncint/ncintdispatch.h | 4 ++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index e5ec53cea6c..b4d7d4a4026 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -74,7 +74,7 @@ NC_Dispatch NCINT_dispatcher = { PIO_NCINT_def_var_fill, NC4_show_metadata, - NC4_inq_unlimdims, + PIO_NCINT_inq_unlimdims, NC4_inq_ncid, NC4_inq_grps, @@ -782,3 +782,24 @@ PIO_NCINT_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value) { return PIOc_def_var_fill(ncid, varid, no_fill, fill_value); } + +/** + * @internal Returns an array of unlimited dimension ids.The user can + * get the number of unlimited dimensions by first calling this with + * NULL for the second pointer. + * + * @param ncid File and group ID. + * @param nunlimdimsp Pointer that gets the number of unlimited + * dimensions. Ignored if NULL. + * @param unlimdimidsp Pointer that gets arrray of unlimited dimension + * ID. Ignored if NULL. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @author Ed Hartnett, Dennis Heimbigner + */ +int +PIO_NCINT_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) +{ + return PIOc_inq_unlimdims(ncid, nunlimdimsp, unlimdimidsp); +} diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index 0c722fdbce6..c6556aa01c8 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -156,6 +156,10 @@ extern "C" { extern int PIO_NCINT_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value); + extern int + PIO_NCINT_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp); + + #if defined(__cplusplus) }