Skip to content

Commit

Permalink
separated put functions into category by var/vara/var1/vars/vard for …
Browse files Browse the repository at this point in the history
…documentation
  • Loading branch information
edhartnett committed Jun 6, 2019
1 parent 6de0e94 commit df1218b
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 82 deletions.
3 changes: 3 additions & 0 deletions doc/source/c_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
188 changes: 108 additions & 80 deletions src/clib/pio_put_nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <pio_internal.h>

/**
* @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.
* @{
*/

Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}

/**
* @}
*/
4 changes: 2 additions & 2 deletions src/clib/pio_put_vard.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <pio_internal.h>

/**
* @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.
* @{
*/

Expand Down

0 comments on commit df1218b

Please sign in to comment.