|
| hid_t | NXCDF_memory_type (nc_type type, int *closep) |
| | Map a netCDF atomic type to the HDF5 datatype describing the caller's memory buffer.
|
| static int | is_small_float (nc_type xtype) |
| | Return non-zero if xtype is a nxCDF small floating-point type.
|
| static int | check_memtype (nc_type xtype, nc_type memtype) |
| | Decide whether a typed I/O call is allowed on a variable.
|
| int | NXCDF_var_par_access (int ncid, int varid, int par_access) |
| | Select a variable's session-only parallel transfer mode.
|
| static int | var_io (int ncid, int varid, const size_t *startp, const size_t *countp, const ptrdiff_t *stridep, void *data, nc_type memtype, int writing) |
| | Common hyperslab I/O behind the nc_get/put_vara and nc_get/put_vars dispatch entries.
|
| int | NXCDF_get_vara (int ncid, int varid, const size_t *start, const size_t *count, void *value, nc_type memtype) |
| | Read a hyperslab — the nc_get_vara_* dispatch entry.
|
| int | NXCDF_put_vara (int ncid, int varid, const size_t *start, const size_t *count, const void *value, nc_type memtype) |
| | Write a hyperslab — the nc_put_vara_* dispatch entry.
|
| int | NXCDF_get_vars (int ncid, int varid, const size_t *start, const size_t *count, const ptrdiff_t *stride, void *value, nc_type memtype) |
| | Read a strided hyperslab — the nc_get_vars_* dispatch entry.
|
| int | NXCDF_put_vars (int ncid, int varid, const size_t *start, const size_t *count, const ptrdiff_t *stride, const void *value, nc_type memtype) |
| | Write a strided hyperslab — the nc_put_vars_* dispatch entry.
|
| int | NXCDF_get_varm (int ncid, int varid, const size_t *s, const size_t *c, const ptrdiff_t *st, const ptrdiff_t *im, void *v, nc_type t) |
| | Mapped hyperslab read (nc_get_varm_*); not implemented.
|
| int | NXCDF_put_varm (int ncid, int varid, const size_t *s, const size_t *c, const ptrdiff_t *st, const ptrdiff_t *im, const void *v, nc_type t) |
| | Mapped hyperslab write (nc_put_varm_*); not implemented.
|
Hyperslab variable I/O and memtype checks for fixed-size nxCDF atomic types.
- Author
- Edward Hartnett
- Date
- 2026-08-29
- Copyright
- Intelligent Data Design, Inc. All rights reserved.
| hid_t NXCDF_memory_type |
( |
nc_type | type, |
|
|
int * | closep ) |
Map a netCDF atomic type to the HDF5 datatype describing the caller's memory buffer.
H5Dread/H5Dwrite take a "memory datatype" describing the layout of the buffer in RAM — this is what lets HDF5 convert on the fly (for example nc_get_vara_float on an NC_SHORT variable). Most netCDF types map to a predefined H5T_NATIVE_* constant that must not be closed; types with no native constant (NC_CHAR, small floats, strings, references) are produced by H5Tcopy of a base type, and the caller owns the copy — closep says which.
NC_BFLOAT16 copies little-endian bfloat16 and then adopts the machine's uint16 byte order, because HDF5 2.1.1 has no native-order bfloat16 constant. NC_CHAR is a fixed-length 1-byte string; NC_STRING is a variable-length string.
- Parameters
-
| type | NetCDF atomic type (the nc_type of the memory buffer). |
| closep | Set nonzero when the returned type must be closed with H5Tclose(); may be NULL. |
- Returns
- HDF5 memory datatype, or negative on error.
| int var_io |
( |
int | ncid, |
|
|
int | varid, |
|
|
const size_t * | startp, |
|
|
const size_t * | countp, |
|
|
const ptrdiff_t * | stridep, |
|
|
void * | data, |
|
|
nc_type | memtype, |
|
|
int | writing ) |
|
static |
Common hyperslab I/O behind the nc_get/put_vara and nc_get/put_vars dispatch entries.
A hyperslab is the rectangular (possibly strided) region of a variable an I/O call touches. This function resolves the variable's HDF5 dataset, validates the memtype against check_memtype(), bounds-checks the selection (extending unlimited dimensions on writes past the current extent), performs any type conversion or quantization through the internal engine nxcdf_convert_type(), and runs H5Dread/H5Dwrite with a matching memory dataspace.
When a conversion overflows (NC_ERANGE semantics, issue #381), the I/O still completes — the engine records the range error and the function returns NC_ERANGE after the data lands.
Parallel sessions use an owned MPI transfer list. Collective empty/fill-only selections still enter HDF5 with none-selected spaces. Unlimited writes negotiate extents across the file communicator; independent growth fails before mutation. The caller supplies matching collective order and valid rank-local arguments. Dynamic/reference transfers remain serial-only.
- Author
- Edward Hartnett, Intelligent Data Design, Inc.
- Parameters
-
| ncid | NetCDF file identifier. |
| varid | Variable identifier. |
| startp | Hyperslab start indices. |
| countp | Hyperslab counts. |
| stridep | Hyperslab strides, or NULL for contiguous. |
| data | Data buffer. |
| memtype | NetCDF atomic memory type (NC_NAT resolves to the variable's own type for the untyped nc_get_var/nc_put_var, var1 and vars calls). |
| writing | Nonzero for a write, zero for a read. |
- Returns
- NC_NOERR on success, NC_ERANGE when data landed but a conversion overflowed, or another NetCDF error code.