From 6de0e94958312ca4944769e41987fb35acd9d6cb Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Thu, 6 Jun 2019 09:49:39 -0600 Subject: [PATCH] separated get functions into category by var/vara/var1/vars/vard for documentation --- doc/source/c_api.txt | 3 + src/clib/pio_get_nc.c | 177 +++++++++++++++++++++++----------------- src/clib/pio_get_vard.c | 4 +- 3 files changed, 109 insertions(+), 75 deletions(-) diff --git a/doc/source/c_api.txt b/doc/source/c_api.txt index be71cb9d2dc..bc996be621f 100644 --- a/doc/source/c_api.txt +++ b/doc/source/c_api.txt @@ -32,7 +32,10 @@ - \ref PIO_def_var_c - \ref PIO_put_att_c \subsection putget_c Reading/Writing Data + - \ref PIO_get_vara_c - \ref PIO_get_var_c + - \ref PIO_get_var1_c + - \ref PIO_get_vars_c - \ref PIO_put_var_c \subsection inqnc_c Learn about Files and Metadata - \ref PIO_inq_c diff --git a/src/clib/pio_get_nc.c b/src/clib/pio_get_nc.c index 7b05fe5f607..589a3de11e2 100644 --- a/src/clib/pio_get_nc.c +++ b/src/clib/pio_get_nc.c @@ -12,8 +12,8 @@ #include /** - * @addtogroup PIO_get_var_c Read Data - * Read data from a variable in C. + * @addtogroup PIO_get_vars_c Read Strided Arrays + * Read strided arrays of data from a variable in C. * @{ */ @@ -345,6 +345,45 @@ int PIOc_get_vars_longlong(int ncid, int varid, const PIO_Offset *start, return PIOc_get_vars_tc(ncid, varid, start, count, stride, NC_INT64, buf); } +/** + * Get strided, muti-dimensional subset of a variable of the same type + * as the variable in the file. + * + * This routine is called collectively by all tasks in the + * communicator ios.union_comm. + * + * @param ncid identifies the netCDF file + * @param varid the variable ID number + * @param start an array of start indicies (must have same number of + * entries as variable has dimensions). If NULL, indices of 0 will be + * used. + * @param count an array of counts (must have same number of entries + * as variable has dimensions). If NULL, counts matching the size of + * the variable will be used. + * @param stride an array of strides (must have same number of + * entries as variable has dimensions). If NULL, strides of 1 will be + * used. + * @param buf pointer that will get the data. + * @return PIO_NOERR on success, error code otherwise. + * @author Ed Hartnett + */ +int PIOc_get_vars(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, void *buf) +{ + return PIOc_get_vars_tc(ncid, varid, start, count, stride, NC_NAT, buf); +} + +/** + * @} + */ + +/** + * @addtogroup PIO_get_vara_c Read Arrays + * Read arrays of data from a variable in C, specifying start and + * count arrays. + * @{ + */ + /** * Get a muti-dimensional subset of a text variable. * @@ -635,6 +674,41 @@ int PIOc_get_vara_longlong(int ncid, int varid, const PIO_Offset *start, return PIOc_get_vars_tc(ncid, varid, start, count, NULL, NC_INT64, buf); } +/** + * Get a muti-dimensional subset of a variable the same type + * as the variable in the file. + * + * This routine is called collectively by all tasks in the + * communicator ios.union_comm. + * + * @param ncid identifies the netCDF file + * @param varid the variable ID number + * @param start an array of start indicies (must have same number of + * entries as variable has dimensions). If NULL, indices of 0 will be + * used. + * @param count an array of counts (must have same number of entries + * as variable has dimensions). If NULL, counts matching the size of + * the variable will be used. + * @param buf pointer that will get the data. + * @return PIO_NOERR on success, error code otherwise. + * @author Ed Hartnett + */ +int PIOc_get_vara(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + void *buf) +{ + return PIOc_get_vars_tc(ncid, varid, start, count, NULL, NC_NAT, buf); +} + +/** + * @} + */ + +/** + * @addtogroup PIO_get_var_c Read Entire Variable + * Read the entire variable at one time into an array in C. + * @{ + */ + /** * Get all data of a text variable. * @@ -839,6 +913,34 @@ int PIOc_get_var_longlong(int ncid, int varid, long long *buf) return PIOc_get_var_tc(ncid, varid, NC_INT64, buf); } +/** + * Get all data from a variable the same type as the variable in the + * file. + * + * This routine is called collectively by all tasks in the + * communicator ios.union_comm. + * + * @param ncid identifies the netCDF file + * @param varid the variable ID number + * @param buf pointer that will get the data. + * @return PIO_NOERR on success, error code otherwise. + * @author Ed Hartnett + */ +int PIOc_get_var(int ncid, int varid, void *buf) +{ + return PIOc_get_var_tc(ncid, varid, NC_NAT, buf); +} + +/** + * @} + */ + +/** + * @addtogroup PIO_get_var1_c Read One Value + * Read one value from a variable in C. + * @{ + */ + /** * Get one value of a text variable. * @@ -1083,24 +1185,6 @@ int PIOc_get_var1_longlong(int ncid, int varid, const PIO_Offset *index, return PIOc_get_var1_tc(ncid, varid, index, NC_INT64, buf); } -/** - * Get all data from a variable the same type as the variable in the - * file. - * - * This routine is called collectively by all tasks in the - * communicator ios.union_comm. - * - * @param ncid identifies the netCDF file - * @param varid the variable ID number - * @param buf pointer that will get the data. - * @return PIO_NOERR on success, error code otherwise. - * @author Ed Hartnett - */ -int PIOc_get_var(int ncid, int varid, void *buf) -{ - return PIOc_get_var_tc(ncid, varid, NC_NAT, buf); -} - /** * Get one value from a variable the same type as the variable in the * file. @@ -1122,59 +1206,6 @@ int PIOc_get_var1(int ncid, int varid, const PIO_Offset *index, void *buf) return PIOc_get_var1_tc(ncid, varid, index, NC_NAT, buf); } -/** - * Get a muti-dimensional subset of a variable the same type - * as the variable in the file. - * - * This routine is called collectively by all tasks in the - * communicator ios.union_comm. - * - * @param ncid identifies the netCDF file - * @param varid the variable ID number - * @param start an array of start indicies (must have same number of - * entries as variable has dimensions). If NULL, indices of 0 will be - * used. - * @param count an array of counts (must have same number of entries - * as variable has dimensions). If NULL, counts matching the size of - * the variable will be used. - * @param buf pointer that will get the data. - * @return PIO_NOERR on success, error code otherwise. - * @author Ed Hartnett - */ -int PIOc_get_vara(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - void *buf) -{ - return PIOc_get_vars_tc(ncid, varid, start, count, NULL, NC_NAT, buf); -} - -/** - * Get strided, muti-dimensional subset of a variable of the same type - * as the variable in the file. - * - * This routine is called collectively by all tasks in the - * communicator ios.union_comm. - * - * @param ncid identifies the netCDF file - * @param varid the variable ID number - * @param start an array of start indicies (must have same number of - * entries as variable has dimensions). If NULL, indices of 0 will be - * used. - * @param count an array of counts (must have same number of entries - * as variable has dimensions). If NULL, counts matching the size of - * the variable will be used. - * @param stride an array of strides (must have same number of - * entries as variable has dimensions). If NULL, strides of 1 will be - * used. - * @param buf pointer that will get the data. - * @return PIO_NOERR on success, error code otherwise. - * @author Ed Hartnett - */ -int PIOc_get_vars(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, void *buf) -{ - return PIOc_get_vars_tc(ncid, varid, start, count, stride, NC_NAT, buf); -} - /** * @} */ diff --git a/src/clib/pio_get_vard.c b/src/clib/pio_get_vard.c index cccead9bc62..0ae9284f17a 100644 --- a/src/clib/pio_get_vard.c +++ b/src/clib/pio_get_vard.c @@ -12,8 +12,8 @@ #include /** - * @addtogroup PIO_get_var_c Read Data - * Read data from a variable in C. + * @addtogroup PIO_get_vard_c Read Distributed Arrays + * Read distributed arrays from a variable in C. * @{ */