merge trunk into this branch

This commit is contained in:
Dennis Heimbigner 2013-03-15 20:31:07 +00:00
commit dea3c726c8
41 changed files with 1453 additions and 183 deletions

View File

@ -532,7 +532,7 @@ ENDIF()
# Options to enable parallel IO, tests.
SET(STATUS_PNETCDF "OFF")
OPTION(ENABLE_PNETCDF "Build netCDF-4 with parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)
OPTION(ENABLE_PNETCDF "Build with parallel I/O for classic and 64-bit offset files using parallel-netcdf." OFF)
IF(ENABLE_PNETCDF)
# Check for ncmpi_create in libpnetcdf, define USE_PNETCDF
# Does the user want to turn on PNETCDF read ability?
@ -546,6 +546,8 @@ IF(ENABLE_PNETCDF)
SET(STATUS_PNETCDF "ON")
INCLUDE_DIRECTORIES(${PNETCDF_INCLUDE_DIR})
SET(HAVE_LIBPNETCDF ON)
# pnetcdf => parallel
SET(STATUS_PARALLEL "ON")
ENDIF()
@ -704,6 +706,10 @@ add_subdirectory("include")
add_subdirectory(libdispatch)
add_subdirectory(libsrc)
IF (USE_PNETCDF)
add_subdirectory(libsrc5)
ENDIF (USE_HDF5)
IF (USE_HDF5)
add_subdirectory(libsrc4)
ENDIF (USE_HDF5)

View File

@ -64,9 +64,9 @@ if BUILD_CDMREMOTE
LIBCDMR = libcdmr
endif
# Build librpc
if BUILD_RPC
LIBRPC = librpc
# Build pnetcdf
if USE_PNETCDF
LIBSRC5 = libsrc5
endif
# Build UDUNITS?
@ -88,7 +88,7 @@ endif
# and run. ncgen must come before ncdump, because their tests
# depend on it.
SUBDIRS = include $(OCLIB) $(H5_TEST_DIR) libdispatch libsrc \
$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBRPC) liblib \
$(LIBSRC4_DIR) $(DAP2) $(LIBCDMR) $(LIBSRC5) liblib \
$(NCGEN3) $(NCGEN) $(NCDUMP) \
$(TESTDIRS) \
man4 $(EXAMPLES) \

2
cf
View File

@ -8,7 +8,7 @@ fi
HDF5=1
DAP=1
PNETCDF=1
#PNETCDF=1
#RPC=1
#PGI=1
#M32=1

View File

@ -133,7 +133,7 @@ AC_MSG_RESULT($enable_hdf4_file_tests)
# Does the user want to turn on PNETCDF read ability?
AC_MSG_CHECKING([whether parallel I/O for classic and 64-bit offset files using parallel-netcdf is to be enabled])
AC_ARG_ENABLE([pnetcdf], [AS_HELP_STRING([--enable-pnetcdf],
[build netcdf-4 with parallel I/O for classic and 64-bit offset files using parallel-netcdf])])
[build with parallel I/O for classic and 64-bit offset files using parallel-netcdf])])
test "x$enable_pnetcdf" = xyes || enable_pnetcdf=no
AC_MSG_RESULT($enable_pnetcdf)
@ -687,18 +687,6 @@ if test "x$enable_netcdf_4" = xyes; then
if test "x$ac_cv_func_H5Pget_fapl_mpio" = xyes -o "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
enable_parallel=yes
AC_DEFINE([USE_PARALLEL], [1], [if true, parallel netCDF-4 is in use])
# Using pnetcdf for classic parallel I/O?
if test "x$enable_pnetcdf" = xyes; then
AC_CHECK_LIB([pnetcdf], [ncmpi_create], [],
[AC_MSG_ERROR([Cannot link to pnetcdf library, yet --enable-pnetcdf was used.])])
dnl AC_CHECK_HEADERS([pnetcdf.h], [], [nc4_pnetcdf_h_missing=yes)
dnl if test ! "x$HAVE_PNETCDF" = x1; then
dnl AC_MSG_ERROR([Cannot find pnetcdf header, yet --enable-pnetcdf was used.])
dnl fi
AC_DEFINE([USE_PNETCDF], [1], [if true, parallel netCDF is used])
fi
fi
AC_MSG_CHECKING([whether parallel I/O features are to be included])
@ -739,6 +727,19 @@ if test "x$enable_logging" = xyes; then
AC_DEFINE([LOGGING], 1, [If true, turn on logging.])
fi
# Using pnetcdf for classic parallel I/O?
if test "x$enable_pnetcdf" = xyes; then
AC_CHECK_LIB([pnetcdf], [ncmpi_create], [],
[AC_MSG_ERROR([Cannot link to pnetcdf library, yet --enable-pnetcdf was used.])])
AC_DEFINE([USE_PNETCDF], [1], [if true, parallel netCDF is used])
# pnetcdf => parallel
# If parallel is in use, enable it in the C code. Also add some stuff to netcdf.h.
enable_parallel=yes
AC_DEFINE([USE_PARALLEL], [1], [if true, pnetcdf or parallel netcdf-4 is in use])
fi
# Like other libraries, udunits and libcf
# are no long part of the netcdf distribution.
@ -886,6 +887,7 @@ AC_CONFIG_FILES([Makefile
man4/images/Makefile
libsrc/Makefile
libsrc4/Makefile
libsrc5/Makefile
nctest/Makefile
nc_test4/Makefile
nc_test/Makefile
@ -898,7 +900,6 @@ AC_CONFIG_FILES([Makefile
oc2/Makefile
libdap2/Makefile
libcdmr/Makefile
librpc/Makefile
libdispatch/Makefile
liblib/Makefile
ncdump/cdl4/Makefile

View File

@ -273,21 +273,6 @@ typedef struct NC_HDF5_FILE_INFO
int ignore_creationorder;
int hdf4;
int sdid;
#ifdef USE_PNETCDF
/* pnetcdf_file will be true if the file is created/opened with the
* parallel-netcdf library. pnetcdf_access_mode keeps track of
* whether independpent or collective mode is
* desired. pnetcdf_ndims keeps track of how many dims each var
* has, which I need to know to convert start, count, and stride
* arrays from size_t to MPI_Offset. (I can't use an inq function
* to find out the number of dims, because these are collective in
* pnetcdf.) */
int pnetcdf_file;
int pnetcdf_access_mode;
int pnetcdf_ndims[NC_MAX_VARS];
#endif /* USE_PNETCDF */
} NC_HDF5_FILE_INFO_T;
/* These functions only use the netcdf API calls, so they will work on

View File

@ -85,6 +85,8 @@ extern int nc_put_vara_ulonglong(int ncid, int varid,
#define NC_DISPATCH_NC4 2
#define NC_DISPATCH_NCD 4
#define NC_DISPATCH_NCR 8
#define NC_DISPATCH_NC5 16
/* Define a type for use when doing e.g. nc_get_vara_long, etc. */
/* Should matche values in libsrc4/netcdf.h */
@ -107,15 +109,27 @@ extern int nc_put_vara_ulonglong(int ncid, int varid,
/* Define an alias for int to indicate an error return */
typedef int NCerror;
/* WARNING: this must match libsrc4/netcdf.h */
#ifndef MPI_Comm
#define MPI_Comm int
#endif
#ifndef MPI_Info
#define MPI_Info int
#endif
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
#ifndef MPI_INFO_NULL
#define MPI_INFO_NULL 0
#endif
/* Define a struct to hold the MPI info so it can be passed down the
* call stack. This is used internally by the netCDF library. It
* should not be used by netcdf users. */
#ifdef USE_PARALLEL
typedef struct NC_MPI_INFO {
MPI_Comm comm;
MPI_Info info;
} NC_MPI_INFO;
#endif
/* Define known dispatch tables and initializers */
@ -133,6 +147,11 @@ extern NC_Dispatch* NCD3_dispatch_table;
extern int NCD3_initialize(void);
#endif
#ifdef USE_PNETCDF
extern NC_Dispatch* NC5_dispatch_table;
extern int NC5_initialize(void);
#endif
#ifdef USE_NETCDF4
extern NC_Dispatch* NC4_dispatch_table;
@ -172,17 +191,6 @@ struct nc_vlen_t;
struct NC;
/* WARNING: this must match libsrc4/netcdf.h */
#ifndef USE_PARALLEL
#ifndef MPI_Comm
#define MPI_Comm int
#define MPI_Info int
#define MPI_COMM_WORLD 0
#ifndef MPI_INFO_NULL
#define MPI_INFO_NULL 0
#endif
#endif
#endif
int NC_create(const char *path, int cmode,
size_t initialsz, int basepe, size_t *chunksizehintp,
@ -271,13 +279,14 @@ int (*inq_var_all)(int ncid, int varid, char *name, nc_type *xtypep,
int *no_fill, void *fill_valuep, int *endiannessp,
int *options_maskp, int *pixels_per_blockp);
int (*var_par_access)(int, int, int);
/* Note the following may still be invoked by netcdf client code
even when the file is a classic file
*/
#ifdef USE_NETCDF4
int (*show_metadata)(int);
int (*inq_unlimdims)(int, int*, int*);
int (*var_par_access)(int, int, int);
int (*inq_ncid)(int, const char*, int*);
int (*inq_grps)(int, int*, int*);
int (*inq_grpname)(int, char*);
@ -313,7 +322,6 @@ int (*def_var_endian)(int, int, int);
int (*set_var_chunk_cache)(int, int, size_t, size_t, float);
int (*get_var_chunk_cache)(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp);
#endif /*USE_NETCDF4*/
};
/* Following functions must be handled as non-dispatch */

View File

@ -2,12 +2,12 @@ NCLIB=../liblib/.libs/libnetcdf.a
NCINCL=-I ../liblib
#CYGWIN
LFLAG=-L/usr/local/lib
#LFLAG=-L/usr/local/lib
#HDF5LIB=/usr/local/lib/libhdf5_hl.a /usr/local/lib/libhdf5.a
#!CYGWIN
#LFLAG=-L/upc/share/ed/local/${HOST}/lib
#HDF5LIB=/share/ed/local/${HOST}/lib/libhdf5_hl.a /share/ed/local/${HOST}/lib/libhdf5.a
LFLAG=-L/upc/share/ed/local/${HOST}/lib
HDF5LIB=/share/ed/local/${HOST}/lib/libhdf5_hl.a /share/ed/local/${HOST}/lib/libhdf5.a
CURLLIB=-lcurl
ZLIB=-lz
@ -258,7 +258,7 @@ fix::
done
##################################################
T=civ
T=civ2
v::
cc -g -c ${T}.c ${INCL}

View File

@ -25,7 +25,7 @@ dapmerge3(NCDAPCOMMON* nccomm, CDFnode* ddsroot, OCddsnode dasroot)
NClist* allnodes;
OClink conn;
char* ocname = NULL;
char** values = NULL;
conn = nccomm->oc.conn;
if(ddsroot == NULL || dasroot == NULL) return NC_NOERR;
@ -44,7 +44,7 @@ dapmerge3(NCDAPCOMMON* nccomm, CDFnode* ddsroot, OCddsnode dasroot)
OCCHECK(oc_dds_attr_count(conn,ocnode,&attrcount));
for(j=0;j<attrcount;j++) {
size_t nvalues;
char** values = NULL;
NCattribute* att = NULL;
if(ocname != NULL) {
@ -103,11 +103,13 @@ fprintf(stderr,"%s.Unlimited_Dimension=%s\n",node->ocname,nccomm->cdf.recorddimn
if(values) {
oc_reclaim_strings(nvalues,values);
free(values);
values = NULL;
}
}
}
done:
if(values != NULL) free(values);
if(ocname != NULL) free(ocname);
if(ocstat != OC_NOERR) ncstat = ocerrtoncerr(ocstat);
return THROW(ncstat);
@ -120,7 +122,7 @@ buildattribute(char* name, nc_type ptype,
{
int i;
NCerror ncstat = NC_NOERR;
NCattribute* att;
NCattribute* att = NULL;
att = (NCattribute*)calloc(1,sizeof(NCattribute));
MEMCHECK(att,NC_ENOMEM);
@ -132,6 +134,8 @@ buildattribute(char* name, nc_type ptype,
nclistpush(att->values,(void*)nulldup(values[i]));
if(attp) *attp = att;
else
free(att);
return THROW(ncstat);
}

View File

@ -1,8 +1,9 @@
PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""
alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=;
#TOP="/home/dmh/mach/trunk"
TOP="/cygdrive/f/svn/trunk"
TOP="/home/dmh/mach/trunk"
TOP="/home/dmh/mach/pnetcdf"
#TOP="/cygdrive/f/svn/trunk"
#TOP="/cygdrive/c/Users/dmh/svn/trunk"
#PROG=./ncd
@ -10,8 +11,7 @@ PROG="$TOP/ncdump/ncdump"
P=`pwd`
F="http://motherlode.ucar.edu:8081/dts/ingrid"
CON="v3H[0:0][0:43]"
F="file://${TOP}/ncdap_test/testdata3/synth9"
PARMS="[log]"
#PARMS="${PARMS}[netcdf3]"
@ -107,4 +107,6 @@ CON="U50M_EOSGRID_Data_Fields[0:23][282:282][441:441]"
#CON="OneD.amp,TwoD.amp,ThreeD.amp"
F="http://goldsmr2.sci.gsfc.nasa.gov/opendap/hyrax/MERRA/MAT1NXSLV.5.2.0/1990/01/MERRA100.prod.assim.tavg1_2d_slv_Nx.19900101.hdf"
CON="U50M_EOSGRID_Data_Fields[0:23][282:282][441:441],XDim_EOSGRID"
F="http://motherlode.ucar.edu:8081/dts/ingrid"
CON="v3H[0:0][0:43]"
fi

View File

@ -88,10 +88,11 @@ NCDEFAULT_put_varm,
NULL, /*inq_var_all*/
NULL, /*var_par_access*/
#ifdef USE_NETCDF4
NULL, /*show_metadata*/
NULL, /*inq_unlimdims*/
NULL, /*var_par_access*/
NULL, /*inq_ncid*/
NULL, /*inq_grps*/
NULL, /*inq_grpname*/

View File

@ -79,9 +79,6 @@ NCD3_open(const char * path, int mode,
NCDAPCOMMON* dapcomm = NULL;
const char* value;
/* We will use a fake file descriptor as our internal in-memory filename */
char tmpname[32];
if(!nc3dinitialized) nc3dinitialize();
if(path == NULL)
@ -137,11 +134,18 @@ NCD3_open(const char * path, int mode,
}
/* Use libsrc code for storing metadata */
{
char tmpname[32];
snprintf(tmpname,sizeof(tmpname),"%d",drno->int_ncid);
/* Now, use the file to create the netcdf file; always 64 bit */
ncstat = nc_create(tmpname,NC_DISKLESS|NC_64BIT_OFFSET,&drno->substrate);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
/* Create fake file name: exact name must be unique,
but is otherwise irrelevant because we are using NC_DISKLESS
*/
snprintf(tmpname,sizeof(tmpname),"%d",drno->int_ncid);
/* Now, use the file to create the netcdf file; force classic. */
ncstat = nc_create(tmpname,NC_DISKLESS|NC_CLASSIC_MODEL,&drno->substrate);
if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
}
/* Avoid fill */
nc_set_fill(drno->substrate,NC_NOFILL,NULL);

View File

@ -24,6 +24,17 @@ Research/Unidata. See COPYRIGHT file for more info.
#endif
#include "ncdispatch.h"
/* Define an enum over the possible set of
File Types
*/
enum FileType {
FT_UNKNOWN,
FT_HDF,
FT_NC,
FT_PNETCDF
};
static int nc_initialized = 0;
/** \defgroup datasets NetCDF Files
@ -82,16 +93,15 @@ nc_local_initialize(void)
static int
NC_check_file_type(const char *path, int use_parallel, void *mpi_info,
int *cdf, int *hdf)
enum FileType* filetype, int* version)
{
char magic[MAGIC_NUMBER_LEN];
*hdf = 0; *cdf = 0;
*filetype = FT_UNKNOWN;
/* Get the 4-byte magic from the beginning of the file. Don't use posix
* for parallel, use the MPI functions instead. */
#ifdef USE_PARALLEL_MPIO
/* Note that this assumes netcdf-4 support is enabled */
if (use_parallel)
{
MPI_File fh;
@ -112,8 +122,6 @@ NC_check_file_type(const char *path, int use_parallel, void *mpi_info,
return NC_EPARINIT;
if((retval = MPI_File_close(&fh)) != MPI_SUCCESS)
return NC_EPARINIT;
/* Pretend this is an HDF5 file */
*hdf = 5;
} else
#endif /* USE_PARALLEL */
{
@ -127,28 +135,34 @@ NC_check_file_type(const char *path, int use_parallel, void *mpi_info,
return errno;
i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
fclose(fp);
if(i == 0 && errno == 22) //if file size < 4, Windows fread returns 0, errno 22.
return NC_ENOTNC;
if(i == 0 && errno == 22) //if file size < 4, Windows fread returns 0, errno 22.
return NC_ENOTNC;
if(i != 1)
return errno;
return errno;
}
/* Ignore the first byte for HDF */
if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F')
*hdf = 5;
else if(magic[0] == '\016' && magic[1] == '\003'
&& magic[2] == '\023' && magic[3] == '\001')
*hdf = 4;
else if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F')
{
if(magic[3] == '\001')
*cdf = 1; /* netcdf classic version 1 */
/* Look at the magic number */
/* Ignore the first byte for HDF */
if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F') {
*filetype = FT_HDF;
*version = 5;
} else if(magic[0] == '\016' && magic[1] == '\003'
&& magic[2] == '\023' && magic[3] == '\001') {
*filetype = FT_HDF;
*version = 4;
} else if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') {
*filetype = FT_NC;
if(magic[3] == '\001')
*version = 1; /* netcdf classic version 1 */
else if(magic[3] == '\002')
*cdf = 2; /* netcdf classic version 2 */
else
*version = 2; /* netcdf classic version 2 */
else if(magic[3] == '\005') {
*filetype = FT_PNETCDF;
*version = 5; /* pnetcdf file */
} else
return NC_ENOTNC;
} else
} else
return NC_ENOTNC;
}
return NC_NOERR;
}
@ -1444,8 +1458,12 @@ NC_create(const char *path, int cmode, size_t initialsz,
/* Look to the incoming cmode for hints */
if(model == 0) {
if(cmode & NC_NETCDF4 || cmode & NC_PNETCDF)
if(cmode & NC_NETCDF4)
model = NC_DISPATCH_NC4;
else if(cmode & NC_PNETCDF)
model = NC_DISPATCH_NC5;
else if(cmode & NC_CLASSIC_MODEL)
model = NC_DISPATCH_NC3;
}
if(model == 0) {
@ -1498,6 +1516,11 @@ NC_create(const char *path, int cmode, size_t initialsz,
if(model == (NC_DISPATCH_NC3 | NC_DISPATCH_NCD))
dispatcher = NCD3_dispatch_table;
else
#endif
#ifdef USE_PNETCDF
if(model == (NC_DISPATCH_NC5))
dispatcher = NC5_dispatch_table;
else
#endif
if(model == (NC_DISPATCH_NC3))
dispatcher = NC3_dispatch_table;
@ -1550,8 +1573,8 @@ NC_open(const char *path, int cmode,
/* Need two pieces of information for now */
int model = 0;
int isurl = 0;
int cdfversion = 0;
int hdfversion = 0;
int version;
enum FileType filetype;
if(!nc_initialized) {
stat = NC_initialize();
@ -1564,23 +1587,36 @@ NC_open(const char *path, int cmode,
isurl = NC_testurl(path);
if(isurl)
model = NC_urlmodel(path);
if(!isurl) {
else {
filetype = FT_UNKNOWN;
version = 0;
model = 0;
/* Look at the file if it exists */
stat = NC_check_file_type(path,useparallel,mpi_info,&cdfversion,&hdfversion);
stat = NC_check_file_type(path,useparallel,mpi_info,
&filetype,&version);
if(stat == NC_NOERR) {
if(hdfversion != 0) {
switch (filetype) {
case FT_NC:
if(version == 1 || version == 2)
model = NC_DISPATCH_NC3;
break;
case FT_HDF:
model = NC_DISPATCH_NC4;
} else if(cdfversion != 0) {
model = NC_DISPATCH_NC3;
}
break;
case FT_PNETCDF:
model = NC_DISPATCH_NC5;
break;
default:
return NC_ENOTNC;
}
} else /* presumably not a netcdf file */
return stat;
}
/* Look to the incoming cmode for hints */
if(model == 0) {
if(cmode & NC_NETCDF4 || cmode & NC_PNETCDF) model |= NC_DISPATCH_NC4;
if(cmode & NC_PNETCDF) model |= NC_DISPATCH_NC5;
else if(cmode & NC_NETCDF4) model |= NC_DISPATCH_NC4;
}
if(model == 0) model = NC_DISPATCH_NC3; /* final default */
@ -1590,7 +1626,10 @@ NC_open(const char *path, int cmode,
cmode |= NC_NETCDF4;
else if(model & NC_DISPATCH_NC3) {
cmode &= ~NC_NETCDF4; /* must be netcdf-3 */
if(cdfversion == 2) cmode |= NC_64BIT_OFFSET;
if(version == 2) cmode |= NC_64BIT_OFFSET;
} else if(model & NC_DISPATCH_NC5) {
cmode &= ~(NC_NETCDF4 | NC_64BIT_OFFSET); /* must be pnetcdf */
cmode |= NC_PNETCDF;
}
if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
@ -1611,6 +1650,11 @@ NC_open(const char *path, int cmode,
dispatcher = NCD3_dispatch_table;
else
#endif
#if defined(USE_PNETCDF)
if(model == (NC_DISPATCH_NC5))
dispatcher = NC5_dispatch_table;
else
#endif
#if defined(USE_NETCDF4)
if(model == (NC_DISPATCH_NC4))
dispatcher = NC4_dispatch_table;

View File

@ -1,8 +1,18 @@
/** \substrate
Define the substrate dispatch table and functions
These functions end up calling functions in one of the dispatch layers
(netCDF-4, dap server, etc) using the substrate field of struct NC.
The idea of a substrate is that for some dispatch
tables, it is convenient to delegate many of its functions
of some other dispatch table, called the substrate.
For example, the libdap2 code needs to create
metadata. Rather than duplicate the code in libsrc,
it is convenient to create a temporary
netcdf-3 "file" (using in-memory data storage)
and delegate the creation and inquiries about
the metadata to that substrate netcdf-3 object.
So, these functions end up calling functions in another
dispatch table using the substrate field of struct NC.
Copyright 2010 University Corporation for Atmospheric
Research/Unidata. See COPYRIGHT file for more info.
@ -854,12 +864,12 @@ NCSUB_put_varm,
NCSUB_inq_var_all,
NCSUB_var_par_access,
#ifdef USE_NETCDF4
NCSUB_show_metadata,
NCSUB_inq_unlimdims,
NCSUB_var_par_access,
NCSUB_inq_ncid,
NCSUB_inq_grps,
NCSUB_inq_grpname,

View File

@ -12,6 +12,10 @@ IF(USE_HDF5 OR USE_NETCDF4)
SET(liblib_LIBS ${liblib_LIBS} netcdf4)
ENDIF()
IF(USE_PNETCDF)
SET(liblib_LIBS ${liblib_LIBS} netcdf5)
ENDIF()
IF(USE_DAP)
SET(liblib_LIBS ${liblib_LIBS} oc2 dap2)
ENDIF()

View File

@ -33,9 +33,15 @@ endif # BUILD_V2
# The output library will always include netcdf3 and dispatch
# libraries
libnetcdf_la_LIBADD += ${top_builddir}/libdispatch/libdispatch.la \
${top_builddir}/libsrc/libnetcdf3.la
${top_builddir}/libsrc/libnetcdf3.la
# netcdf3 + dap
# + pnetcdf
if USE_PNETCDF
AM_CPPFLAGS += -I${top_srcdir}/libsrc5
libnetcdf_la_LIBADD += ${top_builddir}/libsrc5/libnetcdf5.la
endif # USE_PNETCDF
# + dap
if USE_DAP
AM_CPPFLAGS += -I${top_srcdir}/libdap2 -I${top_srcdir}/oc
libnetcdf_la_LIBADD += ${top_builddir}/libdap2/libdap2.la

View File

@ -8,6 +8,8 @@
extern int NC3_initialize(void);
extern int NCSUBSTRATE_initialize(void);
#ifdef USE_NETCDF4
extern int NC4_initialize(void);
#endif
@ -23,10 +25,18 @@ extern int NCD4_initialize(void);
extern int NCCR_initialize(void);
#endif
#ifdef BUILD_RPC
extern int NCRPC_initialize(void);
#ifdef USE_PNETCDF
extern int NC5_initialize(void);
#endif
/**
This procedure invokes all defined
initializers, and there is an initializer
for every known dispatch table.
So if you modify the format of NC_Dispatch,
then you need to fix it everywhere.
*/
int
NC_initialize(void)
{
@ -43,6 +53,10 @@ NC_initialize(void)
if((stat = NCD3_initialize())) return stat;
#endif
#ifdef USE_PNETCDF
if((stat = NC5_initialize())) return stat;
#endif
#ifdef USE_NETCDF4
if((stat = NC4_initialize())) return stat;
@ -58,12 +72,10 @@ NC_initialize(void)
if((stat = NCCR_initialize())) return stat;
#endif
#ifdef USE_RPC
if((stat = NCRPC_initialize())) return stat;
#endif
#endif /* USE_NETCDF4 */
/* Finally, initialize the SUBSTRATE table (dsubstrate.c) */
if((stat = NCSUBSTRATE_initialize())) return stat;
return NC_NOERR;
}

View File

@ -37,10 +37,11 @@ static int NC3_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
int *no_fill, void *fill_valuep, int *endiannessp,
int *options_maskp, int *pixels_per_blockp);
static int NC3_var_par_access(int,int,int);
#ifdef USE_NETCDF4
static int NC3_show_metadata(int);
static int NC3_inq_unlimdims(int,int*,int*);
static int NC3_var_par_access(int,int,int);
static int NC3_inq_ncid(int,const char*,int*);
static int NC3_inq_grps(int,int*,int*);
static int NC3_inq_grpname(int,char*);
@ -122,10 +123,11 @@ NCDEFAULT_put_varm,
NC3_inq_var_all,
NC3_var_par_access,
#ifdef USE_NETCDF4
NC3_show_metadata,
NC3_inq_unlimdims,
NC3_var_par_access,
NC3_inq_ncid,
NC3_inq_grps,
NC3_inq_grpname,
@ -194,6 +196,12 @@ NC3_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
return NC_NOERR;
}
static int
NC3_var_par_access(int ncid, int varid, int par_access)
{
return NC_NOERR; /* no-op for netcdf classic */
}
#ifdef USE_NETCDF4
static int
@ -488,11 +496,5 @@ NC3_def_var_endian(int ncid, int varid, int endianness)
return NC_ENOTNC4;
}
static int
NC3_var_par_access(int ncid, int varid, int par_access)
{
return NC_ENOTNC4;
}
#endif /*USE_NETCDF4*/

View File

@ -17,7 +17,7 @@ conditions.
#include "nc4dispatch.h"
#include "ncdispatch.h"
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
#include <pnetcdf.h>
#endif
@ -478,7 +478,7 @@ NC4_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp
h5 = NC4_DATA(nc);
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
{
@ -512,7 +512,7 @@ NC4_inq_attid(int ncid, int varid, const char *name, int *attnump)
h5 = NC4_DATA(nc);
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq_attid(nc->int_ncid, varid, name, attnump);
@ -544,7 +544,7 @@ NC4_inq_attname(int ncid, int varid, int attnum, char *name)
h5 = NC4_DATA(nc);
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq_attname(nc->int_ncid, varid, attnum, name);
@ -596,7 +596,7 @@ NC4_rename_att(int ncid, int varid, const char *name,
if (h5->no_write)
return NC_EPERM;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_rename_att(nc->int_ncid, varid, name, newname);
@ -702,7 +702,7 @@ NC4_del_att(int ncid, int varid, const char *name)
if (h5->no_write)
return NC_EPERM;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_del_att(nc->int_ncid, varid, name);
@ -797,12 +797,13 @@ nc4_put_att_tc(int ncid, int varid, const char *name, nc_type file_type,
h5 = NC4_DATA(nc);
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
{
if (mem_type == NC_UBYTE)
mem_type = NC_BYTE;
switch(mem_type)
{
case NC_BYTE:
@ -859,12 +860,13 @@ nc4_get_att_tc(int ncid, int varid, const char *name, nc_type mem_type,
h5 = NC4_DATA(nc);
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
{
if (mem_type == NC_UBYTE)
mem_type = NC_BYTE;
switch(mem_type)
{
case NC_BYTE:

View File

@ -14,7 +14,7 @@ $Id: nc4dim.c,v 1.41 2010/05/25 17:54:23 dmh Exp $
#include "nc4internal.h"
#include "nc4dispatch.h"
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
#include <pnetcdf.h>
#endif
@ -37,7 +37,7 @@ NC4_inq_unlimdim(int ncid, int *unlimdimidp)
return retval;
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq_unlimdim(nc->int_ncid, unlimdimidp);
@ -87,7 +87,7 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
if (h5->no_write)
return NC_EPERM;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_def_dim(nc->int_ncid, name, len, idp);
@ -169,7 +169,7 @@ NC4_inq_dimid(int ncid, const char *name, int *idp)
assert(h5);
assert(nc && grp);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq_dimid(nc->int_ncid, name, idp);
@ -213,7 +213,7 @@ NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp)
assert(h5);
assert(nc && grp);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
{
@ -291,7 +291,7 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
if (h5->no_write)
return NC_EPERM;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_rename_dim(nc->int_ncid, dimid, name);

View File

@ -56,11 +56,11 @@ NCDEFAULT_put_varm,
NC4_inq_var_all,
NC4_var_par_access,
NC4_show_metadata,
NC4_inq_unlimdims,
NC4_var_par_access,
NC4_inq_ncid,
NC4_inq_grps,
NC4_inq_grpname,

View File

@ -19,7 +19,7 @@ COPYRIGHT file for copying and redistribution conditions.
#include <mfhdf.h>
#endif
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
#include <pnetcdf.h>
#endif
@ -252,7 +252,7 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
nc4_info = NC4_DATA(nc);
assert(nc4_info && nc4_info->root_grp);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
if (cmode & NC_PNETCDF)
return NC_NOERR;
#endif
@ -429,7 +429,7 @@ NC4_create(const char* path, int cmode, size_t initialsz, int basepe,
nc_file->int_ncid = nc_file->ext_ncid;
res = nc4_create_file(path, cmode, comm, info, nc_file);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
if (cmode & NC_PNETCDF)
{
NC_HDF5_FILE_INFO_T* nc4_info;
@ -2752,7 +2752,7 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
/* Depending on the type of file, open it. */
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
if(mode & NC_PNETCDF) {
/* this is not really an hdf file */
int pnetcdf_nvars, i;
@ -2837,7 +2837,7 @@ NC4_set_fill(int ncid, int fillmode, int *old_modep)
nc4_info->fill_mode = fillmode;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (nc4_info->pnetcdf_file)
return ncmpi_set_fill(nc->int_ncid, fillmode, old_modep);
@ -2862,7 +2862,7 @@ NC4_redef(int ncid)
return NC_EBADID;
assert(nc4_info);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (nc4_info->pnetcdf_file)
return ncmpi_redef(nc->int_ncid);
@ -2911,7 +2911,7 @@ static int NC4_enddef(int ncid)
return NC_EBADID;
assert(nc4_info);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
if (nc4_info->pnetcdf_file)
{
int res;
@ -2991,7 +2991,7 @@ NC4_sync(int ncid)
return NC_EBADID;
assert(nc4_info);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (nc4_info->pnetcdf_file)
return ncmpi_sync(nc->int_ncid);
@ -3100,7 +3100,7 @@ NC4_abort(int ncid)
assert(nc4_info);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (nc4_info->pnetcdf_file)
return ncmpi_abort(nc->int_ncid);
@ -3146,7 +3146,7 @@ NC4_close(int ncid)
if (grp->parent)
return NC_EBADGRPID;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_close(nc->int_ncid);
@ -3180,7 +3180,7 @@ NC4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
assert(h5 && grp && nc);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq(nc->int_ncid, ndimsp, nvarsp, nattsp, unlimdimidp);

View File

@ -19,7 +19,7 @@
#include <H5DSpublic.h>
#include <math.h>
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
#include <pnetcdf.h>
#endif

View File

@ -18,7 +18,7 @@ conditions.
#include "ncdispatch.h" /* from libdispatch */
#include <utf8proc.h>
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
#include <pnetcdf.h>
#endif
@ -267,7 +267,7 @@ nc4_find_nc_grp_h5(int ncid, NC **nc, NC_GRP_INFO_T **grpp,
*nc = f;
#if 0 /* I do not understand this code at all */
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
if (h5->pnetcdf_file) {
*h5p = NULL;
*grpp = NULL;

View File

@ -115,9 +115,10 @@ NC4_inq_typeid(int ncid, const char *name, nc_type *typeidp)
/* Normalize name. */
if (!(norm_name = (char*)malloc(strlen(name) + 1)))
return NC_ENOMEM;
if ((retval = nc4_normalize_name(name, norm_name)))
return retval;
if ((retval = nc4_normalize_name(name, norm_name))) {
free(norm_name);
return retval;
}
/* Is the type in this group? If not, search parents. */
for (grp2 = grp; grp2; grp2 = grp2->parent)
for (type = grp2->type; type; type = type->next)

View File

@ -13,7 +13,7 @@ conditions.
#include "nc4dispatch.h"
#include <math.h>
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
#include <pnetcdf.h>
#endif
@ -576,7 +576,7 @@ NC4_def_var(int ncid, const char *name, nc_type xtype, int ndims,
if (!(nc = nc4_find_nc_file(ncid,&h5)))
return NC_EBADID;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
{
@ -623,7 +623,7 @@ NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
assert(nc);
assert(grp && h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq_var(nc->int_ncid, varid, name, xtypep, ndimsp,
@ -1079,7 +1079,7 @@ NC4_inq_varid(int ncid, const char *name, int *varidp)
NC_VAR_INFO_T *var;
char norm_name[NC_MAX_NAME + 1];
int retval;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
NC_HDF5_FILE_INFO_T *h5;
#endif
@ -1094,7 +1094,7 @@ NC4_inq_varid(int ncid, const char *name, int *varidp)
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, NULL)))
return retval;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
h5 = NC4_DATA(nc);
assert(h5);
/* Take care of files created/opened with parallel-netcdf library. */
@ -1141,7 +1141,7 @@ NC4_rename_var(int ncid, int varid, const char *name)
assert(h5);
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_rename_var(nc->int_ncid, varid, name);
@ -1219,7 +1219,7 @@ NC4_var_par_access(int ncid, int varid, int par_access)
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
return retval;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Handle files opened/created with parallel-netcdf library. */
if (h5->pnetcdf_file)
{
@ -1259,7 +1259,7 @@ nc4_put_vara_tc(int ncid, int varid, nc_type mem_type, int mem_type_is_long,
{
NC *nc;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
NC_HDF5_FILE_INFO_T *h5;
#endif
@ -1269,7 +1269,7 @@ nc4_put_vara_tc(int ncid, int varid, nc_type mem_type, int mem_type_is_long,
if (!(nc = nc4_find_nc_file(ncid,NULL)))
return NC_EBADID;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
h5 = NC4_DATA(nc);
assert(h5);
@ -1399,7 +1399,7 @@ nc4_get_vara_tc(int ncid, int varid, nc_type mem_type, int mem_type_is_long,
if (!(nc = nc4_find_nc_file(ncid,&h5)))
return NC_EBADID;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Handle files opened/created with the parallel-netcdf library. */
if (h5->pnetcdf_file)
{

View File

@ -91,7 +91,7 @@ NC4_inq_format(int ncid, int *formatp)
if (!(nc = nc4_find_nc_file(ncid,&h5)))
return NC_EBADID;
#ifdef USE_PNETCDF
#if 0 /*def USE_PNETCDF*/
/* Take care of files created/opened with parallel-netcdf library. */
if (h5->pnetcdf_file)
return ncmpi_inq_format(nc->int_ncid, formatp);

10
libsrc5/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".")
SET(libsrc5_SOURCES nc5dispatch.c)
add_library(netcdf5 OBJECT ${libsrc_SOURCES})

24
libsrc5/Makefile.am Normal file
View File

@ -0,0 +1,24 @@
## This is an automake file, part of Unidata's netCDF package.
# Copyright 2005, see the COPYRIGHT file for more information.
# This automake file is in charge of building the libsrc directory,
# which contains the classic library code.
include $(top_srcdir)/lib_flags.am
libnetcdf5_la_CPPFLAGS = ${AM_CPPFLAGS}
# This is the code for a dispatch table for pnetcdf
# (which has CDF5 as its magic number)
# Turn on a pre-processor flag when building a DLL for windows.
if BUILD_DLL
libnetcdf5_la_CPPFLAGS += -DDLL_EXPORT
endif # BUILD_DLL
# These files comprise the pnetcdf dispatch library code.
libnetcdf5_la_SOURCES = nc5dispatch.c
noinst_LTLIBRARIES = libnetcdf5.la
EXTRA_DIST = CMakeLists.txt

1123
libsrc5/nc5dispatch.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,10 @@ if USE_NETCDF4
TESTPROGRAMS += tst_atts
endif
if USE_PNETCDF
TESTPROGRAMS += tst_parallel2 tst_pnetcdf
endif
# if EXTRA_TESTS
# TESTPROGRAMS +=
# endif # EXTRA_TESTS
@ -70,6 +74,10 @@ TESTS += run_diskless2.sh
endif
endif
if USE_PNETCDF
TESTS += run_pnetcdf_test.sh
endif
# This will run a bunch of the test programs with valgrind, the memory
# checking tool. (Valgrind must be present for this to work.)
if USE_VALGRIND_TESTS
@ -84,7 +92,7 @@ endif # USE_VALGRIND_TESTS
# Distribute the .c files so that m4 isn't required on the users
# machine.
EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh \
run_diskless.sh run_diskless2.sh run_mmap.sh
run_diskless.sh run_diskless2.sh run_mmap.sh run_pnetcdf_test.sh
# ref_tst_diskless2.cdl is for diff comparison and to produce tst_diskless2.c
EXTRA_DIST += ref_tst_diskless2.cdl CMakeLists.txt

View File

@ -120,21 +120,23 @@ tst_att_ordering(int cmode)
int
main(int argc, char **argv)
{
(void) signal(SIGFPE, SIG_IGN);
signed char schar_in[ATT_LEN], schar_out[ATT_LEN] = {NC_MIN_BYTE, 1, NC_MAX_BYTE};
unsigned char uchar_in[ATT_LEN];
short short_in[ATT_LEN], short_out[ATT_LEN] = {NC_MIN_SHORT, -128, NC_MAX_SHORT};
unsigned short ushort_in[ATT_LEN], ushort_out[ATT_LEN] = {0, 128, NC_MAX_USHORT};
int int_in[ATT_LEN], int_out[ATT_LEN] = {-100000, 128, 100000};
long long_in[ATT_LEN];
unsigned int uint_in[ATT_LEN], uint_out[ATT_LEN] = {0, 128, NC_MAX_UINT};
float float_in[ATT_LEN], float_out[ATT_LEN] = {-0.5, 0.25, 0.125};
double double_in[ATT_LEN], double_out[ATT_LEN] = {-0.25, .5, 0.125};
long long longlong_in[ATT_LEN] = {-1LL, -1LL, -1LL};
#ifdef USE_NETCDF4
long long_in[ATT_LEN];
unsigned short ushort_in[ATT_LEN], ushort_out[ATT_LEN] = {0, 128, NC_MAX_USHORT};
unsigned int uint_in[ATT_LEN], uint_out[ATT_LEN] = {0, 128, NC_MAX_UINT};
long long longlong_out[ATT_LEN] = {-3123456789LL, 128LL, 3123456789LL};
unsigned long long ulonglong_in[ATT_LEN] = {NC_MAX_UINT64, NC_MAX_UINT64, NC_MAX_UINT64};
unsigned long long ulonglong_out[ATT_LEN] = {0LL, 128LL, 3123456789LL};
#endif
(void) signal(SIGFPE, SIG_IGN);
printf("\n*** Testing netcdf-3 attribute functions.\n");
printf("*** testing really simple global atts...");

View File

@ -14,6 +14,7 @@
#include <string.h>
#include <mpi.h>
#include <netcdf.h>
#include <netcdf_par.h>
#include <assert.h>
#define NVARS 6

View File

@ -107,17 +107,12 @@ if TEST_PARALLEL
check_PROGRAMS += tst_mpi_parallel tst_parallel tst_parallel3 \
tst_parallel4 tst_nc4perf
TESTS += run_par_test.sh
# More tests run with --enable-pnetcdf
if USE_PNETCDF
check_PROGRAMS += tst_parallel2 tst_pnetcdf
TESTS += run_pnetcdf_test.sh
endif
endif
EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh run_bm_test2.sh \
run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh run_par_bm_test.sh \
run_bm_elena.sh run_par_bm_radar_2D.sh run_bm_radar_2D_endianness1.sh \
run_tst_chunks.sh ref_chunks1.cdl ref_chunks2.cdl run_pnetcdf_test.sh \
run_tst_chunks.sh ref_chunks1.cdl ref_chunks2.cdl \
run_get_hdf4_files.sh run_valgrind_tests.sh run_valgrind_tests2.sh \
run_bm_ar4.sh ref_tst_compounds.nc run_hdf4_valgrind_tests.sh \
ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc \

View File

@ -4,4 +4,4 @@ Attributes {
Int32 a1 32;
}
}
}
}

View File

@ -0,0 +1,11 @@
Dataset {
Grid {
Array:
Float32 temp[lat=2][long=2];
Maps:
Int32 lat[lat=2];
Int32 long[long=2];
} G1;
Int32 lat[lat=2];
Int32 long[long=2];
} TEST3;

View File

@ -32,12 +32,13 @@ bin_constant(Generator* generator, Constant* con, Bytebuffer* buf,...)
}
switch (con->nctype) {
case NC_OPAQUE: {
unsigned char* bytes;
unsigned char* bytes = NULL;
size_t len;
/* Assume the opaque string has been normalized */
bytes=makebytestring(con->value.opaquev.stringv,&len);
bbAppendn(buf,(void*)bytes,len);
} break;
free(bytes);
} break;
case NC_CHAR:
bbAppendn(buf,&con->value.charv,sizeof(con->value.charv));
break;

View File

@ -606,6 +606,7 @@ convertstringtochars(Constant* str)
con.nctype = NC_CHAR;
con.lineno = str->lineno;
con.value.charv = s[i];
con.filled = 0;
dlappend(dl,&con);
}
return dl;

View File

@ -8,7 +8,7 @@
# $Id: Makefile.am,v 1.1 2010/05/23 21:05:33 dmh Exp $
# Cause C preprocessor to search current and parent directory.
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/include
# OC Sources; include the daptab.[ch] to avoid the need for bison by user
SRC=oc.c \

View File

@ -309,6 +309,8 @@ daplexinit(char* input, DAPlexstate** lexstatep)
lexstate->yytext = ocbytesnew();
lexstate->reclaim = oclistnew();
dapsetwordchars(lexstate,0); /* Assume DDS */
if(!lexstatep)
free(lexstate);
}
void