Skip to content

Commit

Permalink
adding more functions to netcdf integration layer
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 6, 2019
1 parent 4b8dcd4 commit 267b96b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/ncint/ncint_pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ nc_init_intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, int
{
int ret;

/* Initialize if we need to. */
if (!ncint_initialized)
PIO_NCINT_initialize();

/* Call the PIOc_ function to initialize the intracomm. */
if ((ret = PIOc_Init_Intracomm(comp_comm, num_iotasks, stride, base, rearr,
iosysidp)))
return ret;
Expand Down
66 changes: 58 additions & 8 deletions src/ncint/ncintdispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ NC_Dispatch NCINT_dispatcher = {
PIO_NCINT_create,
PIO_NCINT_open,

NC_RO_redef,
NC_RO__enddef,
PIO_NCINT_redef,
PIO_NCINT__enddef,
PIO_NCINT_sync,
PIO_NCINT_abort,
PIO_NCINT_close,
NC_RO_set_fill,
PIO_NCINT_set_fill,
NC_NOTNC3_inq_base_pe,
NC_NOTNC3_set_base_pe,
PIO_NCINT_inq_format,
Expand Down Expand Up @@ -150,8 +150,8 @@ PIO_NCINT_finalize(void)

int
PIO_NCINT_create(const char* path, int cmode, size_t initialsz, int basepe,
size_t *chunksizehintp, void *parameters,
const NC_Dispatch *dispatch, NC *nc_file)
size_t *chunksizehintp, void *parameters,
const NC_Dispatch *dispatch, NC *nc_file)
{
int iotype;
iosystem_desc_t *ios; /* Pointer to io system information. */
Expand Down Expand Up @@ -185,7 +185,7 @@ PIO_NCINT_create(const char* path, int cmode, size_t initialsz, int basepe,

int
PIO_NCINT_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
void *parameters, const NC_Dispatch *dispatch, NC *nc_file)
void *parameters, const NC_Dispatch *dispatch, NC *nc_file)
{
int iotype;
iosystem_desc_t *ios; /* Pointer to io system information. */
Expand Down Expand Up @@ -225,11 +225,45 @@ PIO_NCINT_def_dim(int ncid, const char *name, size_t len, int *idp)

int
PIO_NCINT_def_var(int ncid, const char *name, nc_type xtype, int ndims,
const int *dimidsp, int *varidp)
const int *dimidsp, int *varidp)
{
return PIOc_def_var(ncid, name, xtype, ndims, dimidsp, varidp);
}

/**
* @internal This just calls nc_enddef, ignoring the extra parameters.
*
* @param ncid File and group ID.
* @param h_minfree Ignored.
* @param v_align Ignored.
* @param v_minfree Ignored.
* @param r_align Ignored.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
int
PIO_NCINT__enddef(int ncid, size_t h_minfree, size_t v_align,
size_t v_minfree, size_t r_align)
{
return PIOc_enddef(ncid);
}

/**
* @internal Put the file back in redef mode. This is done
* automatically for netcdf-4 files, if the user forgets.
*
* @param ncid File and group ID.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
int
PIO_NCINT_redef(int ncid)
{
return PIOc_redef(ncid);
}

/**
* @internal Flushes all buffers associated with the file, after
* writing all changed metadata. This may only be called in data mode.
Expand Down Expand Up @@ -259,6 +293,22 @@ PIO_NCINT_close(int ncid, void *v)
return PIOc_closefile(ncid);
}

/**
* @internal Set fill mode.
*
* @param ncid File ID.
* @param fillmode File mode.
* @param old_modep Pointer that gets old mode. Ignored if NULL.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
int
PIO_NCINT_set_fill(int ncid, int fillmode, int *old_modep)
{
return PIOc_set_fill(ncid, fillmode, old_modep);
}

int
PIO_NCINT_inq_format(int ncid, int *formatp)
{
Expand All @@ -273,7 +323,7 @@ PIO_NCINT_inq_format_extended(int ncid, int *formatp, int *modep)

int
PIO_NCINT_get_vara(int ncid, int varid, const size_t *start, const size_t *count,
void *value, nc_type t)
void *value, nc_type t)
{
return TEST_VAL_42;
}
10 changes: 10 additions & 0 deletions src/ncint/ncintdispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ extern "C" {
extern int
PIO_NCINT_sync(int ncid);

extern int
PIO_NCINT_redef(int ncid);

extern int
PIO_NCINT__enddef(int ncid, size_t h_minfree, size_t v_align,
size_t v_minfree, size_t r_align);

extern int
PIO_NCINT_set_fill(int ncid, int fillmode, int *old_modep);

extern int
PIO_NCINT_abort(int ncid);

Expand Down

0 comments on commit 267b96b

Please sign in to comment.