Merge pull request #2098 from DennisHeimbigner/fortcache.dmh

Make the fortran cache API always be defined.
This commit is contained in:
Ward Fisher 2021-09-07 10:30:00 -06:00 committed by GitHub
commit 0a4f4e16ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 0 deletions

View File

@ -1331,5 +1331,37 @@ nc_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp,
return ncp->dispatch->get_var_chunk_cache(ncid, varid, sizep,
nelemsp, preemptionp);
}
#ifndef USE_NETCDF4
/* Make sure the fortran API is defined, even if it only returns errors */
int
nc_set_chunk_cache_ints(int size, int nelems, int preemption)
{
return NC_ENOTBUILT;
}
int
nc_get_chunk_cache_ints(int *sizep, int *nelemsp, int *preemptionp)
{
return NC_ENOTBUILT;
}
int
nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
int preemption)
{
return NC_ENOTBUILT;
}
int
nc_get_var_chunk_cache_ints(int ncid, int varid, int *sizep,
int *nelemsp, int *preemptionp)
{
return NC_ENOTBUILT;
}
#endif /*USE_NETCDF4*/
/** @} */
/** @} */

View File

@ -838,6 +838,7 @@ NC4_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp
/**
* @internal Define chunking stuff for a var. This is called by
* the fortran API.
* Note: see libsrc4/nc4cache.c for definition when HDF5 is disabled
*
* @param ncid File ID.
* @param varid Variable ID.
@ -2147,6 +2148,7 @@ NC4_HDF5_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
/**
* @internal A wrapper for NC4_set_var_chunk_cache(), we need this
* version for fortran. Negative values leave settings as they are.
* Note: see libsrc4/nc4cache.c for definition when HDF5 is disabled
*
* @param ncid File ID.
* @param varid Variable ID.

View File

@ -115,6 +115,8 @@ nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp)
* but with integers instead of size_t, and with an integer preemption
* (which is the float preemtion * 100). This was required for fortran
* to avoid size_t issues.
* Note: if netcdf-4 is completely disabled, then the definitions in
* libdispatch/dfile.c take effect.
*
* @param size Cache size.
* @param nelems Number of elements.
@ -139,6 +141,8 @@ nc_set_chunk_cache_ints(int size, int nelems, int preemption)
* nc_get_chunk_cache() but with integers instead of size_t, and with
* an integer preemption (which is the float preemtion * 100). This
* was required for fortran to avoid size_t issues.
* Note: if netcdf-4 is completely disabled, then the definitions in
* libdispatch/dfile.c take effect.
*
* @param sizep Pointer that gets cache size.
* @param nelemsp Pointer that gets number of elements.
@ -159,3 +163,25 @@ nc_get_chunk_cache_ints(int *sizep, int *nelemsp, int *preemptionp)
return NC_NOERR;
}
#ifndef USE_HDF5
/* See definitions in libhd5/hdf5var.c */
/* Make sure they are always defined */
/* Note: if netcdf-4 is completely disabled, then the definitions in
* libdispatch/dfile.c take effect.
*/
int
nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
int preemption)
{
return NC_NOERR;
}
int
nc_def_var_chunking_ints(int ncid, int varid, int storage, int *chunksizesp)
{
return NC_NOERR;
}
#endif /*USE_HDF5*/