Skip to content

Commit

Permalink
now writing darrays with netcdf intergration
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 6, 2019
1 parent ff6a067 commit eaccc55
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/clib/pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,9 @@ extern "C" {

int nc_free_decomp(int ioid);

int nc_put_vard_int(int ncid, int varid, int decompid, const size_t recnum,
const int *op);

#if defined(__cplusplus)
}
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/ncint/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/clib
noinst_LTLIBRARIES = libncint.la

# The source files.
libncint_la_SOURCES = ncintdispatch.c ncintdispatch.h ncint_pio.c
libncint_la_SOURCES = ncintdispatch.c ncintdispatch.h ncint_pio.c \
ncint_vard.c
15 changes: 11 additions & 4 deletions tests/ncint/tst_pio_udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ main(int argc, char **argv)
NC_Dispatch *disp_in;
size_t elements_per_pe;
size_t *compdof; /* The decomposition mapping. */
int *my_data;
int i;

/* Turn on logging for PIO library. */
Expand All @@ -70,9 +71,16 @@ main(int argc, char **argv)

/* Create the PIO decomposition for this test. */
if (nc_init_decomp(iosysid, PIO_INT, NDIM2, dimlen, elements_per_pe,
compdof, &ioid, 0, NULL, NULL)) ERR;
compdof, &ioid, 1, NULL, NULL)) ERR;
free(compdof);

/* Create some data on this processor. */
if (!(my_data = malloc(elements_per_pe * sizeof(int)))) ERR;
for (i = 0; i < elements_per_pe; i++)
my_data[i] = my_rank * 10 + i;

/* Write some data with distributed arrays. */
if (nc_put_vard_int(ncid, varid, ioid, 0, my_data)) ERR;
if (nc_close(ncid)) ERR;

/* Check that our user-defined format has been added. */
Expand All @@ -83,10 +91,9 @@ main(int argc, char **argv)
if (nc_open(FILE_NAME, NC_UDF0, &ncid)) ERR;
if (nc_close(ncid)) ERR;

/* Free the decomposition. */
/* Free resources. */
free(my_data);
if (nc_free_decomp(ioid)) ERR;

/* Close the iosystem. */
if (nc_free_iosystem(iosysid)) ERR;
}
SUMMARIZE_ERR;
Expand Down

0 comments on commit eaccc55

Please sign in to comment.