Skip to content

Commit

Permalink
added def_dim
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 5, 2019
1 parent 92dd174 commit 45ccb61
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/ncint/ncintdispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ NC_Dispatch NCINT_dispatcher = {
NC4_inq,
NC4_inq_type,

NC_RO_def_dim,
NC_NCINT_def_dim,
NC4_inq_dimid,
NC4_inq_dim,
NC4_inq_unlimdim,
Expand All @@ -53,7 +53,7 @@ NC_Dispatch NCINT_dispatcher = {
NC4_get_att,
NC_RO_put_att,

NC_RO_def_var,
NC_NCINT_def_var,
NC4_inq_varid,
NC_RO_rename_var,
NC_NCINT_get_vara,
Expand Down Expand Up @@ -205,6 +205,19 @@ NC_NCINT_create(const char* path, int cmode, size_t initialsz, int basepe,
return PIO_NOERR;
}

int
NC_NCINT_def_dim(int ncid, const char *name, size_t len, int *idp)
{
return PIOc_def_dim(ncid, name, len, idp);
}

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

int
NC_NCINT_abort(int ncid)
{
Expand Down
7 changes: 7 additions & 0 deletions src/ncint/ncintdispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ extern "C" {
size_t *chunksizehintp, void *parameters,
const NC_Dispatch *dispatch, NC *nc_file);

extern int
NC_NCINT_def_var(int ncid, const char *name, nc_type xtype, int ndims,
const int *dimidsp, int *varidp);

extern int
NC_NCINT_def_dim(int ncid, const char *name, size_t len, int *idp);

extern int
NC_NCINT_abort(int ncid);

Expand Down
6 changes: 6 additions & 0 deletions tests/ncint/tst_pio_udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <mpi.h>

#define FILE_NAME "tst_pio_udf.nc"
#define VAR_NAME "data_var"
#define DIM_NAME "dim_x"
#define DIM_LEN 16

extern NC_Dispatch NCINT_dispatcher;

Expand All @@ -32,6 +35,7 @@ main(int argc, char **argv)
printf("*** testing simple use of netCDF integration layer format...");
{
int ncid;
int dimid, varid;
int iosysid;
NC_Dispatch *disp_in;

Expand All @@ -48,6 +52,8 @@ main(int argc, char **argv)

/* Create an empty file to play with. */
if (nc_create(FILE_NAME, NC_UDF0, &ncid)) ERR;
if (nc_def_dim(ncid, DIM_NAME, DIM_LEN, &dimid)) ERR;
if (nc_def_var(ncid, VAR_NAME, NC_INT, 1, &dimid, &varid)) ERR;
if (nc_close(ncid)) ERR;

/* Check that our user-defined format has been added. */
Expand Down

0 comments on commit 45ccb61

Please sign in to comment.