From 6fe3aed22d607b5f05f4d8af3636fef0943ea199 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 18 May 2019 12:46:47 -0600 Subject: [PATCH 1/5] documentation fixes --- doc/Doxyfile.in | 2 +- src/clib/pio.h | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 18436877545..34dcdbc5946 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -772,7 +772,7 @@ INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../doc/source \ @CMAKE_CURRENT_SOURCE_DIR@/../src/flib \ @CMAKE_CURRENT_SOURCE_DIR@/../examples/c \ @CMAKE_CURRENT_SOURCE_DIR@/../examples/f03 \ - @CMAKE_CURRENT_SOURCE_DIR@/../src/clib + @CMAKE_CURRENT_SOURCE_DIR@/../src/clib \ @CMAKE_BINARY_DIR@/src/flib \ @C_SRC_FILES@ diff --git a/src/clib/pio.h b/src/clib/pio.h index f5647e364a0..38a83db62ca 100644 --- a/src/clib/pio.h +++ b/src/clib/pio.h @@ -50,57 +50,58 @@ /** Used in the decomposition netCDF file. */ -/* Holds the version of the decomposition file. */ +/** Holds the version of the decomposition file. */ #define DECOMP_VERSION_ATT_NAME "PIO_library_version" -/* Holds the maximum length of any task map. */ +/** Holds the maximum length of any task map. */ #define DECOMP_MAX_MAPLEN_ATT_NAME "max_maplen" -/* Name of title attribute. */ +/** Name of title attribute in decomposition file. */ #define DECOMP_TITLE_ATT_NAME "title" -/* Name of history attribute. */ +/** Name of history attribute in decomposition file. */ #define DECOMP_HISTORY_ATT_NAME "history" -/* Name of source attribute. */ +/** Name of source attribute in decomposition file. */ #define DECOMP_SOURCE_ATT_NAME "source" -/* Name of array order (C or Fortran) attribute. */ +/** Name of array order (C or Fortran) attribute in decomposition + * file. */ #define DECOMP_ORDER_ATT_NAME "array_order" -/* Name of backtrace attribute. */ +/** Name of backtrace attribute in decomposition file. */ #define DECOMP_BACKTRACE_ATT_NAME "backtrace" -/* Name for the dim dim in decomp file. */ +/** Name for the dim dim in decomp file. */ #define DECOMP_DIM_DIM "dims" -/* Name for the npes dim in decomp file. */ +/** Name for the npes dim in decomp file. */ #define DECOMP_TASK_DIM_NAME "task" -/* Name for the npes dim in decomp file. */ +/** Name for the npes dim in decomp file. */ #define DECOMP_MAPELEM_DIM_NAME "map_element" +/** Name for the number of dimensions dim in decomp file. */ #define DECOMP_NDIMS "ndims" -/* Name of var in decomp file that holds global array sizes. */ +/** Name of var in decomp file that holds global array sizes. */ #define DECOMP_GLOBAL_SIZE_VAR_NAME "global_size" -/* Name of var in decomp file that holds the length of the map for +/** Name of var in decomp file that holds the length of the map for * each task. */ #define DECOMP_MAPLEN_VAR_NAME "maplen" -/* Name of var in decomp file that holds map. */ +/** Name of var in decomp file that holds map. */ #define DECOMP_MAP_VAR_NAME "map" -/* String used to indicate a decomposition file is in C +/** String used to indicate a decomposition file is in C * array-order. */ #define DECOMP_C_ORDER_STR "C" -/* String used to indicate a decomposition file is in Fortran +/** String used to indicate a decomposition file is in Fortran * array-order. */ #define DECOMP_FORTRAN_ORDER_STR "Fortran" - /** * Variable description structure. */ From d22a00c59f6a8fdb05f25382cff914cad8839a9f Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 18 May 2019 13:00:59 -0600 Subject: [PATCH 2/5] more documentation and warning fixes --- src/clib/pio.h | 26 ++++++++++++++++++-------- src/clib/pio_rearrange.c | 1 - src/clib/pioc_support.c | 2 +- src/clib/uthash.h | 3 +++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/clib/pio.h b/src/clib/pio.h index 38a83db62ca..83ed8f7feae 100644 --- a/src/clib/pio.h +++ b/src/clib/pio.h @@ -34,8 +34,13 @@ #endif /** PIO_OFFSET is an integer type of size sufficient to represent the - * size (in bytes) of the largest file supported by MPI. */ + * size (in bytes) of the largest file supported by MPI. This is not + * actually used by the code. */ #define PIO_OFFSET MPI_OFFSET + +/** PIO_OFFSET is defined as MPI_Offset, which is defined in + * pio_internal.h as long long. This is what is used throughout the C + * code. */ #define PIO_Offset MPI_Offset /** The maximum number of variables allowed in a netCDF file. */ @@ -210,7 +215,7 @@ enum PIO_REARR_COMM_FC_DIR PIO_REARR_COMM_FC_2D_DISABLE }; -/* Constant to indicate unlimited requests. */ +/** Constant to indicate unlimited requests for the rearranger. */ #define PIO_REARR_COMM_UNLIMITED_PEND_REQ -1 /** @@ -760,13 +765,16 @@ enum PIO_ERROR_HANDLERS #define PIO_EINDEP (-203) #endif /* _PNETCDF */ -/** Define error codes for PIO. */ +/** The first error code for PIO. */ #define PIO_FIRST_ERROR_CODE (-500) + +/** Bad IOTYPE error. */ #define PIO_EBADIOTYPE (-500) -/** variable dimensions do not match in a multivar call */ + +/** Variable dimensions do not match in a multivar call. */ #define PIO_EVARDIMMISMATCH (-501) -/** ??? */ +/** Request NULL. */ #define PIO_REQ_NULL (NC_REQ_NULL-1) #if defined(__cplusplus) @@ -818,11 +826,14 @@ extern "C" { int *num_procs_per_comp, int **proc_list, MPI_Comm *io_comm, MPI_Comm *comp_comm, int rearranger, int *iosysidp); - int PIOc_Init_Intercomm(int component_count, MPI_Comm peer_comm, MPI_Comm *comp_comms, - MPI_Comm io_comm, int *iosysidp); + /* How many IO tasks in this iosysid? */ int PIOc_get_numiotasks(int iosysid, int *numiotasks); + + /* Initialize PIO for intracomm mode. */ int PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int rearr, int *iosysidp); + + /* Shut down iosystem and free all associated resources. */ int PIOc_finalize(int iosysid); /* Set error handling for entire io system. */ @@ -913,7 +924,6 @@ extern "C" { int deflate_level); int PIOc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep, int *deflate_levelp); - int PIOc_inq_var_szip(int ncid, int varid, int *options_maskp, int *pixels_per_blockp); int PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunksizesp); int PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizesp); int PIOc_def_var_endian(int ncid, int varid, int endian); diff --git a/src/clib/pio_rearrange.c b/src/clib/pio_rearrange.c index fe449774358..fa946c140eb 100644 --- a/src/clib/pio_rearrange.c +++ b/src/clib/pio_rearrange.c @@ -1344,7 +1344,6 @@ int box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *com } if(ios->ioproc){ /* Only I/O procs send sc_info messages */ - int nmsgs = ios->num_iotasks; for (int i = 0; i < ios->num_comptasks; i++) { sendcounts[ios->compranks[i]] = sc_info_msg_sz; diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index c771e584c2d..ae94aea8f64 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -1710,7 +1710,7 @@ int PIOc_writemap_from_f90(const char *file, int ndims, const int *gdims, * parameters are read on comp task 0 and ignored elsewhere. * * @param iosysid A defined pio system ID, obtained from - * PIOc_Init_Intercomm() or PIOc_InitAsync(). + * PIOc_Init_Intracomm() or PIOc_InitAsync(). * @param ncidp A pointer that gets the ncid of the newly created * file. * @param iotype A pointer to a pio output format. Must be one of diff --git a/src/clib/uthash.h b/src/clib/uthash.h index 76bdca64199..59910166f59 100644 --- a/src/clib/uthash.h +++ b/src/clib/uthash.h @@ -1156,6 +1156,7 @@ for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); #define HASH_COUNT(head) HASH_CNT(hh,head) #define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U) +/** Hash bucket. */ typedef struct UT_hash_bucket { struct UT_hash_handle *hh_head; unsigned count; @@ -1180,6 +1181,7 @@ typedef struct UT_hash_bucket { #define HASH_SIGNATURE 0xa0111fe1u #define HASH_BLOOM_SIGNATURE 0xb12220f2u +/** Hash table. */ typedef struct UT_hash_table { UT_hash_bucket *buckets; unsigned num_buckets, log2_num_buckets; @@ -1213,6 +1215,7 @@ typedef struct UT_hash_table { } UT_hash_table; +/** Hash handle. */ typedef struct UT_hash_handle { struct UT_hash_table *tbl; void *prev; /* prev element in app order */ From 5db51a62dce636a1d2d4d8fd387f1779edfe3076 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 18 May 2019 13:29:26 -0600 Subject: [PATCH 3/5] fixing documentation --- src/clib/pio_nc.c | 273 ++++++++++++++++++++++++++++++---------------- 1 file changed, 180 insertions(+), 93 deletions(-) diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index f747320e721..c356bac4799 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -30,12 +30,22 @@ * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). + * @param ndimsp a pointer that will get the number of + * dimensions. Ignored if NULL. + * @param nvarsp a pointer that will get the number of + * variables. Ignored if NULL. + * @param ngattsp a pointer that will get the number of + * attributes. Ignored if NULL. + * @param unlimdimidp a pointer that will the ID of the unlimited + * dimension, or -1 if there is no unlimited dimension. Ignored if + * NULL. * * @return PIO_NOERR for success, error code otherwise. See - * PIOc_Set_File_Error_Handling + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) +int +PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -158,11 +168,13 @@ int PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) * Find out how many dimensions are defined in the file. * * @param ncid the ncid of the open file. - * @param ndimsp a pointer that will get the number of dimensions. + * @param ndimsp a pointer that will get the number of + * dimensions. Ignored if NULL. * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_ndims(int ncid, int *ndimsp) +int +PIOc_inq_ndims(int ncid, int *ndimsp) { LOG((1, "PIOc_inq_ndims")); return PIOc_inq(ncid, ndimsp, NULL, NULL, NULL); @@ -177,7 +189,8 @@ int PIOc_inq_ndims(int ncid, int *ndimsp) * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_nvars(int ncid, int *nvarsp) +int +PIOc_inq_nvars(int ncid, int *nvarsp) { return PIOc_inq(ncid, NULL, nvarsp, NULL, NULL); } @@ -187,11 +200,12 @@ int PIOc_inq_nvars(int ncid, int *nvarsp) * Find out how many global attributes are defined in a file. * * @param ncid the ncid of the open file. - * @param nattsp a pointer that will get the number of attributes. + * @param ngattsp a pointer that will get the number of attributes. * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_natts(int ncid, int *ngattsp) +int +PIOc_inq_natts(int ncid, int *ngattsp) { return PIOc_inq(ncid, NULL, NULL, ngattsp, NULL); } @@ -206,7 +220,8 @@ int PIOc_inq_natts(int ncid, int *ngattsp) * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_unlimdim(int ncid, int *unlimdimidp) +int +PIOc_inq_unlimdim(int ncid, int *unlimdimidp) { LOG((1, "PIOc_inq_unlimdim ncid = %d", ncid)); return PIOc_inq(ncid, NULL, NULL, NULL, unlimdimidp); @@ -225,7 +240,8 @@ int PIOc_inq_unlimdim(int ncid, int *unlimdimidp) * @ingroup PIO_inq_unlimdim * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) +int +PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -361,7 +377,8 @@ int PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) * @returns 0 for success, error code otherwise. * @author Ed Hartnett */ -int PIOc_inq_type(int ncid, nc_type xtype, char *name, PIO_Offset *sizep) +int +PIOc_inq_type(int ncid, nc_type xtype, char *name, PIO_Offset *sizep) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -451,7 +468,8 @@ int PIOc_inq_type(int ncid, nc_type xtype, char *name, PIO_Offset *sizep) * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_format(int ncid, int *formatp) +int +PIOc_inq_format(int ncid, int *formatp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -527,11 +545,16 @@ int PIOc_inq_format(int ncid, int *formatp) * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). + * @param dimid the dimension ID. + * @param name a pointer that gets the name of the dimension. Igorned + * if NULL. Name will be PIO_MAX_NAME chars or fewer. * @param lenp a pointer that will get the number of values - * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling() * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) +int +PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -629,11 +652,12 @@ int PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) * @param ncid the ncid of an open file. * @param dimid the dimension ID. * @param name a pointer that gets the name of the dimension. Igorned - * if NULL. + * if NULL. Name will be PIO_MAX_NAME chars or fewer. * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_dimname(int ncid, int dimid, char *name) +int +PIOc_inq_dimname(int ncid, int dimid, char *name) { LOG((1, "PIOc_inq_dimname ncid = %d dimid = %d", ncid, dimid)); return PIOc_inq_dim(ncid, dimid, name, NULL); @@ -650,7 +674,8 @@ int PIOc_inq_dimname(int ncid, int dimid, char *name) * @returns 0 for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_dimlen(int ncid, int dimid, PIO_Offset *lenp) +int +PIOc_inq_dimlen(int ncid, int dimid, PIO_Offset *lenp) { return PIOc_inq_dim(ncid, dimid, NULL, lenp); } @@ -670,7 +695,8 @@ int PIOc_inq_dimlen(int ncid, int dimid, PIO_Offset *lenp) * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_dimid(int ncid, const char *name, int *idp) +int +PIOc_inq_dimid(int ncid, const char *name, int *idp) { iosystem_desc_t *ios; file_desc_t *file; @@ -757,13 +783,22 @@ int PIOc_inq_dimid(int ncid, const char *name, int *idp) * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. - * @param xtypep a pointer that will get the type of the attribute. - * @param nattsp a pointer that will get the number of attributes + * @param name a pointer that gets the name of the dimension. Igorned + * if NULL. Name will be PIO_MAX_NAME chars or fewer. + * @param xtypep a pointer that will get the type of the + * attribute. Ignored if NULL. + * @param ndimsp a pointer that will get the number of + * dimensions. Ignored if NULL. + * @param dimidsp a pointer that will get an array of dimids. Ignored + * if NULL. + * @param nattsp a pointer that will get the number of + * attributes. Ignored if NULL. * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, - int *dimidsp, int *nattsp) +int +PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, + int *dimidsp, int *nattsp) { iosystem_desc_t *ios; file_desc_t *file; @@ -919,7 +954,8 @@ int PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_varname(int ncid, int varid, char *name) +int +PIOc_inq_varname(int ncid, int varid, char *name) { return PIOc_inq_var(ncid, varid, name, NULL, NULL, NULL, NULL); } @@ -935,7 +971,8 @@ int PIOc_inq_varname(int ncid, int varid, char *name) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_vartype(int ncid, int varid, nc_type *xtypep) +int +PIOc_inq_vartype(int ncid, int varid, nc_type *xtypep) { return PIOc_inq_var(ncid, varid, NULL, xtypep, NULL, NULL, NULL); } @@ -951,7 +988,8 @@ int PIOc_inq_vartype(int ncid, int varid, nc_type *xtypep) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_varndims(int ncid, int varid, int *ndimsp) +int +PIOc_inq_varndims(int ncid, int varid, int *ndimsp) { return PIOc_inq_var(ncid, varid, NULL, NULL, ndimsp, NULL, NULL); } @@ -967,7 +1005,8 @@ int PIOc_inq_varndims(int ncid, int varid, int *ndimsp) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_vardimid(int ncid, int varid, int *dimidsp) +int +PIOc_inq_vardimid(int ncid, int varid, int *dimidsp) { return PIOc_inq_var(ncid, varid, NULL, NULL, NULL, dimidsp, NULL); } @@ -983,7 +1022,8 @@ int PIOc_inq_vardimid(int ncid, int varid, int *dimidsp) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_varnatts(int ncid, int varid, int *nattsp) +int +PIOc_inq_varnatts(int ncid, int varid, int *nattsp) { return PIOc_inq_var(ncid, varid, NULL, NULL, NULL, NULL, nattsp); } @@ -1004,7 +1044,8 @@ int PIOc_inq_varnatts(int ncid, int varid, int *nattsp) * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_varid(int ncid, const char *name, int *varidp) +int +PIOc_inq_varid(int ncid, const char *name, int *varidp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1094,8 +1135,9 @@ int PIOc_inq_varid(int ncid, const char *name, int *varidp) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_att_eh(int ncid, int varid, const char *name, int eh, - nc_type *xtypep, PIO_Offset *lenp) +int +PIOc_inq_att_eh(int ncid, int varid, const char *name, int eh, + nc_type *xtypep, PIO_Offset *lenp) { int msg = PIO_MSG_INQ_ATT; iosystem_desc_t *ios; @@ -1199,8 +1241,9 @@ int PIOc_inq_att_eh(int ncid, int varid, const char *name, int eh, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, - PIO_Offset *lenp) +int +PIOc_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, + PIO_Offset *lenp) { return PIOc_inq_att_eh(ncid, varid, name, 1, xtypep, lenp); } @@ -1217,7 +1260,8 @@ int PIOc_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_attlen(int ncid, int varid, const char *name, PIO_Offset *lenp) +int +PIOc_inq_attlen(int ncid, int varid, const char *name, PIO_Offset *lenp) { return PIOc_inq_att(ncid, varid, name, NULL, lenp); } @@ -1234,7 +1278,8 @@ int PIOc_inq_attlen(int ncid, int varid, const char *name, PIO_Offset *lenp) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep) +int +PIOc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep) { return PIOc_inq_att(ncid, varid, name, xtypep, NULL); } @@ -1255,7 +1300,8 @@ int PIOc_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep) * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_attname(int ncid, int varid, int attnum, char *name) +int +PIOc_inq_attname(int ncid, int varid, int attnum, char *name) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1343,11 +1389,15 @@ int PIOc_inq_attname(int ncid, int varid, int attnum, char *name) * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. - * @param idp a pointer that will get the id of the variable or attribute. + * @param name a pointer that will get name of attribute. Ignored if + * NULL. + * @param idp a pointer that will get the id of the variable or + * attribute. Ignored if NULL. * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) +int +PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1437,7 +1487,8 @@ int PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_rename_dim(int ncid, int dimid, const char *name) +int +PIOc_rename_dim(int ncid, int dimid, const char *name) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1523,7 +1574,8 @@ int PIOc_rename_dim(int ncid, int dimid, const char *name) * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_rename_var(int ncid, int varid, const char *name) +int +PIOc_rename_var(int ncid, int varid, const char *name) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1610,8 +1662,9 @@ int PIOc_rename_var(int ncid, int varid, const char *name) * PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett */ -int PIOc_rename_att(int ncid, int varid, const char *name, - const char *newname) +int +PIOc_rename_att(int ncid, int varid, const char *name, + const char *newname) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1702,7 +1755,8 @@ int PIOc_rename_att(int ncid, int varid, const char *name, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_del_att(int ncid, int varid, const char *name) +int +PIOc_del_att(int ncid, int varid, const char *name) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1785,7 +1839,8 @@ int PIOc_del_att(int ncid, int varid, const char *name) * @ingroup PIO_set_fill * @author Jim Edwards, Ed Hartnett */ -int PIOc_set_fill(int ncid, int fillmode, int *old_modep) +int +PIOc_set_fill(int ncid, int fillmode, int *old_modep) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1875,7 +1930,8 @@ int PIOc_set_fill(int ncid, int fillmode, int *old_modep) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_enddef(int ncid) +int +PIOc_enddef(int ncid) { return pioc_change_def(ncid, 1); } @@ -1894,7 +1950,8 @@ int PIOc_enddef(int ncid) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_redef(int ncid) +int +PIOc_redef(int ncid) { return pioc_change_def(ncid, 0); } @@ -1914,7 +1971,8 @@ int PIOc_redef(int ncid) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_def_dim(int ncid, const char *name, PIO_Offset len, int *idp) +int +PIOc_def_dim(int ncid, const char *name, PIO_Offset len, int *idp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2005,8 +2063,9 @@ int PIOc_def_dim(int ncid, const char *name, PIO_Offset len, int *idp) * @ingroup PIO_def_var * @author Jim Edwards, Ed Hartnett */ -int PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims, - const int *dimidsp, int *varidp) +int +PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims, + const int *dimidsp, int *varidp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2047,11 +2106,11 @@ int PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims, return pio_err(ios, NULL, ierr, __FILE__, __LINE__); /* Get the size of the MPI type. */ - if(mpi_type == MPI_DATATYPE_NULL) - mpi_type_size = 0; - else - if ((mpierr = MPI_Type_size(mpi_type, &mpi_type_size))) - return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); + if(mpi_type == MPI_DATATYPE_NULL) + mpi_type_size = 0; + else + if ((mpierr = MPI_Type_size(mpi_type, &mpi_type_size))) + return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); /* How many unlimited dims are present in the file? */ if ((ierr = PIOc_inq_unlimdims(ncid, &nunlimdims, NULL))) @@ -2211,7 +2270,8 @@ int PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims, * @ingroup PIO_def_var * @author Jim Edwards, Ed Hartnett */ -int PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) +int +PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2343,7 +2403,8 @@ int PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_value * @ingroup PIO_inq_var_fill * @author Jim Edwards, Ed Hartnett */ -int PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) +int +PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2523,7 +2584,8 @@ int PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) * @ingroup PIO_get_att * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att(int ncid, int varid, const char *name, void *ip) +int +PIOc_get_att(int ncid, int varid, const char *name, void *ip) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2566,8 +2628,9 @@ int PIOc_get_att(int ncid, int varid, const char *name, void *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const void *op) +int +PIOc_put_att(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const void *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, xtype, op); } @@ -2587,7 +2650,8 @@ int PIOc_put_att(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_double(int ncid, int varid, const char *name, double *ip) +int +PIOc_get_att_double(int ncid, int varid, const char *name, double *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_DOUBLE, (void *)ip); } @@ -2607,7 +2671,8 @@ int PIOc_get_att_double(int ncid, int varid, const char *name, double *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip) +int +PIOc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_UBYTE, (void *)ip); } @@ -2627,7 +2692,8 @@ int PIOc_get_att_uchar(int ncid, int varid, const char *name, unsigned char *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip) +int +PIOc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_USHORT, (void *)ip); } @@ -2647,7 +2713,8 @@ int PIOc_get_att_ushort(int ncid, int varid, const char *name, unsigned short *i * @ingroup PIO_get_att * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip) +int +PIOc_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_UINT, (void *)ip); } @@ -2667,7 +2734,8 @@ int PIOc_get_att_uint(int ncid, int varid, const char *name, unsigned int *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_long(int ncid, int varid, const char *name, long *ip) +int +PIOc_get_att_long(int ncid, int varid, const char *name, long *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_LONG_INTERNAL, (void *)ip); } @@ -2689,7 +2757,8 @@ int PIOc_get_att_long(int ncid, int varid, const char *name, long *ip) * @ingroup PIO_get_att * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_text(int ncid, int varid, const char *name, char *ip) +int +PIOc_get_att_text(int ncid, int varid, const char *name, char *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_CHAR, (void *)ip); } @@ -2709,7 +2778,8 @@ int PIOc_get_att_text(int ncid, int varid, const char *name, char *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_schar(int ncid, int varid, const char *name, signed char *ip) +int +PIOc_get_att_schar(int ncid, int varid, const char *name, signed char *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_BYTE, (void *)ip); } @@ -2729,7 +2799,8 @@ int PIOc_get_att_schar(int ncid, int varid, const char *name, signed char *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *ip) +int +PIOc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long long *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_UINT64, (void *)ip); } @@ -2749,7 +2820,8 @@ int PIOc_get_att_ulonglong(int ncid, int varid, const char *name, unsigned long * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_short(int ncid, int varid, const char *name, short *ip) +int +PIOc_get_att_short(int ncid, int varid, const char *name, short *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_SHORT, (void *)ip); } @@ -2769,7 +2841,8 @@ int PIOc_get_att_short(int ncid, int varid, const char *name, short *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_int(int ncid, int varid, const char *name, int *ip) +int +PIOc_get_att_int(int ncid, int varid, const char *name, int *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_INT, (void *)ip); } @@ -2789,7 +2862,8 @@ int PIOc_get_att_int(int ncid, int varid, const char *name, int *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_longlong(int ncid, int varid, const char *name, long long *ip) +int +PIOc_get_att_longlong(int ncid, int varid, const char *name, long long *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_INT64, (void *)ip); } @@ -2809,7 +2883,8 @@ int PIOc_get_att_longlong(int ncid, int varid, const char *name, long long *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_get_att_float(int ncid, int varid, const char *name, float *ip) +int +PIOc_get_att_float(int ncid, int varid, const char *name, float *ip) { return PIOc_get_att_tc(ncid, varid, name, PIO_FLOAT, (void *)ip); } @@ -2831,8 +2906,9 @@ int PIOc_get_att_float(int ncid, int varid, const char *name, float *ip) * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const signed char *op) +int +PIOc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const signed char *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_BYTE, op); } @@ -2854,8 +2930,9 @@ int PIOc_put_att_schar(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const long *op) +int +PIOc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const long *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_LONG_INTERNAL, op); } @@ -2877,8 +2954,9 @@ int PIOc_put_att_long(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const int *op) +int +PIOc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const int *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_INT, op); } @@ -2900,8 +2978,9 @@ int PIOc_put_att_int(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const unsigned char *op) +int +PIOc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const unsigned char *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_UBYTE, op); } @@ -2923,8 +3002,9 @@ int PIOc_put_att_uchar(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const long long *op) +int +PIOc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const long long *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_INT64, op); } @@ -2946,8 +3026,9 @@ int PIOc_put_att_longlong(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const unsigned int *op) +int +PIOc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const unsigned int *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_UINT, op); } @@ -2969,8 +3050,9 @@ int PIOc_put_att_uint(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const float *op) +int +PIOc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const float *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_FLOAT, op); } @@ -2992,8 +3074,9 @@ int PIOc_put_att_float(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const unsigned long long *op) +int +PIOc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const unsigned long long *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_UINT64, op); } @@ -3015,8 +3098,9 @@ int PIOc_put_att_ulonglong(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const unsigned short *op) +int +PIOc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const unsigned short *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_USHORT, op); } @@ -3038,8 +3122,9 @@ int PIOc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_text(int ncid, int varid, const char *name, - PIO_Offset len, const char *op) +int +PIOc_put_att_text(int ncid, int varid, const char *name, + PIO_Offset len, const char *op) { return PIOc_put_att_tc(ncid, varid, name, NC_CHAR, len, NC_CHAR, op); } @@ -3061,8 +3146,9 @@ int PIOc_put_att_text(int ncid, int varid, const char *name, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const short *op) +int +PIOc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const short *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_SHORT, op); } @@ -3084,8 +3170,9 @@ int PIOc_put_att_short(int ncid, int varid, const char *name, nc_type xtype, * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett */ -int PIOc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, - PIO_Offset len, const double *op) +int +PIOc_put_att_double(int ncid, int varid, const char *name, nc_type xtype, + PIO_Offset len, const double *op) { return PIOc_put_att_tc(ncid, varid, name, xtype, len, PIO_DOUBLE, op); } From d80d0d6bf2c396f5660aef352a5e4534db51edb3 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 18 May 2019 13:54:21 -0600 Subject: [PATCH 4/5] more documentation fixes --- src/clib/pio_put_nc.c | 384 +++++++++++++++++++--------------------- src/clib/pioc_support.c | 223 ++++++++++++++--------- 2 files changed, 325 insertions(+), 282 deletions(-) diff --git a/src/clib/pio_put_nc.c b/src/clib/pio_put_nc.c index 9abd69be7c8..8479a6343e1 100644 --- a/src/clib/pio_put_nc.c +++ b/src/clib/pio_put_nc.c @@ -32,8 +32,9 @@ * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_text(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const char *op) +int +PIOc_put_vars_text(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const char *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_CHAR, op); } @@ -59,9 +60,10 @@ int PIOc_put_vars_text(int ncid, int varid, const PIO_Offset *start, const PIO_O * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_uchar(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const PIO_Offset *stride, - const unsigned char *op) +int +PIOc_put_vars_uchar(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const PIO_Offset *stride, + const unsigned char *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_UBYTE, op); } @@ -87,8 +89,9 @@ int PIOc_put_vars_uchar(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_schar(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const signed char *op) +int +PIOc_put_vars_schar(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const signed char *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_BYTE, op); } @@ -115,8 +118,9 @@ int PIOc_put_vars_schar(int ncid, int varid, const PIO_Offset *start, const PIO_ * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_ushort(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const unsigned short *op) +int +PIOc_put_vars_ushort(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const unsigned short *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_USHORT, op); } @@ -142,8 +146,9 @@ int PIOc_put_vars_ushort(int ncid, int varid, const PIO_Offset *start, const PIO * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_short(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const PIO_Offset *stride, const short *op) +int +PIOc_put_vars_short(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const PIO_Offset *stride, const short *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_SHORT, op); } @@ -170,8 +175,9 @@ int PIOc_put_vars_short(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_uint(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const unsigned int *op) +int +PIOc_put_vars_uint(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const unsigned int *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_UINT, op); } @@ -197,8 +203,9 @@ int PIOc_put_vars_uint(int ncid, int varid, const PIO_Offset *start, const PIO_O * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_int(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const int *op) +int +PIOc_put_vars_int(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const int *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_INT, op); } @@ -224,8 +231,9 @@ int PIOc_put_vars_int(int ncid, int varid, const PIO_Offset *start, const PIO_Of * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_long(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const long *op) +int +PIOc_put_vars_long(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const long *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, PIO_LONG_INTERNAL, op); } @@ -251,8 +259,9 @@ int PIOc_put_vars_long(int ncid, int varid, const PIO_Offset *start, const PIO_O * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_float(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const float *op) +int +PIOc_put_vars_float(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const float *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_FLOAT, op); } @@ -279,8 +288,9 @@ int PIOc_put_vars_float(int ncid, int varid, const PIO_Offset *start, const PIO_ * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_longlong(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const long long *op) +int +PIOc_put_vars_longlong(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const long long *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_INT64, op); } @@ -307,8 +317,9 @@ int PIOc_put_vars_longlong(int ncid, int varid, const PIO_Offset *start, const P * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_double(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const double *op) +int +PIOc_put_vars_double(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const double *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_DOUBLE, op); } @@ -335,8 +346,9 @@ int PIOc_put_vars_double(int ncid, int varid, const PIO_Offset *start, const PIO * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vars_ulonglong(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, - const PIO_Offset *stride, const unsigned long long *op) +int +PIOc_put_vars_ulonglong(int ncid, int varid, const PIO_Offset *start, const PIO_Offset *count, + const PIO_Offset *stride, const unsigned long long *op) { return PIOc_put_vars_tc(ncid, varid, start, count, stride, NC_UINT64, op); } @@ -349,14 +361,15 @@ int PIOc_put_vars_ulonglong(int ncid, int varid, const PIO_Offset *start, const * * @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 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_text(int ncid, int varid, const PIO_Offset *index, const char *op) +int +PIOc_put_var1_text(int ncid, int varid, const PIO_Offset *index, const char *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_CHAR, op); } @@ -369,15 +382,16 @@ int PIOc_put_var1_text(int ncid, int varid, const PIO_Offset *index, const char * * @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 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_uchar(int ncid, int varid, const PIO_Offset *index, - const unsigned char *op) +int +PIOc_put_var1_uchar(int ncid, int varid, const PIO_Offset *index, + const unsigned char *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_UBYTE, op); } @@ -390,15 +404,16 @@ int PIOc_put_var1_uchar(int ncid, int varid, const PIO_Offset *index, * * @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 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_schar(int ncid, int varid, const PIO_Offset *index, - const signed char *op) +int +PIOc_put_var1_schar(int ncid, int varid, const PIO_Offset *index, + const signed char *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_BYTE, op); } @@ -411,15 +426,16 @@ int PIOc_put_var1_schar(int ncid, int varid, const PIO_Offset *index, * * @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 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_ushort(int ncid, int varid, const PIO_Offset *index, - const unsigned short *op) +int +PIOc_put_var1_ushort(int ncid, int varid, const PIO_Offset *index, + const unsigned short *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_USHORT, op); } @@ -432,15 +448,16 @@ int PIOc_put_var1_ushort(int ncid, int varid, const PIO_Offset *index, * * @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 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_short(int ncid, int varid, const PIO_Offset *index, - const short *op) +int +PIOc_put_var1_short(int ncid, int varid, const PIO_Offset *index, + const short *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_SHORT, op); } @@ -453,15 +470,16 @@ int PIOc_put_var1_short(int ncid, int varid, const PIO_Offset *index, * * @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 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_uint(int ncid, int varid, const PIO_Offset *index, - const unsigned int *op) +int +PIOc_put_var1_uint(int ncid, int varid, const PIO_Offset *index, + const unsigned int *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_UINT, op); } @@ -474,14 +492,15 @@ int PIOc_put_var1_uint(int ncid, int varid, const PIO_Offset *index, * * @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 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(int ncid, int varid, const PIO_Offset *index, const int *op) +int +PIOc_put_var1_int(int ncid, int varid, const PIO_Offset *index, const int *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_INT, op); } @@ -494,14 +513,15 @@ int PIOc_put_var1_int(int ncid, int varid, const PIO_Offset *index, const int *o * * @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 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_float(int ncid, int varid, const PIO_Offset *index, const float *op) +int +PIOc_put_var1_float(int ncid, int varid, const PIO_Offset *index, const float *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_FLOAT, op); } @@ -514,14 +534,15 @@ int PIOc_put_var1_float(int ncid, int varid, const PIO_Offset *index, const floa * * @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 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_long(int ncid, int varid, const PIO_Offset *index, const long *op) +int +PIOc_put_var1_long(int ncid, int varid, const PIO_Offset *index, const long *op) { return PIOc_put_var1_tc(ncid, varid, index, PIO_LONG_INTERNAL, op); } @@ -534,15 +555,16 @@ int PIOc_put_var1_long(int ncid, int varid, const PIO_Offset *index, const long * * @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 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_double(int ncid, int varid, const PIO_Offset *index, - const double *op) +int +PIOc_put_var1_double(int ncid, int varid, const PIO_Offset *index, + const double *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_DOUBLE, op); } @@ -555,15 +577,16 @@ int PIOc_put_var1_double(int ncid, int varid, const PIO_Offset *index, * * @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 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_ulonglong(int ncid, int varid, const PIO_Offset *index, - const unsigned long long *op) +int +PIOc_put_var1_ulonglong(int ncid, int varid, const PIO_Offset *index, + const unsigned long long *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_UINT64, op); } @@ -576,15 +599,16 @@ int PIOc_put_var1_ulonglong(int ncid, int varid, const PIO_Offset *index, * * @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 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_longlong(int ncid, int varid, const PIO_Offset *index, - const long long *op) +int +PIOc_put_var1_longlong(int ncid, int varid, const PIO_Offset *index, + const long long *op) { return PIOc_put_var1_tc(ncid, varid, index, NC_INT64, op); } @@ -607,8 +631,9 @@ int PIOc_put_var1_longlong(int ncid, int varid, const PIO_Offset *index, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_text(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const char *op) +int +PIOc_put_vara_text(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const char *op) { return PIOc_put_vars_text(ncid, varid, start, count, NULL, op); } @@ -631,8 +656,9 @@ int PIOc_put_vara_text(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_uchar(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const unsigned char *op) +int +PIOc_put_vara_uchar(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const unsigned char *op) { return PIOc_put_vars_uchar(ncid, varid, start, count, NULL, op); } @@ -655,8 +681,9 @@ int PIOc_put_vara_uchar(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_schar(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const signed char *op) +int +PIOc_put_vara_schar(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const signed char *op) { return PIOc_put_vars_schar(ncid, varid, start, count, NULL, op); } @@ -679,8 +706,9 @@ int PIOc_put_vara_schar(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_ushort(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const unsigned short *op) +int +PIOc_put_vara_ushort(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const unsigned short *op) { return PIOc_put_vars_ushort(ncid, varid, start, count, NULL, op); } @@ -703,8 +731,9 @@ int PIOc_put_vara_ushort(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_short(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const short *op) +int +PIOc_put_vara_short(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const short *op) { return PIOc_put_vars_short(ncid, varid, start, count, NULL, op); } @@ -727,8 +756,9 @@ int PIOc_put_vara_short(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_uint(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const unsigned int *op) +int +PIOc_put_vara_uint(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const unsigned int *op) { return PIOc_put_vars_uint(ncid, varid, start, count, NULL, op); } @@ -751,8 +781,9 @@ int PIOc_put_vara_uint(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_int(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const int *op) +int +PIOc_put_vara_int(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const int *op) { return PIOc_put_vars_int(ncid, varid, start, count, NULL, op); } @@ -775,8 +806,9 @@ int PIOc_put_vara_int(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_long(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const long *op) +int +PIOc_put_vara_long(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const long *op) { return PIOc_put_vars_long(ncid, varid, start, count, NULL, op); } @@ -799,8 +831,9 @@ int PIOc_put_vara_long(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_float(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const float *op) +int +PIOc_put_vara_float(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const float *op) { return PIOc_put_vars_float(ncid, varid, start, count, NULL, op); } @@ -823,8 +856,9 @@ int PIOc_put_vara_float(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_ulonglong(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const unsigned long long *op) +int +PIOc_put_vara_ulonglong(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const unsigned long long *op) { return PIOc_put_vars_ulonglong(ncid, varid, start, count, NULL, op); } @@ -847,8 +881,9 @@ int PIOc_put_vara_ulonglong(int ncid, int varid, const PIO_Offset *start, * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_vara_longlong(int ncid, int varid, const PIO_Offset *start, - const PIO_Offset *count, const long long *op) +int +PIOc_put_vara_longlong(int ncid, int varid, const PIO_Offset *start, + const PIO_Offset *count, const long long *op) { return PIOc_put_vars_longlong(ncid, varid, start, count, NULL, op); } @@ -871,8 +906,9 @@ int PIOc_put_vara_longlong(int ncid, int varid, const PIO_Offset *start, * @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) +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); } @@ -885,17 +921,12 @@ int PIOc_put_vara_double(int ncid, int varid, const PIO_Offset *start, * * @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_var_text(int ncid, int varid, const char *op) +int +PIOc_put_var_text(int ncid, int varid, const char *op) { return PIOc_put_var_tc(ncid, varid, PIO_CHAR, op); } @@ -908,17 +939,12 @@ int PIOc_put_var_text(int ncid, int varid, const char *op) * * @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_var_uchar(int ncid, int varid, const unsigned char *op) +int +PIOc_put_var_uchar(int ncid, int varid, const unsigned char *op) { return PIOc_put_var_tc(ncid, varid, PIO_UBYTE, op); } @@ -931,17 +957,12 @@ int PIOc_put_var_uchar(int ncid, int varid, const unsigned char *op) * * @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_var_schar(int ncid, int varid, const signed char *op) +int +PIOc_put_var_schar(int ncid, int varid, const signed char *op) { return PIOc_put_var_tc(ncid, varid, PIO_BYTE, op); } @@ -954,17 +975,12 @@ int PIOc_put_var_schar(int ncid, int varid, const signed char *op) * * @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_var_ushort(int ncid, int varid, const unsigned short *op) +int +PIOc_put_var_ushort(int ncid, int varid, const unsigned short *op) { return PIOc_put_var_tc(ncid, varid, NC_USHORT, op); } @@ -977,17 +993,12 @@ int PIOc_put_var_ushort(int ncid, int varid, const unsigned short *op) * * @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_var_short(int ncid, int varid, const short *op) +int +PIOc_put_var_short(int ncid, int varid, const short *op) { return PIOc_put_var_tc(ncid, varid, PIO_SHORT, op); } @@ -1000,17 +1011,12 @@ int PIOc_put_var_short(int ncid, int varid, const short *op) * * @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_var_uint(int ncid, int varid, const unsigned int *op) +int +PIOc_put_var_uint(int ncid, int varid, const unsigned int *op) { return PIOc_put_var_tc(ncid, varid, PIO_UINT, op); } @@ -1023,17 +1029,12 @@ int PIOc_put_var_uint(int ncid, int varid, const unsigned int *op) * * @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_var_int(int ncid, int varid, const int *op) +int +PIOc_put_var_int(int ncid, int varid, const int *op) { return PIOc_put_var_tc(ncid, varid, PIO_INT, op); } @@ -1046,17 +1047,12 @@ int PIOc_put_var_int(int ncid, int varid, const int *op) * * @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_var_long(int ncid, int varid, const long *op) +int +PIOc_put_var_long(int ncid, int varid, const long *op) { return PIOc_put_var_tc(ncid, varid, PIO_LONG_INTERNAL, op); } @@ -1069,17 +1065,12 @@ int PIOc_put_var_long(int ncid, int varid, const long *op) * * @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_var_float(int ncid, int varid, const float *op) +int +PIOc_put_var_float(int ncid, int varid, const float *op) { return PIOc_put_var_tc(ncid, varid, PIO_FLOAT, op); } @@ -1092,17 +1083,12 @@ int PIOc_put_var_float(int ncid, int varid, const float *op) * * @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_var_ulonglong(int ncid, int varid, const unsigned long long *op) +int +PIOc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op) { return PIOc_put_var_tc(ncid, varid, PIO_UINT64, op); } @@ -1115,17 +1101,12 @@ int PIOc_put_var_ulonglong(int ncid, int varid, const unsigned long long *op) * * @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_var_longlong(int ncid, int varid, const long long *op) +int +PIOc_put_var_longlong(int ncid, int varid, const long long *op) { return PIOc_put_var_tc(ncid, varid, PIO_INT64, op); } @@ -1138,17 +1119,12 @@ int PIOc_put_var_longlong(int ncid, int varid, const long long *op) * * @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_var_double(int ncid, int varid, const double *op) +int +PIOc_put_var_double(int ncid, int varid, const double *op) { return PIOc_put_var_tc(ncid, varid, PIO_DOUBLE, op); } @@ -1161,11 +1137,12 @@ int PIOc_put_var_double(int ncid, int varid, const double *op) * * @param ncid identifies the netCDF file * @param varid the variable ID number - * @param buf pointer that will get the data. + * @param op pointer to the data to be written. * @return PIO_NOERR on success, error code otherwise. * @author Ed Hartnett */ -int PIOc_put_var(int ncid, int varid, const void *op) +int +PIOc_put_var(int ncid, int varid, const void *op) { return PIOc_put_var_tc(ncid, varid, NC_NAT, op); } @@ -1178,14 +1155,15 @@ int PIOc_put_var(int ncid, int varid, const void *op) * * @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 buf pointer that will get the data. + * @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) +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); } @@ -1204,12 +1182,13 @@ int PIOc_put_var1(int ncid, int varid, const PIO_Offset *index, const void *op) * @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. + * @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) +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); } @@ -1231,12 +1210,13 @@ int PIOc_put_vara(int ncid, int varid, const PIO_Offset *start, const PIO_Offset * @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. + * @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) +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/pioc_support.c b/src/clib/pioc_support.c index ae94aea8f64..ffcd12310d4 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -42,8 +42,10 @@ extern int default_error_handler; * @param errmsg Pointer that will get the error message. The message * will be PIO_MAX_NAME chars or less. * @return 0 on success. + * @author Jim Edwards */ -int PIOc_strerror(int pioerr, char *errmsg) +int +PIOc_strerror(int pioerr, char *errmsg) { LOG((1, "PIOc_strerror pioerr = %d", pioerr)); @@ -76,9 +78,9 @@ int PIOc_strerror(int pioerr, char *errmsg) case PIO_EBADIOTYPE: strcpy(errmsg, "Bad IO type"); break; - case PIO_EVARDIMMISMATCH: - strcpy(errmsg, "Variable dim mismatch in multivar call"); - break; + case PIO_EVARDIMMISMATCH: + strcpy(errmsg, "Variable dim mismatch in multivar call"); + break; default: strcpy(errmsg, "Unknown Error: Unrecognized error code"); } @@ -101,8 +103,10 @@ int PIOc_strerror(int pioerr, char *errmsg) * @param level the logging level, 0 for errors only, 5 for max * verbosity. * @returns 0 on success, error code otherwise. + * @author Ed Hartnett */ -int PIOc_set_log_level(int level) +int +PIOc_set_log_level(int level) { #if PIO_ENABLE_LOGGING @@ -126,7 +130,8 @@ int PIOc_set_log_level(int level) * Initialize logging. Open log file, if not opened yet, or increment * ref count if already open. */ -void pio_init_logging(void) +void +pio_init_logging(void) { #if PIO_ENABLE_LOGGING char log_filename[PIO_MAX_NAME]; @@ -152,7 +157,8 @@ void pio_init_logging(void) /** * Finalize logging - close log files, if open. */ -void pio_finalize_logging(void) +void +pio_finalize_logging(void) { #if PIO_ENABLE_LOGGING pio_log_ref_cnt -= 1; @@ -189,8 +195,10 @@ void pio_finalize_logging(void) * then increasing levels of verbosity. * @param fmt the format string. * @param ... the arguments used in format string. + * @author Ed Hartnett */ -void pio_log(int severity, const char *fmt, ...) +void +pio_log(int severity, const char *fmt, ...) { va_list argp; int t; @@ -276,8 +284,10 @@ void pio_log(int severity, const char *fmt, ...) * automated process or tools. * * @param fp file pointer to send output to + * @author Jim Edwards */ -void print_trace(FILE *fp) +void +print_trace(FILE *fp) { void *array[10]; size_t size; @@ -305,8 +315,10 @@ void print_trace(FILE *fp) * @param msg an error message * @param fname name of code file where error occured * @param line the line of code where the error occurred. + * @author Jim Edwards */ -void piodie(const char *msg, const char *fname, int line) +void +piodie(const char *msg, const char *fname, int line) { fprintf(stderr,"Abort with message %s in file %s at line %d\n", msg ? msg : "_", fname ? fname : "_", line); @@ -327,8 +339,10 @@ void piodie(const char *msg, const char *fname, int line) * @param msg an error message * @param fname name of code file where error occured * @param line the line of code where the error occurred. + * @author Jim Edwards */ -void pioassert(_Bool expression, const char *msg, const char *fname, int line) +void +pioassert(_Bool expression, const char *msg, const char *fname, int line) { #ifndef NDEBUG if (!expression) @@ -348,8 +362,9 @@ void pioassert(_Bool expression, const char *msg, const char *fname, int line) * @return PIO_NOERR for no error, otherwise PIO_EIO. * @author Ed Hartnett */ -int check_mpi(iosystem_desc_t *ios, file_desc_t *file, int mpierr, - const char *filename, int line) +int +check_mpi(iosystem_desc_t *ios, file_desc_t *file, int mpierr, + const char *filename, int line) { if (mpierr) { @@ -376,8 +391,10 @@ int check_mpi(iosystem_desc_t *ios, file_desc_t *file, int mpierr, * @param fname the name of the code file. * @param line the line number of the netCDF call in the code. * @return the error code + * @author Ed Hartnett */ -int check_netcdf(file_desc_t *file, int status, const char *fname, int line) +int +check_netcdf(file_desc_t *file, int status, const char *fname, int line) { return check_netcdf2(NULL, file, status, fname, line); } @@ -394,9 +411,11 @@ int check_netcdf(file_desc_t *file, int status, const char *fname, int line) * @param fname the name of the code file. * @param line the line number of the netCDF call in the code. * @return the error code + * @author Ed Hartnett */ -int check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, - const char *fname, int line) +int +check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, + const char *fname, int line) { int eh = default_error_handler; /* Error handler that will be used. */ int rbuf; @@ -404,7 +423,7 @@ int check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, pioassert(fname, "code file name must be provided", __FILE__, __LINE__); if (file && file->iosystem->ioproc && - (file->iotype == PIO_IOTYPE_PNETCDF || file->iotype == PIO_IOTYPE_NETCDF4P)) + (file->iotype == PIO_IOTYPE_PNETCDF || file->iotype == PIO_IOTYPE_NETCDF4P)) { if (file->iosystem->io_rank == 0) MPI_Reduce(MPI_IN_PLACE, &status, 1, MPI_INT, MPI_MIN, 0, file->iosystem->io_comm); @@ -432,10 +451,10 @@ int check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, } else if (eh == PIO_BCAST_ERROR) { - if (ios) - MPI_Bcast(&status, 1, MPI_INT, ios->ioroot, ios->my_comm); - else if (file) - MPI_Bcast(&status, 1, MPI_INT, file->iosystem->ioroot, file->iosystem->my_comm); + if (ios) + MPI_Bcast(&status, 1, MPI_INT, ios->ioroot, ios->my_comm); + else if (file) + MPI_Bcast(&status, 1, MPI_INT, file->iosystem->ioroot, file->iosystem->my_comm); } /* For PIO_RETURN_ERROR, just return the error. */ @@ -462,9 +481,11 @@ int check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, * @param fname name of code file where error occured. * @param line the line of code where the error occurred. * @returns err_num if abort is not called. + * @author Jim Edwards */ -int pio_err(iosystem_desc_t *ios, file_desc_t *file, int err_num, const char *fname, - int line) +int +pio_err(iosystem_desc_t *ios, file_desc_t *file, int err_num, const char *fname, + int line) { char err_msg[PIO_MAX_NAME + 1]; int err_handler = default_error_handler; /* Default error handler. */ @@ -519,8 +540,10 @@ int pio_err(iosystem_desc_t *ios, file_desc_t *file, int err_num, const char *fn * @param a pointer that gets a pointer to the newly allocated * io_region struct. * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int alloc_region2(iosystem_desc_t *ios, int ndims, io_region **regionp) +int +alloc_region2(iosystem_desc_t *ios, int ndims, io_region **regionp) { io_region *region; @@ -556,8 +579,10 @@ int alloc_region2(iosystem_desc_t *ios, int ndims, io_region **regionp) * @param type_size a pointer to int that will get the size of the * type, in bytes. (For example, 4 for PIO_INT). Ignored if NULL. * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int find_mpi_type(int pio_type, MPI_Datatype *mpi_type, int *type_size) +int +find_mpi_type(int pio_type, MPI_Datatype *mpi_type, int *type_size) { MPI_Datatype my_mpi_type; int my_type_size; @@ -639,9 +664,11 @@ int find_mpi_type(int pio_type, MPI_Datatype *mpi_type, int *type_size) * @param ndims the number of dimensions. * @param iodesc pointer that gets the newly allocated io_desc_t. * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int malloc_iodesc(iosystem_desc_t *ios, int piotype, int ndims, - io_desc_t **iodesc) +int +malloc_iodesc(iosystem_desc_t *ios, int piotype, int ndims, + io_desc_t **iodesc) { MPI_Datatype mpi_type; PIO_Offset type_size; @@ -675,10 +702,10 @@ int malloc_iodesc(iosystem_desc_t *ios, int piotype, int ndims, /* Get the size of the type. */ if (mpi_type == MPI_DATATYPE_NULL) - (*iodesc)->mpitype_size = 0; + (*iodesc)->mpitype_size = 0; else - if ((mpierr = MPI_Type_size((*iodesc)->mpitype, &(*iodesc)->mpitype_size))) - return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); + if ((mpierr = MPI_Type_size((*iodesc)->mpitype, &(*iodesc)->mpitype_size))) + return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); /* Initialize some values in the struct. */ (*iodesc)->maxregions = 1; @@ -699,8 +726,10 @@ int malloc_iodesc(iosystem_desc_t *ios, int piotype, int ndims, * Free a region list. * * top a pointer to the start of the list to free. + * @author Jim Edwards */ -void free_region_list(io_region *top) +void +free_region_list(io_region *top) { io_region *ptr, *tptr; @@ -725,7 +754,8 @@ void free_region_list(io_region *top) * @returns 0 for success, error code otherwise. * @author Jim Edwards */ -int PIOc_freedecomp(int iosysid, int ioid) +int +PIOc_freedecomp(int iosysid, int ioid) { iosystem_desc_t *ios; io_desc_t *iodesc; @@ -838,9 +868,11 @@ int PIOc_freedecomp(int iosysid, int ioid) * @param map * @param comm * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int PIOc_readmap(const char *file, int *ndims, int **gdims, PIO_Offset *fmaplen, - PIO_Offset **map, MPI_Comm comm) +int +PIOc_readmap(const char *file, int *ndims, int **gdims, PIO_Offset *fmaplen, + PIO_Offset **map, MPI_Comm comm) { int npes, myrank; int rnpes, rversno; @@ -957,9 +989,11 @@ int PIOc_readmap(const char *file, int *ndims, int **gdims, PIO_Offset *fmaplen, * @param map pointer to the map array * @param f90_comm * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int PIOc_readmap_from_f90(const char *file, int *ndims, int **gdims, PIO_Offset *maplen, - PIO_Offset **map, int f90_comm) +int +PIOc_readmap_from_f90(const char *file, int *ndims, int **gdims, PIO_Offset *maplen, + PIO_Offset **map, int f90_comm) { return PIOc_readmap(file, ndims, gdims, maplen, map, MPI_Comm_f2c(f90_comm)); } @@ -979,9 +1013,11 @@ int PIOc_readmap_from_f90(const char *file, int *ndims, int **gdims, PIO_Offset * @param fortran_order set to non-zero if fortran array ordering is * used, or to zero if C array ordering is used. * @returns 0 for success, error code otherwise. + * @author Ed Hartnett */ -int PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, - char *title, char *history, int fortran_order) +int +PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, + char *title, char *history, int fortran_order) { iosystem_desc_t *ios; /* IO system info. */ io_desc_t *iodesc; /* Decomposition info. */ @@ -1071,7 +1107,7 @@ int PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, * * @param iosysid the IO system ID. * @param filename the name of the decomp file. - * @param ioid pointer that will get the newly-assigned ID of the IO + * @param ioidp pointer that will get the newly-assigned ID of the IO * description. The ioid is needed to later free the decomposition. * @param comm an MPI communicator. * @param pio_type the PIO type to be used as the type for the data. @@ -1084,9 +1120,11 @@ int PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, * @param fortran_order pointer that gets set to 1 if fortran array * ordering is used, or to zero if C array ordering is used. * @returns 0 for success, error code otherwise. + * @author Ed Hartnett */ -int PIOc_read_nc_decomp(int iosysid, const char *filename, int *ioidp, MPI_Comm comm, - int pio_type, char *title, char *history, int *fortran_order) +int +PIOc_read_nc_decomp(int iosysid, const char *filename, int *ioidp, MPI_Comm comm, + int pio_type, char *title, char *history, int *fortran_order) { iosystem_desc_t *ios; /* Pointer to the IO system info. */ int ndims; /* The number of data dims (except unlim). */ @@ -1184,10 +1222,12 @@ int PIOc_read_nc_decomp(int iosysid, const char *filename, int *ioidp, MPI_Comm * @param fortran_order set to non-zero if using fortran array * ordering, 0 for C array ordering. * @returns 0 for success, error code otherwise. + * @author Ed Hartnett */ -int pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmode, int ndims, - int *global_dimlen, int num_tasks, int *task_maplen, int *map, - const char *title, const char *history, int fortran_order) +int +pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmode, int ndims, + int *global_dimlen, int num_tasks, int *task_maplen, int *map, + const char *title, const char *history, int fortran_order) { int max_maplen = 0; int ncid; @@ -1381,10 +1421,12 @@ int pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmo * decomposition file uses C array ordering, 1 if it uses Fortran * array ordering. * @returns 0 for success, error code otherwise. + * @author Ed Hartnett */ -int pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **global_dimlen, - int *num_tasks, int **task_maplen, int *max_maplen, int **map, char *title, - char *history, char *source, char *version, int *fortran_order) +int +pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **global_dimlen, + int *num_tasks, int **task_maplen, int *max_maplen, int **map, char *title, + char *history, char *source, char *version, int *fortran_order) { iosystem_desc_t *ios; int ncid; @@ -1569,8 +1611,10 @@ int pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int * * @param ioid the ID of the IO description. * @param comm an MPI communicator. * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int PIOc_write_decomp(const char *file, int iosysid, int ioid, MPI_Comm comm) +int +PIOc_write_decomp(const char *file, int iosysid, int ioid, MPI_Comm comm) { iosystem_desc_t *ios; io_desc_t *iodesc; @@ -1597,9 +1641,11 @@ int PIOc_write_decomp(const char *file, int iosysid, int ioid, MPI_Comm comm) * @param map the map array * @param comm an MPI communicator. * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, - PIO_Offset *map, MPI_Comm comm) +int +PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, + PIO_Offset *map, MPI_Comm comm) { int npes, myrank; PIO_Offset *nmaplen = NULL; @@ -1696,9 +1742,11 @@ int PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset mapl * @param map the map array * @param comm an MPI communicator. * @returns 0 for success, error code otherwise. + * @author Jim Edwards */ -int PIOc_writemap_from_f90(const char *file, int ndims, const int *gdims, - PIO_Offset maplen, const PIO_Offset *map, int f90_comm) +int +PIOc_writemap_from_f90(const char *file, int ndims, const int *gdims, + PIO_Offset maplen, const PIO_Offset *map, int f90_comm) { return PIOc_writemap(file, ndims, gdims, maplen, (PIO_Offset *)map, MPI_Comm_f2c(f90_comm)); @@ -1720,9 +1768,11 @@ int PIOc_writemap_from_f90(const char *file, int ndims, const int *gdims, * @param mode The netcdf mode for the create operation. * @returns 0 for success, error code otherwise. * @ingroup PIO_createfile + * @author Ed Hartnett */ -int PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, - int mode) +int +PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, + int mode) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -1886,7 +1936,8 @@ int PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filena * @returns 0 if file is OK, error code otherwise. * @author Ed Hartnett */ -int check_unlim_use(int ncid) +int +check_unlim_use(int ncid) { #ifdef _NETCDF4 int nunlimdims; /* Number of unlimited dims in file. */ @@ -1959,8 +2010,9 @@ int check_unlim_use(int ncid) * @ingroup PIO_openfile * @author Ed Hartnett */ -int inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int **rec_var, - int **pio_type, int **pio_type_size, MPI_Datatype **mpi_type, int **mpi_type_size) +int +inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int **rec_var, + int **pio_type, int **pio_type_size, MPI_Datatype **mpi_type, int **mpi_type_size) { int nunlimdims = 0; /* The number of unlimited dimensions. */ int unlimdimid; @@ -2074,11 +2126,11 @@ int inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int * return pio_err(NULL, file, ret, __FILE__, __LINE__); /* Get the size of the MPI type. */ - if ((*mpi_type)[v] == MPI_DATATYPE_NULL) - (*mpi_type_size)[v] = 0; - else - if ((mpierr = MPI_Type_size((*mpi_type)[v], &(*mpi_type_size)[v]))) - return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); + if ((*mpi_type)[v] == MPI_DATATYPE_NULL) + (*mpi_type_size)[v] = 0; + else + if ((mpierr = MPI_Type_size((*mpi_type)[v], &(*mpi_type_size)[v]))) + return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); /* What are the dimids associated with this var? */ if (var_ndims) @@ -2161,8 +2213,9 @@ int inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int * * @ingroup PIO_openfile * @author Jim Edwards, Ed Hartnett */ -int PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, - int mode, int retry) +int +PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, + int mode, int retry) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2330,9 +2383,9 @@ int PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filena if (ios->io_rank == 0) { ierr = nc_open(filename, mode, &file->fh); - if (ierr == PIO_NOERR) - ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF, &nvars, &rec_var, &pio_type, - &pio_type_size, &mpi_type, &mpi_type_size); + if (ierr == PIO_NOERR) + ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF, &nvars, &rec_var, &pio_type, + &pio_type_size, &mpi_type, &mpi_type_size); } else file->do_io = 0; @@ -2344,8 +2397,8 @@ int PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filena /* Broadcast and check the return code. */ if (ios->ioroot == ios->union_rank) - LOG((2, "Bcasting error code ierr %d ios->ioroot %d ios->my_comm %d", - ierr, ios->ioroot, ios->my_comm)); + LOG((2, "Bcasting error code ierr %d ios->ioroot %d ios->my_comm %d", + ierr, ios->ioroot, ios->my_comm)); if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); LOG((2, "Bcast openfile_retry error code ierr = %d", ierr)); @@ -2448,9 +2501,11 @@ int PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filena * @param name pointer that gets name of type. Ignored if NULL. * @param sizep pointer that gets size of type. Ignored if NULL. * @returns 0 on success, error code otherwise. + * @author Ed Hartnett */ -int pioc_pnetcdf_inq_type(int ncid, nc_type xtype, char *name, - PIO_Offset *sizep) +int +pioc_pnetcdf_inq_type(int ncid, nc_type xtype, char *name, + PIO_Offset *sizep) { int typelen; @@ -2494,8 +2549,11 @@ int pioc_pnetcdf_inq_type(int ncid, nc_type xtype, char *name, * * @param ncid the ncid of the file to enddef or redef * @param is_enddef set to non-zero for enddef, 0 for redef. - * @returns PIO_NOERR on success, error code on failure. */ -int pioc_change_def(int ncid, int is_enddef) + * @returns PIO_NOERR on success, error code on failure. + * @author Ed Hartnett + */ +int +pioc_change_def(int ncid, int is_enddef) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -2575,8 +2633,10 @@ int pioc_change_def(int ncid, int is_enddef) * * @param iotype the IO type to check * @returns 0 if valid, non-zero otherwise. + * @author Jim Edwards */ -int iotype_is_valid(int iotype) +int +iotype_is_valid(int iotype) { /* Assume it's not valid. */ int ret = 0; @@ -2633,11 +2693,13 @@ int iotype_is_valid(int iotype) * data rearragment from io processes to compute processes * @param iosysidp index of the defined system descriptor * @return 0 on success, otherwise a PIO error code. + * @author Jayesh Krishna */ -int PIOc_set_rearr_opts(int iosysid, int comm_type, int fcd, bool enable_hs_c2i, - bool enable_isend_c2i, int max_pend_req_c2i, - bool enable_hs_i2c, bool enable_isend_i2c, - int max_pend_req_i2c) +int +PIOc_set_rearr_opts(int iosysid, int comm_type, int fcd, bool enable_hs_c2i, + bool enable_isend_c2i, int max_pend_req_c2i, + bool enable_hs_i2c, bool enable_isend_i2c, + int max_pend_req_i2c) { iosystem_desc_t *ios; rearr_opt_t user_rearr_opts = { @@ -2690,8 +2752,9 @@ int PIOc_set_rearr_opts(int iosysid, int comm_type, int fcd, bool enable_hs_c2i, * @returns 0 for success, error code otherwise * @author Ed Hartnett */ -int determine_procs(int num_io_procs, int component_count, int *num_procs_per_comp, - int **proc_list, int **my_proc_list) +int +determine_procs(int num_io_procs, int component_count, int *num_procs_per_comp, + int **proc_list, int **my_proc_list) { /* If the user did not provide a list of processes for each * component, create one. */ From 977095f931d543ba327021c4ae56f0e81907d77a Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 18 May 2019 14:18:04 -0600 Subject: [PATCH 5/5] more documentation --- src/clib/pio_darray.c | 120 +++--- src/clib/pio_darray_int.c | 797 +++++++++++++++++++++----------------- src/clib/pio_nc.c | 15 +- src/clib/pioc_support.c | 16 +- 4 files changed, 517 insertions(+), 431 deletions(-) diff --git a/src/clib/pio_darray.c b/src/clib/pio_darray.c index 8b5fc55afd2..e221f2c237d 100644 --- a/src/clib/pio_darray.c +++ b/src/clib/pio_darray.c @@ -12,18 +12,22 @@ #include #include #include -/* 10MB default limit. */ + +/** 10MB default limit. */ PIO_Offset pio_buffer_size_limit = PIO_BUFFER_SIZE; -/* Global buffer pool pointer. */ +/** Global buffer pool pointer. */ void *CN_bpool = NULL; -/* Maximum buffer usage. */ +/** Maximum buffer usage. */ PIO_Offset maxusage = 0; -/* For write_darray_multi_serial() and write_darray_multi_par() to - * indicate whether fill or data are being written. */ +/** For write_darray_multi_serial() and write_darray_multi_par() to + * indicate that fill is being written. */ #define DARRAY_FILL 1 + +/** For write_darray_multi_serial() and write_darray_multi_par() to + * indicate that data are being written. */ #define DARRAY_DATA 0 /** @@ -36,7 +40,8 @@ PIO_Offset maxusage = 0; * @return The previous limit setting. * @author Jim Edwards */ -PIO_Offset PIOc_set_buffer_size_limit(PIO_Offset limit) +PIO_Offset +PIOc_set_buffer_size_limit(PIO_Offset limit) { PIO_Offset oldsize = pio_buffer_size_limit; @@ -101,9 +106,10 @@ PIO_Offset PIOc_set_buffer_size_limit(PIO_Offset limit) * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, - PIO_Offset arraylen, void *array, const int *frame, - void **fillvalue, bool flushtodisk) +int +PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, + PIO_Offset arraylen, void *array, const int *frame, + void **fillvalue, bool flushtodisk) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -145,8 +151,8 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, var_desc_t *vdesc; if ((ierr = get_var_desc(varids[v], &file->varlist, &vdesc))) return pio_err(ios, file, ierr, __FILE__, __LINE__); -// if (vdesc->pio_type != iodesc->piotype) -// return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); + /* if (vdesc->pio_type != iodesc->piotype) + return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__);*/ } /* Get a pointer to the variable info for the first variable. */ @@ -162,16 +168,17 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, if ((ierr = PIOc_inq_varndims(file->pio_ncid, varids[0], &fndims))) return check_netcdf(file, ierr, __FILE__, __LINE__); LOG((3, "called PIOc_inq_varndims varids[0] = %d fndims = %d", varids[0], fndims)); - for (int v=1; v < nvars; v++){ - if ((ierr = PIOc_inq_varndims(file->pio_ncid, varids[v], &fndims2))) - return check_netcdf(file, ierr, __FILE__, __LINE__); - if(fndims != fndims2) - return pio_err(ios, file, PIO_EVARDIMMISMATCH, __FILE__, __LINE__); - } + for (int v=1; v < nvars; v++){ + if ((ierr = PIOc_inq_varndims(file->pio_ncid, varids[v], &fndims2))) + return check_netcdf(file, ierr, __FILE__, __LINE__); + if(fndims != fndims2) + return pio_err(ios, file, PIO_EVARDIMMISMATCH, __FILE__, __LINE__); + } } - /* If async is in use, and this is not an IO task, bcast the parameters. */ + /* If async is in use, and this is not an IO task, bcast the + * parameters. */ if (ios->async) { if (!ios->ioproc) @@ -265,7 +272,7 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, } else if (file->iotype == PIO_IOTYPE_PNETCDF && ios->ioproc) { - /* this assures that iobuf is allocated on all iotasks thus + /* this assures that iobuf is allocated on all iotasks thus assuring that the flush_output_buffer call above is called collectively (from all iotasks) */ if (!(file->iobuf = bget(1))) @@ -274,13 +281,13 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, } if (iodesc->needssort) { - if (!(tmparray = malloc(arraylen*nvars*iodesc->piotype_size))) - return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - pio_sorted_copy(array, tmparray, iodesc, nvars, 0); + if (!(tmparray = malloc(arraylen*nvars*iodesc->piotype_size))) + return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + pio_sorted_copy(array, tmparray, iodesc, nvars, 0); } else { - tmparray = array; + tmparray = array; } /* Move data from compute to IO tasks. */ @@ -314,7 +321,7 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, /* Release resources. */ if (file->iobuf) { - LOG((3,"freeing variable buffer in pio_darray")); + LOG((3,"freeing variable buffer in pio_darray")); brel(file->iobuf); file->iobuf = NULL; } @@ -335,22 +342,22 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, LOG((2, "nvars = %d holegridsize = %ld iodesc->needsfill = %d\n", nvars, iodesc->holegridsize, iodesc->needsfill)); - pioassert(!vdesc0->fillbuf, "buffer overwrite",__FILE__, __LINE__); + pioassert(!vdesc0->fillbuf, "buffer overwrite",__FILE__, __LINE__); /* Get a buffer. */ - if (ios->io_rank == 0) - vdesc0->fillbuf = bget(iodesc->maxholegridsize * iodesc->mpitype_size * nvars); - else if (iodesc->holegridsize > 0) - vdesc0->fillbuf = bget(iodesc->holegridsize * iodesc->mpitype_size * nvars); + if (ios->io_rank == 0) + vdesc0->fillbuf = bget(iodesc->maxholegridsize * iodesc->mpitype_size * nvars); + else if (iodesc->holegridsize > 0) + vdesc0->fillbuf = bget(iodesc->holegridsize * iodesc->mpitype_size * nvars); /* copying the fill value into the data buffer for the box * rearranger. This will be overwritten with data where * provided. */ - if(fillvalue) - for (int nv = 0; nv < nvars; nv++) - for (int i = 0; i < iodesc->holegridsize; i++) - memcpy(&((char *)vdesc0->fillbuf)[iodesc->mpitype_size * (i + nv * iodesc->holegridsize)], - &((char *)fillvalue)[iodesc->mpitype_size * nv], iodesc->mpitype_size); + if(fillvalue) + for (int nv = 0; nv < nvars; nv++) + for (int i = 0; i < iodesc->holegridsize; i++) + memcpy(&((char *)vdesc0->fillbuf)[iodesc->mpitype_size * (i + nv * iodesc->holegridsize)], + &((char *)fillvalue)[iodesc->mpitype_size * nv], iodesc->mpitype_size); /* Write the darray based on the iotype. */ switch (file->iotype) @@ -384,7 +391,7 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, } if(iodesc->needssort && tmparray != NULL) - free(tmparray); + free(tmparray); /* Flush data to disk for pnetcdf. */ if (ios->ioproc && file->iotype == PIO_IOTYPE_PNETCDF) @@ -510,7 +517,8 @@ pio_inq_var_fill_expected(int ncid, int varid, int pio_type, PIO_Offset type_siz * @ingroup PIO_write_darray * @author Ed Hartnett */ -int find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) +int +find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) { iosystem_desc_t *ios; /* Pointer to io system information. */ int pio_type; @@ -603,8 +611,9 @@ int find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *array, - void *fillvalue) +int +PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *array, + void *fillvalue) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Info about file we are writing to. */ @@ -656,10 +665,10 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * /* If the type of the var doesn't match the type of the * decomposition, return an error. */ -// if (iodesc->piotype != vdesc->pio_type) -// return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); -// pioassert(iodesc->mpitype_size == vdesc->mpi_type_size, "wrong mpi info", -// __FILE__, __LINE__); + /* if (iodesc->piotype != vdesc->pio_type) */ + /* return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); */ + /* pioassert(iodesc->mpitype_size == vdesc->mpi_type_size, "wrong mpi info", */ + /* __FILE__, __LINE__); */ /* If we don't know the fill value for this var, get it. */ if (!vdesc->fillvalue) @@ -677,7 +686,7 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * hashid = ioid*10 + vdesc->rec_var; HASH_FIND_INT( file->buffer, &hashid, wmb); if (wmb) - LOG((3, "wmb->ioid = %d wmb->recordvar = %d", wmb->ioid, wmb->recordvar)); + LOG((3, "wmb->ioid = %d wmb->recordvar = %d", wmb->ioid, wmb->recordvar)); /* If we did not find an existing wmb entry, create a new wmb. */ if (!wmb) @@ -695,8 +704,8 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * wmb->data = NULL; wmb->frame = NULL; wmb->fillvalue = NULL; - wmb->htid = hashid; - HASH_ADD_INT( file->buffer, htid, wmb ); + wmb->htid = hashid; + HASH_ADD_INT( file->buffer, htid, wmb ); } LOG((2, "wmb->num_arrays = %d arraylen = %d iodesc->mpitype_size = %d\n", wmb->num_arrays, arraylen, iodesc->mpitype_size)); @@ -732,7 +741,7 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * https://github.com/pmodels/mpich/pull/2888 */ io_data_size = (1 + wmb->num_arrays) * iodesc->maxiobuflen * iodesc->mpitype_size; if(io_data_size > INT_MAX) - needsflush = 2; + needsflush = 2; /* Tell all tasks on the computation communicator whether we need * to flush data. */ @@ -848,8 +857,9 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett */ -int PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, - void *array) +int +PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, + void *array) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -899,13 +909,13 @@ int PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, if (iodesc->needssort) { - if (!(tmparray = malloc(iodesc->piotype_size*iodesc->maplen))) - return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - for(int m=0; mmaplen;m++) - ((int *) array)[m] = -1; + if (!(tmparray = malloc(iodesc->piotype_size*iodesc->maplen))) + return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + for(int m=0; mmaplen;m++) + ((int *) array)[m] = -1; } else - tmparray = array; + tmparray = array; /* Rearrange the data. */ if ((ierr = rearrange_io2comp(ios, iodesc, iobuf, tmparray))) @@ -913,8 +923,8 @@ int PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, if (iodesc->needssort) { - pio_sorted_copy(tmparray, array, iodesc, 1, 1); - free(tmparray); + pio_sorted_copy(tmparray, array, iodesc, 1, 1); + free(tmparray); } /* Free the buffer. */ diff --git a/src/clib/pio_darray_int.c b/src/clib/pio_darray_int.c index 3e30aa45029..8f770ee3bbf 100644 --- a/src/clib/pio_darray_int.c +++ b/src/clib/pio_darray_int.c @@ -18,20 +18,26 @@ #define USE_VARD_WRITE 1 #endif -/* 10MB default limit. */ +/** 10MB default limit. */ extern PIO_Offset pio_buffer_size_limit; -/* Initial size of compute buffer. */ +/** Initial size of compute buffer. */ bufsize pio_cnbuffer_limit = 33554432; -/* Global buffer pool pointer. */ +/** Global buffer pool pointer. */ extern void *CN_bpool; -/* Maximum buffer usage. */ +/** Maximum buffer usage. */ extern PIO_Offset maxusage; -/* handler for freeing the memory buffer pool */ -void bpool_free(void *p) +/** + * Handler for freeing the memory buffer pool. + * + * @param p pointer to the memory buffer pool. + * @author Jim Edwards + */ +void +bpool_free(void *p) { free(p); if(p == CN_bpool){ @@ -51,7 +57,8 @@ void bpool_free(void *p) * @returns 0 for success, error code otherwise. * @author Jim Edwards */ -int compute_buffer_init(iosystem_desc_t *ios) +int +compute_buffer_init(iosystem_desc_t *ios) { #if !PIO_USE_MALLOC @@ -73,37 +80,72 @@ int compute_buffer_init(iosystem_desc_t *ios) } #if USE_VARD -int get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, MPI_Offset *gdim0) +/** + * Get the length of dimension 0. + * + * @param file pointer to the file descriptor. + * @param iosdesc pointer to the iosystem descriptor. + * @param varid variable ID. + * @param fndims number of dimensions in the file. + * @param gdim0 pointer that gets gdim0. + * @returns 0 for success, error code otherwise. + * @author Jim Edwards + */ +int +get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, + MPI_Offset *gdim0) { - int ierr=PIO_NOERR; + int ierr = PIO_NOERR; + *gdim0 = 0; - if(file->iotype == PIO_IOTYPE_PNETCDF && iodesc->ndims < fndims) + if (file->iotype == PIO_IOTYPE_PNETCDF && iodesc->ndims < fndims) { - int numunlimdims; - /* We need to confirm the file has an unlimited dimension and if it doesn't we need to find - the extent of the first variable dimension */ - LOG((3,"look for numunlimdims")); - if ((ierr = PIOc_inq_unlimdims(file->pio_ncid, &numunlimdims, NULL))) - return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((3,"numunlimdims = %d", numunlimdims)); - if (numunlimdims <= 0) - { - int dimids[fndims]; - if ((ierr = PIOc_inq_vardimid(file->pio_ncid, varid, dimids))) - return check_netcdf(file, ierr, __FILE__, __LINE__); - if ((ierr = PIOc_inq_dimlen(file->pio_ncid, dimids[0], gdim0))) - return check_netcdf(file, ierr, __FILE__, __LINE__); + int numunlimdims; + + /* We need to confirm the file has an unlimited dimension and + if it doesn't we need to find the extent of the first + variable dimension. */ + LOG((3,"look for numunlimdims")); + if ((ierr = PIOc_inq_unlimdims(file->pio_ncid, &numunlimdims, NULL))) + return check_netcdf(file, ierr, __FILE__, __LINE__); + LOG((3,"numunlimdims = %d", numunlimdims)); + if (numunlimdims <= 0) + { + int dimids[fndims]; + if ((ierr = PIOc_inq_vardimid(file->pio_ncid, varid, dimids))) + return check_netcdf(file, ierr, __FILE__, __LINE__); + if ((ierr = PIOc_inq_dimlen(file->pio_ncid, dimids[0], gdim0))) + return check_netcdf(file, ierr, __FILE__, __LINE__); } } LOG((3,"gdim0 = %d",*gdim0)); return ierr; } + +/** + * Get the MPI data type of vard. + * + * @param iosdesc pointer to the iosystem descriptor. + * @param gdim0 + * @param unlimdimoffset + * @param rrcnt + * @param ndims the number of dimensions in the decomposition. + * @param fndims the number of dimensions in the file. + * @param varid variable ID. + * @param fndims number of dimensions in the file. + * @param frame the record number. + * @param startlist + * @param countlist + * @param filetype a pointer that gets the MPI data type. + * @returns 0 for success, error code otherwise. + * @author Jim Edwards + */ static int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdimoffset, - int rrcnt, int ndims, int fndims, - int frame, PIO_Offset **startlist, PIO_Offset **countlist, - MPI_Datatype *filetype) + int rrcnt, int ndims, int fndims, + int frame, PIO_Offset **startlist, PIO_Offset **countlist, + MPI_Datatype *filetype) { int sa_ndims; @@ -120,46 +162,46 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi *filetype = MPI_DATATYPE_NULL; if(rrcnt == 0) - return PIO_NOERR; + return PIO_NOERR; for ( int rc=0; rc ndims) { - if ( gdim0 > 0) - { - gdims[0] = gdim0; - sa_ndims = fndims; - dim_offset = 0; - for (int i=1; i < fndims; i++) - gdims[i] = iodesc->dimlen[i-1]; - } - else - { - sa_ndims = ndims; - dim_offset = 1; - for (int i=0; i < ndims; i++) - gdims[i] = iodesc->dimlen[i]; - } + if ( gdim0 > 0) + { + gdims[0] = gdim0; + sa_ndims = fndims; + dim_offset = 0; + for (int i=1; i < fndims; i++) + gdims[i] = iodesc->dimlen[i-1]; + } + else + { + sa_ndims = ndims; + dim_offset = 1; + for (int i=0; i < ndims; i++) + gdims[i] = iodesc->dimlen[i]; + } } else { - sa_ndims = fndims; - dim_offset = 0; - for (int i=0; i < fndims; i++) - gdims[i] = iodesc->dimlen[i]; + sa_ndims = fndims; + dim_offset = 0; + for (int i=0; i < fndims; i++) + gdims[i] = iodesc->dimlen[i]; } int true_rrcnt=-1; /* true number of contiguous requests */ MPI_Aint prev_end=-1; /* end offset of rc-1 request */ for( int rc=0; rcmpitype && @@ -279,9 +321,10 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi * @ingroup PIO_write_darray * @author Ed Hartnett */ -int find_start_count(int ndims, int fndims, var_desc_t *vdesc, - io_region *region, const int *frame, size_t *start, - size_t *count) +int +find_start_count(int ndims, int fndims, var_desc_t *vdesc, + io_region *region, const int *frame, size_t *start, + size_t *count) { /* Init start/count arrays to zero. */ for (int i = 0; i < fndims; i++) @@ -312,7 +355,7 @@ int find_start_count(int ndims, int fndims, var_desc_t *vdesc, else if (fndims == ndims) { /* In some cases the unlimited dim is not treated as - the pio record dim */ + the pio record dim */ start[0] += vdesc->record; } } @@ -354,8 +397,9 @@ int find_start_count(int ndims, int fndims, var_desc_t *vdesc, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *varids, - io_desc_t *iodesc, int fill, const int *frame) +int +write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *varids, + io_desc_t *iodesc, int fill, const int *frame) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Pointer to var info struct. */ @@ -395,8 +439,8 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * #if USE_VARD_WRITE if (!ios->async || !ios->ioproc) { - if ((ierr = get_gdim0(file, iodesc, varids[0], fndims, &gdim0))) - return pio_err(NULL, file, ierr, __FILE__, __LINE__); + if ((ierr = get_gdim0(file, iodesc, varids[0], fndims, &gdim0))) + return pio_err(NULL, file, ierr, __FILE__, __LINE__); } #endif @@ -519,12 +563,12 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * { #if USE_VARD_WRITE /* PnetCDF 1.10.0 and later support type conversion in - * vard APIs. However, it requires all variables - * accessed by the filetype are of the same NC data - * type. + * vard APIs. However, it requires all variables + * accessed by the filetype are of the same NC data + * type. */ - /* obtain file offset of variable nv */ + /* obtain file offset of variable nv */ if ((ierr = ncmpi_inq_varoffset(file->fh, varids[nv], &vari_offset))) return pio_err(NULL, file, ierr, __FILE__, __LINE__); @@ -537,26 +581,26 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * blocklens[nv] = 1; /* 1 for each vartypes[nv] */ /* If this is the first variable or the frame has changed between variables (this should be rare) */ - if(nv==0 || (nv > 0 && frame != NULL && frame[nv] != frame[nv-1])){ - int thisframe; - PIO_Offset unlimdimoffset; - if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ - { - if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) - return pio_err(NULL, file, ierr, __FILE__, __LINE__); - LOG((3, "num_regions = %d unlimdimoffset %ld", num_regions, unlimdimoffset)); - }else - unlimdimoffset = gdim0; - if (frame) - thisframe = frame[nv]; - else - thisframe = 0; - - ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, - rrcnt, ndims, fndims, - thisframe, startlist, countlist, - &vartypes[numReqs]); - } + if(nv==0 || (nv > 0 && frame != NULL && frame[nv] != frame[nv-1])){ + int thisframe; + PIO_Offset unlimdimoffset; + if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ + { + if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) + return pio_err(NULL, file, ierr, __FILE__, __LINE__); + LOG((3, "num_regions = %d unlimdimoffset %ld", num_regions, unlimdimoffset)); + }else + unlimdimoffset = gdim0; + if (frame) + thisframe = frame[nv]; + else + thisframe = 0; + + ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, + rrcnt, ndims, fndims, + thisframe, startlist, countlist, + &vartypes[numReqs]); + } else /* reuse the previous variable's datatype */ vartypes[numReqs] = vartypes[numReqs-1]; #else @@ -619,7 +663,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * if(filetype != MPI_DATATYPE_NULL) { if((mpierr = MPI_Type_free(&filetype))) - return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); + return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); } vard_llen = 0; /* reset request size to 0 */ numReqs = 0; @@ -640,7 +684,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * /* Write, in non-blocking fashion, a list of subarrays. */ LOG((3, "about to call ncmpi_iput_varn() varids[%d] = %d rrcnt = %d, llen = %d", nv, varids[nv], rrcnt, llen)); - ierr = ncmpi_iput_varn(file->fh, varids[nv], rrcnt, startlist, countlist, + ierr = ncmpi_iput_varn(file->fh, varids[nv], rrcnt, startlist, countlist, bufptr, llen, iodesc->mpitype, &vdesc->request[vdesc->nreqs]); /* keeps wait calls in sync */ @@ -649,7 +693,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * vdesc->nreqs++; #endif - } + } /* Free resources. */ for (int i = 0; i < rrcnt; i++) @@ -704,9 +748,10 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett **/ -int find_all_start_count(io_region *region, int maxregions, int fndims, - int iodesc_ndims, var_desc_t *vdesc, size_t *tmp_start, - size_t *tmp_count) +int +find_all_start_count(io_region *region, int maxregions, int fndims, + int iodesc_ndims, var_desc_t *vdesc, size_t *tmp_start, + size_t *tmp_count) { /* Check inputs. */ pioassert(maxregions >= 0 && fndims > 0 && iodesc_ndims >= 0 && vdesc && @@ -771,9 +816,10 @@ int find_all_start_count(io_region *region, int maxregions, int fndims, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset llen, - int maxregions, int nvars, int fndims, size_t *tmp_start, - size_t *tmp_count, void *iobuf) +int +send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset llen, + int maxregions, int nvars, int fndims, size_t *tmp_start, + size_t *tmp_count, void *iobuf) { MPI_Status status; /* Recv status for MPI. */ int mpierr; /* Return code from MPI function codes. */ @@ -850,9 +896,10 @@ int send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset lle * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, - io_desc_t *iodesc, PIO_Offset llen, int maxregions, int nvars, - int fndims, size_t *tmp_start, size_t *tmp_count, void *iobuf) +int +recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, + io_desc_t *iodesc, PIO_Offset llen, int maxregions, int nvars, + int fndims, size_t *tmp_start, size_t *tmp_count, void *iobuf) { iosystem_desc_t *ios; /* Pointer to io system information. */ size_t rlen; /* Length of IO buffer on this task. */ @@ -1009,8 +1056,9 @@ int recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const int *varids, - io_desc_t *iodesc, int fill, const int *frame) +int +write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const int *varids, + io_desc_t *iodesc, int fill, const int *frame) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Contains info about the variable. */ @@ -1101,7 +1149,8 @@ int write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const in * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett */ -int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) +int +pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Information about the variable. */ @@ -1138,7 +1187,7 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu return pio_err(ios, file, ierr, __FILE__, __LINE__); #if USE_VARD_READ if(!ios->async || !ios->ioproc) - ierr = get_gdim0(file, iodesc, vid, fndims, &gdim0); + ierr = get_gdim0(file, iodesc, vid, fndims, &gdim0); #endif /* LOG((4, "fndims %d ndims %d", fndims, ndims)); */ @@ -1298,23 +1347,23 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu if (regioncnt == iodesc->maxregions - 1) { #if USE_VARD_READ - MPI_Datatype filetype; - PIO_Offset unlimdimoffset; - int mpierr; - if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ - { - if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) - return pio_err(NULL, file, ierr, __FILE__, __LINE__); - } - else - unlimdimoffset = gdim0; - - ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, - rrlen, ndims, fndims, - vdesc->record, startlist, countlist, &filetype); - ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype); - if(filetype != MPI_DATATYPE_NULL && (mpierr = MPI_Type_free(&filetype))) - return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); + MPI_Datatype filetype; + PIO_Offset unlimdimoffset; + int mpierr; + if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ + { + if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) + return pio_err(NULL, file, ierr, __FILE__, __LINE__); + } + else + unlimdimoffset = gdim0; + + ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, + rrlen, ndims, fndims, + vdesc->record, startlist, countlist, &filetype); + ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype); + if(filetype != MPI_DATATYPE_NULL && (mpierr = MPI_Type_free(&filetype))) + return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); #else /* Read a list of subarrays. */ @@ -1373,8 +1422,9 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett */ -int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, - void *iobuf) +int +pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, + void *iobuf) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Information about the variable. */ @@ -1669,7 +1719,8 @@ int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) +int +flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) { int mpierr; /* Return code from MPI functions. */ int ierr = PIO_NOERR; @@ -1683,9 +1734,9 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) LOG((1, "flush_output_buffer")); /* Find out the buffer usage. */ if ((ierr = ncmpi_inq_buffer_usage(file->fh, &usage))) - /* allow the buffer to be undefined */ - if (ierr != NC_ENULLABUF) - return pio_err(NULL, file, PIO_EBADID, __FILE__, __LINE__); + /* allow the buffer to be undefined */ + if (ierr != NC_ENULLABUF) + return pio_err(NULL, file, PIO_EBADID, __FILE__, __LINE__); /* If we are not forcing a flush, spread the usage to all IO * tasks. */ @@ -1789,7 +1840,8 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) * @ingroup PIO_write_darray * @author Jim Edwards */ -void cn_buffer_report(iosystem_desc_t *ios, bool collective) +void +cn_buffer_report(iosystem_desc_t *ios, bool collective) { int mpierr; /* Return code from MPI functions. */ @@ -1838,7 +1890,8 @@ void cn_buffer_report(iosystem_desc_t *ios, bool collective) * @ingroup PIO_write_darray * @author Jim Edwards */ -void free_cn_buffer_pool(iosystem_desc_t *ios) +void +free_cn_buffer_pool(iosystem_desc_t *ios) { #if !PIO_USE_MALLOC LOG((2, "free_cn_buffer_pool CN_bpool = %d", CN_bpool)); @@ -1864,7 +1917,8 @@ void free_cn_buffer_pool(iosystem_desc_t *ios) * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) +int +flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) { file_desc_t *file; int ret; @@ -1914,242 +1968,256 @@ int flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) return PIO_NOERR; } -int pio_sorted_copy(const void *array, void *sortedarray, io_desc_t *iodesc, int nvars,int direction) +/** + * Sort the contents of an array. + * + * @param array pointer to the array + * @param sortedarray pointer that gets the sorted array. + * @param iodesc pointer to the iodesc. + * @param nvars number of variables. + * @param direction sort direction. + * @returns 0 for success, error code otherwise. + * @ingroup PIO_write_darray + * @author Jim Edwards + */ +int +pio_sorted_copy(const void *array, void *sortedarray, io_desc_t *iodesc, + int nvars, int direction) { int maplen = iodesc->maplen; if (direction == 0){ - switch (iodesc->piotype) - { - case PIO_BYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((signed char *)sortedarray)[m+maplen*v] = ((signed char *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_CHAR: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char *)sortedarray)[m+maplen*v] = ((char *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_SHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((short *)sortedarray)[m+maplen*v] = ((short *)array)[iodesc->remap[m]+maplen*v]; - } - } - - break; - case PIO_INT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((int *)sortedarray)[m+maplen*v] = ((int *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_FLOAT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((float *)sortedarray)[m+maplen*v] = ((float *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_DOUBLE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((double *)sortedarray)[m+maplen*v] = ((double *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_UBYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned char *)sortedarray)[m+maplen*v] = ((unsigned char *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_USHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned short *)sortedarray)[m+maplen*v] = ((unsigned short *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_UINT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned int *)sortedarray)[m+maplen*v] = ((unsigned int *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_INT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((long long *)sortedarray)[m+maplen*v] = ((long long *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_UINT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned long long *)sortedarray)[m+maplen*v] = ((unsigned long long *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_STRING: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char **)sortedarray)[m+maplen*v] = ((char **)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - default: - return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); - } + switch (iodesc->piotype) + { + case PIO_BYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((signed char *)sortedarray)[m+maplen*v] = ((signed char *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_CHAR: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char *)sortedarray)[m+maplen*v] = ((char *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_SHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((short *)sortedarray)[m+maplen*v] = ((short *)array)[iodesc->remap[m]+maplen*v]; + } + } + + break; + case PIO_INT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((int *)sortedarray)[m+maplen*v] = ((int *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_FLOAT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((float *)sortedarray)[m+maplen*v] = ((float *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_DOUBLE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((double *)sortedarray)[m+maplen*v] = ((double *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_UBYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned char *)sortedarray)[m+maplen*v] = ((unsigned char *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_USHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned short *)sortedarray)[m+maplen*v] = ((unsigned short *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_UINT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned int *)sortedarray)[m+maplen*v] = ((unsigned int *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_INT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((long long *)sortedarray)[m+maplen*v] = ((long long *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_UINT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned long long *)sortedarray)[m+maplen*v] = ((unsigned long long *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_STRING: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char **)sortedarray)[m+maplen*v] = ((char **)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + default: + return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); + } } else { - switch (iodesc->piotype) - { - case PIO_BYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((signed char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((signed char *)array)[m+maplen*v]; - } - } - break; - case PIO_CHAR: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((char *)array)[m+maplen*v]; - } - } - break; - case PIO_SHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((short *)array)[m+maplen*v]; - } - } - - break; - case PIO_INT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((int *)array)[m+maplen*v]; - } - } - break; - case PIO_FLOAT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((float *)sortedarray)[iodesc->remap[m]+maplen*v] = ((float *)array)[m+maplen*v]; - } - } - break; - case PIO_DOUBLE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((double *)sortedarray)[iodesc->remap[m]+maplen*v] = ((double *)array)[m+maplen*v]; - } - } - break; - case PIO_UBYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned char *)array)[m+maplen*v]; - } - } - break; - case PIO_USHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned short *)array)[m+maplen*v]; - } - } - break; - case PIO_UINT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned int *)array)[m+maplen*v]; - } - } - break; - case PIO_INT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((long long *)array)[m+maplen*v]; - } - } - break; - case PIO_UINT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned long long *)array)[m+maplen*v]; - } - } - break; - case PIO_STRING: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char **)sortedarray)[iodesc->remap[m]+maplen*v] = ((char **)array)[m+maplen*v]; - } - } - break; - default: - return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); - } + switch (iodesc->piotype) + { + case PIO_BYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((signed char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((signed char *)array)[m+maplen*v]; + } + } + break; + case PIO_CHAR: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((char *)array)[m+maplen*v]; + } + } + break; + case PIO_SHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((short *)array)[m+maplen*v]; + } + } + + break; + case PIO_INT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((int *)array)[m+maplen*v]; + } + } + break; + case PIO_FLOAT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((float *)sortedarray)[iodesc->remap[m]+maplen*v] = ((float *)array)[m+maplen*v]; + } + } + break; + case PIO_DOUBLE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((double *)sortedarray)[iodesc->remap[m]+maplen*v] = ((double *)array)[m+maplen*v]; + } + } + break; + case PIO_UBYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned char *)array)[m+maplen*v]; + } + } + break; + case PIO_USHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned short *)array)[m+maplen*v]; + } + } + break; + case PIO_UINT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned int *)array)[m+maplen*v]; + } + } + break; + case PIO_INT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((long long *)array)[m+maplen*v]; + } + } + break; + case PIO_UINT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned long long *)array)[m+maplen*v]; + } + } + break; + case PIO_STRING: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char **)sortedarray)[iodesc->remap[m]+maplen*v] = ((char **)array)[m+maplen*v]; + } + } + break; + default: + return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); + } } return PIO_NOERR; } @@ -2163,7 +2231,8 @@ int pio_sorted_copy(const void *array, void *sortedarray, io_desc_t *iodesc, int * @returns 0 for success, error code otherwise. * @author Jim Edwards */ -int compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc) +int +compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc) { int maxbytesoniotask = INT_MAX; int maxbytesoncomputetask = INT_MAX; diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index c356bac4799..81ce3d7b7d5 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -1484,7 +1484,10 @@ PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). - * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling + * @param dimid the dimension ID. + * @param name the new name for the dimension. + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ int @@ -1571,7 +1574,9 @@ PIOc_rename_dim(int ncid, int dimid, const char *name) * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. - * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling + * @param name the new name for the variable. + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ int @@ -1658,8 +1663,10 @@ PIOc_rename_var(int ncid, int varid, const char *name) * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. - * @return PIO_NOERR for success, error code otherwise. See - * PIOc_Set_File_Error_Handling + * @param name the name of the attribute. + * @param newname the new name for the attribute. + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ int diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index ffcd12310d4..3ae2a4b1b95 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -1740,7 +1740,7 @@ PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, * @param gdims an array of dimension ids * @param maplen the length of the map * @param map the map array - * @param comm an MPI communicator. + * @param f90_comm an MPI communicator. * @returns 0 for success, error code otherwise. * @author Jim Edwards */ @@ -2201,12 +2201,12 @@ inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int **rec * * Input parameters are read on comp task 0 and ignored elsewhere. * - * @param iosysid: A defined pio system descriptor (input) - * @param ncidp: A pio file descriptor (output) - * @param iotype: A pio output format (input) - * @param filename: The filename to open - * @param mode: The netcdf mode for the open operation - * @param retry: non-zero to automatically retry with netCDF serial + * @param iosysid a defined pio system descriptor. + * @param ncidp a pio file descriptor. + * @param iotype a pio output format. + * @param filename the filename to open + * @param mode the netcdf mode for the open operation + * @param retry non-zero to automatically retry with netCDF serial * classic. * * @return 0 for success, error code otherwise. @@ -2663,6 +2663,7 @@ iotype_is_valid(int iotype) /** * Set the rearranger options associated with an iosystem * + * @param iosysid a defined pio system descriptor. * @param comm_type Type of communication (pt2pt/coll) used * by the rearranger. See PIO_REARR_COMM_TYPE for more detail. * Possible values are : @@ -2691,7 +2692,6 @@ iotype_is_valid(int iotype) * data, from io to compute processes * @param max_pend_req_i2c Maximum pending requests during * data rearragment from io processes to compute processes - * @param iosysidp index of the defined system descriptor * @return 0 on success, otherwise a PIO error code. * @author Jayesh Krishna */