diff --git a/doc/source/c_api.txt b/doc/source/c_api.txt index bc996be621f..e9d3ed3f62e 100644 --- a/doc/source/c_api.txt +++ b/doc/source/c_api.txt @@ -36,7 +36,10 @@ - \ref PIO_get_var_c - \ref PIO_get_var1_c - \ref PIO_get_vars_c + - \ref PIO_put_vara_c - \ref PIO_put_var_c + - \ref PIO_put_var1_c + - \ref PIO_put_vars_c \subsection inqnc_c Learn about Files and Metadata - \ref PIO_inq_c - \ref PIO_get_att_c diff --git a/src/clib/pio_put_nc.c b/src/clib/pio_put_nc.c index 76aea931731..d6f87ae08f9 100644 --- a/src/clib/pio_put_nc.c +++ b/src/clib/pio_put_nc.c @@ -11,8 +11,8 @@ #include /** - * @addtogroup PIO_put_var_c Write Data - * Write data to a Variable in C. + * @addtogroup PIO_put_vars_c Write Strided Arrays + * Write strided arrays of data to a Variable in C. * @{ */ @@ -358,6 +358,43 @@ PIOc_put_vars_ulonglong(int ncid, int varid, const PIO_Offset *start, const PIO_ return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_UINT64, op); } +/** + * Write strided, muti-dimensional subset of a variable of any type. + * + * 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 op pointer to the data to be written. + * @return PIO_NOERR on success, error code otherwise. + * @author Ed Hartnett + */ +int +PIOc_put_vars(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const void *op) +{ + return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_NAT, op); +} + +/** + * @} + */ +/** + * @addtogroup PIO_put_var1_c Write One Value + * Write one value to a variable in C. + * @{ + */ + /** * Put one value from an text variable. * @@ -618,6 +655,37 @@ PIOc_put_var1_longlong(int ncid, int varid, const PIO_Offset *index, return PIOc_put_var1_tc(ncid, varid, index, NC_INT64, op); } +/** + * Put one value from a variable of any type. + * + * 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 index an array of indicies where the data value will be + * written (must have same number of entries as variable has + * dimensions). If NULL, indices of 0 will be used. + * @param op pointer to the data to be written. + * @return PIO_NOERR on success, error code otherwise. + * @author Ed Hartnett + */ +int +PIOc_put_var1(int ncid, int varid, const PIO_Offset *index, const void *op) +{ + return PIOc_put_var1_tc(ncid, varid, index, NC_NAT, op); +} + +/** + * @} + */ +/** + * @addtogroup PIO_put_vara_c Write Arrays + * Write arrays of data to a Variable in C, specifying start and count + * arrays. + * @{ + */ + /** * Put muti-dimensional subset of a text variable. * @@ -843,6 +911,31 @@ PIOc_put_vara_float(int ncid, int varid, const PIO_Offset *start, return PIOc_put_vars_float(ncid, varid, start, count, NULL, op); } +/** + * Put muti-dimensional subset of a 64-bit integer variable. + * + * 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 op pointer to the data to be written. + * @return PIO_NOERR on success, error code otherwise. + * @author Ed Hartnett + */ +int +PIOc_put_vara_double(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const double *op) +{ + return PIOc_put_vars_double(ncid, varid, start, count, NULL, op); +} + /** * Put muti-dimensional subset of an unsigned 64-bit integer variable. * @@ -894,7 +987,7 @@ PIOc_put_vara_longlong(int ncid, int varid, const PIO_Offset *start, } /** - * Put muti-dimensional subset of a 64-bit integer variable. + * Put muti-dimensional subset of a variable of any type. * * This routine is called collectively by all tasks in the * communicator ios.union_comm. @@ -912,12 +1005,21 @@ PIOc_put_vara_longlong(int ncid, int varid, const PIO_Offset *start, * @author Ed Hartnett */ int -PIOc_put_vara_double(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const double *op) +PIOc_put_vara(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const void *op) { - return PIOc_put_vars_double(ncid, varid, start, count, NULL, op); + return PIOc_put_vars_tc(ncid, varid, start, count, NULL, NC_NAT, op); } +/** + * @} + */ +/** + * @addtogroup PIO_put_var_c Write Entire Variable + * Write the entire variable in C. + * @{ + */ + /** * Put all data to a text variable. * @@ -1152,80 +1254,6 @@ PIOc_put_var(int ncid, int varid, const void *op) return PIOc_put_var_tc(ncid, varid, NC_NAT, op); } -/** - * Put one value from a variable of any type. - * - * 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 index an array of indicies where the data value will be - * written (must have same number of entries as variable has - * dimensions). If NULL, indices of 0 will be used. - * @param op pointer to the data to be written. - * @return PIO_NOERR on success, error code otherwise. - * @author Ed Hartnett - */ -int -PIOc_put_var1(int ncid, int varid, const PIO_Offset *index, const void *op) -{ - return PIOc_put_var1_tc(ncid, varid, index, NC_NAT, op); -} - -/** - * Put muti-dimensional subset of a variable of any type. - * - * 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 op pointer to the data to be written. - * @return PIO_NOERR on success, error code otherwise. - * @author Ed Hartnett - */ -int -PIOc_put_vara(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const void *op) -{ - return PIOc_put_vars_tc(ncid, varid, start, count, NULL, NC_NAT, op); -} - -/** - * Write strided, muti-dimensional subset of a variable of any type. - * - * 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 op pointer to the data to be written. - * @return PIO_NOERR on success, error code otherwise. - * @author Ed Hartnett - */ -int -PIOc_put_vars(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const void *op) -{ - return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_NAT, op); -} - /** * @} */ diff --git a/src/clib/pio_put_vard.c b/src/clib/pio_put_vard.c index ac30207727f..7834c71aa3d 100644 --- a/src/clib/pio_put_vard.c +++ b/src/clib/pio_put_vard.c @@ -11,8 +11,8 @@ #include /** - * @addtogroup PIO_put_var_c Write Data - * Write data to a Variable in C. + * @addtogroup PIO_put_vard_c Write Data + * Write distributed arrays to a Variable in C. * @{ */