mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-18 17:40:55 +08:00
Implement support for complex number datatypes (#4630)
* Implement support for complex number datatypes Adds the new datatype class H5T_COMPLEX Adds the new API function H5Tcomplex_create which creates a complex number datatype from an ID of a base floating-point datatype Adds the new feature check macros H5_HAVE_COMPLEX_NUMBERS and H5_HAVE_C99_COMPLEX_NUMBERS Adds the new datatype size macros H5_SIZEOF_FLOAT_COMPLEX, H5_SIZEOF_DOUBLE_COMPLEX and H5_SIZEOF_LONG_DOUBLE_COMPLEX Adds the new datatype ID macros H5T_NATIVE_FLOAT_COMPLEX, H5T_NATIVE_DOUBLE_COMPLEX, H5T_NATIVE_LDOUBLE_COMPLEX, H5T_CPLX_IEEE_F16LE, H5T_CPLX_IEEE_F16BE, H5T_CPLX_IEEE_F32LE, H5T_CPLX_IEEE_F32BE, H5T_CPLX_IEEE_F64LE and H5T_CPLX_IEEE_F64BE Adds hard and soft datatype conversion paths between complex number datatypes and all the integer and floating-point datatypes, as well as between other complex number datatypes Adds a special conversion path between complex number datatypes and array or compound datatypes where the in-memory layout of data is the same between the datatypes and data can be converted directly Adds support for complex number datatypes to the h5dump, h5ls and h5diff/ph5diff tools. Allows h5dump '-m' option to change floating-point printing format for float complex and double complex datatypes, as well as long double complex if it has the same size as double complex Adds minimal support to the h5watch and h5import tools Adds support for the predefined complex number datatypes and H5Tcomplex_create function to the Java wrappers. Also adds initial, untested support to the JNI for future use with HDFView Adds support for just the H5T_COMPLEX datatype class to the Fortran wrappers Adds support for the predefined complex number datatypes and H5Tcomplex_create function to the high level library H5LT interface for use with the H5LTtext_to_dtype and H5LTdtype_to_text functions Changes some usages of "complex" in the library since it conflicts with the "complex" keyword from the complex.h header. Also changes various usages of the word "complex" throughout the library to distinguish compound datatypes from complex datatypes.
This commit is contained in:
parent
e8257bd2b5
commit
90429f5e7d
137
HDF5Examples/C/H5T/200/h5ex_t_complex.c
Normal file
137
HDF5Examples/C/H5T/200/h5ex_t_complex.c
Normal file
@ -0,0 +1,137 @@
|
||||
/************************************************************
|
||||
|
||||
This example shows how to read and write complex number
|
||||
datatypes to a dataset. The program first writes float
|
||||
complex values to a dataset with a dataspace of DIM0xDIM1,
|
||||
then closes the file. Next, it reopens the file, reads
|
||||
back the data, and outputs it to the screen. This example
|
||||
assumes the C99 complex number types are supported. For an
|
||||
example that uses MSVC's complex number types, see the
|
||||
h5ex_t_complex_msvc.c example file.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <complex.h>
|
||||
|
||||
#define FILE "h5ex_t_complex.h5"
|
||||
#define DATASET "DS1"
|
||||
#define DIM0 4
|
||||
#define DIM1 7
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
float _Complex wdata[DIM0][DIM1]; /* Write buffer */
|
||||
float _Complex **rdata; /* Read buffer */
|
||||
hid_t file, space, dset; /* Handles */
|
||||
herr_t status;
|
||||
hsize_t dims[2] = {DIM0, DIM1};
|
||||
int ndims;
|
||||
hsize_t i, j;
|
||||
|
||||
/*
|
||||
* Initialize data.
|
||||
*/
|
||||
for (i = 0; i < DIM0; i++)
|
||||
for (j = 0; j < DIM1; j++) {
|
||||
float real = (float)i / (j + 0.5) + j;
|
||||
float imaginary = (float)i / (j + 0.5) + j + 1;
|
||||
wdata[i][j] = real + imaginary * I;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new file using the default properties.
|
||||
*/
|
||||
file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Create dataspace. Setting maximum size to NULL sets the maximum
|
||||
* size to be the current size.
|
||||
*/
|
||||
space = H5Screate_simple(2, dims, NULL);
|
||||
|
||||
/*
|
||||
* Create the dataset and write the complex number data to it. In
|
||||
* this example we will save the data as complex numbers of 2 64-bit
|
||||
* little endian IEEE floating point numbers, regardless of the native
|
||||
* type. The HDF5 library automatically converts between different
|
||||
* complex number types.
|
||||
*/
|
||||
dset = H5Dcreate(file, DATASET, H5T_COMPLEX_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
status = H5Dwrite(dset, H5T_NATIVE_FLOAT_COMPLEX, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
|
||||
|
||||
/*
|
||||
* Close and release resources.
|
||||
*/
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Fclose(file);
|
||||
|
||||
/*
|
||||
* Now we begin the read section of this example. Here we assume
|
||||
* the dataset has the same name and rank, but can have any size.
|
||||
* Therefore we must allocate a new array to read in data using
|
||||
* malloc().
|
||||
*/
|
||||
|
||||
/*
|
||||
* Open file and dataset.
|
||||
*/
|
||||
file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
dset = H5Dopen(file, DATASET, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Get dataspace and allocate memory for read buffer. This is a
|
||||
* two dimensional dataset so the dynamic allocation must be done
|
||||
* in steps.
|
||||
*/
|
||||
space = H5Dget_space(dset);
|
||||
ndims = H5Sget_simple_extent_dims(space, dims, NULL);
|
||||
|
||||
/*
|
||||
* Allocate array of pointers to rows.
|
||||
*/
|
||||
rdata = malloc(dims[0] * sizeof(float _Complex *));
|
||||
|
||||
/*
|
||||
* Allocate space for complex number data.
|
||||
*/
|
||||
rdata[0] = malloc(dims[0] * dims[1] * sizeof(float _Complex));
|
||||
|
||||
/*
|
||||
* Set the rest of the pointers to rows to the correct addresses.
|
||||
*/
|
||||
for (i = 1; i < dims[0]; i++)
|
||||
rdata[i] = rdata[0] + i * dims[1];
|
||||
|
||||
/*
|
||||
* Read the data.
|
||||
*/
|
||||
status = H5Dread(dset, H5T_NATIVE_FLOAT_COMPLEX, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
|
||||
|
||||
/*
|
||||
* Output the data to the screen.
|
||||
*/
|
||||
printf("%s:\n", DATASET);
|
||||
for (i = 0; i < dims[0]; i++) {
|
||||
printf(" [");
|
||||
for (j = 0; j < dims[1]; j++) {
|
||||
printf(" %6.4f%+6.4fi", crealf(rdata[i][j]), cimagf(rdata[i][j]));
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Close and release resources.
|
||||
*/
|
||||
free(rdata[0]);
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Fclose(file);
|
||||
|
||||
return 0;
|
||||
}
|
145
HDF5Examples/C/H5T/200/h5ex_t_complex_custom.c
Normal file
145
HDF5Examples/C/H5T/200/h5ex_t_complex_custom.c
Normal file
@ -0,0 +1,145 @@
|
||||
/************************************************************
|
||||
|
||||
This example shows how to read and write complex number
|
||||
datatypes to a dataset. The program first writes float
|
||||
complex values to a dataset with a dataspace of DIM0xDIM1,
|
||||
then closes the file. Next, it reopens the file, reads
|
||||
back the data, and outputs it to the screen. This example
|
||||
assumes the C99 complex number types are supported. For an
|
||||
example that uses MSVC's complex number types, see the
|
||||
h5ex_t_complex_msvc.c example file.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <complex.h>
|
||||
|
||||
#define FILE "h5ex_t_complex_custom.h5"
|
||||
#define DATASET "DS1"
|
||||
#define DIM0 4
|
||||
#define DIM1 7
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
float _Complex wdata[DIM0][DIM1]; /* Write buffer */
|
||||
float _Complex **rdata; /* Read buffer */
|
||||
hid_t file, space, dset, dtype; /* Handles */
|
||||
herr_t status;
|
||||
hsize_t dims[2] = {DIM0, DIM1};
|
||||
int ndims;
|
||||
hsize_t i, j;
|
||||
|
||||
/*
|
||||
* Initialize data.
|
||||
*/
|
||||
for (i = 0; i < DIM0; i++)
|
||||
for (j = 0; j < DIM1; j++) {
|
||||
float real = (float)i / (j + 0.5) + j;
|
||||
float imaginary = (float)i / (j + 0.5) + j + 1;
|
||||
wdata[i][j] = real + imaginary * I;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new file using the default properties.
|
||||
*/
|
||||
file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Create dataspace. Setting maximum size to NULL sets the maximum
|
||||
* size to be the current size.
|
||||
*/
|
||||
space = H5Screate_simple(2, dims, NULL);
|
||||
|
||||
/*
|
||||
* Create the dataset and write the complex number data to it. In
|
||||
* this example we will save the data as complex numbers of 2 64-bit
|
||||
* little endian IEEE floating point numbers, regardless of the native
|
||||
* type. The HDF5 library automatically converts between different
|
||||
* complex number types.
|
||||
*/
|
||||
dset = H5Dcreate(file, DATASET, H5T_COMPLEX_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Create a datatype for writing to the dataset. This datatype is a
|
||||
* complex number equivalent to the H5T_NATIVE_FLOAT_COMPLEX type.
|
||||
*/
|
||||
dtype = H5Tcomplex_create(H5T_NATIVE_FLOAT);
|
||||
|
||||
status = H5Dwrite(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
|
||||
|
||||
/*
|
||||
* Close and release resources.
|
||||
*/
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Fclose(file);
|
||||
|
||||
/*
|
||||
* Now we begin the read section of this example. Here we assume
|
||||
* the dataset has the same name and rank, but can have any size.
|
||||
* Therefore we must allocate a new array to read in data using
|
||||
* malloc().
|
||||
*/
|
||||
|
||||
/*
|
||||
* Open file and dataset.
|
||||
*/
|
||||
file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
dset = H5Dopen(file, DATASET, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Get dataspace and allocate memory for read buffer. This is a
|
||||
* two dimensional dataset so the dynamic allocation must be done
|
||||
* in steps.
|
||||
*/
|
||||
space = H5Dget_space(dset);
|
||||
ndims = H5Sget_simple_extent_dims(space, dims, NULL);
|
||||
|
||||
/*
|
||||
* Allocate array of pointers to rows.
|
||||
*/
|
||||
rdata = malloc(dims[0] * sizeof(float _Complex *));
|
||||
|
||||
/*
|
||||
* Allocate space for complex number data.
|
||||
*/
|
||||
rdata[0] = malloc(dims[0] * dims[1] * sizeof(float _Complex));
|
||||
|
||||
/*
|
||||
* Set the rest of the pointers to rows to the correct addresses.
|
||||
*/
|
||||
for (i = 1; i < dims[0]; i++)
|
||||
rdata[i] = rdata[0] + i * dims[1];
|
||||
|
||||
/*
|
||||
* Read the data.
|
||||
*/
|
||||
status = H5Dread(dset, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
|
||||
|
||||
/*
|
||||
* Output the data to the screen.
|
||||
*/
|
||||
printf("%s:\n", DATASET);
|
||||
for (i = 0; i < dims[0]; i++) {
|
||||
printf(" [");
|
||||
for (j = 0; j < dims[1]; j++) {
|
||||
printf(" %6.4f%+6.4fi", crealf(rdata[i][j]), cimagf(rdata[i][j]));
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Close and release resources.
|
||||
*/
|
||||
free(rdata[0]);
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Tclose(dtype);
|
||||
status = H5Fclose(file);
|
||||
|
||||
return 0;
|
||||
}
|
138
HDF5Examples/C/H5T/200/h5ex_t_complex_msvc.c
Normal file
138
HDF5Examples/C/H5T/200/h5ex_t_complex_msvc.c
Normal file
@ -0,0 +1,138 @@
|
||||
/************************************************************
|
||||
|
||||
This example shows how to read and write complex number
|
||||
datatypes to a dataset. The program first writes float
|
||||
complex values to a dataset with a dataspace of DIM0xDIM1,
|
||||
then closes the file. Next, it reopens the file, reads
|
||||
back the data, and outputs it to the screen. This example
|
||||
assumes MSVC's complex number types are supported rather
|
||||
than the C99 complex number types. For an example that uses
|
||||
the C99 complex number types, see the h5ex_t_complex.c
|
||||
example file.
|
||||
|
||||
************************************************************/
|
||||
|
||||
#include "hdf5.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <complex.h>
|
||||
|
||||
#define FILE "h5ex_t_complex_msvc.h5"
|
||||
#define DATASET "DS1"
|
||||
#define DIM0 4
|
||||
#define DIM1 7
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
_Fcomplex wdata[DIM0][DIM1]; /* Write buffer */
|
||||
_Fcomplex **rdata; /* Read buffer */
|
||||
hid_t file, space, dset; /* Handles */
|
||||
herr_t status;
|
||||
hsize_t dims[2] = {DIM0, DIM1};
|
||||
int ndims;
|
||||
hsize_t i, j;
|
||||
|
||||
/*
|
||||
* Initialize data.
|
||||
*/
|
||||
for (i = 0; i < DIM0; i++)
|
||||
for (j = 0; j < DIM1; j++) {
|
||||
float real = (float)i / (j + 0.5) + j;
|
||||
float imaginary = (float)i / (j + 0.5) + j + 1;
|
||||
wdata[i][j] = _FCbuild(real, imaginary);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new file using the default properties.
|
||||
*/
|
||||
file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Create dataspace. Setting maximum size to NULL sets the maximum
|
||||
* size to be the current size.
|
||||
*/
|
||||
space = H5Screate_simple(2, dims, NULL);
|
||||
|
||||
/*
|
||||
* Create the dataset and write the complex number data to it. In
|
||||
* this example we will save the data as complex numbers of 2 64-bit
|
||||
* little endian IEEE floating point numbers, regardless of the native
|
||||
* type. The HDF5 library automatically converts between different
|
||||
* complex number types.
|
||||
*/
|
||||
dset = H5Dcreate(file, DATASET, H5T_COMPLEX_IEEE_F64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
status = H5Dwrite(dset, H5T_NATIVE_FLOAT_COMPLEX, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]);
|
||||
|
||||
/*
|
||||
* Close and release resources.
|
||||
*/
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Fclose(file);
|
||||
|
||||
/*
|
||||
* Now we begin the read section of this example. Here we assume
|
||||
* the dataset has the same name and rank, but can have any size.
|
||||
* Therefore we must allocate a new array to read in data using
|
||||
* malloc().
|
||||
*/
|
||||
|
||||
/*
|
||||
* Open file and dataset.
|
||||
*/
|
||||
file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
dset = H5Dopen(file, DATASET, H5P_DEFAULT);
|
||||
|
||||
/*
|
||||
* Get dataspace and allocate memory for read buffer. This is a
|
||||
* two dimensional dataset so the dynamic allocation must be done
|
||||
* in steps.
|
||||
*/
|
||||
space = H5Dget_space(dset);
|
||||
ndims = H5Sget_simple_extent_dims(space, dims, NULL);
|
||||
|
||||
/*
|
||||
* Allocate array of pointers to rows.
|
||||
*/
|
||||
rdata = malloc(dims[0] * sizeof(_Fcomplex *));
|
||||
|
||||
/*
|
||||
* Allocate space for complex number data.
|
||||
*/
|
||||
rdata[0] = malloc(dims[0] * dims[1] * sizeof(_Fcomplex));
|
||||
|
||||
/*
|
||||
* Set the rest of the pointers to rows to the correct addresses.
|
||||
*/
|
||||
for (i = 1; i < dims[0]; i++)
|
||||
rdata[i] = rdata[0] + i * dims[1];
|
||||
|
||||
/*
|
||||
* Read the data.
|
||||
*/
|
||||
status = H5Dread(dset, H5T_NATIVE_FLOAT_COMPLEX, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata[0]);
|
||||
|
||||
/*
|
||||
* Output the data to the screen.
|
||||
*/
|
||||
printf("%s:\n", DATASET);
|
||||
for (i = 0; i < dims[0]; i++) {
|
||||
printf(" [");
|
||||
for (j = 0; j < dims[1]; j++) {
|
||||
printf(" %6.4f%+6.4fi", crealf(rdata[i][j]), cimagf(rdata[i][j]));
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Close and release resources.
|
||||
*/
|
||||
free(rdata[0]);
|
||||
free(rdata);
|
||||
status = H5Dclose(dset);
|
||||
status = H5Sclose(space);
|
||||
status = H5Fclose(file);
|
||||
|
||||
return 0;
|
||||
}
|
@ -47,7 +47,8 @@ public class H5Ex_T_Commit {
|
||||
H5T_ENUM(HDF5Constants.H5T_ENUM), // enumeration types
|
||||
H5T_VLEN(HDF5Constants.H5T_VLEN), // Variable-Length types
|
||||
H5T_ARRAY(HDF5Constants.H5T_ARRAY), // Array types
|
||||
H5T_NCLASSES(11); // this must be last
|
||||
H5T_COMPLEX(HDF5Constants.H5T_COMPLEX), // Complex number types
|
||||
H5T_NCLASSES(12); // this must be last
|
||||
|
||||
private static final Map<Long, H5T_class> lookup = new HashMap<Long, H5T_class>();
|
||||
|
||||
|
@ -632,7 +632,7 @@ test_attr_compound_write(FileAccPropList &fapl)
|
||||
hsize_t dims2[] = {ATTR4_DIM1, ATTR4_DIM2};
|
||||
DataSpace sid2(ATTR4_RANK, dims2);
|
||||
|
||||
// Create complex attribute for the dataset
|
||||
// Create compound attribute for the dataset
|
||||
Attribute attr = dataset.createAttribute(ATTR4_NAME, comp_type, sid2);
|
||||
|
||||
// Try to create the same attribute again (should fail)
|
||||
@ -643,7 +643,7 @@ test_attr_compound_write(FileAccPropList &fapl)
|
||||
{
|
||||
} // do nothing, exception expected
|
||||
|
||||
// Write complex attribute data
|
||||
// Write compound attribute data
|
||||
attr.write(comp_type, attr_data4);
|
||||
|
||||
PASSED();
|
||||
@ -2001,8 +2001,8 @@ test_attr(const void *params)
|
||||
test_attr_rename(curr_fapl); // Test renaming attribute
|
||||
test_attr_basic_read(curr_fapl); // Test basic H5A reading code
|
||||
|
||||
test_attr_compound_write(curr_fapl); // Test complex datatype H5A writing code
|
||||
test_attr_compound_read(curr_fapl); // Test complex datatype H5A reading code
|
||||
test_attr_compound_write(curr_fapl); // Test compound datatype H5A writing code
|
||||
test_attr_compound_read(curr_fapl); // Test compound datatype H5A reading code
|
||||
|
||||
test_attr_scalar_write(curr_fapl); // Test scalar dataspace H5A writing code
|
||||
test_attr_scalar_read(curr_fapl); // Test scalar dataspace H5A reading code
|
||||
|
@ -21,6 +21,7 @@ include (CheckTypeSize)
|
||||
include (CheckVariableExists)
|
||||
include (TestBigEndian)
|
||||
include (CheckStructHasMember)
|
||||
include (CMakePushCheckState)
|
||||
|
||||
set (HDF_PREFIX "H5")
|
||||
|
||||
@ -828,6 +829,71 @@ macro (H5ConversionTests TEST def msg)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check for complex number support
|
||||
#-----------------------------------------------------------------------------
|
||||
message (STATUS "Checking if complex number support is available")
|
||||
CHECK_INCLUDE_FILE (complex.h ${HDF_PREFIX}_HAVE_COMPLEX_H)
|
||||
if (${HDF_PREFIX}_HAVE_COMPLEX_H)
|
||||
set (H5_HAVE_C99_COMPLEX_NUMBERS 1)
|
||||
|
||||
HDF_CHECK_TYPE_SIZE ("float _Complex" ${HDF_PREFIX}_SIZEOF_FLOAT_COMPLEX)
|
||||
HDF_CHECK_TYPE_SIZE ("double _Complex" ${HDF_PREFIX}_SIZEOF_DOUBLE_COMPLEX)
|
||||
HDF_CHECK_TYPE_SIZE ("long double _Complex" ${HDF_PREFIX}_SIZEOF_LONG_DOUBLE_COMPLEX)
|
||||
|
||||
if (MSVC AND NOT ${HDF_PREFIX}_SIZEOF_FLOAT_COMPLEX AND NOT ${HDF_PREFIX}_SIZEOF_DOUBLE_COMPLEX
|
||||
AND NOT ${HDF_PREFIX}_SIZEOF_LONG_DOUBLE_COMPLEX)
|
||||
# If using MSVC, the _Complex types (if available) are _Fcomplex, _Dcomplex and _Lcomplex.
|
||||
# The standard types are checked for first in case MSVC uses them in the future or in case
|
||||
# the compiler used is simulating MSVC and uses the standard types.
|
||||
cmake_push_check_state()
|
||||
list (APPEND CMAKE_EXTRA_INCLUDE_FILES complex.h)
|
||||
HDF_CHECK_TYPE_SIZE ("_Fcomplex" ${HDF_PREFIX}_SIZEOF__FCOMPLEX)
|
||||
HDF_CHECK_TYPE_SIZE ("_Dcomplex" ${HDF_PREFIX}_SIZEOF__DCOMPLEX)
|
||||
HDF_CHECK_TYPE_SIZE ("_Lcomplex" ${HDF_PREFIX}_SIZEOF__LCOMPLEX)
|
||||
cmake_pop_check_state()
|
||||
if (${HDF_PREFIX}_SIZEOF__FCOMPLEX AND ${HDF_PREFIX}_SIZEOF__DCOMPLEX AND
|
||||
${HDF_PREFIX}_SIZEOF__FCOMPLEX)
|
||||
set (${HDF_PREFIX}_SIZEOF_FLOAT_COMPLEX ${${HDF_PREFIX}_SIZEOF__FCOMPLEX}
|
||||
CACHE INTERNAL "SizeOf for float _Complex" FORCE)
|
||||
set (${HDF_PREFIX}_SIZEOF_DOUBLE_COMPLEX ${${HDF_PREFIX}_SIZEOF__DCOMPLEX}
|
||||
CACHE INTERNAL "SizeOf for double _Complex" FORCE)
|
||||
set (${HDF_PREFIX}_SIZEOF_LONG_DOUBLE_COMPLEX ${${HDF_PREFIX}_SIZEOF__LCOMPLEX}
|
||||
CACHE INTERNAL "SizeOf for long double _Complex" FORCE)
|
||||
|
||||
unset (H5_HAVE_C99_COMPLEX_NUMBERS)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (${HDF_PREFIX}_SIZEOF_FLOAT_COMPLEX AND ${HDF_PREFIX}_SIZEOF_DOUBLE_COMPLEX AND
|
||||
${HDF_PREFIX}_SIZEOF_LONG_DOUBLE_COMPLEX)
|
||||
# Check if __STDC_NO_COMPLEX__ macro is defined, in which case complex number
|
||||
# support is not available
|
||||
HDF_FUNCTION_TEST (HAVE_STDC_NO_COMPLEX)
|
||||
|
||||
if (NOT H5_HAVE_STDC_NO_COMPLEX)
|
||||
# Compile simple test program with complex numbers
|
||||
HDF_FUNCTION_TEST (HAVE_COMPLEX_NUMBERS)
|
||||
|
||||
if (H5_HAVE_COMPLEX_NUMBERS)
|
||||
if (H5_HAVE_C99_COMPLEX_NUMBERS)
|
||||
message (STATUS "Using C99 complex number types")
|
||||
else ()
|
||||
message (STATUS "Using MSVC complex number types")
|
||||
endif ()
|
||||
else ()
|
||||
message (STATUS "Complex number support has been disabled since a simple test program couldn't be compiled and linked")
|
||||
endif ()
|
||||
else ()
|
||||
message (STATUS "Complex number support has been disabled since __STDC_NO_COMPLEX__ is defined")
|
||||
endif ()
|
||||
else ()
|
||||
message (STATUS "Complex number support has been disabled since the C types were not found")
|
||||
endif ()
|
||||
else ()
|
||||
message (STATUS "Complex number support has been disabled since the complex.h header was not found")
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check various conversion capabilities
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@ -104,9 +104,15 @@
|
||||
/* Define if the __attribute__(()) extension is present */
|
||||
#cmakedefine H5_HAVE_ATTRIBUTE @H5_HAVE_ATTRIBUTE@
|
||||
|
||||
/* Define if C99 complex number types are present */
|
||||
#cmakedefine H5_HAVE_C99_COMPLEX_NUMBERS @H5_HAVE_C99_COMPLEX_NUMBERS@
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#cmakedefine H5_HAVE_CLOCK_GETTIME @H5_HAVE_CLOCK_GETTIME@
|
||||
|
||||
/* Define if complex number support is available */
|
||||
#cmakedefine H5_HAVE_COMPLEX_NUMBERS @H5_HAVE_COMPLEX_NUMBERS@
|
||||
|
||||
/* Define to 1 if you have the <curl/curl.h> header file. */
|
||||
#cmakedefine H5_HAVE_CURL_CURL_H @H5_HAVE_CURL_H@
|
||||
|
||||
@ -445,9 +451,15 @@
|
||||
/* The size of `double', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@
|
||||
|
||||
/* The size of `double _Complex', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_DOUBLE_COMPLEX @H5_SIZEOF_DOUBLE_COMPLEX@
|
||||
|
||||
/* The size of `float', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_FLOAT @H5_SIZEOF_FLOAT@
|
||||
|
||||
/* The size of `float _Complex', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_FLOAT_COMPLEX @H5_SIZEOF_FLOAT_COMPLEX@
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_INT @H5_SIZEOF_INT@
|
||||
|
||||
@ -501,6 +513,9 @@
|
||||
/* The size of `long double', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@
|
||||
|
||||
/* The size of `long double _Complex', as computed by sizeof. */
|
||||
#cmakedefine H5_SIZEOF_LONG_DOUBLE_COMPLEX @H5_SIZEOF_LONG_DOUBLE_COMPLEX@
|
||||
|
||||
#else
|
||||
|
||||
/* On Apple, to support Universal Binaries (where multiple CPU
|
||||
@ -520,10 +535,13 @@
|
||||
|
||||
# if defined(__i386__) || defined(__x86_64__)
|
||||
#define H5_SIZEOF_LONG_DOUBLE 16
|
||||
#define H5_SIZEOF_LONG_DOUBLE_COMPLEX 32
|
||||
# elif defined(__aarch64__)
|
||||
#define H5_SIZEOF_LONG_DOUBLE 8
|
||||
#define H5_SIZEOF_LONG_DOUBLE_COMPLEX 16
|
||||
# else
|
||||
#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@
|
||||
#cmakedefine H5_SIZEOF_LONG_DOUBLE_COMPLEX @H5_SIZEOF_LONG_DOUBLE_COMPLEX@
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@ -128,3 +128,65 @@ main(void)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDC_NO_COMPLEX
|
||||
#ifndef __STDC_NO_COMPLEX__
|
||||
#error "__STDC_NO_COMPLEX__ not defined"
|
||||
#else
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMPLEX_NUMBERS
|
||||
#include <complex.h>
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__llvm__) && !defined(__INTEL_LLVM_COMPILER)
|
||||
|
||||
typedef _Fcomplex H5_float_complex;
|
||||
typedef _Dcomplex H5_double_complex;
|
||||
typedef _Lcomplex H5_ldouble_complex;
|
||||
#define H5_make_fcomplex _FCbuild
|
||||
#define H5_make_dcomplex _Cbuild
|
||||
#define H5_make_lcomplex _LCbuild
|
||||
|
||||
#else
|
||||
|
||||
typedef float _Complex H5_float_complex;
|
||||
typedef double _Complex H5_double_complex;
|
||||
typedef long double _Complex H5_ldouble_complex;
|
||||
static float _Complex
|
||||
H5_make_fcomplex(float real, float imaginary)
|
||||
{
|
||||
return real + imaginary * (float _Complex)_Complex_I;
|
||||
}
|
||||
static double _Complex
|
||||
H5_make_dcomplex(double real, double imaginary)
|
||||
{
|
||||
return real + imaginary * (double _Complex)_Complex_I;
|
||||
}
|
||||
static long double _Complex
|
||||
H5_make_lcomplex(long double real, long double imaginary)
|
||||
{
|
||||
return real + imaginary * (long double _Complex)_Complex_I;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
H5_float_complex z1 = H5_make_fcomplex(1.0f, 1.0f);
|
||||
H5_double_complex z2 = H5_make_dcomplex(2.0, 4.0);
|
||||
H5_ldouble_complex z3 = H5_make_lcomplex(3.0L, 5.0L);
|
||||
float r1 = crealf(z1);
|
||||
float i1 = cimagf(z1);
|
||||
double r2 = creal(z2);
|
||||
double i2 = cimag(z2);
|
||||
long double r3 = creall(z3);
|
||||
long double i3 = cimagl(z3);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
52
configure.ac
52
configure.ac
@ -574,6 +574,58 @@ AC_CHECK_SIZEOF([float])
|
||||
AC_CHECK_SIZEOF([double])
|
||||
AC_CHECK_SIZEOF([long double])
|
||||
|
||||
## ----------------------------------------------------------------------
|
||||
## Check if complex number support is available
|
||||
##
|
||||
HAVE_COMPLEX_NUMBERS="no"
|
||||
AC_CHECK_SIZEOF([float complex], [], [#include <complex.h>])
|
||||
AC_CHECK_SIZEOF([double complex], [], [#include <complex.h>])
|
||||
AC_CHECK_SIZEOF([long double complex], [], [#include <complex.h>])
|
||||
|
||||
if test "$ac_cv_sizeof_float_complex" != 0 &&
|
||||
test "$ac_cv_sizeof_double_complex" != 0 &&
|
||||
test "$ac_cv_sizeof_long_double_complex" != 0; then
|
||||
# Check if __STDC_NO_COMPLEX__ macro is defined, in which case complex number
|
||||
# support is not available
|
||||
AC_MSG_CHECKING([if __STDC_NO_COMPLEX__ is defined])
|
||||
TEST_SRC="`(echo \"#define HAVE_STDC_NO_COMPLEX 1\"; cat $srcdir/config/cmake/HDFTests.c)`"
|
||||
AC_CACHE_VAL([hdf5_cv_have_stdc_no_complex],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([$TEST_SRC])],
|
||||
[hdf5_cv_have_stdc_no_complex=yes],
|
||||
[hdf5_cv_have_stdc_no_complex=no],
|
||||
[hdf5_cv_have_stdc_no_complex=maybe])])
|
||||
AC_MSG_RESULT(${hdf5_cv_have_stdc_no_complex})
|
||||
|
||||
if test "X$hdf5_cv_have_stdc_no_complex" == "Xno"; then
|
||||
# Compile simple test program with complex numbers
|
||||
AC_MSG_CHECKING([if complex number test program can be compiled and linked])
|
||||
TEST_SRC="`(echo \"#define HAVE_COMPLEX_NUMBERS 1\"; cat $srcdir/config/cmake/HDFTests.c)`"
|
||||
AC_CACHE_VAL([hdf5_cv_have_complex_numbers],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([$TEST_SRC])],
|
||||
[hdf5_cv_have_complex_numbers=yes],
|
||||
[hdf5_cv_have_complex_numbers=no],
|
||||
[hdf5_cv_have_complex_numbers=maybe])])
|
||||
AC_MSG_RESULT(${hdf5_cv_have_complex_numbers})
|
||||
|
||||
if test "X$hdf5_cv_have_complex_numbers" == "Xyes"; then
|
||||
HAVE_COMPLEX_NUMBERS="yes"
|
||||
|
||||
# Define HAVE_COMPLEX_NUMBERS macro for H5pubconf.h.
|
||||
AC_DEFINE([HAVE_COMPLEX_NUMBERS], [1], [Determine if complex number support is available])
|
||||
AC_DEFINE([HAVE_C99_COMPLEX_NUMBERS], [1], [Determine if C99 complex number types are present])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Define HAVE_COMPLEX_NUMBERS value to substitute into other files for conditional testing
|
||||
AC_SUBST([HAVE_COMPLEX_NUMBERS])
|
||||
AC_SUBST([HAVE_C99_COMPLEX_NUMBERS])
|
||||
|
||||
AC_MSG_CHECKING([if complex number support is available])
|
||||
AC_MSG_RESULT([$HAVE_COMPLEX_NUMBERS])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for enabling/disabling support for non-standard features, datatypes,
|
||||
# etc. These features should still be checked for at configure time, but these
|
||||
|
@ -377,7 +377,7 @@ ALIASES += ref_rfc20040811="<a href=\"https://\RFCURL/text-dtype.htm.pdf\">Conve
|
||||
|
||||
ALIASES += click4more="(Click on a enumerator, field, or type for more information.)"
|
||||
ALIASES += csets="<table><tr><td>#H5T_CSET_ASCII</td><td>US ASCII</td></tr><tr><td>#H5T_CSET_UTF8</td><td>UTF-8 Unicode encoding</td></tr></table>"
|
||||
ALIASES += datatype_class=" \li #H5T_INTEGER \li #H5T_FLOAT \li #H5T_STRING \li #H5T_BITFIELD \li #H5T_OPAQUE \li #H5T_COMPOUND \li #H5T_REFERENCE \li #H5T_ENUM \li #H5T_VLEN \li #H5T_ARRAY"
|
||||
ALIASES += datatype_class=" \li #H5T_INTEGER \li #H5T_FLOAT \li #H5T_STRING \li #H5T_BITFIELD \li #H5T_OPAQUE \li #H5T_COMPOUND \li #H5T_REFERENCE \li #H5T_ENUM \li #H5T_VLEN \li #H5T_ARRAY \li #H5T_COMPLEX"
|
||||
ALIASES += file_access="<table><tr><td>#H5F_ACC_RDWR</td><td>File was opened with read/write access.</td></tr><tr><td>#H5F_ACC_RDONLY</td><td>File was opened with read-only access.</td></tr><tr><td>#H5F_ACC_SWMR_WRITE</td><td>File was opened with read/write access for a single-writer/multiple-reader (SWMR) scenario. Note that the writer process must also open the file with the #H5F_ACC_RDWR flag.</td></tr><tr><td>#H5F_ACC_SWMR_READ</td><td>File was opened with read-only access for a single-writer/multiple-reader (SWMR) scenario. Note that the reader process must also open the file with the #H5F_ACC_RDONLY flag.</td></tr></table>"
|
||||
ALIASES += id_types="<table><tr><td>#H5I_FILE</td><td>File</td></tr><tr><td>#H5I_GROUP</td><td>Group</td></tr><tr><td>#H5I_DATATYPE</td><td>Datatype</td></tr><tr><td>#H5I_DATASPACE</td><td>Dataspace</td></tr><tr><td>#H5I_DATASET</td><td>Dataset</td></tr><tr><td>#H5I_ATTR</td><td>Attribute</td></tr></table>"
|
||||
ALIASES += indexes="<table><tr><td>#H5_INDEX_NAME</td><td>Lexicographic order on name</td></tr><tr><td>#H5_INDEX_CRT_ORDER</td><td>Index on creation order</td></tr></table>"
|
||||
|
667
doxygen/dox/DDLBNF200.dox
Normal file
667
doxygen/dox/DDLBNF200.dox
Normal file
@ -0,0 +1,667 @@
|
||||
/** \page DDLBNF200 DDL in BNF for HDF5 2.0.0 and above
|
||||
|
||||
\todo Revise this & break it up!
|
||||
|
||||
\section intro200 Introduction
|
||||
|
||||
This document contains the data description language (DDL) for an HDF5 file. The
|
||||
description is in Backus-Naur Form (BNF).
|
||||
|
||||
\section expo200 Explanation of Symbols
|
||||
|
||||
This section contains a brief explanation of the symbols used in the DDL.
|
||||
|
||||
\code{.unparsed}
|
||||
::= defined as
|
||||
<tname> a token with the name tname
|
||||
<a> | <b> one of <a> or <b>
|
||||
<a>opt zero or one occurrence of <a>
|
||||
<a>* zero or more occurrence of <a>
|
||||
<a>+ one or more occurrence of <a>
|
||||
[0-9] an element in the range between 0 and 9
|
||||
'[' the token within the quotes (used for special characters)
|
||||
TBD To Be Decided
|
||||
\endcode
|
||||
|
||||
\section ddl200 The DDL
|
||||
|
||||
\code{.unparsed}
|
||||
<file> ::= HDF5 <file_name> { <file_super_block>opt <root_group> }
|
||||
|
||||
<file_name> ::= <identifier>
|
||||
|
||||
<file_super_block> ::= SUPER_BLOCK {
|
||||
SUPERBLOCK_VERSION <int_value>
|
||||
FREELIST_VERSION <int_value>
|
||||
SYMBOLTABLE_VERSION <int_value>
|
||||
OBJECTHEADER_VERSION <int_value>
|
||||
OFFSET_SIZE <int_value>
|
||||
LENGTH_SIZE <int_value>
|
||||
BTREE_RANK <int_value>
|
||||
BTREE_LEAF <int_value>
|
||||
ISTORE_K <int_value>
|
||||
<super_block_filespace>
|
||||
USER_BLOCK {
|
||||
USERBLOCK_SIZE <int_value>
|
||||
}
|
||||
}
|
||||
|
||||
<super_block_filespace> ::= FILE_SPACE_STRATEGY <super_block_strategy>
|
||||
FREE_SPACE_PERSIST <boolean_value>
|
||||
FREE_SPACE_SECTION_THRESHOLD <int_value>
|
||||
FILE_SPACE_PAGE_SIZE <int_value>
|
||||
|
||||
<super_block_strategy> ::= H5F_FSPACE_STRATEGY_FSM_AGGR | H5F_FSPACE_STRATEGY_PAGE |
|
||||
H5F_FSPACE_STRATEGY_AGGR | H5F_FSPACE_STRATEGY_NONE |
|
||||
Unknown strategy
|
||||
|
||||
<root_group> ::= GROUP "/" {
|
||||
<anon_named_datatype>*
|
||||
<object_id>opt
|
||||
<group_comment>opt
|
||||
<group_attribute>*
|
||||
<group_member>*
|
||||
}
|
||||
|
||||
<datatype> ::= <atomic_type> | <compound_type> | <variable_length_type> | <array_type> |
|
||||
<complex_type>
|
||||
|
||||
<anon_named_datatype> ::= DATATYPE <anon_named_type_name> {
|
||||
<datatype>
|
||||
}
|
||||
|
||||
<anon_named_type_name> ::= the assigned name for anonymous named type is
|
||||
in the form of #oid, where oid is the object id
|
||||
of the type
|
||||
|
||||
<atomic_type> ::= <integer> | <float> | <time> | <string> |
|
||||
<bitfield> | <opaque> | <reference> | <enum>
|
||||
|
||||
<boolean_value> ::= FALSE | TRUE
|
||||
|
||||
<integer> ::= H5T_STD_I8BE | H5T_STD_I8LE |
|
||||
H5T_STD_I16BE | H5T_STD_I16LE |
|
||||
H5T_STD_I32BE | H5T_STD_I32LE |
|
||||
H5T_STD_I64BE | H5T_STD_I64LE |
|
||||
H5T_STD_U8BE | H5T_STD_U8LE |
|
||||
H5T_STD_U16BE | H5T_STD_U16LE |
|
||||
H5T_STD_U32BE | H5T_STD_U32LE |
|
||||
H5T_STD_U64BE | H5T_STD_U64LE |
|
||||
H5T_NATIVE_CHAR | H5T_NATIVE_UCHAR |
|
||||
H5T_NATIVE_SHORT | H5T_NATIVE_USHORT |
|
||||
H5T_NATIVE_INT | H5T_NATIVE_UINT |
|
||||
H5T_NATIVE_LONG | H5T_NATIVE_ULONG |
|
||||
H5T_NATIVE_LLONG | H5T_NATIVE_ULLONG
|
||||
|
||||
<float> ::= H5T_IEEE_F16BE | H5T_IEEE_F16LE |
|
||||
H5T_IEEE_F32BE | H5T_IEEE_F32LE |
|
||||
H5T_IEEE_F64BE | H5T_IEEE_F64LE |
|
||||
H5T_NATIVE_FLOAT16 | H5T_NATIVE_FLOAT |
|
||||
H5T_NATIVE_DOUBLE | H5T_NATIVE_LDOUBLE
|
||||
|
||||
<time> ::= H5T_TIME: not yet implemented
|
||||
|
||||
<string> ::= H5T_STRING {
|
||||
STRSIZE <strsize>;
|
||||
STRPAD <strpad>;
|
||||
CSET <cset>;
|
||||
CTYPE <ctype>;
|
||||
}
|
||||
|
||||
<strsize> ::= <int_value>
|
||||
|
||||
<strpad> ::= H5T_STR_NULLTERM | H5T_STR_NULLPAD | H5T_STR_SPACEPAD
|
||||
|
||||
<cset> ::= H5T_CSET_ASCII | H5T_CSET_UTF8
|
||||
|
||||
<ctype> ::= H5T_C_S1 | H5T_FORTRAN_S1
|
||||
|
||||
<bitfield> ::= H5T_STD_B8BE | H5T_STD_B8LE |
|
||||
H5T_STD_B16BE | H5T_STD_B16LE |
|
||||
H5T_STD_B32BE | H5T_STD_B32LE |
|
||||
H5T_STD_B64BE | H5T_STD_B64LE
|
||||
|
||||
<opaque> ::= H5T_OPAQUE {
|
||||
OPAQUE_TAG <identifier>;
|
||||
OPAQUE_SIZE <int_value>;opt
|
||||
}
|
||||
|
||||
<reference> ::= H5T_REFERENCE { <ref_type> }
|
||||
|
||||
<ref_type> ::= H5T_STD_REF_OBJECT | H5T_STD_REF_DSETREG | H5T_STD_REF | UNDEFINED
|
||||
|
||||
<compound_type> ::= H5T_COMPOUND {
|
||||
<member_type_def>+
|
||||
}
|
||||
|
||||
<member_type_def> ::= <datatype> <field_name>;
|
||||
|
||||
<field_name> ::= <identifier>
|
||||
|
||||
<variable_length_type> ::= H5T_VLEN { <datatype> }
|
||||
|
||||
<array_type> ::= H5T_ARRAY { <dim_sizes> <datatype> }
|
||||
|
||||
<dim_sizes> ::= '['<dimsize>']' | '['<dimsize>']'<dim_sizes>
|
||||
|
||||
<dimsize> ::= <int_value>
|
||||
|
||||
<attribute> ::= ATTRIBUTE <attr_name> {
|
||||
<dataset_type>
|
||||
<dataset_space>
|
||||
<data>opt
|
||||
}
|
||||
|
||||
<attr_name> ::= <identifier>
|
||||
|
||||
<dataset_type> ::= DATATYPE <path_name> | <datatype>
|
||||
|
||||
<enum> ::= H5T_ENUM {
|
||||
<enum_base_type> <enum_def>+
|
||||
}
|
||||
|
||||
<enum_base_type> ::= <integer>
|
||||
// Currently enums can only hold integer type data, but they may be expanded
|
||||
// in the future to hold any datatype
|
||||
|
||||
<enum_def> ::= <enum_symbol> <enum_val>;
|
||||
|
||||
<enum_symbol> ::= <identifier>
|
||||
|
||||
<enum_val> ::= <int_value>
|
||||
|
||||
<complex_type> ::= H5T_COMPLEX { <complex_base_type> <complex_base_type> } |
|
||||
H5T_COMPLEX_IEEE_F16BE | H5T_COMPLEX_IEEE_F16LE |
|
||||
H5T_COMPLEX_IEEE_F32BE | H5T_COMPLEX_IEEE_F32LE |
|
||||
H5T_COMPLEX_IEEE_F64BE | H5T_COMPLEX_IEEE_F64LE |
|
||||
H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_DOUBLE_COMPLEX |
|
||||
H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
|
||||
<complex_base_type> ::= <float>
|
||||
// Currently complex number datatypes can only hold homogeneous floating-point
|
||||
// type data, but they may be expanded in the future to hold heterogeneous
|
||||
// floating-point type data or even non-floating-point type data
|
||||
|
||||
<path_name> ::= <path_part>+
|
||||
|
||||
<path_part> ::= /<identifier>
|
||||
|
||||
<dataspace> ::= <scalar_space> | <simple_space> | <complex_space> | <null_space>
|
||||
|
||||
<null_space> ::= NULL
|
||||
|
||||
<scalar_space> ::= SCALAR
|
||||
|
||||
<simple_space> ::= SIMPLE { <current_dims> / <max_dims> }
|
||||
|
||||
<complex_space> ::= COMPLEX { <complex_space_definition> }
|
||||
|
||||
<dataset_space> ::= DATASPACE <path_name> | <dataspace>
|
||||
|
||||
<current_dims> ::= <dims>
|
||||
|
||||
<max_dims> ::= '(' <max_dim_list> ')'
|
||||
|
||||
<max_dim_list> ::= <max_dim> | <max_dim>, <max_dim_list>
|
||||
|
||||
<max_dim> ::= <int_value> | H5S_UNLIMITED
|
||||
|
||||
<data> ::= <subset> | <data_values>
|
||||
|
||||
<data_values> ::= DATA {
|
||||
<scalar_space_data> | <simple_space_data>
|
||||
}
|
||||
|
||||
<scalar_space_data> ::= <any_element>
|
||||
|
||||
<any_element> ::= <atomic_element> | <compound_element> |
|
||||
<variable_length_element> | <array_element>
|
||||
|
||||
<any_data_seq> ::= <any_element> | <any_element>, <any_data_seq>
|
||||
|
||||
<atomic_element> :: = <integer_data> | <float_data> | <time_data> |
|
||||
<string_data> | <bitfield_data> | <opaque_data> |
|
||||
<enum_data> | <reference_data>
|
||||
|
||||
<subset> ::= SUBSET {
|
||||
<start>;
|
||||
<stride>;
|
||||
<count>;
|
||||
<block>;
|
||||
DATA {
|
||||
<simple_space_data>
|
||||
}
|
||||
}
|
||||
|
||||
<start> ::= START (<coor_list>)
|
||||
|
||||
<stride> ::= STRIDE (<pos_list>)
|
||||
|
||||
<count> ::= COUNT (<max_dim_list>)
|
||||
|
||||
<block> ::= BLOCK (<max_dim_list>)
|
||||
|
||||
<coor_list> ::= <coor_data>, <coor_list> | <coor_data>
|
||||
|
||||
<coor_data> ::= <integer_data> | H5S_UNLIMITED
|
||||
|
||||
<integer_data> ::= <int_value>
|
||||
|
||||
<float_data> ::= a floating point number
|
||||
|
||||
<time_data> ::= DATA{ not yet implemented.}
|
||||
|
||||
<string_data> ::= a string
|
||||
// A string is enclosed in double quotes.
|
||||
// If a string is displayed on more than one line, string concatenate
|
||||
// operator '//'is used.
|
||||
|
||||
<bitfield_data> ::= <hex_value>
|
||||
|
||||
<opaque_data> ::= <hex_value>:<hex_value> | <hex_value>
|
||||
|
||||
<enum_data> ::= <enum_symbol>
|
||||
|
||||
<reference_data> ::= <object_ref_data> | <data_region_data> | <attribute_data> | NULL
|
||||
|
||||
<object_ref_data> ::= <object_type> <object_ref>
|
||||
|
||||
<object_type> ::= ATTRIBUTE | DATASET | GROUP | DATATYPE
|
||||
|
||||
<object_ref> ::= <object_id>
|
||||
|
||||
<object_id> ::= <path_name> | OBJECTID { <object_num> }
|
||||
|
||||
<object_num> ::= <int_value>:<int_value> | <int_value>
|
||||
|
||||
<attribute_data> ::= ATTRIBUTE <attr_name>opt
|
||||
<data>opt
|
||||
|
||||
<data_region_data> ::= DATASET <dataset_name> {
|
||||
<data_region_type>opt <data_region_data_list>
|
||||
<dataset_type>opt <dataset_space>opt
|
||||
<data>opt
|
||||
}
|
||||
|
||||
<data_region_type> ::= REGION_TYPE <data_region_data_type>
|
||||
|
||||
<data_region_data_type> ::= POINT | BLOCK
|
||||
|
||||
<data_region_data_list> ::= <data_region_data_info>, <data_region_data_list> |
|
||||
<data_region_data_info>
|
||||
|
||||
<data_region_data_info> ::= <region_info> | <point_info>
|
||||
|
||||
<region_info> ::= (<lower_region_vals>)-(<upper_region_vals>)
|
||||
|
||||
<lower_region_vals> ::= <lower_bound>, <lower_region_vals> | <lower_bound>
|
||||
|
||||
<upper_region_vals> ::= <upper_bound>, <upper_region_vals> | <upper_bound>
|
||||
|
||||
<lower_bound> ::= <int_value>
|
||||
|
||||
<upper_bound> ::= <int_value>
|
||||
|
||||
<point_info> ::= (<point_vals>)
|
||||
|
||||
<point_vals> ::= <int_value> | <int_value>, <point_vals>
|
||||
|
||||
<compound_element> ::= { <any_data_seq> }
|
||||
|
||||
<atomic_simple_data> :: = <atomic_element>, <atomic_simple_data> |
|
||||
<atomic_element>
|
||||
|
||||
<simple_space_data> :: = <any_data_seq>
|
||||
|
||||
<variable_length_element> ::= ( <any_data_seq> )
|
||||
|
||||
<array_element> ::= '[' <any_data_seq> ']'
|
||||
|
||||
<named_datatype> ::= DATATYPE <type_name> { <datatype> }
|
||||
|
||||
<type_name> ::= <identifier>
|
||||
|
||||
<hardlink> ::= HARDLINK <path_name>
|
||||
|
||||
<group> ::= GROUP <group_name> { <hardlink> | <group_info> }
|
||||
|
||||
<group_comment> ::= COMMENT <string_data>
|
||||
|
||||
<group_name> ::= <identifier>
|
||||
|
||||
<group_info> ::= <object_id>opt <group_comment>opt <group_attribute>*
|
||||
<group_member>*
|
||||
|
||||
<group_attribute> ::= <attribute>
|
||||
|
||||
<group_member> ::= <named_datatype> | <group> | <dataset> |
|
||||
<softlink> | <external_link>
|
||||
|
||||
<dataset> ::= DATASET <dataset_name> { <hardlink> | <dataset_info> }
|
||||
|
||||
<dataset_info> ::= <dataset_type>
|
||||
<dataset_space>
|
||||
<dcpl_info>opt
|
||||
<dataset_attribute>* <object_id>opt
|
||||
<data>opt
|
||||
// Tokens above can be in any order as long as <data> is
|
||||
// after <dataset_type> and <dataset_space>.
|
||||
|
||||
<dcpl_info> ::= <storagelayout>
|
||||
<compression_filters>
|
||||
<fillvalue>
|
||||
<allocationtime>
|
||||
|
||||
<dataset_name> ::= <identifier>
|
||||
|
||||
<storagelayout> :: = STORAGE_LAYOUT {
|
||||
<contiguous_layout> | <chunked_layout> |
|
||||
<compact_layout> | <virtual_layout>
|
||||
}
|
||||
|
||||
<contiguous_layout> ::= CONTIGUOUS
|
||||
<internal_layout> | <external_layout>
|
||||
|
||||
<chunked_layout> ::= CHUNKED <dims>
|
||||
<filter_ratio>opt
|
||||
|
||||
<compact_layout> ::= COMPACT
|
||||
<size>
|
||||
|
||||
<internal_layout> ::= <size>
|
||||
<offset>
|
||||
|
||||
<external_layout> ::= EXTERNAL {
|
||||
<external_file>+
|
||||
}
|
||||
|
||||
<virtual_layout> ::= <vmaps>*opt
|
||||
|
||||
<vmaps> ::= MAPPING <int_value> {
|
||||
<virtual_map>
|
||||
<source_map>
|
||||
}
|
||||
|
||||
<virtual_map> ::= VIRTUAL {
|
||||
<vmaps_selection>
|
||||
}
|
||||
|
||||
<source_map> ::= SOURCE {
|
||||
FILE <file_name>
|
||||
DATASET <dataset_name>
|
||||
<vmaps_selection>
|
||||
}
|
||||
|
||||
<vmaps_selection> ::= <regular_hyperslab> | <irregular_hyperslab> |
|
||||
<select_points> | <select_none> | <select_all>
|
||||
|
||||
<regular_hyperslab> ::= SELECTION REGULAR_HYPERSLAB {
|
||||
<start>
|
||||
<stride>
|
||||
<count>
|
||||
<block>
|
||||
}
|
||||
|
||||
<irregular_hyperslab> ::= SELECTION IRREGULAR_HYPERSLAB {
|
||||
<region_info>+
|
||||
}
|
||||
|
||||
<select_points> ::= SELECTION POINT {
|
||||
(<coor_list>)+
|
||||
}
|
||||
|
||||
<select_none> ::= SELECTION NONE
|
||||
|
||||
<select_all> ::= SELECTION ALL
|
||||
|
||||
<dims> ::= (<dims_values>)
|
||||
|
||||
<dims_values> ::= <int_value> | <int_value>, <dims_values>
|
||||
|
||||
<external_file> ::= FILENAME <file_name> <size> <offset>
|
||||
|
||||
<offset> ::= OFFSET <int_value>
|
||||
|
||||
<size> ::= SIZE <int_value>
|
||||
|
||||
<filter_ratio> ::= <size> | <compressionratio>
|
||||
|
||||
<compressionratio> :: = <size> (<float_data>:1 COMPRESSION)
|
||||
|
||||
<compression_filters> :: = FILTERS {
|
||||
<filter_type>+ | NONE
|
||||
}
|
||||
|
||||
<filter_type> :: = <filter_deflate> | <filter_shuffle> |
|
||||
<filter_flecther> | <filter_szip> |
|
||||
<filter_nbit> | <filter_scaleoffset> |
|
||||
<filter_default>
|
||||
|
||||
<filter_default> :: = <filter_user> {
|
||||
FILTER_ID <int_value>
|
||||
<filter_comment>opt
|
||||
<filter_params>opt
|
||||
}
|
||||
|
||||
<filter_user> :: = USER_DEFINED_FILTER
|
||||
|
||||
<filter_deflate> :: = COMPRESSION DEFLATE { LEVEL <int_value> }
|
||||
|
||||
<filter_shuffle> :: = PREPROCESSING SHUFFLE
|
||||
|
||||
<filter_flecther> :: = CHECKSUM FLETCHER32
|
||||
|
||||
<filter_szip> :: = COMPRESSION SZIP {
|
||||
PIXELS_PER_BLOCK <int_value>
|
||||
<filter_szip_mode>opt
|
||||
<filter_szip_coding>opt
|
||||
<filter_szip_order>opt
|
||||
<filter_szip_header>opt
|
||||
}
|
||||
|
||||
<filter_szip_mode> :: = MODE HARDWARE | K13
|
||||
|
||||
<filter_szip_coding> :: = CODING ENTROPY | NEAREST NEIGHBOUR
|
||||
|
||||
<filter_szip_order> :: = BYTE_ORDER LSB | MSB
|
||||
|
||||
<filter_szip_header> :: = HEADER RAW
|
||||
|
||||
<filter_nbit> :: = CHECKSUM NBIT
|
||||
|
||||
<filter_scaleoffset> :: = COMPRESSION SCALEOFFSET { MIN BITS <int_value> }
|
||||
|
||||
<filter_comment> :: = COMMENT <identifier>
|
||||
|
||||
<filter_params> :: = PARAMS { <int_value>* }
|
||||
|
||||
<fillvalue> ::= FILLVALUE {
|
||||
FILL_TIME H5D_FILL_TIME_ALLOC | H5D_FILL_TIME_NEVER | H5D_FILL_TIME_IFSET
|
||||
VALUE H5D_FILL_VALUE_UNDEFINED | H5D_FILL_VALUE_DEFAULT | <any_element>
|
||||
}
|
||||
|
||||
<allocationtime> ::= ALLOCATION_TIME {
|
||||
H5D_ALLOC_TIME_EARLY | H5D_ALLOC_TIME_INCR |
|
||||
H5D_ALLOC_TIME_LATE
|
||||
}
|
||||
|
||||
<dataset_attribute> ::= <attribute>
|
||||
|
||||
<softlink> ::= SOFTLINK <softlink_name> {
|
||||
LINKTARGET <target>
|
||||
}
|
||||
|
||||
<softlink_name> ::= <identifier>
|
||||
|
||||
<target> ::= <identifier>
|
||||
|
||||
<external_link> ::= EXTERNAL_LINK <external_link_name> {
|
||||
TARGETFILE <targetfile>
|
||||
TARGETPATH <targetpath> <targetobj>opt
|
||||
}
|
||||
|
||||
<external_link_name> ::= <identifier>
|
||||
|
||||
<user_defined_link> ::= USERDEFINED_LINK <external_link_name> {
|
||||
LINKCLASS <user_link_type>
|
||||
}
|
||||
|
||||
<user_link_type> ::= <int_value>
|
||||
|
||||
<targetfile> ::= <file_name>
|
||||
|
||||
<targetpath> ::= <identifier>
|
||||
|
||||
<targetobj> ::= <named_datatype> | <group> | <dataset>
|
||||
|
||||
<identifier> ::= "a string"
|
||||
// character '/' should be used with care.
|
||||
|
||||
<pos_list> ::= <pos_int>, <pos_list> | <pos_int>
|
||||
|
||||
<int_value> ::= 0 | <pos_int>
|
||||
|
||||
<pos_int> ::= [1-9][0-9]*
|
||||
|
||||
<hex_value> ::= 0x[0-F][0-F]+ | [0-F][0-F]+
|
||||
\endcode
|
||||
|
||||
\section example200 An Example of an HDF5 File in DDL
|
||||
|
||||
\code{.unparsed}
|
||||
HDF5 "example.h5" {
|
||||
GROUP "/" {
|
||||
ATTRIBUTE "attr1" {
|
||||
DATATYPE H5T_STRING {
|
||||
STRSIZE 17;
|
||||
STRPAD H5T_STR_NULLTERM;
|
||||
CSET H5T_CSET_ASCII;
|
||||
CTYPE H5T_C_S1;
|
||||
}
|
||||
DATASPACE SCALAR
|
||||
DATA {
|
||||
"string attribute"
|
||||
}
|
||||
}
|
||||
DATASET "dset1" {
|
||||
DATATYPE H5T_STD_I32BE
|
||||
DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
|
||||
DATA {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
|
||||
}
|
||||
}
|
||||
DATASET "dset2" {
|
||||
DATATYPE H5T_COMPOUND {
|
||||
H5T_STD_I32BE "a";
|
||||
H5T_IEEE_F32BE "b";
|
||||
H5T_IEEE_F64BE "c";
|
||||
}
|
||||
DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
|
||||
DATA {
|
||||
{
|
||||
1,
|
||||
0.1,
|
||||
0.01
|
||||
},
|
||||
{
|
||||
2,
|
||||
0.2,
|
||||
0.02
|
||||
},
|
||||
{
|
||||
3,
|
||||
0.3,
|
||||
0.03
|
||||
},
|
||||
{
|
||||
4,
|
||||
0.4,
|
||||
0.04
|
||||
},
|
||||
{
|
||||
5,
|
||||
0.5,
|
||||
0.05
|
||||
}
|
||||
}
|
||||
}
|
||||
GROUP "group1" {
|
||||
COMMENT "This is a comment for group1";
|
||||
DATASET "dset3" {
|
||||
DATATYPE "/type1"
|
||||
DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
|
||||
DATA {
|
||||
{
|
||||
[ 0, 1, 2, 3 ],
|
||||
[ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
|
||||
0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
|
||||
0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
|
||||
0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
{
|
||||
[ 0, 1, 2, 3 ],
|
||||
[ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
|
||||
0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
|
||||
0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
|
||||
0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
{
|
||||
[ 0, 1, 2, 3 ],
|
||||
[ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
|
||||
0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
|
||||
0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
|
||||
0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
{
|
||||
[ 0, 1, 2, 3 ],
|
||||
[ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
|
||||
0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
|
||||
0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
|
||||
0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
{
|
||||
[ 0, 1, 2, 3 ],
|
||||
[ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
|
||||
0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
|
||||
0.3, 0.3, 0.3, 0.3, 0.3, 0.3,
|
||||
0.4, 0.4, 0.4, 0.4, 0.4, 0.4,
|
||||
0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DATASET "dset3" {
|
||||
DATATYPE H5T_VLEN { H5T_STD_I32LE }
|
||||
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
|
||||
DATA {
|
||||
(0), (10, 11), (20, 21, 22), (30, 31, 32, 33)
|
||||
}
|
||||
}
|
||||
GROUP "group2" {
|
||||
HARDLINK "/group1"
|
||||
}
|
||||
SOFTLINK "slink1" {
|
||||
LINKTARGET "somevalue"
|
||||
}
|
||||
DATATYPE "type1" H5T_COMPOUND {
|
||||
H5T_ARRAY { [4] H5T_STD_I32BE } "a";
|
||||
H5T_ARRAY { [5][6] H5T_IEEE_F32BE } "b";
|
||||
}
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
*/
|
@ -204,7 +204,7 @@ Useful tools for working with HDF5 files include:
|
||||
\li HDFView: A java browser to view HDF (HDF4 and HDF5) files
|
||||
|
||||
<h4>h5dump</h4>
|
||||
The h5dump utility displays the contents of an HDF5 file in Data Description Language (\ref DDLBNF114).
|
||||
The h5dump utility displays the contents of an HDF5 file in Data Description Language (\ref DDLBNF200).
|
||||
Below is an example of h5dump output for an HDF5 file that contains no objects:
|
||||
\code
|
||||
$ h5dump file.h5
|
||||
|
@ -366,7 +366,7 @@ inadvertently left open. A File Access property controls how the file is closed.
|
||||
The HDF Group has developed tools for examining the contents of HDF5 files. The tool used throughout the HDF5 tutorial
|
||||
is the HDF5 dumper, <code style="background-color:whitesmoke;">h5dump</code>, which displays the file contents in human-readable form. The output of <code style="background-color:whitesmoke;">h5dump</code> is an ASCII
|
||||
display formatted according to the HDF5 DDL grammar. This grammar is defined, using Backus-Naur Form, in the
|
||||
\ref DDLBNF114.
|
||||
\ref DDLBNF200.
|
||||
|
||||
To view the HDF5 file contents, simply type:
|
||||
\code
|
||||
@ -394,7 +394,7 @@ HDF5 "file.h5" {
|
||||
|
||||
\subsection subsecLBFileExampleDDL File Definition in DDL
|
||||
The simplified DDL file definition for creating an HDF5 file. For simplicity, a simplified DDL is used in this tutorial. A
|
||||
complete and more rigorous DDL can be found in the \ref DDLBNF114.
|
||||
complete and more rigorous DDL can be found in the \ref DDLBNF200.
|
||||
|
||||
The following symbol definitions are used in the DDL:
|
||||
\code
|
||||
|
@ -6,6 +6,10 @@
|
||||
* <div>
|
||||
* \snippet{doc} tables/predefinedDatatypes.dox predefined_ieee_datatypes_table
|
||||
* </div>
|
||||
*
|
||||
* <div>
|
||||
* \snippet{doc} tables/predefinedDatatypes.dox predefined_complex_datatypes_table
|
||||
* </div>
|
||||
*
|
||||
* <div>
|
||||
* \snippet{doc} tables/predefinedDatatypes.dox predefined_std_datatypes_table
|
||||
|
@ -5,6 +5,7 @@
|
||||
\li \ref DDLBNF110
|
||||
\li \ref DDLBNF112
|
||||
\li \ref DDLBNF114
|
||||
\li \ref DDLBNF200
|
||||
|
||||
\section File Format
|
||||
|
||||
|
@ -476,6 +476,16 @@
|
||||
and do not represent any values or padding in the file.
|
||||
</p>
|
||||
|
||||
<a name="ChangesForHdf5_2_0">
|
||||
<h3>I.B. Changes for HDF5 2.0</h3></a>
|
||||
<p>The following sections have been
|
||||
changed or added for the 2.0 release:</p>
|
||||
<ul>
|
||||
<li>Under <a href="#DatatypeMessage">“The Datatype Message”</a>,
|
||||
in the Description for “Fields:Datatype Message”,
|
||||
version 5 was added, as well as the new Complex class (11).</li>
|
||||
</ul>
|
||||
|
||||
<a name="ChangesForHdf5_1_12">
|
||||
<h3>I.B. Changes for HDF5 1.12</h3></a>
|
||||
<p>The following sections have been
|
||||
@ -9685,6 +9695,11 @@ within the embedded dataspace]<br />
|
||||
<td>Used to encode the revised reference datatype.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><code>5</code></td>
|
||||
<td>Used when a complex number datatype needs to be encoded.
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
<p>The class of the datatype determines the format for the class
|
||||
@ -9752,6 +9767,11 @@ within the embedded dataspace]<br />
|
||||
<td align="center"><code>10</code></td>
|
||||
<td><a href="#ClassArray">Array</a></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><code>11</code></td>
|
||||
<td><a href="#ClassComplex">Complex</a></td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
</td>
|
||||
@ -11525,6 +11545,119 @@ within the embedded dataspace]<br />
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<a name="ClassComplex"></a>
|
||||
<p>Class specific information for the Complex class (Class 11):</p>
|
||||
|
||||
<div align="center">
|
||||
<table class="desc">
|
||||
<caption>
|
||||
Bits: Complex Bit Field Description
|
||||
</caption>
|
||||
|
||||
<tr>
|
||||
<th width="10%">Bits</th>
|
||||
<th>Meaning</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><p>0</p></td>
|
||||
<td><p><b>Homogeneous.</b> If zero, each part of the complex number
|
||||
datatype is a different floating point datatype (heterogeneous).
|
||||
Otherwise, each part of the complex number datatype is the same
|
||||
floating point datatype (homogeneous). Currently, only homogeneous
|
||||
complex number datatypes are supported.</p></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><p>1,2</p></td>
|
||||
<td><p><b>Complex number form.</b> This two-bit value contains the type of
|
||||
complex number datatype described. The values defined are:
|
||||
|
||||
<table class="list">
|
||||
<tr>
|
||||
<th width="20%" align="center">Value</th>
|
||||
<th width="80%" align="left">Description</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><code>0</code></td>
|
||||
<td>Rectangular
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><code>1</code></td>
|
||||
<td>Polar
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><code>2</code></td>
|
||||
<td>Exponential
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><code>3</code></td>
|
||||
<td>Reserved
|
||||
</td>
|
||||
</tr>
|
||||
</table></p>
|
||||
|
||||
<p>Currently, only rectangular complex number datatypes are supported.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><p>3-23</p></td>
|
||||
<td><p>Reserved (zero).</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div align="center">
|
||||
<table class="format">
|
||||
<caption>
|
||||
Layout: Complex Property Description
|
||||
</caption>
|
||||
|
||||
<tr>
|
||||
<th width="25%">Byte</th>
|
||||
<th width="25%">Byte</th>
|
||||
<th width="25%">Byte</th>
|
||||
<th width="25%">Byte</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4"><br />Parent Type Message<br /><br /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div align="center">
|
||||
<table class="desc">
|
||||
<caption>
|
||||
Fields: Complex Property Description
|
||||
</caption>
|
||||
<tr>
|
||||
<th width="10%">Field Name</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><p>Parent Type Message</p></td>
|
||||
<td>
|
||||
<p>Each complex number type is based on a parent floating point type.
|
||||
This field contains the datatype message describing that parent type.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<h4><a name="OldFillValueMessage">IV.A.2.e. The Data Storage -
|
||||
|
@ -35,6 +35,41 @@
|
||||
//! [predefined_ieee_datatypes_table]
|
||||
*
|
||||
*
|
||||
//! [predefined_complex_datatypes_table]
|
||||
<table>
|
||||
<caption>Predefined Complex Number Datatypes</caption>
|
||||
<tr>
|
||||
<th>Datatype</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_COMPLEX_IEEE_F16BE</td>
|
||||
<td>Complex number of 2 16-bit big-endian IEEE floating point numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_COMPLEX_IEEE_F16LE</td>
|
||||
<td>Complex number of 2 16-bit little-endian IEEE floating point numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_COMPLEX_IEEE_F32BE</td>
|
||||
<td>Complex number of 2 32-bit big-endian IEEE floating point numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_COMPLEX_IEEE_F32LE</td>
|
||||
<td>Complex number of 2 32-bit little-endian IEEE floating point numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_COMPLEX_IEEE_F64BE</td>
|
||||
<td>Complex number of 2 64-bit big-endian IEEE floating point numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_COMPLEX_IEEE_F64LE</td>
|
||||
<td>Complex number of 2 64-bit little-endian IEEE floating point numbers</td>
|
||||
</tr>
|
||||
</table>
|
||||
//! [predefined_complex_datatypes_table]
|
||||
*
|
||||
*
|
||||
//! [predefined_std_datatypes_table]
|
||||
<table>
|
||||
<caption>Predefined Standard Datatypes</caption>
|
||||
@ -489,6 +524,18 @@
|
||||
<td>C-style long double</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_NATIVE_FLOAT_COMPLEX</td>
|
||||
<td>C-style float _Complex (MSVC _Fcomplex) (May be H5I_INVALID_HID if platform doesn't support float _Complex / _Fcomplex type)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_NATIVE_DOUBLE_COMPLEX</td>
|
||||
<td>C-style double _Complex (MSVC _Dcomplex) (May be H5I_INVALID_HID if platform doesn't support double _Complex / _Dcomplex type)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_NATIVE_LDOUBLE_COMPLEX</td>
|
||||
<td>C-style long double _Complex (MSVC _Lcomplex) (May be H5I_INVALID_HID if platform doesn't support long double _Complex / _Lcomplex type)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>#H5T_NATIVE_B8</td>
|
||||
<td>8-bit bitfield based on native types</td>
|
||||
</tr>
|
||||
|
@ -212,11 +212,12 @@ h5tequal_c(hid_t_f *type1_id, hid_t_f *type2_id, int_f *c_flag)
|
||||
* H5T_STRING_F (3)
|
||||
* H5T_BITFIELD_F (4)
|
||||
* H5T_OPAQUE_F (5)
|
||||
* H5T_COMPOUNDF (6)
|
||||
* H5T_COMPOUND_F (6)
|
||||
* H5T_REFERENCE_F (7)
|
||||
* H5T_ENUM_F (8)
|
||||
* H5T_VLEN_F (9)
|
||||
* H5T_ARRAY_F (10)
|
||||
* H5T_COMPLEX_F (11)
|
||||
* RETURNS
|
||||
* 0 on success, -1 on failure
|
||||
* SOURCE
|
||||
@ -239,17 +240,7 @@ h5tget_class_c(hid_t_f *type_id, int_f *classtype)
|
||||
return ret_value;
|
||||
}
|
||||
*classtype = c_classtype;
|
||||
/*
|
||||
if (c_classtype == H5T_INTEGER) *classtype = H5T_INTEGER_F;
|
||||
if (c_classtype == H5T_FLOAT) *classtype = H5T_FLOAT_F;
|
||||
if (c_classtype == H5T_TIME) *classtype = H5T_TIME_F;
|
||||
if (c_classtype == H5T_STRING) *classtype = H5T_STRING_F;
|
||||
if (c_classtype == H5T_BITFIELD) *classtype = H5T_BITFIELD_F;
|
||||
if (c_classtype == H5T_OPAQUE) *classtype = H5T_OPAQUE_F;
|
||||
if (c_classtype == H5T_COMPOUND) *classtype = H5T_COMPOUND_F;
|
||||
if (c_classtype == H5T_REFERENCE) *classtype = H5T_REFERENCE_F;
|
||||
if (c_classtype == H5T_ENUM) *classtype = H5T_ENUM_F;
|
||||
*/
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
|
@ -267,6 +267,7 @@ CONTAINS
|
||||
!! \li H5T_ENUM_F
|
||||
!! \li H5T_VLEN_F
|
||||
!! \li H5T_ARRAY_F
|
||||
!! \li H5T_COMPLEX_F
|
||||
!! \param hdferr \fortran_error
|
||||
!!
|
||||
!! See C API: @ref H5Tget_class()
|
||||
@ -1726,9 +1727,9 @@ CONTAINS
|
||||
!!
|
||||
!! \brief Returns datatype class of compound datatype member.
|
||||
!!
|
||||
!! \param type_id Datartpe identifier.
|
||||
!! \param type_id Datatype identifier.
|
||||
!! \param member_no Index of compound datatype member.
|
||||
!! \param class Class type for compound dadtype member. Valid classes:
|
||||
!! \param class Class type for compound datatype member. Valid classes:
|
||||
!! \li H5T_NO_CLASS_F (error)
|
||||
!! \li H5T_INTEGER_F
|
||||
!! \li H5T_FLOAT_F
|
||||
@ -1741,6 +1742,7 @@ CONTAINS
|
||||
!! \li H5T_ENUM_F
|
||||
!! \li H5T_VLEN_F
|
||||
!! \li H5T_ARRAY_F
|
||||
!! \li H5T_COMPLEX_F
|
||||
!! \param hdferr \fortran_error
|
||||
!!
|
||||
!! See C API: @ref H5Tget_member_class()
|
||||
|
@ -848,6 +848,7 @@ h5init_flags_c(int_f *h5d_flags, size_t_f *h5d_size_flags, int_f *h5e_flags, hid
|
||||
h5t_flags[32] = (int_f)H5T_ARRAY;
|
||||
h5t_flags[33] = (int_f)H5T_DIR_ASCEND;
|
||||
h5t_flags[34] = (int_f)H5T_DIR_DESCEND;
|
||||
h5t_flags[35] = (int_f)H5T_COMPLEX;
|
||||
|
||||
/*
|
||||
* H5VL flags
|
||||
|
@ -144,7 +144,7 @@ MODULE H5LIB
|
||||
!
|
||||
! H5T flags declaration
|
||||
!
|
||||
INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35
|
||||
INTEGER, PARAMETER :: H5T_FLAGS_LEN = 36
|
||||
INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags
|
||||
!
|
||||
! H5VL flags declaration
|
||||
@ -705,6 +705,7 @@ CONTAINS
|
||||
H5T_ARRAY_F = H5T_flags(33)
|
||||
H5T_DIR_ASCEND_F = H5T_flags(34)
|
||||
H5T_DIR_DESCEND_F = H5T_flags(35)
|
||||
H5T_COMPLEX_F = H5T_flags(36)
|
||||
!
|
||||
! H5VL flags
|
||||
!
|
||||
|
@ -863,6 +863,7 @@ MODULE H5GLOBAL
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_ENUM_F
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_VLEN_F
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_ARRAY_F
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_COMPLEX_F
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_LE_F
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_BE_F
|
||||
!DEC$ATTRIBUTES DLLEXPORT :: H5T_ORDER_VAX_F
|
||||
@ -901,6 +902,7 @@ MODULE H5GLOBAL
|
||||
INTEGER :: H5T_ENUM_F !< H5T_ENUM
|
||||
INTEGER :: H5T_VLEN_F !< H5T_VLEN
|
||||
INTEGER :: H5T_ARRAY_F !< H5T_ARRAY
|
||||
INTEGER :: H5T_COMPLEX_F !< H5T_COMPLEX
|
||||
INTEGER :: H5T_ORDER_LE_F !< H5T_ORDER_LE
|
||||
INTEGER :: H5T_ORDER_BE_F !< H5T_ORDER_BE
|
||||
INTEGER :: H5T_ORDER_VAX_F !< H5T_ORDER_VAX
|
||||
|
@ -2753,6 +2753,49 @@ next:
|
||||
|
||||
break;
|
||||
}
|
||||
case H5T_COMPLEX: {
|
||||
hid_t super;
|
||||
size_t super_len;
|
||||
char *stmp = NULL;
|
||||
|
||||
/* Print lead-in */
|
||||
snprintf(dt_str, *slen, "H5T_COMPLEX {\n");
|
||||
indent += COL;
|
||||
if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
|
||||
goto out;
|
||||
|
||||
if ((super = H5Tget_super(dtype)) < 0)
|
||||
goto out;
|
||||
if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
|
||||
goto out;
|
||||
stmp = (char *)calloc(super_len, sizeof(char));
|
||||
if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) {
|
||||
free(stmp);
|
||||
goto out;
|
||||
}
|
||||
if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) {
|
||||
free(stmp);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (stmp)
|
||||
free(stmp);
|
||||
stmp = NULL;
|
||||
snprintf(tmp_str, TMP_LEN, "\n");
|
||||
if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
|
||||
goto out;
|
||||
H5Tclose(super);
|
||||
|
||||
/* Print closing */
|
||||
indent -= COL;
|
||||
if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen)))
|
||||
goto out;
|
||||
snprintf(tmp_str, TMP_LEN, "}");
|
||||
if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str)))
|
||||
goto out;
|
||||
|
||||
break;
|
||||
}
|
||||
case H5T_TIME:
|
||||
snprintf(dt_str, *slen, "H5T_TIME: not yet implemented");
|
||||
break;
|
||||
|
@ -645,8 +645,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
|
||||
(yy_hold_char) = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
#define YY_NUM_RULES 67
|
||||
#define YY_END_OF_BUFFER 68
|
||||
#define YY_NUM_RULES 77
|
||||
#define YY_END_OF_BUFFER 78
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
@ -654,39 +654,45 @@ struct yy_trans_info
|
||||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static const flex_int16_t yy_accept[283] =
|
||||
static const flex_int16_t yy_accept[335] =
|
||||
{ 0,
|
||||
66, 66, 68, 67, 66, 67, 58, 64, 65, 67,
|
||||
67, 67, 67, 62, 63, 60, 61, 66, 0, 58,
|
||||
0, 0, 0, 0, 0, 59, 0, 0, 0, 0,
|
||||
0, 41, 0, 0, 0, 0, 0, 42, 0, 0,
|
||||
76, 76, 78, 77, 76, 77, 68, 74, 75, 77,
|
||||
77, 77, 77, 72, 73, 70, 71, 76, 0, 68,
|
||||
0, 0, 0, 0, 0, 69, 0, 0, 0, 0,
|
||||
0, 50, 0, 0, 0, 0, 0, 51, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 40, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 49, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 57, 39, 0, 0, 0, 48, 52, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 54, 56, 53, 0,
|
||||
0, 67, 48, 0, 0, 0, 57, 61, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 63, 66, 62, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 55, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 38, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 65,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 47, 0,
|
||||
0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 60, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 51, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 2, 0, 0, 0, 0, 0, 0, 9,
|
||||
10, 0, 0, 50, 0, 47, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 2, 0, 0, 0,
|
||||
0, 0, 0, 9, 10, 0, 0, 59, 0, 0,
|
||||
56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 3, 4, 5, 6,
|
||||
7, 8, 11, 12, 13, 14, 15, 16, 0, 0,
|
||||
0, 46, 49, 28, 29, 30, 31, 32, 33, 0,
|
||||
0, 0, 22, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 17, 0, 0, 0,
|
||||
0, 24, 0, 0, 0, 23, 0, 0, 0, 44,
|
||||
0, 0, 0, 35, 0, 26, 18, 20, 19, 0,
|
||||
25, 0, 43, 45, 36, 0, 0, 27, 21, 34,
|
||||
37, 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 3, 4, 5, 6, 7, 8, 11, 12, 13,
|
||||
14, 15, 16, 0, 0, 0, 0, 55, 58, 28,
|
||||
29, 30, 31, 32, 33, 0, 0, 0, 22, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 17, 0, 0, 0, 0, 24, 0,
|
||||
0, 0, 23, 0, 0, 0, 53, 0, 0, 0,
|
||||
0, 35, 0, 26, 18, 20, 19, 0, 25, 0,
|
||||
52, 54, 0, 36, 0, 0, 0, 27, 21, 0,
|
||||
0, 34, 0, 37, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 38, 39, 40, 41, 42,
|
||||
43, 0, 0, 0, 0, 0, 0, 0, 44, 0,
|
||||
45, 0, 46, 0
|
||||
} ;
|
||||
|
||||
static const YY_CHAR yy_ec[256] =
|
||||
@ -699,12 +705,12 @@ static const YY_CHAR yy_ec[256] =
|
||||
7, 8, 9, 10, 4, 11, 4, 12, 13, 1,
|
||||
1, 1, 1, 1, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 1, 1, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 31, 32, 33, 1, 1, 34, 35,
|
||||
36, 1, 37, 1, 38, 1, 1, 1, 1, 1,
|
||||
28, 29, 30, 31, 32, 33, 1, 34, 35, 36,
|
||||
37, 1, 38, 1, 39, 1, 1, 1, 1, 1,
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 39, 1, 40, 1, 1, 1, 1, 1,
|
||||
1, 1, 40, 1, 41, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
@ -721,166 +727,193 @@ static const YY_CHAR yy_ec[256] =
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static const YY_CHAR yy_meta[41] =
|
||||
static const YY_CHAR yy_meta[42] =
|
||||
{ 0,
|
||||
1, 1, 2, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1
|
||||
} ;
|
||||
|
||||
static const flex_int16_t yy_base[285] =
|
||||
static const flex_int16_t yy_base[337] =
|
||||
{ 0,
|
||||
0, 0, 307, 308, 304, 0, 0, 308, 308, 11,
|
||||
296, 277, 272, 308, 308, 308, 308, 300, 298, 0,
|
||||
282, 265, 267, 269, 267, 308, 264, 267, 255, 254,
|
||||
16, 308, 273, 33, 14, 276, 267, 308, 259, 24,
|
||||
262, 260, 267, 270, 256, 251, 34, 259, 266, 262,
|
||||
243, 248, 252, 257, 244, 241, 243, 253, 239, 255,
|
||||
36, 239, 249, 231, 245, 308, 246, 249, 235, 230,
|
||||
255, 235, 227, 239, 234, 227, 216, 34, 231, 227,
|
||||
233, 308, 308, 216, 223, 210, 308, 308, 218, 208,
|
||||
212, 212, 38, 218, 39, 228, 308, 308, 308, 209,
|
||||
0, 0, 360, 361, 357, 0, 0, 361, 361, 12,
|
||||
349, 330, 325, 361, 361, 361, 361, 353, 351, 0,
|
||||
335, 317, 320, 322, 320, 361, 317, 320, 307, 306,
|
||||
17, 361, 326, 34, 15, 329, 320, 361, 312, 31,
|
||||
315, 313, 320, 323, 309, 304, 35, 312, 319, 315,
|
||||
295, 301, 305, 310, 297, 294, 296, 306, 292, 308,
|
||||
34, 292, 302, 283, 298, 361, 299, 302, 288, 283,
|
||||
308, 288, 280, 292, 287, 280, 268, 32, 284, 280,
|
||||
286, 361, 361, 268, 39, 263, 361, 361, 272, 261,
|
||||
266, 266, 44, 272, 43, 282, 361, 361, 361, 277,
|
||||
|
||||
47, 226, 220, 220, 219, 66, 73, 216, 203, 207,
|
||||
218, 207, 201, 199, 204, 80, 190, 308, 217, 220,
|
||||
217, 52, 214, 217, 214, 59, 308, 198, 206, 196,
|
||||
201, 201, 197, 177, 204, 207, 204, 75, 66, 73,
|
||||
78, 193, 192, 80, 85, 87, 191, 190, 184, 190,
|
||||
187, 308, 182, 192, 172, 89, 91, 94, 180, 174,
|
||||
176, 173, 96, 95, 102, 179, 178, 177, 176, 175,
|
||||
174, 308, 308, 173, 172, 171, 170, 169, 168, 308,
|
||||
308, 96, 167, 308, 162, 308, 178, 164, 163, 162,
|
||||
161, 160, 159, 162, 143, 148, 142, 146, 145, 145,
|
||||
262, 55, 279, 273, 273, 272, 67, 74, 269, 256,
|
||||
260, 271, 251, 259, 253, 251, 256, 81, 241, 361,
|
||||
269, 272, 269, 60, 266, 269, 266, 67, 361, 250,
|
||||
258, 248, 231, 252, 252, 248, 227, 255, 258, 255,
|
||||
76, 74, 79, 81, 244, 243, 86, 88, 90, 242,
|
||||
241, 235, 241, 238, 233, 361, 232, 242, 222, 92,
|
||||
95, 97, 230, 224, 226, 223, 99, 98, 101, 229,
|
||||
228, 227, 226, 225, 224, 361, 361, 223, 222, 221,
|
||||
220, 219, 218, 361, 361, 99, 217, 361, 216, 211,
|
||||
361, 227, 213, 212, 211, 210, 209, 208, 211, 192,
|
||||
|
||||
148, 142, 146, 141, 103, 144, 308, 308, 308, 308,
|
||||
308, 308, 308, 308, 308, 308, 308, 308, 150, 145,
|
||||
135, 308, 308, 308, 308, 308, 308, 308, 308, 132,
|
||||
145, 145, 308, 126, 132, 136, 141, 125, 139, 121,
|
||||
125, 125, 123, 131, 118, 132, 308, 122, 113, 128,
|
||||
122, 308, 112, 109, 110, 308, 113, 117, 107, 308,
|
||||
110, 114, 112, 123, 98, 308, 308, 308, 308, 100,
|
||||
308, 84, 308, 308, 308, 89, 68, 308, 308, 308,
|
||||
308, 308, 132, 65
|
||||
197, 191, 195, 194, 194, 197, 191, 195, 190, 106,
|
||||
193, 361, 361, 361, 361, 361, 361, 361, 361, 361,
|
||||
361, 361, 361, 199, 194, 184, 192, 361, 361, 361,
|
||||
361, 361, 361, 361, 361, 180, 193, 193, 361, 174,
|
||||
180, 184, 189, 173, 187, 169, 173, 173, 171, 179,
|
||||
166, 180, 175, 361, 169, 160, 175, 169, 361, 159,
|
||||
156, 157, 361, 160, 164, 154, 361, 158, 164, 141,
|
||||
161, 95, 155, 361, 361, 361, 361, 157, 361, 145,
|
||||
361, 361, 156, 135, 163, 156, 153, 361, 361, 128,
|
||||
154, 361, 143, 129, 157, 160, 157, 138, 139, 146,
|
||||
|
||||
113, 122, 124, 137, 133, 133, 140, 139, 138, 137,
|
||||
136, 135, 125, 128, 125, 361, 361, 361, 361, 361,
|
||||
361, 123, 126, 116, 124, 107, 117, 93, 361, 103,
|
||||
361, 46, 361, 361, 147, 52
|
||||
} ;
|
||||
|
||||
static const flex_int16_t yy_def[285] =
|
||||
static const flex_int16_t yy_def[337] =
|
||||
{ 0,
|
||||
282, 1, 282, 282, 282, 283, 284, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 283, 284,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
334, 1, 334, 334, 334, 335, 336, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 335, 336,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 0, 282, 282
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 0, 334, 334
|
||||
} ;
|
||||
|
||||
static const flex_int16_t yy_nxt[349] =
|
||||
static const flex_int16_t yy_nxt[403] =
|
||||
{ 0,
|
||||
4, 5, 6, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 8, 9, 4, 4, 10, 4, 4, 4, 4,
|
||||
11, 4, 4, 4, 4, 12, 4, 4, 4, 13,
|
||||
4, 4, 4, 4, 4, 14, 15, 4, 16, 17,
|
||||
21, 22, 36, 48, 49, 37, 39, 62, 40, 53,
|
||||
41, 42, 77, 54, 43, 94, 63, 44, 45, 106,
|
||||
113, 55, 46, 109, 78, 47, 142, 20, 110, 107,
|
||||
119, 95, 120, 147, 143, 121, 122, 123, 114, 124,
|
||||
166, 148, 125, 126, 135, 281, 136, 168, 167, 137,
|
||||
159, 160, 170, 161, 174, 169, 162, 163, 280, 176,
|
||||
4, 4, 4, 4, 4, 4, 14, 15, 4, 16,
|
||||
17, 21, 22, 36, 48, 49, 37, 39, 62, 40,
|
||||
77, 41, 42, 94, 20, 43, 53, 63, 44, 45,
|
||||
54, 100, 78, 46, 101, 107, 47, 110, 115, 55,
|
||||
95, 121, 111, 122, 145, 108, 123, 124, 125, 333,
|
||||
126, 150, 146, 127, 128, 138, 116, 139, 170, 151,
|
||||
140, 163, 164, 172, 165, 174, 171, 166, 167, 285,
|
||||
|
||||
171, 178, 175, 188, 164, 190, 165, 177, 192, 179,
|
||||
201, 189, 198, 191, 279, 202, 193, 203, 199, 278,
|
||||
277, 200, 219, 204, 205, 241, 220, 276, 242, 275,
|
||||
274, 206, 19, 273, 19, 272, 271, 270, 269, 268,
|
||||
267, 266, 265, 264, 263, 262, 261, 260, 259, 258,
|
||||
257, 256, 255, 254, 253, 252, 251, 250, 249, 248,
|
||||
247, 246, 245, 244, 243, 240, 239, 238, 237, 236,
|
||||
235, 234, 233, 232, 231, 230, 229, 228, 227, 226,
|
||||
225, 224, 223, 222, 221, 218, 217, 216, 215, 214,
|
||||
213, 212, 211, 210, 209, 208, 207, 197, 196, 195,
|
||||
178, 173, 180, 175, 182, 168, 193, 169, 179, 195,
|
||||
181, 197, 183, 206, 194, 203, 208, 196, 207, 198,
|
||||
332, 204, 209, 210, 205, 224, 331, 307, 247, 225,
|
||||
211, 248, 295, 286, 296, 308, 309, 297, 311, 330,
|
||||
329, 328, 327, 326, 310, 325, 312, 19, 324, 19,
|
||||
323, 322, 321, 320, 319, 318, 317, 316, 315, 314,
|
||||
313, 306, 305, 304, 303, 302, 301, 300, 299, 298,
|
||||
294, 293, 292, 291, 290, 289, 288, 287, 284, 283,
|
||||
282, 281, 280, 279, 278, 277, 276, 275, 274, 273,
|
||||
272, 271, 270, 269, 268, 267, 266, 265, 264, 263,
|
||||
|
||||
194, 187, 186, 185, 184, 183, 182, 181, 180, 173,
|
||||
172, 158, 157, 156, 155, 154, 153, 152, 151, 150,
|
||||
149, 146, 145, 144, 141, 140, 139, 138, 134, 133,
|
||||
132, 131, 130, 129, 128, 127, 118, 117, 116, 115,
|
||||
112, 111, 108, 105, 104, 103, 102, 101, 100, 99,
|
||||
98, 97, 96, 93, 92, 91, 90, 89, 88, 87,
|
||||
86, 85, 84, 83, 82, 81, 80, 79, 76, 75,
|
||||
74, 73, 72, 71, 70, 69, 68, 67, 66, 65,
|
||||
64, 61, 60, 59, 58, 57, 56, 52, 51, 50,
|
||||
38, 35, 34, 33, 32, 31, 30, 29, 28, 27,
|
||||
262, 261, 260, 259, 258, 257, 256, 255, 254, 253,
|
||||
252, 251, 250, 249, 246, 245, 244, 243, 242, 241,
|
||||
240, 239, 238, 237, 236, 235, 234, 233, 232, 231,
|
||||
230, 229, 228, 227, 226, 223, 222, 221, 220, 219,
|
||||
218, 217, 216, 215, 214, 213, 212, 202, 201, 200,
|
||||
199, 192, 191, 190, 189, 188, 187, 186, 185, 184,
|
||||
177, 176, 162, 161, 160, 159, 158, 157, 156, 155,
|
||||
154, 153, 152, 149, 148, 147, 144, 143, 142, 141,
|
||||
137, 136, 135, 134, 133, 132, 131, 130, 129, 120,
|
||||
119, 118, 117, 114, 113, 112, 109, 106, 105, 104,
|
||||
|
||||
26, 18, 25, 24, 23, 18, 282, 3, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282
|
||||
103, 102, 99, 98, 97, 96, 93, 92, 91, 90,
|
||||
89, 88, 87, 86, 85, 84, 83, 82, 81, 80,
|
||||
79, 76, 75, 74, 73, 72, 71, 70, 69, 68,
|
||||
67, 66, 65, 64, 61, 60, 59, 58, 57, 56,
|
||||
52, 51, 50, 38, 35, 34, 33, 32, 31, 30,
|
||||
29, 28, 27, 26, 18, 25, 24, 23, 18, 334,
|
||||
3, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
|
||||
334, 334
|
||||
} ;
|
||||
|
||||
static const flex_int16_t yy_chk[349] =
|
||||
static const flex_int16_t yy_chk[403] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
10, 10, 31, 35, 35, 31, 34, 47, 34, 40,
|
||||
34, 34, 61, 40, 34, 78, 47, 34, 34, 93,
|
||||
101, 40, 34, 95, 61, 34, 122, 284, 95, 93,
|
||||
106, 78, 106, 126, 122, 106, 106, 107, 101, 107,
|
||||
139, 126, 107, 107, 116, 277, 116, 140, 139, 116,
|
||||
138, 138, 141, 138, 144, 140, 138, 138, 276, 145,
|
||||
1, 10, 10, 31, 35, 35, 31, 34, 47, 34,
|
||||
61, 34, 34, 78, 336, 34, 40, 47, 34, 34,
|
||||
40, 85, 61, 34, 85, 93, 34, 95, 102, 40,
|
||||
78, 107, 95, 107, 124, 93, 107, 107, 108, 332,
|
||||
108, 128, 124, 108, 108, 118, 102, 118, 142, 128,
|
||||
118, 141, 141, 143, 141, 144, 142, 141, 141, 272,
|
||||
|
||||
141, 146, 144, 156, 138, 157, 138, 145, 158, 146,
|
||||
164, 156, 163, 157, 272, 164, 158, 165, 163, 270,
|
||||
265, 163, 182, 165, 165, 205, 182, 264, 205, 263,
|
||||
262, 165, 283, 261, 283, 259, 258, 257, 255, 254,
|
||||
253, 251, 250, 249, 248, 246, 245, 244, 243, 242,
|
||||
241, 240, 239, 238, 237, 236, 235, 234, 232, 231,
|
||||
230, 221, 220, 219, 206, 204, 203, 202, 201, 200,
|
||||
199, 198, 197, 196, 195, 194, 193, 192, 191, 190,
|
||||
189, 188, 187, 185, 183, 179, 178, 177, 176, 175,
|
||||
174, 171, 170, 169, 168, 167, 166, 162, 161, 160,
|
||||
147, 143, 148, 144, 149, 141, 160, 141, 147, 161,
|
||||
148, 162, 149, 168, 160, 167, 169, 161, 168, 162,
|
||||
330, 167, 169, 169, 167, 186, 328, 301, 210, 186,
|
||||
169, 210, 290, 272, 290, 301, 302, 290, 303, 327,
|
||||
326, 325, 324, 323, 302, 322, 303, 335, 315, 335,
|
||||
314, 313, 312, 311, 310, 309, 308, 307, 306, 305,
|
||||
304, 300, 299, 298, 297, 296, 295, 294, 293, 291,
|
||||
287, 286, 285, 284, 283, 280, 278, 273, 271, 270,
|
||||
269, 268, 266, 265, 264, 262, 261, 260, 258, 257,
|
||||
256, 255, 253, 252, 251, 250, 249, 248, 247, 246,
|
||||
|
||||
159, 155, 154, 153, 151, 150, 149, 148, 147, 143,
|
||||
142, 137, 136, 135, 134, 133, 132, 131, 130, 129,
|
||||
128, 125, 124, 123, 121, 120, 119, 117, 115, 114,
|
||||
113, 112, 111, 110, 109, 108, 105, 104, 103, 102,
|
||||
100, 96, 94, 92, 91, 90, 89, 86, 85, 84,
|
||||
81, 80, 79, 77, 76, 75, 74, 73, 72, 71,
|
||||
70, 69, 68, 67, 65, 64, 63, 62, 60, 59,
|
||||
58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
|
||||
48, 46, 45, 44, 43, 42, 41, 39, 37, 36,
|
||||
33, 30, 29, 28, 27, 25, 24, 23, 22, 21,
|
||||
245, 244, 243, 242, 241, 240, 238, 237, 236, 227,
|
||||
226, 225, 224, 211, 209, 208, 207, 206, 205, 204,
|
||||
203, 202, 201, 200, 199, 198, 197, 196, 195, 194,
|
||||
193, 192, 190, 189, 187, 183, 182, 181, 180, 179,
|
||||
178, 175, 174, 173, 172, 171, 170, 166, 165, 164,
|
||||
163, 159, 158, 157, 155, 154, 153, 152, 151, 150,
|
||||
146, 145, 140, 139, 138, 137, 136, 135, 134, 133,
|
||||
132, 131, 130, 127, 126, 125, 123, 122, 121, 119,
|
||||
117, 116, 115, 114, 113, 112, 111, 110, 109, 106,
|
||||
105, 104, 103, 101, 100, 96, 94, 92, 91, 90,
|
||||
|
||||
19, 18, 13, 12, 11, 5, 3, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
|
||||
282, 282, 282, 282, 282, 282, 282, 282
|
||||
89, 86, 84, 81, 80, 79, 77, 76, 75, 74,
|
||||
73, 72, 71, 70, 69, 68, 67, 65, 64, 63,
|
||||
62, 60, 59, 58, 57, 56, 55, 54, 53, 52,
|
||||
51, 50, 49, 48, 46, 45, 44, 43, 42, 41,
|
||||
39, 37, 36, 33, 30, 29, 28, 27, 25, 24,
|
||||
23, 22, 21, 19, 18, 13, 12, 11, 5, 3,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
|
||||
|
||||
334, 334
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
@ -939,8 +972,8 @@ static int my_yyinput(char *, int);
|
||||
extern char *myinput;
|
||||
extern size_t input_len;
|
||||
|
||||
#line 913 "hl/src//H5LTanalyze.c"
|
||||
#line 914 "hl/src//H5LTanalyze.c"
|
||||
#line 946 "hl/src//H5LTanalyze.c"
|
||||
#line 947 "hl/src//H5LTanalyze.c"
|
||||
|
||||
#define INITIAL 0
|
||||
|
||||
@ -1152,7 +1185,7 @@ YY_DECL
|
||||
#line 53 "hl/src//H5LTanalyze.l"
|
||||
|
||||
|
||||
#line 1126 "hl/src//H5LTanalyze.c"
|
||||
#line 1159 "hl/src//H5LTanalyze.c"
|
||||
|
||||
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
@ -1179,13 +1212,13 @@ yy_match:
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 283 )
|
||||
if ( yy_current_state >= 335 )
|
||||
yy_c = yy_meta[yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 308 );
|
||||
while ( yy_base[yy_current_state] != 361 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
@ -1397,162 +1430,212 @@ YY_RULE_SETUP
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 96 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_STRING_TOKEN);}
|
||||
{return hid(H5T_COMPLEX_IEEE_F16BE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 97 "hl/src//H5LTanalyze.l"
|
||||
{return token(STRSIZE_TOKEN);}
|
||||
{return hid(H5T_COMPLEX_IEEE_F16LE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 98 "hl/src//H5LTanalyze.l"
|
||||
{return token(STRPAD_TOKEN);}
|
||||
{return hid(H5T_COMPLEX_IEEE_F32BE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 99 "hl/src//H5LTanalyze.l"
|
||||
{return token(CSET_TOKEN);}
|
||||
{return hid(H5T_COMPLEX_IEEE_F32LE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 100 "hl/src//H5LTanalyze.l"
|
||||
{return token(CTYPE_TOKEN);}
|
||||
{return hid(H5T_COMPLEX_IEEE_F64BE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 101 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_STR_NULLTERM_TOKEN);}
|
||||
{return hid(H5T_COMPLEX_IEEE_F64LE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 102 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_STR_NULLPAD_TOKEN);}
|
||||
{return hid(H5T_NATIVE_FLOAT_COMPLEX_TOKEN);}
|
||||
YY_BREAK
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 103 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_STR_SPACEPAD_TOKEN);}
|
||||
{return hid(H5T_NATIVE_DOUBLE_COMPLEX_TOKEN);}
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 104 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_CSET_ASCII_TOKEN);}
|
||||
{return hid(H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN);}
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 105 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_CSET_UTF8_TOKEN);}
|
||||
#line 106 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_STRING_TOKEN);}
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 106 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_C_S1_TOKEN);}
|
||||
#line 107 "hl/src//H5LTanalyze.l"
|
||||
{return token(STRSIZE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 107 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_FORTRAN_S1_TOKEN);}
|
||||
#line 108 "hl/src//H5LTanalyze.l"
|
||||
{return token(STRPAD_TOKEN);}
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 108 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_VARIABLE_TOKEN);}
|
||||
#line 109 "hl/src//H5LTanalyze.l"
|
||||
{return token(CSET_TOKEN);}
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 110 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_COMPOUND_TOKEN);}
|
||||
{return token(CTYPE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 111 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_ENUM_TOKEN);}
|
||||
{return token(H5T_STR_NULLTERM_TOKEN);}
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 112 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_ARRAY_TOKEN);}
|
||||
{return token(H5T_STR_NULLPAD_TOKEN);}
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 113 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_VLEN_TOKEN);}
|
||||
{return token(H5T_STR_SPACEPAD_TOKEN);}
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 115 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_OPAQUE_TOKEN);}
|
||||
#line 114 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_CSET_ASCII_TOKEN);}
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 116 "hl/src//H5LTanalyze.l"
|
||||
{return token(OPQ_SIZE_TOKEN);}
|
||||
#line 115 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_CSET_UTF8_TOKEN);}
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 117 "hl/src//H5LTanalyze.l"
|
||||
{return token(OPQ_TAG_TOKEN);}
|
||||
#line 116 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_C_S1_TOKEN);}
|
||||
YY_BREAK
|
||||
case 58:
|
||||
YY_RULE_SETUP
|
||||
#line 119 "hl/src//H5LTanalyze.l"
|
||||
#line 117 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_FORTRAN_S1_TOKEN);}
|
||||
YY_BREAK
|
||||
case 59:
|
||||
YY_RULE_SETUP
|
||||
#line 118 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_VARIABLE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 60:
|
||||
YY_RULE_SETUP
|
||||
#line 120 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_COMPOUND_TOKEN);}
|
||||
YY_BREAK
|
||||
case 61:
|
||||
YY_RULE_SETUP
|
||||
#line 121 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_ENUM_TOKEN);}
|
||||
YY_BREAK
|
||||
case 62:
|
||||
YY_RULE_SETUP
|
||||
#line 122 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_ARRAY_TOKEN);}
|
||||
YY_BREAK
|
||||
case 63:
|
||||
YY_RULE_SETUP
|
||||
#line 123 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_VLEN_TOKEN);}
|
||||
YY_BREAK
|
||||
case 64:
|
||||
YY_RULE_SETUP
|
||||
#line 124 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_COMPLEX_TOKEN);}
|
||||
YY_BREAK
|
||||
case 65:
|
||||
YY_RULE_SETUP
|
||||
#line 126 "hl/src//H5LTanalyze.l"
|
||||
{return token(H5T_OPAQUE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 66:
|
||||
YY_RULE_SETUP
|
||||
#line 127 "hl/src//H5LTanalyze.l"
|
||||
{return token(OPQ_SIZE_TOKEN);}
|
||||
YY_BREAK
|
||||
case 67:
|
||||
YY_RULE_SETUP
|
||||
#line 128 "hl/src//H5LTanalyze.l"
|
||||
{return token(OPQ_TAG_TOKEN);}
|
||||
YY_BREAK
|
||||
case 68:
|
||||
YY_RULE_SETUP
|
||||
#line 130 "hl/src//H5LTanalyze.l"
|
||||
{
|
||||
H5LTyylval.ival = atoi(yytext);
|
||||
return NUMBER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 59:
|
||||
/* rule 59 can match eol */
|
||||
case 69:
|
||||
/* rule 69 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 124 "hl/src//H5LTanalyze.l"
|
||||
#line 135 "hl/src//H5LTanalyze.l"
|
||||
{
|
||||
H5LTyylval.sval = trim_quotes(yytext);
|
||||
return STRING;
|
||||
}
|
||||
YY_BREAK
|
||||
case 60:
|
||||
case 70:
|
||||
YY_RULE_SETUP
|
||||
#line 129 "hl/src//H5LTanalyze.l"
|
||||
#line 140 "hl/src//H5LTanalyze.l"
|
||||
{return token('{');}
|
||||
YY_BREAK
|
||||
case 61:
|
||||
case 71:
|
||||
YY_RULE_SETUP
|
||||
#line 130 "hl/src//H5LTanalyze.l"
|
||||
#line 141 "hl/src//H5LTanalyze.l"
|
||||
{return token('}');}
|
||||
YY_BREAK
|
||||
case 62:
|
||||
case 72:
|
||||
YY_RULE_SETUP
|
||||
#line 131 "hl/src//H5LTanalyze.l"
|
||||
#line 142 "hl/src//H5LTanalyze.l"
|
||||
{return token('[');}
|
||||
YY_BREAK
|
||||
case 63:
|
||||
case 73:
|
||||
YY_RULE_SETUP
|
||||
#line 132 "hl/src//H5LTanalyze.l"
|
||||
#line 143 "hl/src//H5LTanalyze.l"
|
||||
{return token(']');}
|
||||
YY_BREAK
|
||||
case 64:
|
||||
case 74:
|
||||
YY_RULE_SETUP
|
||||
#line 133 "hl/src//H5LTanalyze.l"
|
||||
#line 144 "hl/src//H5LTanalyze.l"
|
||||
{return token(':');}
|
||||
YY_BREAK
|
||||
case 65:
|
||||
case 75:
|
||||
YY_RULE_SETUP
|
||||
#line 134 "hl/src//H5LTanalyze.l"
|
||||
#line 145 "hl/src//H5LTanalyze.l"
|
||||
{return token(';');}
|
||||
YY_BREAK
|
||||
case 66:
|
||||
/* rule 66 can match eol */
|
||||
case 76:
|
||||
/* rule 76 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 135 "hl/src//H5LTanalyze.l"
|
||||
#line 146 "hl/src//H5LTanalyze.l"
|
||||
;
|
||||
YY_BREAK
|
||||
case 67:
|
||||
case 77:
|
||||
YY_RULE_SETUP
|
||||
#line 137 "hl/src//H5LTanalyze.l"
|
||||
#line 148 "hl/src//H5LTanalyze.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1526 "hl/src//H5LTanalyze.c"
|
||||
#line 1609 "hl/src//H5LTanalyze.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@ -1849,7 +1932,7 @@ static int yy_get_next_buffer (void)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 283 )
|
||||
if ( yy_current_state >= 335 )
|
||||
yy_c = yy_meta[yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
||||
@ -1877,11 +1960,11 @@ static int yy_get_next_buffer (void)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 283 )
|
||||
if ( yy_current_state >= 335 )
|
||||
yy_c = yy_meta[yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
||||
yy_is_jam = (yy_current_state == 282);
|
||||
yy_is_jam = (yy_current_state == 334);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
@ -2557,7 +2640,7 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 137 "hl/src//H5LTanalyze.l"
|
||||
#line 148 "hl/src//H5LTanalyze.l"
|
||||
|
||||
|
||||
/* Allocate a copy of `quoted` with the double quote character at
|
||||
|
@ -93,6 +93,16 @@ H5T_NATIVE_FLOAT {return hid(H5T_NATIVE_FLOAT_TOKEN);}
|
||||
H5T_NATIVE_DOUBLE {return hid(H5T_NATIVE_DOUBLE_TOKEN);}
|
||||
H5T_NATIVE_LDOUBLE {return hid(H5T_NATIVE_LDOUBLE_TOKEN);}
|
||||
|
||||
H5T_COMPLEX_IEEE_F16BE {return hid(H5T_COMPLEX_IEEE_F16BE_TOKEN);}
|
||||
H5T_COMPLEX_IEEE_F16LE {return hid(H5T_COMPLEX_IEEE_F16LE_TOKEN);}
|
||||
H5T_COMPLEX_IEEE_F32BE {return hid(H5T_COMPLEX_IEEE_F32BE_TOKEN);}
|
||||
H5T_COMPLEX_IEEE_F32LE {return hid(H5T_COMPLEX_IEEE_F32LE_TOKEN);}
|
||||
H5T_COMPLEX_IEEE_F64BE {return hid(H5T_COMPLEX_IEEE_F64BE_TOKEN);}
|
||||
H5T_COMPLEX_IEEE_F64LE {return hid(H5T_COMPLEX_IEEE_F64LE_TOKEN);}
|
||||
H5T_NATIVE_FLOAT_COMPLEX {return hid(H5T_NATIVE_FLOAT_COMPLEX_TOKEN);}
|
||||
H5T_NATIVE_DOUBLE_COMPLEX {return hid(H5T_NATIVE_DOUBLE_COMPLEX_TOKEN);}
|
||||
H5T_NATIVE_LDOUBLE_COMPLEX {return hid(H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN);}
|
||||
|
||||
H5T_STRING {return token(H5T_STRING_TOKEN);}
|
||||
STRSIZE {return token(STRSIZE_TOKEN);}
|
||||
STRPAD {return token(STRPAD_TOKEN);}
|
||||
@ -111,6 +121,7 @@ H5T_COMPOUND {return token(H5T_COMPOUND_TOKEN);}
|
||||
H5T_ENUM {return token(H5T_ENUM_TOKEN);}
|
||||
H5T_ARRAY {return token(H5T_ARRAY_TOKEN);}
|
||||
H5T_VLEN {return token(H5T_VLEN_TOKEN);}
|
||||
H5T_COMPLEX {return token(H5T_COMPLEX_TOKEN);}
|
||||
|
||||
H5T_OPAQUE {return token(H5T_OPAQUE_TOKEN);}
|
||||
OPQ_SIZE {return token(OPQ_SIZE_TOKEN);}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -91,28 +91,38 @@ extern int H5LTyydebug;
|
||||
H5T_NATIVE_FLOAT_TOKEN = 292, /* H5T_NATIVE_FLOAT_TOKEN */
|
||||
H5T_NATIVE_DOUBLE_TOKEN = 293, /* H5T_NATIVE_DOUBLE_TOKEN */
|
||||
H5T_NATIVE_LDOUBLE_TOKEN = 294, /* H5T_NATIVE_LDOUBLE_TOKEN */
|
||||
H5T_STRING_TOKEN = 295, /* H5T_STRING_TOKEN */
|
||||
STRSIZE_TOKEN = 296, /* STRSIZE_TOKEN */
|
||||
STRPAD_TOKEN = 297, /* STRPAD_TOKEN */
|
||||
CSET_TOKEN = 298, /* CSET_TOKEN */
|
||||
CTYPE_TOKEN = 299, /* CTYPE_TOKEN */
|
||||
H5T_VARIABLE_TOKEN = 300, /* H5T_VARIABLE_TOKEN */
|
||||
H5T_STR_NULLTERM_TOKEN = 301, /* H5T_STR_NULLTERM_TOKEN */
|
||||
H5T_STR_NULLPAD_TOKEN = 302, /* H5T_STR_NULLPAD_TOKEN */
|
||||
H5T_STR_SPACEPAD_TOKEN = 303, /* H5T_STR_SPACEPAD_TOKEN */
|
||||
H5T_CSET_ASCII_TOKEN = 304, /* H5T_CSET_ASCII_TOKEN */
|
||||
H5T_CSET_UTF8_TOKEN = 305, /* H5T_CSET_UTF8_TOKEN */
|
||||
H5T_C_S1_TOKEN = 306, /* H5T_C_S1_TOKEN */
|
||||
H5T_FORTRAN_S1_TOKEN = 307, /* H5T_FORTRAN_S1_TOKEN */
|
||||
H5T_OPAQUE_TOKEN = 308, /* H5T_OPAQUE_TOKEN */
|
||||
OPQ_SIZE_TOKEN = 309, /* OPQ_SIZE_TOKEN */
|
||||
OPQ_TAG_TOKEN = 310, /* OPQ_TAG_TOKEN */
|
||||
H5T_COMPOUND_TOKEN = 311, /* H5T_COMPOUND_TOKEN */
|
||||
H5T_ENUM_TOKEN = 312, /* H5T_ENUM_TOKEN */
|
||||
H5T_ARRAY_TOKEN = 313, /* H5T_ARRAY_TOKEN */
|
||||
H5T_VLEN_TOKEN = 314, /* H5T_VLEN_TOKEN */
|
||||
STRING = 315, /* STRING */
|
||||
NUMBER = 316 /* NUMBER */
|
||||
H5T_COMPLEX_IEEE_F16BE_TOKEN = 295, /* H5T_COMPLEX_IEEE_F16BE_TOKEN */
|
||||
H5T_COMPLEX_IEEE_F16LE_TOKEN = 296, /* H5T_COMPLEX_IEEE_F16LE_TOKEN */
|
||||
H5T_COMPLEX_IEEE_F32BE_TOKEN = 297, /* H5T_COMPLEX_IEEE_F32BE_TOKEN */
|
||||
H5T_COMPLEX_IEEE_F32LE_TOKEN = 298, /* H5T_COMPLEX_IEEE_F32LE_TOKEN */
|
||||
H5T_COMPLEX_IEEE_F64BE_TOKEN = 299, /* H5T_COMPLEX_IEEE_F64BE_TOKEN */
|
||||
H5T_COMPLEX_IEEE_F64LE_TOKEN = 300, /* H5T_COMPLEX_IEEE_F64LE_TOKEN */
|
||||
H5T_NATIVE_FLOAT_COMPLEX_TOKEN = 301, /* H5T_NATIVE_FLOAT_COMPLEX_TOKEN */
|
||||
H5T_NATIVE_DOUBLE_COMPLEX_TOKEN = 302, /* H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */
|
||||
H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN = 303, /* H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */
|
||||
H5T_STRING_TOKEN = 304, /* H5T_STRING_TOKEN */
|
||||
STRSIZE_TOKEN = 305, /* STRSIZE_TOKEN */
|
||||
STRPAD_TOKEN = 306, /* STRPAD_TOKEN */
|
||||
CSET_TOKEN = 307, /* CSET_TOKEN */
|
||||
CTYPE_TOKEN = 308, /* CTYPE_TOKEN */
|
||||
H5T_VARIABLE_TOKEN = 309, /* H5T_VARIABLE_TOKEN */
|
||||
H5T_STR_NULLTERM_TOKEN = 310, /* H5T_STR_NULLTERM_TOKEN */
|
||||
H5T_STR_NULLPAD_TOKEN = 311, /* H5T_STR_NULLPAD_TOKEN */
|
||||
H5T_STR_SPACEPAD_TOKEN = 312, /* H5T_STR_SPACEPAD_TOKEN */
|
||||
H5T_CSET_ASCII_TOKEN = 313, /* H5T_CSET_ASCII_TOKEN */
|
||||
H5T_CSET_UTF8_TOKEN = 314, /* H5T_CSET_UTF8_TOKEN */
|
||||
H5T_C_S1_TOKEN = 315, /* H5T_C_S1_TOKEN */
|
||||
H5T_FORTRAN_S1_TOKEN = 316, /* H5T_FORTRAN_S1_TOKEN */
|
||||
H5T_OPAQUE_TOKEN = 317, /* H5T_OPAQUE_TOKEN */
|
||||
OPQ_SIZE_TOKEN = 318, /* OPQ_SIZE_TOKEN */
|
||||
OPQ_TAG_TOKEN = 319, /* OPQ_TAG_TOKEN */
|
||||
H5T_COMPOUND_TOKEN = 320, /* H5T_COMPOUND_TOKEN */
|
||||
H5T_ENUM_TOKEN = 321, /* H5T_ENUM_TOKEN */
|
||||
H5T_ARRAY_TOKEN = 322, /* H5T_ARRAY_TOKEN */
|
||||
H5T_VLEN_TOKEN = 323, /* H5T_VLEN_TOKEN */
|
||||
H5T_COMPLEX_TOKEN = 324, /* H5T_COMPLEX_TOKEN */
|
||||
STRING = 325, /* STRING */
|
||||
NUMBER = 326 /* NUMBER */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
#endif
|
||||
@ -127,7 +137,7 @@ union YYSTYPE
|
||||
char *sval; /*for name string*/
|
||||
hid_t hid; /*for hid_t token*/
|
||||
|
||||
#line 131 "hl/src//H5LTparse.h"
|
||||
#line 141 "hl/src//H5LTparse.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
@ -83,6 +83,11 @@ static char* enum_memb_symbol; /*enum member symbol string*/
|
||||
%token <hid> H5T_IEEE_F32BE_TOKEN H5T_IEEE_F32LE_TOKEN H5T_IEEE_F64BE_TOKEN H5T_IEEE_F64LE_TOKEN
|
||||
%token <hid> H5T_NATIVE_FLOAT16_TOKEN H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN
|
||||
|
||||
%token <hid> H5T_COMPLEX_IEEE_F16BE_TOKEN H5T_COMPLEX_IEEE_F16LE_TOKEN
|
||||
%token <hid> H5T_COMPLEX_IEEE_F32BE_TOKEN H5T_COMPLEX_IEEE_F32LE_TOKEN
|
||||
%token <hid> H5T_COMPLEX_IEEE_F64BE_TOKEN H5T_COMPLEX_IEEE_F64LE_TOKEN
|
||||
%token <hid> H5T_NATIVE_FLOAT_COMPLEX_TOKEN H5T_NATIVE_DOUBLE_COMPLEX_TOKEN H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN
|
||||
|
||||
%token <ival> H5T_STRING_TOKEN STRSIZE_TOKEN STRPAD_TOKEN CSET_TOKEN CTYPE_TOKEN H5T_VARIABLE_TOKEN
|
||||
%token <ival> H5T_STR_NULLTERM_TOKEN H5T_STR_NULLPAD_TOKEN H5T_STR_SPACEPAD_TOKEN
|
||||
%token <ival> H5T_CSET_ASCII_TOKEN H5T_CSET_UTF8_TOKEN H5T_C_S1_TOKEN H5T_FORTRAN_S1_TOKEN
|
||||
@ -93,6 +98,7 @@ static char* enum_memb_symbol; /*enum member symbol string*/
|
||||
%token <ival> H5T_ENUM_TOKEN
|
||||
%token <ival> H5T_ARRAY_TOKEN
|
||||
%token <ival> H5T_VLEN_TOKEN
|
||||
%token <ival> H5T_COMPLEX_TOKEN
|
||||
|
||||
%token <sval> STRING
|
||||
%token <ival> NUMBER
|
||||
@ -106,6 +112,7 @@ ddl_type : atomic_type
|
||||
| compound_type
|
||||
| array_type
|
||||
| vlen_type
|
||||
| complex_type
|
||||
;
|
||||
atomic_type : integer_type
|
||||
| fp_type
|
||||
@ -245,6 +252,19 @@ vlen_type : H5T_VLEN_TOKEN '{' ddl_type '}'
|
||||
{ $<hid>$ = H5Tvlen_create($<hid>3); H5Tclose($<hid>3); }
|
||||
;
|
||||
|
||||
complex_type : H5T_NATIVE_FLOAT_COMPLEX_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_FLOAT_COMPLEX); }
|
||||
| H5T_NATIVE_DOUBLE_COMPLEX_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_DOUBLE_COMPLEX); }
|
||||
| H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN { $<hid>$ = H5Tcopy(H5T_NATIVE_LDOUBLE_COMPLEX); }
|
||||
| H5T_COMPLEX_IEEE_F16LE_TOKEN { $<hid>$ = H5Tcopy(H5T_COMPLEX_IEEE_F16LE); }
|
||||
| H5T_COMPLEX_IEEE_F16BE_TOKEN { $<hid>$ = H5Tcopy(H5T_COMPLEX_IEEE_F16BE); }
|
||||
| H5T_COMPLEX_IEEE_F32LE_TOKEN { $<hid>$ = H5Tcopy(H5T_COMPLEX_IEEE_F32LE); }
|
||||
| H5T_COMPLEX_IEEE_F32BE_TOKEN { $<hid>$ = H5Tcopy(H5T_COMPLEX_IEEE_F32BE); }
|
||||
| H5T_COMPLEX_IEEE_F64LE_TOKEN { $<hid>$ = H5Tcopy(H5T_COMPLEX_IEEE_F64LE); }
|
||||
| H5T_COMPLEX_IEEE_F64BE_TOKEN { $<hid>$ = H5Tcopy(H5T_COMPLEX_IEEE_F64BE); }
|
||||
| H5T_COMPLEX_TOKEN '{' ddl_type '}'
|
||||
{ $<hid>$ = H5Tcomplex_create($<hid>3); H5Tclose($<hid>3); }
|
||||
;
|
||||
|
||||
opaque_type : H5T_OPAQUE_TOKEN
|
||||
'{'
|
||||
OPQ_SIZE_TOKEN opaque_size ';'
|
||||
|
@ -1893,6 +1893,226 @@ out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* subroutine for test_text_dtype(): test complex number datatypes
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_complex(void)
|
||||
{
|
||||
hid_t dtype;
|
||||
H5T_class_t type_class;
|
||||
|
||||
HL_TESTING3(" text for complex number types");
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_FLOAT_COMPLEX\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_NATIVE_FLOAT_COMPLEX))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_DOUBLE_COMPLEX\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_NATIVE_DOUBLE_COMPLEX))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE_COMPLEX\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_NATIVE_LDOUBLE_COMPLEX))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_NATIVE_FLOAT }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_NATIVE_FLOAT_COMPLEX))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_NATIVE_DOUBLE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_NATIVE_DOUBLE_COMPLEX))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_NATIVE_LDOUBLE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_NATIVE_LDOUBLE_COMPLEX))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX_IEEE_F16LE\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F16LE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX_IEEE_F16BE\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F16BE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX_IEEE_F32LE\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F32LE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX_IEEE_F32BE\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F32BE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX_IEEE_F64LE\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F64LE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX_IEEE_F64BE\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F64BE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_IEEE_F16LE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F16LE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_IEEE_F16BE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F16BE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_IEEE_F32LE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F32LE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_IEEE_F32BE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F32BE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_IEEE_F64LE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F64LE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
if ((dtype = H5LTtext_to_dtype("H5T_COMPLEX { H5T_IEEE_F64BE }\n", H5LT_DDL)) < 0)
|
||||
goto out;
|
||||
if ((type_class = H5Tget_class(dtype)) < 0)
|
||||
goto out;
|
||||
if (type_class != H5T_COMPLEX)
|
||||
goto out;
|
||||
if (!H5Tequal(dtype, H5T_COMPLEX_IEEE_F64BE))
|
||||
goto out;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
goto out;
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
|
||||
out:
|
||||
H5_FAILED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* test H5LTtext_to_dtype function
|
||||
*-------------------------------------------------------------------------
|
||||
@ -1933,6 +2153,9 @@ test_text_dtype(void)
|
||||
if (test_complicated_compound() < 0)
|
||||
goto out;
|
||||
|
||||
if (test_complex() < 0)
|
||||
goto out;
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
|
@ -94,17 +94,21 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel",
|
||||
static herr_t
|
||||
doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
|
||||
{
|
||||
h5tools_context_t ctx; /* print context */
|
||||
h5tool_format_t info; /* Format info for the tools library */
|
||||
static char fmt_ldouble[16]; /* Format info */
|
||||
static char fmt_double[16], fmt_float[16]; /* Format info */
|
||||
struct subset_t subset; /* Subsetting info */
|
||||
hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
int i; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
h5tools_context_t ctx; /* print context */
|
||||
h5tool_format_t info; /* Format info for the tools library */
|
||||
static char fmt_ldouble[16]; /* Format info */
|
||||
static char fmt_double[16]; /* Format info */
|
||||
static char fmt_float[16]; /* Format info */
|
||||
static char fmt_ldouble_complex[32]; /* Format info */
|
||||
static char fmt_double_complex[32]; /* Format info */
|
||||
static char fmt_float_complex[16]; /* Format info */
|
||||
struct subset_t subset; /* Subsetting info */
|
||||
hsize_t ss_start[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
hsize_t ss_stride[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
hsize_t ss_block[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
hsize_t ss_count[H5S_MAX_RANK]; /* Info for hyperslab */
|
||||
int i; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
/* Subsetting information for the tools library printing routines */
|
||||
subset.start.data = ss_start;
|
||||
@ -176,8 +180,14 @@ doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
|
||||
info.fmt_float = fmt_float;
|
||||
snprintf(fmt_double, sizeof(fmt_double), "%%1.%dg", DBL_DIG);
|
||||
info.fmt_double = fmt_double;
|
||||
snprintf(fmt_ldouble, sizeof(fmt_ldouble), "%%1.%dLg", DBL_DIG);
|
||||
snprintf(fmt_ldouble, sizeof(fmt_ldouble), "%%1.%dLg", LDBL_DIG);
|
||||
info.fmt_ldouble = fmt_ldouble;
|
||||
snprintf(fmt_float_complex, sizeof(fmt_float_complex), "%%1.%dg%%+1.%dgi", FLT_DIG, FLT_DIG);
|
||||
info.fmt_float_complex = fmt_float_complex;
|
||||
snprintf(fmt_double_complex, sizeof(fmt_double_complex), "%%1.%dg%%+1.%dgi", DBL_DIG, DBL_DIG);
|
||||
info.fmt_double_complex = fmt_double_complex;
|
||||
snprintf(fmt_ldouble_complex, sizeof(fmt_ldouble_complex), "%%1.%dLg%%+1.%dLgi", LDBL_DIG, LDBL_DIG);
|
||||
info.fmt_ldouble_complex = fmt_ldouble_complex;
|
||||
|
||||
info.dset_format = "DSET-%s ";
|
||||
info.dset_hidefileno = 0;
|
||||
|
@ -13747,6 +13747,33 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native void H5Tcompiler_conv(long src_id, long dst_id)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* @ingroup JH5T
|
||||
*
|
||||
* H5Tcomplex_create creates a new complex number datatype object.
|
||||
*
|
||||
* @param base_id
|
||||
* IN: Datatype identifier for the complex number base datatype.
|
||||
* Must be a floating-point datatype.
|
||||
*
|
||||
* @return a valid datatype identifier
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* Error from the HDF5 Library.
|
||||
**/
|
||||
public static long H5Tcomplex_create(long base_id) throws HDF5LibraryException
|
||||
{
|
||||
long id = _H5Tcomplex_create(base_id);
|
||||
if (id > 0) {
|
||||
log.trace("OPEN_IDS: H5Tcomplex_create add {}", id);
|
||||
OPEN_IDS.add(id);
|
||||
log.trace("OPEN_IDS: {}", OPEN_IDS.size());
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
private synchronized static native long _H5Tcomplex_create(long base_id) throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* @ingroup JH5T
|
||||
*
|
||||
@ -14250,6 +14277,8 @@ public class H5 implements java.io.Serializable {
|
||||
retValue = "H5T_VLEN";
|
||||
else if (HDF5Constants.H5T_ARRAY == class_id) /* Array types */
|
||||
retValue = "H5T_ARRAY";
|
||||
else if (HDF5Constants.H5T_COMPLEX == class_id) /* Complex number types */
|
||||
retValue = "H5T_COMPLEX";
|
||||
else
|
||||
retValue = "H5T_NO_CLASS";
|
||||
|
||||
|
@ -1041,6 +1041,8 @@ public class HDF5Constants {
|
||||
/** */
|
||||
public static final long H5T_C_S1 = H5T_C_S1();
|
||||
/** */
|
||||
public static final int H5T_COMPLEX = H5T_COMPLEX();
|
||||
/** */
|
||||
public static final int H5T_COMPOUND = H5T_COMPOUND();
|
||||
/** */
|
||||
public static final int H5T_CONV_CONV = H5T_CONV_CONV();
|
||||
@ -1049,6 +1051,18 @@ public class HDF5Constants {
|
||||
/** */
|
||||
public static final int H5T_CONV_INIT = H5T_CONV_INIT();
|
||||
/** */
|
||||
public static final long H5T_COMPLEX_IEEE_F16BE = H5T_COMPLEX_IEEE_F16BE();
|
||||
/** */
|
||||
public static final long H5T_COMPLEX_IEEE_F16LE = H5T_COMPLEX_IEEE_F16LE();
|
||||
/** */
|
||||
public static final long H5T_COMPLEX_IEEE_F32BE = H5T_COMPLEX_IEEE_F32BE();
|
||||
/** */
|
||||
public static final long H5T_COMPLEX_IEEE_F32LE = H5T_COMPLEX_IEEE_F32LE();
|
||||
/** */
|
||||
public static final long H5T_COMPLEX_IEEE_F64BE = H5T_COMPLEX_IEEE_F64BE();
|
||||
/** */
|
||||
public static final long H5T_COMPLEX_IEEE_F64LE = H5T_COMPLEX_IEEE_F64LE();
|
||||
/** */
|
||||
public static final int H5T_CSET_ERROR = H5T_CSET_ERROR();
|
||||
/** */
|
||||
public static final int H5T_CSET_ASCII = H5T_CSET_ASCII();
|
||||
@ -1177,10 +1191,14 @@ public class HDF5Constants {
|
||||
/** */
|
||||
public static final long H5T_NATIVE_DOUBLE = H5T_NATIVE_DOUBLE();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_DOUBLE_COMPLEX = H5T_NATIVE_DOUBLE_COMPLEX();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_FLOAT = H5T_NATIVE_FLOAT();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_FLOAT16 = H5T_NATIVE_FLOAT16();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_FLOAT_COMPLEX = H5T_NATIVE_FLOAT_COMPLEX();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_HADDR = H5T_NATIVE_HADDR();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_HBOOL = H5T_NATIVE_HBOOL();
|
||||
@ -1223,6 +1241,8 @@ public class HDF5Constants {
|
||||
/** */
|
||||
public static final long H5T_NATIVE_LONG = H5T_NATIVE_LONG();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_LDOUBLE_COMPLEX = H5T_NATIVE_LDOUBLE_COMPLEX();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_OPAQUE = H5T_NATIVE_OPAQUE();
|
||||
/** */
|
||||
public static final long H5T_NATIVE_SCHAR = H5T_NATIVE_SCHAR();
|
||||
@ -2532,6 +2552,8 @@ public class HDF5Constants {
|
||||
|
||||
private static native final long H5T_C_S1();
|
||||
|
||||
private static native final int H5T_COMPLEX();
|
||||
|
||||
private static native final int H5T_COMPOUND();
|
||||
|
||||
private static native final int H5T_CONV_CONV();
|
||||
@ -2540,6 +2562,18 @@ public class HDF5Constants {
|
||||
|
||||
private static native final int H5T_CONV_INIT();
|
||||
|
||||
private static native final long H5T_COMPLEX_IEEE_F16BE();
|
||||
|
||||
private static native final long H5T_COMPLEX_IEEE_F16LE();
|
||||
|
||||
private static native final long H5T_COMPLEX_IEEE_F32BE();
|
||||
|
||||
private static native final long H5T_COMPLEX_IEEE_F32LE();
|
||||
|
||||
private static native final long H5T_COMPLEX_IEEE_F64BE();
|
||||
|
||||
private static native final long H5T_COMPLEX_IEEE_F64LE();
|
||||
|
||||
private static native final int H5T_CSET_ERROR();
|
||||
|
||||
private static native final int H5T_CSET_ASCII();
|
||||
@ -2668,10 +2702,14 @@ public class HDF5Constants {
|
||||
|
||||
private static native final long H5T_NATIVE_DOUBLE();
|
||||
|
||||
private static native final long H5T_NATIVE_DOUBLE_COMPLEX();
|
||||
|
||||
private static native final long H5T_NATIVE_FLOAT();
|
||||
|
||||
private static native final long H5T_NATIVE_FLOAT16();
|
||||
|
||||
private static native final long H5T_NATIVE_FLOAT_COMPLEX();
|
||||
|
||||
private static native final long H5T_NATIVE_HADDR();
|
||||
|
||||
private static native final long H5T_NATIVE_HBOOL();
|
||||
@ -2714,6 +2752,8 @@ public class HDF5Constants {
|
||||
|
||||
private static native final long H5T_NATIVE_LONG();
|
||||
|
||||
private static native final long H5T_NATIVE_LDOUBLE_COMPLEX();
|
||||
|
||||
private static native final long H5T_NATIVE_OPAQUE();
|
||||
|
||||
private static native final long H5T_NATIVE_SCHAR();
|
||||
|
@ -2537,6 +2537,11 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1C_1S1(JNIEnv *env, jclass cls)
|
||||
return H5T_C_S1;
|
||||
}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX;
|
||||
}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPOUND(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPOUND;
|
||||
@ -2556,6 +2561,36 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1INIT(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_CONV_INIT;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX_1IEEE_1F16BE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX_IEEE_F16BE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX_1IEEE_1F16LE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX_IEEE_F16LE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX_1IEEE_1F32BE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX_IEEE_F32BE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX_1IEEE_1F32LE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX_IEEE_F32LE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX_1IEEE_1F64BE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX_IEEE_F64BE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPLEX_1IEEE_1F64LE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_COMPLEX_IEEE_F64LE;
|
||||
}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ERROR(JNIEnv *env, jclass cls)
|
||||
{
|
||||
@ -2877,6 +2912,11 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE(JNIEnv *env, jclass cls)
|
||||
return H5T_NATIVE_DOUBLE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE_1COMPLEX(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_NATIVE_DOUBLE_COMPLEX;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_NATIVE_FLOAT;
|
||||
@ -2887,6 +2927,11 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT16(JNIEnv *env, jclass cls)
|
||||
return H5T_NATIVE_FLOAT16;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT_1COMPLEX(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_NATIVE_FLOAT_COMPLEX;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_NATIVE_HADDR;
|
||||
@ -2992,6 +3037,11 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LONG(JNIEnv *env, jclass cls)
|
||||
return H5T_NATIVE_LONG;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LDOUBLE_1COMPLEX(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_NATIVE_LDOUBLE_COMPLEX;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1OPAQUE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_NATIVE_OPAQUE;
|
||||
|
@ -1237,12 +1237,13 @@ Java_hdf_hdf5lib_H5_H5Aread_1VLStrings(JNIEnv *env, jclass clss, jlong attr_id,
|
||||
jobjectArray buf)
|
||||
{
|
||||
H5T_class_t type_class;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isComplex = 0;
|
||||
htri_t isComplex2 = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
herr_t status = FAIL;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isCompound = 0;
|
||||
htri_t isVlen = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
bool isComposite = false;
|
||||
herr_t status = FAIL;
|
||||
|
||||
UNUSED(clss);
|
||||
|
||||
@ -1266,13 +1267,13 @@ Java_hdf_hdf5lib_H5_H5Aread_1VLStrings(JNIEnv *env, jclass clss, jlong attr_id,
|
||||
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
if ((isCompound = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
if ((isVlen = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
isComplex = isComplex || isComplex2;
|
||||
isComposite = isCompound || isVlen;
|
||||
|
||||
if (H5Tclose(nested_tid) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
@ -1283,7 +1284,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1VLStrings(JNIEnv *env, jclass clss, jlong attr_id,
|
||||
isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
|
||||
}
|
||||
|
||||
if (!isStr || isComplex || isVlenStr) {
|
||||
if (!isStr || isComposite || isVlenStr) {
|
||||
if ((status = H5AreadVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
}
|
||||
@ -1441,12 +1442,13 @@ Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings(JNIEnv *env, jclass clss, jlong attr_id,
|
||||
jobjectArray buf)
|
||||
{
|
||||
H5T_class_t type_class;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isComplex = 0;
|
||||
htri_t isComplex2 = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
herr_t status = FAIL;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isCompound = 0;
|
||||
htri_t isVlen = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
bool isComposite = false;
|
||||
herr_t status = FAIL;
|
||||
|
||||
UNUSED(clss);
|
||||
|
||||
@ -1470,13 +1472,13 @@ Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings(JNIEnv *env, jclass clss, jlong attr_id,
|
||||
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
if ((isCompound = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
if ((isVlen = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
isComplex = isComplex || isComplex2;
|
||||
isComposite = isCompound || isVlen;
|
||||
|
||||
if (H5Tclose(nested_tid) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
@ -1487,7 +1489,7 @@ Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings(JNIEnv *env, jclass clss, jlong attr_id,
|
||||
isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
|
||||
}
|
||||
|
||||
if (!isStr || isComplex || isVlenStr) {
|
||||
if (!isStr || isComposite || isVlenStr) {
|
||||
if ((status = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
}
|
||||
|
@ -1253,12 +1253,13 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_i
|
||||
jobjectArray buf)
|
||||
{
|
||||
H5T_class_t type_class;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isComplex = 0;
|
||||
htri_t isComplex2 = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
herr_t status = FAIL;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isCompound = 0;
|
||||
htri_t isVlen = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
bool isComposite = false;
|
||||
herr_t status = FAIL;
|
||||
|
||||
UNUSED(clss);
|
||||
|
||||
@ -1282,13 +1283,13 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_i
|
||||
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
if ((isCompound = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
if ((isVlen = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
isComplex = isComplex || isComplex2;
|
||||
isComposite = isCompound || isVlen;
|
||||
|
||||
if (H5Tclose(nested_tid) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
@ -1299,7 +1300,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_i
|
||||
isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
|
||||
}
|
||||
|
||||
if (!isStr || isComplex || isVlenStr) {
|
||||
if (!isStr || isComposite || isVlenStr) {
|
||||
if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
|
||||
(hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
@ -1478,12 +1479,13 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_
|
||||
jobjectArray buf)
|
||||
{
|
||||
H5T_class_t type_class;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isComplex = 0;
|
||||
htri_t isComplex2 = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
herr_t status = FAIL;
|
||||
htri_t isStr = 0;
|
||||
htri_t isVlenStr = 0;
|
||||
htri_t isCompound = 0;
|
||||
htri_t isVlen = 0;
|
||||
hid_t nested_tid = H5I_INVALID_HID;
|
||||
bool isComposite = false;
|
||||
herr_t status = FAIL;
|
||||
|
||||
UNUSED(clss);
|
||||
|
||||
@ -1507,13 +1509,13 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_
|
||||
if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
if ((isCompound = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
if ((isVlen = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
isComplex = isComplex || isComplex2;
|
||||
isComposite = isCompound || isVlen;
|
||||
|
||||
if (H5Tclose(nested_tid) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
@ -1524,7 +1526,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_
|
||||
isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
|
||||
}
|
||||
|
||||
if (!isStr || isComplex || isVlenStr) {
|
||||
if (!isStr || isComposite || isVlenStr) {
|
||||
if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
|
||||
(hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
|
@ -1641,6 +1641,25 @@ done:
|
||||
return (jint)ndims;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: _H5Tcomplex_create
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_H5__1H5Tcomplex_1create(JNIEnv *env, jclass clss, jlong base_id)
|
||||
{
|
||||
hid_t retVal = H5I_INVALID_HID;
|
||||
|
||||
UNUSED(clss);
|
||||
|
||||
if ((retVal = H5Tcomplex_create((hid_t)base_id)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
done:
|
||||
return (jlong)retVal;
|
||||
} /* end Java_hdf_hdf5lib_H5__1H5Tcomplex_1create */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Tconvert
|
||||
|
@ -479,6 +479,13 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *, jclass
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *, jclass, jlong, jlongArray);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: _H5Tcomplex_create
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcomplex_1create(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Tconvert
|
||||
|
@ -614,6 +614,43 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
size_t baseTypeSize;
|
||||
|
||||
if ((mtid = H5Tget_super(tid)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if (!(baseTypeSize = H5Tget_size(mtid)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if (NULL == (cptr = calloc(1, typeSize)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer");
|
||||
|
||||
/* Convert real part */
|
||||
if (!(h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, 0))) {
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Skip any whitespace */
|
||||
while (*this_str == ' ')
|
||||
this_str++;
|
||||
|
||||
/* Convert imaginary part */
|
||||
if (!(h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, baseTypeSize))) {
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (H5Tclose(mtid) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
mtid = H5I_INVALID_HID;
|
||||
|
||||
retVal = typeSize;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NCLASSES:
|
||||
case H5T_NO_CLASS: {
|
||||
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: invalid datatype class");
|
||||
@ -1476,6 +1513,48 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
h5str_t real_part, imag_part;
|
||||
size_t baseSize;
|
||||
|
||||
h5str_new(&real_part, 128);
|
||||
h5str_new(&imag_part, 128);
|
||||
|
||||
/* Get the base datatype for the complex number type */
|
||||
if ((mtid = H5Tget_super(tid)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if (!(baseSize = H5Tget_size(mtid)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
if (!h5str_sprintf(ENVONLY, &real_part, container, mtid, cptr, expand_data))
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
if (!h5str_sprintf(ENVONLY, &imag_part, container, mtid, cptr + baseSize, expand_data))
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
|
||||
if (!h5str_append(out_str, real_part.s))
|
||||
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
|
||||
|
||||
if (NULL == strstr(imag_part.s, "-"))
|
||||
if (!h5str_append(out_str, "+"))
|
||||
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
|
||||
|
||||
if (!h5str_append(out_str, imag_part.s))
|
||||
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
|
||||
|
||||
if (!h5str_append(out_str, "i"))
|
||||
H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
|
||||
|
||||
if (H5Tclose(mtid) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
mtid = H5I_INVALID_HID;
|
||||
|
||||
h5str_free(&real_part);
|
||||
h5str_free(&imag_part);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES: {
|
||||
H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: invalid datatype class");
|
||||
@ -2110,6 +2189,17 @@ h5str_get_little_endian_type(hid_t tid)
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
if (size == 4)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F16LE);
|
||||
else if (size == 8)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F32LE);
|
||||
else if (size == 16)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F64LE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES: {
|
||||
goto done;
|
||||
@ -2206,6 +2296,17 @@ h5str_get_big_endian_type(hid_t tid)
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
if (size == 4)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F16BE);
|
||||
else if (size == 8)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F32BE);
|
||||
else if (size == 16)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F64BE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES: {
|
||||
goto done;
|
||||
@ -2462,6 +2563,32 @@ h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hs
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
hid_t memb = H5I_INVALID_HID;
|
||||
|
||||
if ((memb = H5Tget_super(tid)) < 0) {
|
||||
ret_value = FAIL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (block_index = 0; block_index < block_nelmts; block_index++) {
|
||||
mem = ((unsigned char *)_mem) + block_index * size;
|
||||
|
||||
/* dump the complex number element */
|
||||
if (h5str_render_bin_output(stream, container, memb, mem, 2) < 0) {
|
||||
ret_value = FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (H5Tclose(memb) < 0) {
|
||||
ret_value = FAIL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES: {
|
||||
ret_value = FAIL;
|
||||
@ -4306,6 +4433,39 @@ translate_atomic_rbuf(JNIEnv *env, jlong mem_type_id, H5T_class_t type_class, vo
|
||||
|
||||
break;
|
||||
} /* H5T_STRING */
|
||||
case H5T_COMPLEX: {
|
||||
H5T_class_t base_class;
|
||||
size_t base_size, typeCount;
|
||||
void *objBuf = NULL;
|
||||
|
||||
if (!(typeSize = H5Tget_size(mem_type_id)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((memb = H5Tget_super(mem_type_id)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if (!(base_size = H5Tget_size(memb)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((base_class = H5Tget_class(memb)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
typeCount = typeSize / base_size;
|
||||
|
||||
if (NULL == (objBuf = malloc(typeSize)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate buffer");
|
||||
|
||||
memcpy((char *)objBuf, char_buf, typeSize);
|
||||
|
||||
/* The list we're going to return */
|
||||
if (NULL == (jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate list read buffer");
|
||||
|
||||
translate_rbuf(ENVONLY, jList, memb, base_class, (jsize)typeCount, objBuf);
|
||||
jobj = jList;
|
||||
|
||||
if (objBuf)
|
||||
free(objBuf);
|
||||
|
||||
break;
|
||||
}
|
||||
case H5T_TIME:
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
@ -4530,6 +4690,41 @@ translate_atomic_wbuf(JNIEnv *env, jobject in_obj, jlong mem_type_id, H5T_class_
|
||||
}
|
||||
break;
|
||||
} /* H5T_STRING */
|
||||
case H5T_COMPLEX: {
|
||||
H5T_class_t base_class;
|
||||
size_t base_size;
|
||||
void *objBuf = NULL;
|
||||
|
||||
if (!(typeSize = H5Tget_size(mem_type_id)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((memb = H5Tget_super(mem_type_id)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if (!(base_size = H5Tget_size(memb)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((base_class = H5Tget_class(memb)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
/* Convert each array element - invoke the toArray method */
|
||||
if (mToArray == NULL)
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, in_obj, mToArray);
|
||||
jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array);
|
||||
|
||||
if (jnelmts < 0)
|
||||
H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_atomic_wbuf: number of array elements < 0");
|
||||
|
||||
if (NULL == (objBuf = malloc((size_t)jnelmts * base_size)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_wbuf: failed to allocate buffer");
|
||||
|
||||
translate_wbuf(ENVONLY, array, memb, base_class, (jsize)jnelmts, objBuf);
|
||||
|
||||
memcpy(char_buf, (char *)objBuf, base_size * (size_t)jnelmts);
|
||||
|
||||
if (objBuf)
|
||||
free(objBuf);
|
||||
|
||||
break;
|
||||
}
|
||||
case H5T_TIME:
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
@ -4752,6 +4947,60 @@ translate_rbuf(JNIEnv *env, jobjectArray ret_buf, jlong mem_type_id, H5T_class_t
|
||||
}
|
||||
break;
|
||||
}
|
||||
case H5T_COMPLEX: {
|
||||
H5T_class_t base_class;
|
||||
size_t base_size, typeCount;
|
||||
void *objBuf = NULL;
|
||||
|
||||
if (!(typeSize = H5Tget_size(mem_type_id)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((memb = H5Tget_super(mem_type_id)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if (!(base_size = H5Tget_size(memb)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((base_class = H5Tget_class(memb)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
typeCount = typeSize / base_size;
|
||||
|
||||
if (NULL == (objBuf = malloc(typeSize)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "translate_atomic_rbuf: failed to allocate buffer");
|
||||
|
||||
/* Convert each element to a list of 2 floating-point elements */
|
||||
for (i = 0; i < (size_t)count; i++) {
|
||||
found_jList = JNI_TRUE;
|
||||
jList = NULL;
|
||||
|
||||
/* Get the object element */
|
||||
memcpy((char *)objBuf, char_buf + i * typeSize, typeSize);
|
||||
|
||||
/* The list we're going to return: */
|
||||
if (i < (size_t)ret_buflen) {
|
||||
if (NULL ==
|
||||
(jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)ret_buf, (jsize)i)))
|
||||
found_jList = JNI_FALSE;
|
||||
}
|
||||
if (NULL == jList) {
|
||||
if (NULL ==
|
||||
(jList = (jobjectArray)ENVPTR->NewObject(ENVONLY, arrCList, arrListMethod, 0)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY,
|
||||
"translate_rbuf: failed to allocate list read buffer");
|
||||
}
|
||||
|
||||
translate_rbuf(ENVONLY, jList, memb, base_class, (jsize)typeCount, objBuf);
|
||||
if (found_jList == JNI_FALSE)
|
||||
ENVPTR->CallBooleanMethod(ENVONLY, ret_buf, arrAddMethod, jList);
|
||||
else
|
||||
ENVPTR->SetObjectArrayElement(ENVONLY, ret_buf, (jsize)i, jList);
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
|
||||
ENVPTR->DeleteLocalRef(ENVONLY, jList);
|
||||
}
|
||||
|
||||
if (objBuf)
|
||||
free(objBuf);
|
||||
|
||||
break;
|
||||
}
|
||||
case H5T_TIME:
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
@ -4914,6 +5163,39 @@ translate_wbuf(JNIEnv *env, jobjectArray in_buf, jlong mem_type_id, H5T_class_t
|
||||
}
|
||||
break;
|
||||
}
|
||||
case H5T_COMPLEX: {
|
||||
H5T_class_t base_class;
|
||||
size_t base_size;
|
||||
|
||||
if ((memb = H5Tget_super(mem_type_id)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if (!(base_size = H5Tget_size(memb)))
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
if ((base_class = H5Tget_class(memb)) < 0)
|
||||
H5_LIBRARY_ERROR(ENVONLY);
|
||||
|
||||
/* Convert each list to an array element */
|
||||
for (i = 0; i < (size_t)count; i++) {
|
||||
if (NULL == (jList = ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)in_buf, (jsize)i)))
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
|
||||
/* invoke the toArray method */
|
||||
if (mToArray == NULL)
|
||||
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
|
||||
jobjectArray array = (jobjectArray)ENVPTR->CallObjectMethod(ENVONLY, jList, mToArray);
|
||||
jsize jnelmts = ENVPTR->GetArrayLength(ENVONLY, array);
|
||||
|
||||
if (jnelmts < 0)
|
||||
H5_BAD_ARGUMENT_ERROR(ENVONLY, "translate_wbuf: number of array elements < 0");
|
||||
|
||||
translate_wbuf(ENVONLY, array, memb, base_class, jnelmts,
|
||||
char_buf + i * base_size * (size_t)jnelmts);
|
||||
|
||||
ENVPTR->DeleteLocalRef(ENVONLY, jList);
|
||||
} /* end for (i = 0; i < count; i++) */
|
||||
|
||||
break;
|
||||
}
|
||||
case H5T_TIME:
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
|
@ -240,6 +240,60 @@ public class TestH5T {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Tcomplex_create()
|
||||
{
|
||||
String class_name;
|
||||
long[] fields1 = {0, 0, 0, 0, 0};
|
||||
long[] fields2 = {0, 0, 0, 0, 0};
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long dt_size = -1;
|
||||
int typeclass = -1;
|
||||
int typeorder = HDF5Constants.H5T_ORDER_ERROR;
|
||||
int prec1 = 0;
|
||||
int prec2 = 0;
|
||||
|
||||
try {
|
||||
filetype_id = H5.H5Tcomplex_create(HDF5Constants.H5T_IEEE_F32LE);
|
||||
assertTrue("testH5Tcomplex_create:H5Tcomplex_create", filetype_id >= 0);
|
||||
|
||||
typeclass = H5.H5Tget_class(filetype_id);
|
||||
assertTrue("H5.H5Tget_class", typeclass > 0);
|
||||
class_name = H5.H5Tget_class_name(typeclass);
|
||||
assertTrue("H5.H5Tget_class_name", class_name.compareTo("H5T_COMPLEX") == 0);
|
||||
|
||||
dt_size = H5.H5Tget_size(filetype_id);
|
||||
assertTrue("H5.H5Tget_size", dt_size == 8);
|
||||
|
||||
typeorder = H5.H5Tget_order(filetype_id);
|
||||
assertTrue("H5.H5Tget_order", typeorder == HDF5Constants.H5T_ORDER_LE);
|
||||
|
||||
prec1 = H5.H5Tget_precision(HDF5Constants.H5T_IEEE_F32LE);
|
||||
prec2 = H5.H5Tget_precision(filetype_id);
|
||||
assertTrue("H5.H5Tget_precision", prec1 == prec2);
|
||||
|
||||
H5.H5Tget_fields(HDF5Constants.H5T_IEEE_F32LE, fields1);
|
||||
H5.H5Tget_fields(filetype_id, fields2);
|
||||
assertTrue("H5.H5Tget_fields[spos]", fields1[0] == fields2[0]);
|
||||
assertTrue("H5.H5Tget_fields[epos]", fields1[1] == fields2[1]);
|
||||
assertTrue("H5.H5Tget_fields[esize]", fields1[2] == fields2[2]);
|
||||
assertTrue("H5.H5Tget_fields[mpos]", fields1[3] == fields2[3]);
|
||||
assertTrue("H5.H5Tget_fields[msize]", fields1[4] == fields2[4]);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Tcomplex_create " + err);
|
||||
}
|
||||
finally {
|
||||
if (filetype_id >= 0)
|
||||
try {
|
||||
H5.H5Tclose(filetype_id);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Tenum_functions()
|
||||
{
|
||||
|
@ -11,9 +11,10 @@ JUnit version 4.13.2
|
||||
.testH5Tcompound_functions
|
||||
.testH5Tget_size
|
||||
.testH5Tarray_create
|
||||
.testH5Tcomplex_create
|
||||
.testH5Topaque_functions
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (13 tests)
|
||||
OK (14 tests)
|
||||
|
||||
|
@ -151,6 +151,200 @@ New Features
|
||||
|
||||
Library:
|
||||
--------
|
||||
- Added support for complex number datatypes
|
||||
|
||||
Support for the C99 "float _Complex", "double _Complex" and "long double _Complex"
|
||||
(with MSVC, "_Fcomplex", "_Dcomplex" and "_Lcomplex") types has been added for
|
||||
platforms/compilers that support them. These types have been implemented with a
|
||||
new datatype class, H5T_COMPLEX. Note that any datatypes of class H5T_COMPLEX
|
||||
will not be readable with previous versions of HDF5. If a file is accessed with
|
||||
a library version bounds "high" setting less than H5F_LIBVER_V200, an error will
|
||||
occur if the application tries to create an object with a complex number datatype.
|
||||
If compatibility with previous versions of HDF5 is desired, applications should
|
||||
instead consider adopting one of the existing conventions at
|
||||
https://nc-complex.readthedocs.io/en/latest/#conventions-used-in-applications.
|
||||
|
||||
The following new macros have been added:
|
||||
|
||||
- H5_HAVE_COMPLEX_NUMBERS
|
||||
|
||||
This macro is defined in H5pubconf.h and will have the value 1 if native
|
||||
support for complex numbers is available. It will not be defined otherwise.
|
||||
|
||||
- H5_HAVE_C99_COMPLEX_NUMBERS
|
||||
|
||||
This macro is defined in H5pubconf.h and will have the value 1 if native
|
||||
support for C99 complex numbers is available. It will not be defined otherwise.
|
||||
If this macro is not defined but H5_HAVE_COMPLEX_NUMBERS is defined, the
|
||||
complex number types supported are the MSVC types.
|
||||
|
||||
- H5_SIZEOF_FLOAT_COMPLEX
|
||||
|
||||
This macro is defined in H5pubconf.h and will have a value corresponding
|
||||
to the size of the native float complex datatype, as computed by sizeof().
|
||||
If C99 complex number support is available, this will be the size of the
|
||||
"float _Complex" type. Otherwise, it will be the size of the "_Fcomplex"
|
||||
type. It will have the value 0 if support for a native float complex datatype
|
||||
is not available.
|
||||
|
||||
- H5_SIZEOF_DOUBLE_COMPLEX
|
||||
|
||||
This macro is defined in H5pubconf.h and will have a value corresponding
|
||||
to the size of the native double complex datatype, as computed by sizeof().
|
||||
If C99 complex number support is available, this will be the size of the
|
||||
"double _Complex" type. Otherwise, it will be the size of the "_Dcomplex"
|
||||
type. It will have the value 0 if support for a native double complex datatype
|
||||
is not available.
|
||||
|
||||
- H5_SIZEOF_LONG_DOUBLE_COMPLEX
|
||||
|
||||
This macro is defined in H5pubconf.h and will have a value corresponding
|
||||
to the size of the native long double complex datatype, as computed by sizeof().
|
||||
If C99 complex number support is available, this will be the size of the
|
||||
"long double _Complex" type. Otherwise, it will be the size of the "_Lcomplex"
|
||||
type. It will have the value 0 if support for a native long double complex
|
||||
datatype is not available.
|
||||
|
||||
- H5T_NATIVE_FLOAT_COMPLEX
|
||||
|
||||
This macro maps to the ID of an HDF5 datatype representing the native C
|
||||
float complex datatype (either "float _Complex" or "_Fcomplex") for the
|
||||
platform. If support for a native float complex datatype is not available
|
||||
(H5_HAVE_COMPLEX_NUMBERS is not defined), the macro will map to
|
||||
H5I_INVALID_HID and should not be used.
|
||||
|
||||
- H5T_NATIVE_DOUBLE_COMPLEX
|
||||
|
||||
This macro maps to the ID of an HDF5 datatype representing the native C
|
||||
double complex datatype (either "double _Complex" or "_Dcomplex") for the
|
||||
platform. If support for a native double complex datatype is not available
|
||||
(H5_HAVE_COMPLEX_NUMBERS is not defined), the macro will map to
|
||||
H5I_INVALID_HID and should not be used.
|
||||
|
||||
- H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
|
||||
This macro maps to the ID of an HDF5 datatype representing the native C
|
||||
long double complex datatype (either "long double _Complex" or "_Lcomplex")
|
||||
for the platform. If support for a native long double complex datatype is
|
||||
not available (H5_HAVE_COMPLEX_NUMBERS is not defined), the macro will map
|
||||
to H5I_INVALID_HID and should not be used.
|
||||
|
||||
- H5T_COMPLEX_IEEE_F16LE / H5T_COMPLEX_IEEE_F16BE
|
||||
|
||||
These macros map to IDs of HDF5 datatypes representing a complex number of
|
||||
two parts, each of which is an IEEE 754 16-bit floating-point datatype in
|
||||
little- or big-endian order. These datatypes are available regardless of
|
||||
whether complex number support is available or not.
|
||||
|
||||
- H5T_COMPLEX_IEEE_F32LE / H5T_COMPLEX_IEEE_F32BE
|
||||
|
||||
These macros map to IDs of HDF5 datatypes representing a complex number of
|
||||
two parts, each of which is an IEEE 754 32-bit floating-point datatype in
|
||||
little- or big-endian order. These datatypes are available regardless of
|
||||
whether complex number support is available or not.
|
||||
|
||||
- H5T_COMPLEX_IEEE_F64LE / H5T_COMPLEX_IEEE_F64BE
|
||||
|
||||
These macros map to IDs of HDF5 datatypes representing a complex number of
|
||||
two parts, each of which is an IEEE 754 64-bit floating-point datatype in
|
||||
little- or big-endian order. These datatypes are available regardless of
|
||||
whether complex number support is available or not.
|
||||
|
||||
The following new API function has been added:
|
||||
|
||||
hid_t H5Tcomplex_create(hid_t base_type_id);
|
||||
|
||||
Creates a new complex number datatype from the base datatype specified
|
||||
by the given HDF5 ID `base_type_id`. The base datatype must be a
|
||||
floating-point datatype.
|
||||
|
||||
The following new hard datatype conversion paths have been added, but
|
||||
will only be used when complex number support is available:
|
||||
|
||||
H5T_NATIVE_SCHAR <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_UCHAR <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
H5T_NATIVE_SHORT <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_USHORT <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
H5T_NATIVE_INT <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_UINT <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
H5T_NATIVE_LONG <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_ULONG <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
H5T_NATIVE_LLONG <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_ULLONG <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
H5T_NATIVE_FLOAT16 <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_FLOAT <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
H5T_NATIVE_DOUBLE <-> H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_LDOUBLE <-> H5T_NATIVE_FLOAT_COMPLEX
|
||||
|
||||
H5T_NATIVE_SCHAR <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_UCHAR <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_SHORT <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_USHORT <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_INT <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_UINT <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_LONG <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_ULONG <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_LLONG <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_ULLONG <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_FLOAT16 <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_FLOAT <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_DOUBLE <-> H5T_NATIVE_DOUBLE_COMPLEX | H5T_NATIVE_LDOUBLE <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
|
||||
H5T_NATIVE_SCHAR <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_UCHAR <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_SHORT <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_USHORT <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_INT <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_UINT <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_LONG <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_ULONG <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_LLONG <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_ULLONG <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_FLOAT16 <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_FLOAT <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_DOUBLE <-> H5T_NATIVE_LDOUBLE_COMPLEX | H5T_NATIVE_LDOUBLE <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
|
||||
H5T_NATIVE_FLOAT_COMPLEX <-> H5T_NATIVE_DOUBLE_COMPLEX
|
||||
H5T_NATIVE_FLOAT_COMPLEX <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
H5T_NATIVE_DOUBLE_COMPLEX <-> H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
|
||||
Alternative software implementation conversion paths have been added for all of
|
||||
the above for use when native complex number support is not available. All of these
|
||||
conversion paths follow the behavior outlined in the C standard for conversions of
|
||||
complex number values.
|
||||
|
||||
Additionally, a special datatype conversion path has been added between complex number
|
||||
datatypes and array or compound datatypes where the in-memory layout of data is the
|
||||
same between the datatypes and data can be directly converted. This conversion path
|
||||
is subject to the following rules:
|
||||
|
||||
- An array datatype must consist of exactly two elements where each element is of
|
||||
the same floating-point datatype as the complex number datatype's base floating-point
|
||||
datatype.
|
||||
|
||||
- A compound datatype must consist of exactly two fields where each field is of the
|
||||
same floating-point datatype as the complex number datatype's base floating-point
|
||||
datatype. The compound datatype must not have any leading or trailing structure
|
||||
padding or any padding between its two fields. The fields must also have compatible
|
||||
names, must have compatible offsets within the datatype and must be in the order
|
||||
of "real" part -> "imaginary" part, such that the compound datatype matches the
|
||||
following representation:
|
||||
|
||||
H5T_COMPOUND {
|
||||
<float_type> "r(e)(a)(l)"; OFFSET 0
|
||||
<float_type> "i(m)(a)(g)(i)(n)(a)(r)(y)"; OFFSET SIZEOF("r(e)(a)(l)")
|
||||
}
|
||||
|
||||
where "r(e)(a)(l)" means the field may be named any substring of "real", such as
|
||||
"r", or "re" and "i(m)(a)(g)(i)(n)(a)(r)(y)" means the field may be named any
|
||||
substring of "imaginary", such as "im" or "imag".
|
||||
|
||||
Support for complex numbers has been added to the h5dump, h5ls and h5diff/ph5diff
|
||||
tools. The h5dump command-line option '-m' can be used to change the floating-point
|
||||
printing format for the float complex and double complex datatypes, as well as
|
||||
the long double complex datatype if it has the same size as a double complex
|
||||
datatype.
|
||||
|
||||
Support for the predefined complex number datatypes and the H5Tcomplex_create
|
||||
function has been added to the Java wrappers. However, Java does not have
|
||||
official types for complex numbers, so an application must be sure that
|
||||
data is in an appropriate format in-memory when using these datatypes.
|
||||
|
||||
Support for the Fortran wrappers has not yet been added.
|
||||
|
||||
Support for the predefined complex number datatypes and the H5Tcomplex_create
|
||||
function has been added to the high level library, allowing them to work
|
||||
with the H5LTtext_to_dtype and H5LTdtype_to_text functions.
|
||||
|
||||
Simple example programs showing how to use complex number datatypes have
|
||||
been added in the following files:
|
||||
|
||||
- HDF5Examples/C/H5T/200/h5ex_t_complex.c (Uses C99 complex number types)
|
||||
- HDF5Examples/C/H5T/200/h5ex_t_complex_msvc.c (Uses MSVC complex number types)
|
||||
- HDF5Examples/C/H5T/200/h5ex_t_complex_custom.c (Uses H5Tcomplex_create to create
|
||||
a custom complex number type)
|
||||
|
||||
- The H5VLstart_lib_state / H5VLfinish_lib_state API routines for pass-
|
||||
through connector authors now require a parameter that can be used to
|
||||
store the library's context.
|
||||
|
@ -600,17 +600,19 @@ set (H5T_SOURCES
|
||||
${HDF5_SRC_DIR}/H5Tarray.c
|
||||
${HDF5_SRC_DIR}/H5Tbit.c
|
||||
${HDF5_SRC_DIR}/H5Tcommit.c
|
||||
${HDF5_SRC_DIR}/H5Tcomplex.c
|
||||
${HDF5_SRC_DIR}/H5Tcompound.c
|
||||
${HDF5_SRC_DIR}/H5Tconv.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_integer.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_float.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_string.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_bitfield.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_compound.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_reference.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_enum.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_vlen.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_array.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_bitfield.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_complex.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_compound.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_enum.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_float.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_integer.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_reference.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_string.c
|
||||
${HDF5_SRC_DIR}/H5Tconv_vlen.c
|
||||
${HDF5_SRC_DIR}/H5Tcset.c
|
||||
${HDF5_SRC_DIR}/H5Tdbg.c
|
||||
${HDF5_SRC_DIR}/H5Tdeprec.c
|
||||
@ -979,6 +981,7 @@ set (H5_PRIVATE_HEADERS
|
||||
${HDF5_SRC_DIR}/H5Tconv.h
|
||||
${HDF5_SRC_DIR}/H5Tconv_array.h
|
||||
${HDF5_SRC_DIR}/H5Tconv_bitfield.h
|
||||
${HDF5_SRC_DIR}/H5Tconv_complex.h
|
||||
${HDF5_SRC_DIR}/H5Tconv_compound.h
|
||||
${HDF5_SRC_DIR}/H5Tconv_enum.h
|
||||
${HDF5_SRC_DIR}/H5Tconv_float.h
|
||||
|
@ -240,7 +240,7 @@
|
||||
* Tools</a>
|
||||
* page under
|
||||
* <a href="https://\DOXURL/_view_tools_command.html">Command-line Tools</a>.
|
||||
* The HDF5 DDL grammar is described in the document \ref DDLBNF114.
|
||||
* The HDF5 DDL grammar is described in the document \ref DDLBNF200.
|
||||
*
|
||||
* \subsection subsec_file_summary File Function Summaries
|
||||
* General library (\ref H5 functions and macros), (\ref H5F functions), file related
|
||||
|
@ -344,7 +344,7 @@
|
||||
*
|
||||
* h5dump is described on the “HDF5 Tools” page of the \ref RM.
|
||||
*
|
||||
* The HDF5 DDL grammar is described in the @ref DDLBNF114.
|
||||
* The HDF5 DDL grammar is described in the @ref DDLBNF200.
|
||||
*
|
||||
* \subsection subsec_group_function Group Function Summaries
|
||||
* Functions that can be used with groups (\ref H5G functions) and property list functions that can used
|
||||
|
@ -830,6 +830,52 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t
|
||||
dt->shared->force_conv = true;
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
bool homogeneous;
|
||||
|
||||
/*
|
||||
* Complex number datatypes...
|
||||
*/
|
||||
|
||||
/* Set whether the complex number datatype is homogeneous */
|
||||
homogeneous = (bool)(flags & 0x01);
|
||||
|
||||
if (!homogeneous)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
|
||||
"heterogeneous complex number datatypes are currently unsupported");
|
||||
|
||||
/* Set the form of the complex number datatype */
|
||||
dt->shared->u.cplx.form = (H5T_complex_form_t)((flags >> 1) & 0x03);
|
||||
|
||||
if (dt->shared->u.cplx.form != H5T_COMPLEX_RECTANGULAR)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
|
||||
"only complex number datatypes in rectangular form are currently supported");
|
||||
|
||||
/* Other bits of the flags beyond bits 0,1,2 should not be set */
|
||||
if ((flags >> 3) != 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL,
|
||||
"invalid flag bits set for complex number datatype");
|
||||
|
||||
/* Decode the base datatype of the complex number */
|
||||
if (NULL == (dt->shared->parent = H5T__alloc()))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL,
|
||||
"unable to allocate complex number base datatype");
|
||||
if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent, skip, p_end) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL,
|
||||
"unable to decode complex number base datatype");
|
||||
|
||||
/* Check if the parent of this complex number type has a version greater
|
||||
* than the type itself.
|
||||
*/
|
||||
H5O_DTYPE_CHECK_VERSION(dt, version, dt->shared->parent->shared->version, ioflags, "complex",
|
||||
FAIL)
|
||||
|
||||
/* There should be no complex number datatypes with version < 5. */
|
||||
H5O_DTYPE_CHECK_VERSION(dt, version, H5O_DTYPE_VERSION_5, ioflags, "complex", FAIL)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
@ -1347,6 +1393,32 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type");
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
/* Check that the version is valid */
|
||||
assert(dt->shared->version >= H5O_DTYPE_VERSION_5);
|
||||
|
||||
/* Check that the version is at least as great as the parent */
|
||||
assert(dt->shared->version >= dt->shared->parent->shared->version);
|
||||
|
||||
if (dt->shared->u.cplx.form != H5T_COMPLEX_RECTANGULAR)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL,
|
||||
"complex number datatypes not in rectangular form are currently unsupported");
|
||||
|
||||
/* Store that complex number is homogeneous in first flag bit;
|
||||
* Currently, only homogeneous complex number datatypes are supported.
|
||||
*/
|
||||
flags |= 0x01;
|
||||
|
||||
/* Store complex number form in next two bits */
|
||||
flags = (unsigned)(flags | (((unsigned)dt->shared->u.cplx.form & 0x03) << 1));
|
||||
|
||||
/* Encode the base datatype of the complex number */
|
||||
if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL,
|
||||
"unable to encode complex number base datatype");
|
||||
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
@ -1644,6 +1716,10 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg)
|
||||
ret_value += H5O__dtype_size(f, dt->shared->parent);
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
ret_value += H5O__dtype_size(f, dt->shared->parent);
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_STRING:
|
||||
case H5T_REFERENCE:
|
||||
@ -2001,6 +2077,10 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
s = "vlen";
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
s = "complex number";
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
@ -2244,6 +2324,25 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
fprintf(stream, "%*s%s\n", indent, "", "Base type:");
|
||||
H5O__dtype_debug(f, dt->shared->parent, stream, indent + 3, MAX(0, fwidth - 3));
|
||||
} /* end else if */
|
||||
else if (H5T_COMPLEX == dt->shared->type) {
|
||||
switch (dt->shared->u.cplx.form) {
|
||||
case H5T_COMPLEX_RECTANGULAR:
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Form:", "rectangular");
|
||||
break;
|
||||
case H5T_COMPLEX_POLAR:
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Form:", "polar");
|
||||
break;
|
||||
case H5T_COMPLEX_EXPONENTIAL:
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Form:", "exponential");
|
||||
break;
|
||||
default:
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Form:", "invalid");
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stream, "%*s%s\n", indent, "", "Base type:");
|
||||
H5O__dtype_debug(f, dt->shared->parent, stream, indent + 3, MAX(0, fwidth - 3));
|
||||
}
|
||||
else {
|
||||
switch (dt->shared->u.atomic.order) {
|
||||
case H5T_ORDER_LE:
|
||||
|
@ -1461,14 +1461,14 @@ H5Pget_driver(hid_t plist_id)
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list");
|
||||
|
||||
/* Get the driver */
|
||||
if ((ret_value = H5P_peek_driver(plist)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver");
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get driver");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
|
@ -1035,14 +1035,14 @@ H5Pget_elink_fapl(hid_t lapl_id)
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* Get the plist structure */
|
||||
if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS)))
|
||||
HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID");
|
||||
HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID");
|
||||
|
||||
if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links");
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
|
10
src/H5S.c
10
src/H5S.c
@ -373,23 +373,23 @@ H5Screate(H5S_class_t type)
|
||||
H5S_t *new_ds = NULL; /* New dataspace structure */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* Check args */
|
||||
if (type <= H5S_NO_CLASS || type > H5S_NULL) /* don't allow complex dataspace yet */
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace type");
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dataspace type");
|
||||
|
||||
if (NULL == (new_ds = H5S_create(type)))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace");
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create dataspace");
|
||||
|
||||
/* Register */
|
||||
if ((ret_value = H5I_register(H5I_DATASPACE, new_ds, true)) < 0)
|
||||
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID");
|
||||
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID");
|
||||
|
||||
done:
|
||||
if (ret_value < 0)
|
||||
if (new_ds && H5S_close(new_ds) < 0)
|
||||
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace");
|
||||
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace");
|
||||
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Screate() */
|
||||
|
@ -255,10 +255,10 @@ H5_DLL hid_t H5Scopy(hid_t space_id);
|
||||
* Further dataspace types may be added later.
|
||||
*
|
||||
* A scalar dataspace, #H5S_SCALAR, has a single element, though that
|
||||
* element may be of a complex datatype, such as a compound or array
|
||||
* element may be of a composite datatype, such as a compound or array
|
||||
* datatype. By convention, the rank of a scalar dataspace is always \p 0
|
||||
* (zero); think of it geometrically as a single, dimensionless point,
|
||||
* though that point can be complex.
|
||||
* though that point can be composite.
|
||||
*
|
||||
* A simple dataspace, #H5S_SIMPLE, consists of a regular array of elements.
|
||||
*
|
||||
|
@ -2655,39 +2655,39 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, hid_t src
|
||||
H5S_t *proj_space = NULL; /* Output dataspace */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* Check args */
|
||||
if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace");
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace");
|
||||
if (NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace");
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace");
|
||||
if (NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace");
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace");
|
||||
|
||||
/* Check numbers of points selected matches in source and destination */
|
||||
if (H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID,
|
||||
"number of points selected in source space does not match that in destination space");
|
||||
|
||||
/* Check numbers of dimensions matches in source and source intersect spaces
|
||||
*/
|
||||
if (H5S_GET_EXTENT_NDIMS(src_space) != H5S_GET_EXTENT_NDIMS(src_intersect_space))
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID,
|
||||
"rank of source space does not match rank of source intersect space");
|
||||
|
||||
/* Perform operation */
|
||||
if (H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, false) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection");
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, H5I_INVALID_HID, "can't project dataspace intersection");
|
||||
|
||||
/* Register */
|
||||
if ((ret_value = H5I_register(H5I_DATASPACE, proj_space, true)) < 0)
|
||||
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID");
|
||||
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID");
|
||||
|
||||
done:
|
||||
if (ret_value < 0)
|
||||
if (proj_space && H5S_close(proj_space) < 0)
|
||||
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace");
|
||||
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace");
|
||||
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Sselect_project_intersection() */
|
||||
|
638
src/H5T.c
638
src/H5T.c
@ -53,6 +53,7 @@
|
||||
#include "H5Tconv_enum.h"
|
||||
#include "H5Tconv_vlen.h"
|
||||
#include "H5Tconv_array.h"
|
||||
#include "H5Tconv_complex.h"
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
@ -432,6 +433,13 @@ hid_t H5T_IEEE_F32LE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_IEEE_F64BE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_IEEE_F64LE_g = H5I_INVALID_HID;
|
||||
|
||||
hid_t H5T_COMPLEX_IEEE_F16BE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_COMPLEX_IEEE_F16LE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_COMPLEX_IEEE_F32BE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_COMPLEX_IEEE_F32LE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_COMPLEX_IEEE_F64BE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_COMPLEX_IEEE_F64LE_g = H5I_INVALID_HID;
|
||||
|
||||
hid_t H5T_VAX_F32_g = H5I_INVALID_HID;
|
||||
hid_t H5T_VAX_F64_g = H5I_INVALID_HID;
|
||||
|
||||
@ -472,30 +480,33 @@ hid_t H5T_C_S1_g = H5I_INVALID_HID;
|
||||
|
||||
hid_t H5T_FORTRAN_S1_g = H5I_INVALID_HID;
|
||||
|
||||
hid_t H5T_NATIVE_SCHAR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_UCHAR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_SHORT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_USHORT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_INT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_UINT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_ULONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LLONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_ULLONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_FLOAT16_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_FLOAT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_DOUBLE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LDOUBLE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B8_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B16_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B32_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B64_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_OPAQUE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HADDR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HSIZE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HSSIZE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HERR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HBOOL_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_SCHAR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_UCHAR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_SHORT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_USHORT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_INT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_UINT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_ULONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LLONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_ULLONG_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_FLOAT16_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_FLOAT_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_DOUBLE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LDOUBLE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_FLOAT_COMPLEX_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_DOUBLE_COMPLEX_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_LDOUBLE_COMPLEX_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B8_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B16_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B32_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_B64_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_OPAQUE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HADDR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HSIZE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HSSIZE_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HERR_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_HBOOL_g = H5I_INVALID_HID;
|
||||
|
||||
hid_t H5T_NATIVE_INT8_g = H5I_INVALID_HID;
|
||||
hid_t H5T_NATIVE_UINT8_g = H5I_INVALID_HID;
|
||||
@ -541,20 +552,23 @@ size_t H5T_HOBJREF_ALIGN_g = 0;
|
||||
size_t H5T_HDSETREGREF_ALIGN_g = 0;
|
||||
size_t H5T_REF_ALIGN_g = 0;
|
||||
|
||||
size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_INT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UINT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_FLOAT16_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_INT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_UINT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_FLOAT16_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_FLOAT_COMPLEX_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_DOUBLE_COMPLEX_ALIGN_g = 0;
|
||||
size_t H5T_NATIVE_LDOUBLE_COMPLEX_ALIGN_g = 0;
|
||||
|
||||
/* Alignment constraints for C99 types */
|
||||
size_t H5T_NATIVE_INT8_ALIGN_g = 0;
|
||||
@ -596,10 +610,20 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
|
||||
H5__Float16 H5T_NATIVE_FLOAT16_POS_INF_g = 0.0f;
|
||||
H5__Float16 H5T_NATIVE_FLOAT16_NEG_INF_g = 0.0f;
|
||||
#endif
|
||||
float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F;
|
||||
float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F;
|
||||
double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
|
||||
double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
|
||||
float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F;
|
||||
float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F;
|
||||
double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
|
||||
double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
|
||||
long double H5T_NATIVE_LDOUBLE_POS_INF_g = 0.0L;
|
||||
long double H5T_NATIVE_LDOUBLE_NEG_INF_g = 0.0L;
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_float_complex H5T_NATIVE_FLOAT_COMPLEX_POS_INF_g;
|
||||
H5_float_complex H5T_NATIVE_FLOAT_COMPLEX_NEG_INF_g;
|
||||
H5_double_complex H5T_NATIVE_DOUBLE_COMPLEX_POS_INF_g;
|
||||
H5_double_complex H5T_NATIVE_DOUBLE_COMPLEX_NEG_INF_g;
|
||||
H5_ldouble_complex H5T_NATIVE_LDOUBLE_COMPLEX_POS_INF_g;
|
||||
H5_ldouble_complex H5T_NATIVE_LDOUBLE_COMPLEX_NEG_INF_g;
|
||||
#endif
|
||||
|
||||
/* Declare the free list for H5T_t's and H5T_shared_t's */
|
||||
H5FL_DEFINE(H5T_t);
|
||||
@ -612,7 +636,7 @@ const unsigned H5O_dtype_ver_bounds[] = {
|
||||
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */
|
||||
H5O_DTYPE_VERSION_4, /* H5F_LIBVER_V112 */
|
||||
H5O_DTYPE_VERSION_4, /* H5F_LIBVER_V114 */
|
||||
H5O_DTYPE_VERSION_4, /* H5F_LIBVER_V200 */
|
||||
H5O_DTYPE_VERSION_5, /* H5F_LIBVER_V200 */
|
||||
H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
@ -777,6 +801,47 @@ H5T__init_inf(void)
|
||||
} /* end for */
|
||||
} /* end if */
|
||||
|
||||
/* Get the long double datatype */
|
||||
if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
dst = &dst_p->shared->u.atomic;
|
||||
|
||||
/* Check that we can re-order the bytes correctly */
|
||||
if (H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
|
||||
|
||||
/* +Inf */
|
||||
d = (uint8_t *)&H5T_NATIVE_LDOUBLE_POS_INF_g;
|
||||
H5T__bit_set(d, dst->u.f.sign, (size_t)1, false);
|
||||
H5T__bit_set(d, dst->u.f.epos, dst->u.f.esize, true);
|
||||
H5T__bit_set(d, dst->u.f.mpos, dst->u.f.msize, false);
|
||||
|
||||
/* Swap the bytes if the machine architecture is big-endian */
|
||||
if (H5T_ORDER_BE == H5T_native_order_g) {
|
||||
half_size = dst_p->shared->size / 2;
|
||||
for (u = 0; u < half_size; u++) {
|
||||
uint8_t tmp = d[dst_p->shared->size - (u + 1)];
|
||||
d[dst_p->shared->size - (u + 1)] = d[u];
|
||||
d[u] = tmp;
|
||||
} /* end for */
|
||||
} /* end if */
|
||||
|
||||
/* -Inf */
|
||||
d = (uint8_t *)&H5T_NATIVE_LDOUBLE_NEG_INF_g;
|
||||
H5T__bit_set(d, dst->u.f.sign, (size_t)1, true);
|
||||
H5T__bit_set(d, dst->u.f.epos, dst->u.f.esize, true);
|
||||
H5T__bit_set(d, dst->u.f.mpos, dst->u.f.msize, false);
|
||||
|
||||
/* Swap the bytes if the machine architecture is big-endian */
|
||||
if (H5T_ORDER_BE == H5T_native_order_g) {
|
||||
half_size = dst_p->shared->size / 2;
|
||||
for (u = 0; u < half_size; u++) {
|
||||
uint8_t tmp = d[dst_p->shared->size - (u + 1)];
|
||||
d[dst_p->shared->size - (u + 1)] = d[u];
|
||||
d[u] = tmp;
|
||||
} /* end for */
|
||||
} /* end if */
|
||||
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
/* Get the _Float16 datatype */
|
||||
if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT16_g)))
|
||||
@ -820,6 +885,22 @@ H5T__init_inf(void)
|
||||
} /* end if */
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/*
|
||||
* A complex number is considered to be infinite if any of its parts
|
||||
* (real or imaginary) is infinite, so simply set the real part of
|
||||
* the complex number positive/negative infinity values to the
|
||||
* positive/negative infinity value for the base floating-point type.
|
||||
* The imaginary part should be zeroed-out bits.
|
||||
*/
|
||||
memcpy(&H5T_NATIVE_FLOAT_COMPLEX_POS_INF_g, &H5T_NATIVE_FLOAT_POS_INF_g, sizeof(float));
|
||||
memcpy(&H5T_NATIVE_FLOAT_COMPLEX_NEG_INF_g, &H5T_NATIVE_FLOAT_NEG_INF_g, sizeof(float));
|
||||
memcpy(&H5T_NATIVE_DOUBLE_COMPLEX_POS_INF_g, &H5T_NATIVE_DOUBLE_POS_INF_g, sizeof(double));
|
||||
memcpy(&H5T_NATIVE_DOUBLE_COMPLEX_NEG_INF_g, &H5T_NATIVE_DOUBLE_NEG_INF_g, sizeof(double));
|
||||
memcpy(&H5T_NATIVE_LDOUBLE_COMPLEX_POS_INF_g, &H5T_NATIVE_LDOUBLE_POS_INF_g, sizeof(long double));
|
||||
memcpy(&H5T_NATIVE_LDOUBLE_COMPLEX_NEG_INF_g, &H5T_NATIVE_LDOUBLE_NEG_INF_g, sizeof(long double));
|
||||
#endif
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5T__init_inf() */
|
||||
@ -859,6 +940,7 @@ H5T__init_package(void)
|
||||
H5T_t *std_u64le = NULL; /* Datatype structure for unsigned 64-bit little-endian integer */
|
||||
H5T_t *std_u64be = NULL; /* Datatype structure for unsigned 64-bit big-endian integer */
|
||||
H5T_t *dt = NULL;
|
||||
H5T_t *tmp_float = NULL;
|
||||
H5T_t *fixedpt = NULL; /* Datatype structure for native int */
|
||||
H5T_t *floatpt = NULL; /* Datatype structure for native float */
|
||||
H5T_t *string = NULL; /* Datatype structure for C string */
|
||||
@ -867,6 +949,7 @@ H5T__init_package(void)
|
||||
H5T_t *enum_type = NULL; /* Datatype structure for enum objects */
|
||||
H5T_t *vlen = NULL; /* Datatype structure for vlen objects */
|
||||
H5T_t *array = NULL; /* Datatype structure for array objects */
|
||||
H5T_t *cplx = NULL; /* Datatype structure for complex number objects */
|
||||
H5T_t *objref = NULL; /* Datatype structure for deprecated reference objects */
|
||||
H5T_t *regref = NULL; /* Datatype structure for deprecated region references */
|
||||
H5T_t *ref = NULL; /* Datatype structure for opaque references */
|
||||
@ -876,6 +959,12 @@ H5T__init_package(void)
|
||||
true; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
H5T_t *native_float16 = NULL; /* Datatype structure for native _Float16 type */
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5T_t *native_float_complex = NULL; /* Datatype structure for native float _Complex / _Fcomplex type */
|
||||
H5T_t *native_double_complex = NULL; /* Datatype structure for native double _Complex / _Dcomplex type */
|
||||
H5T_t *native_ldouble_complex =
|
||||
NULL; /* Datatype structure for native long double _Complex / _Lcomplex type */
|
||||
#endif
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -893,6 +982,12 @@ H5T__init_package(void)
|
||||
if (H5T__init_native_float_types() < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize floating-point types");
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/* Initialize native complex number datatypes */
|
||||
if (H5T__init_native_complex_types() < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize complex number types");
|
||||
#endif
|
||||
|
||||
/* Initialize all other native types */
|
||||
if (H5T__init_native_internal() < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize integers");
|
||||
@ -928,6 +1023,14 @@ H5T__init_package(void)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (native_ldouble = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
if (NULL == (native_float_complex = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_COMPLEX_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (native_double_complex = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_COMPLEX_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (native_ldouble_complex = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_COMPLEX_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------
|
||||
* Derived native types
|
||||
@ -1151,6 +1254,59 @@ H5T__init_package(void)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location");
|
||||
ref = dt; /* Keep type for later */
|
||||
|
||||
/*------------------------------------------------------------
|
||||
* Complex Number Types
|
||||
*------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Complex number of 2 IEEE 2-byte little-endian floats */
|
||||
if (NULL == (tmp_float = H5I_object(H5T_IEEE_F16LE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (dt = H5T__complex_create(tmp_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "couldn't create complex number datatype");
|
||||
if ((H5T_COMPLEX_IEEE_F16LE_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
|
||||
|
||||
/* Complex number of 2 IEEE 2-byte big-endian floats */
|
||||
if (NULL == (tmp_float = H5I_object(H5T_IEEE_F16BE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (dt = H5T__complex_create(tmp_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "couldn't create complex number datatype");
|
||||
if ((H5T_COMPLEX_IEEE_F16BE_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
|
||||
|
||||
/* Complex number of 2 IEEE 4-byte little-endian floats */
|
||||
if (NULL == (tmp_float = H5I_object(H5T_IEEE_F32LE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (dt = H5T__complex_create(tmp_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "couldn't create complex number datatype");
|
||||
if ((H5T_COMPLEX_IEEE_F32LE_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
|
||||
|
||||
/* Complex number of 2 IEEE 4-byte big-endian floats */
|
||||
if (NULL == (tmp_float = H5I_object(H5T_IEEE_F32BE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (dt = H5T__complex_create(tmp_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "couldn't create complex number datatype");
|
||||
if ((H5T_COMPLEX_IEEE_F32BE_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
|
||||
|
||||
/* Complex number of 2 IEEE 8-byte little-endian floats */
|
||||
if (NULL == (tmp_float = H5I_object(H5T_IEEE_F64LE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (dt = H5T__complex_create(tmp_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "couldn't create complex number datatype");
|
||||
if ((H5T_COMPLEX_IEEE_F64LE_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
|
||||
|
||||
/* Complex number of 2 IEEE 8-byte big-endian floats */
|
||||
if (NULL == (tmp_float = H5I_object(H5T_IEEE_F64BE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object");
|
||||
if (NULL == (dt = H5T__complex_create(tmp_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "couldn't create complex number datatype");
|
||||
if ((H5T_COMPLEX_IEEE_F64BE_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom");
|
||||
|
||||
/*
|
||||
* Register conversion functions beginning with the most general and
|
||||
* ending with the most specific.
|
||||
@ -1165,18 +1321,27 @@ H5T__init_package(void)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
if (NULL == (array = H5T__array_create(native_int, 1, dim)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
if (NULL == (cplx = H5T__complex_create(native_float)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
status = 0;
|
||||
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "i_complex", fixedpt, cplx, H5T__conv_i_complex);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "complex_i", cplx, fixedpt, H5T__conv_complex_i);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "f_complex", floatpt, cplx, H5T__conv_f_complex);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "complex_f", cplx, floatpt, H5T__conv_complex_f);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "complex_complex", cplx, cplx, H5T__conv_complex);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "complexbo", cplx, cplx, H5T__conv_order);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "complexbo(opt)", cplx, cplx, H5T__conv_order_opt);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum);
|
||||
@ -1189,6 +1354,12 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "ref", ref, ref, H5T__conv_ref);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "objref_ref", objref, ref, H5T__conv_ref);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "regref_ref", regref, ref, H5T__conv_ref);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "complex_array_compat", cplx, array, H5T__conv_complex_compat);
|
||||
status |= H5T__register_int(H5T_PERS_SOFT, "array_complex_compat", array, cplx, H5T__conv_complex_compat);
|
||||
status |=
|
||||
H5T__register_int(H5T_PERS_SOFT, "complex_compound_compat", cplx, compound, H5T__conv_complex_compat);
|
||||
status |=
|
||||
H5T__register_int(H5T_PERS_SOFT, "compound_complex_compat", compound, cplx, H5T__conv_complex_compat);
|
||||
|
||||
/*
|
||||
* Native conversions should be listed last since we can use hardware to
|
||||
@ -1226,6 +1397,34 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_flt16", native_ldouble, native_float16,
|
||||
H5T__conv_ldouble__Float16);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "flt_fcomplex", native_float, native_float_complex,
|
||||
H5T__conv_float_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "flt_dcomplex", native_float, native_double_complex,
|
||||
H5T__conv_float_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "flt_lcomplex", native_float, native_ldouble_complex,
|
||||
H5T__conv_float_lcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dbl_fcomplex", native_double, native_float_complex,
|
||||
H5T__conv_double_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dbl_dcomplex", native_double, native_double_complex,
|
||||
H5T__conv_double_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dbl_lcomplex", native_double, native_ldouble_complex,
|
||||
H5T__conv_double_lcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_fcomplex", native_ldouble, native_float_complex,
|
||||
H5T__conv_ldouble_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_dcomplex", native_ldouble, native_double_complex,
|
||||
H5T__conv_ldouble_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_lcomplex", native_ldouble, native_ldouble_complex,
|
||||
H5T__conv_ldouble_lcomplex);
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "flt16_fcomplex", native_float16, native_float_complex,
|
||||
H5T__conv__Float16_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "flt16_dcomplex", native_float16, native_double_complex,
|
||||
H5T__conv__Float16_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "flt16_lcomplex", native_float16, native_ldouble_complex,
|
||||
H5T__conv__Float16_lcomplex);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* from long long */
|
||||
@ -1389,6 +1588,14 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "schar_flt16", native_schar, native_float16,
|
||||
H5T__conv_schar__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "schar_fcomplex", native_schar, native_float_complex,
|
||||
H5T__conv_schar_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "schar_dcomplex", native_schar, native_double_complex,
|
||||
H5T__conv_schar_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "schar_lcomplex", native_schar, native_ldouble_complex,
|
||||
H5T__conv_schar_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From unsigned char to floats */
|
||||
status |=
|
||||
@ -1401,6 +1608,14 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uchar_flt16", native_uchar, native_float16,
|
||||
H5T__conv_uchar__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uchar_fcomplex", native_uchar, native_float_complex,
|
||||
H5T__conv_uchar_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uchar_dcomplex", native_uchar, native_double_complex,
|
||||
H5T__conv_uchar_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uchar_lcomplex", native_uchar, native_ldouble_complex,
|
||||
H5T__conv_uchar_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From short to floats */
|
||||
status |=
|
||||
@ -1413,6 +1628,14 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "short_flt16", native_short, native_float16,
|
||||
H5T__conv_short__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "short_fcomplex", native_short, native_float_complex,
|
||||
H5T__conv_short_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "short_dcomplex", native_short, native_double_complex,
|
||||
H5T__conv_short_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "short_lcomplex", native_short, native_ldouble_complex,
|
||||
H5T__conv_short_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From unsigned short to floats */
|
||||
status |=
|
||||
@ -1425,6 +1648,14 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ushort_flt16", native_ushort, native_float16,
|
||||
H5T__conv_ushort__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ushort_fcomplex", native_ushort, native_float_complex,
|
||||
H5T__conv_ushort_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ushort_dcomplex", native_ushort, native_double_complex,
|
||||
H5T__conv_ushort_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ushort_lcomplex", native_ushort, native_ldouble_complex,
|
||||
H5T__conv_ushort_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From int to floats */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float);
|
||||
@ -1434,6 +1665,14 @@ H5T__init_package(void)
|
||||
status |=
|
||||
H5T__register_int(H5T_PERS_HARD, "int_flt16", native_int, native_float16, H5T__conv_int__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "int_fcomplex", native_int, native_float_complex,
|
||||
H5T__conv_int_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "int_dcomplex", native_int, native_double_complex,
|
||||
H5T__conv_int_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "int_lcomplex", native_int, native_ldouble_complex,
|
||||
H5T__conv_int_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From unsigned int to floats */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float);
|
||||
@ -1444,6 +1683,14 @@ H5T__init_package(void)
|
||||
status |=
|
||||
H5T__register_int(H5T_PERS_HARD, "uint_flt16", native_uint, native_float16, H5T__conv_uint__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uint_fcomplex", native_uint, native_float_complex,
|
||||
H5T__conv_uint_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uint_dcomplex", native_uint, native_double_complex,
|
||||
H5T__conv_uint_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "uint_lcomplex", native_uint, native_ldouble_complex,
|
||||
H5T__conv_uint_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From long to floats */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float);
|
||||
@ -1454,6 +1701,14 @@ H5T__init_package(void)
|
||||
status |=
|
||||
H5T__register_int(H5T_PERS_HARD, "long_flt16", native_long, native_float16, H5T__conv_long__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "long_fcomplex", native_long, native_float_complex,
|
||||
H5T__conv_long_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "long_dcomplex", native_long, native_double_complex,
|
||||
H5T__conv_long_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "long_lcomplex", native_long, native_ldouble_complex,
|
||||
H5T__conv_long_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From unsigned long to floats */
|
||||
status |=
|
||||
@ -1466,6 +1721,14 @@ H5T__init_package(void)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ulong_flt16", native_ulong, native_float16,
|
||||
H5T__conv_ulong__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ulong_fcomplex", native_ulong, native_float_complex,
|
||||
H5T__conv_ulong_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ulong_dcomplex", native_ulong, native_double_complex,
|
||||
H5T__conv_ulong_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ulong_lcomplex", native_ulong, native_ldouble_complex,
|
||||
H5T__conv_ulong_lcomplex);
|
||||
#endif
|
||||
|
||||
/* From long long to floats */
|
||||
status |=
|
||||
@ -1479,6 +1742,16 @@ H5T__init_package(void)
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "llong_flt16", native_llong, native_float16,
|
||||
H5T__conv_llong__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "llong_fcomplex", native_llong, native_float_complex,
|
||||
H5T__conv_llong_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "llong_dcomplex", native_llong, native_double_complex,
|
||||
H5T__conv_llong_dcomplex);
|
||||
#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "llong_lcomplex", native_llong, native_ldouble_complex,
|
||||
H5T__conv_llong_lcomplex);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* From unsigned long long to floats */
|
||||
@ -1493,6 +1766,16 @@ H5T__init_package(void)
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ullong_flt16", native_ullong, native_float16,
|
||||
H5T__conv_ullong__Float16);
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ullong_fcomplex", native_ullong, native_float_complex,
|
||||
H5T__conv_ullong_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ullong_dcomplex", native_ullong, native_double_complex,
|
||||
H5T__conv_ullong_dcomplex);
|
||||
#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ullong_lcomplex", native_ullong, native_ldouble_complex,
|
||||
H5T__conv_ullong_lcomplex);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* From floats to char */
|
||||
@ -1603,7 +1886,7 @@ H5T__init_package(void)
|
||||
H5T__register_int(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong);
|
||||
status |=
|
||||
H5T__register_int(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong);
|
||||
#if H5T_CONV_INTERNAL_LDOUBLE_ULLONG
|
||||
#ifdef H5T_CONV_INTERNAL_LDOUBLE_ULLONG
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong,
|
||||
H5T__conv_ldouble_ullong);
|
||||
#endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */
|
||||
@ -1612,6 +1895,138 @@ H5T__init_package(void)
|
||||
H5T__conv__Float16_ullong);
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/* From complex numbers to char */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_schar", native_float_complex, native_schar,
|
||||
H5T__conv_fcomplex_schar);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_schar", native_double_complex, native_schar,
|
||||
H5T__conv_dcomplex_schar);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_schar", native_ldouble_complex, native_schar,
|
||||
H5T__conv_lcomplex_schar);
|
||||
|
||||
/* From complex numbers to unsigned char */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_uchar", native_float_complex, native_uchar,
|
||||
H5T__conv_fcomplex_uchar);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_uchar", native_double_complex, native_uchar,
|
||||
H5T__conv_dcomplex_uchar);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_uchar", native_ldouble_complex, native_uchar,
|
||||
H5T__conv_lcomplex_uchar);
|
||||
|
||||
/* From complex numbers to short */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_short", native_float_complex, native_short,
|
||||
H5T__conv_fcomplex_short);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_short", native_double_complex, native_short,
|
||||
H5T__conv_dcomplex_short);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_short", native_ldouble_complex, native_short,
|
||||
H5T__conv_lcomplex_short);
|
||||
|
||||
/* From complex numbers to unsigned short */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_ushort", native_float_complex, native_ushort,
|
||||
H5T__conv_fcomplex_ushort);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_ushort", native_double_complex, native_ushort,
|
||||
H5T__conv_dcomplex_ushort);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_ushort", native_ldouble_complex, native_ushort,
|
||||
H5T__conv_lcomplex_ushort);
|
||||
|
||||
/* From complex numbers to int */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_int", native_float_complex, native_int,
|
||||
H5T__conv_fcomplex_int);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_int", native_double_complex, native_int,
|
||||
H5T__conv_dcomplex_int);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_int", native_ldouble_complex, native_int,
|
||||
H5T__conv_lcomplex_int);
|
||||
|
||||
/* From complex numbers to unsigned int */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_uint", native_float_complex, native_uint,
|
||||
H5T__conv_fcomplex_uint);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_uint", native_double_complex, native_uint,
|
||||
H5T__conv_dcomplex_uint);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_uint", native_ldouble_complex, native_uint,
|
||||
H5T__conv_lcomplex_uint);
|
||||
|
||||
/* From complex numbers to long */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_long", native_float_complex, native_long,
|
||||
H5T__conv_fcomplex_long);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_long", native_double_complex, native_long,
|
||||
H5T__conv_dcomplex_long);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_long", native_ldouble_complex, native_long,
|
||||
H5T__conv_lcomplex_long);
|
||||
|
||||
/* From complex numbers to unsigned long */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_ulong", native_float_complex, native_ulong,
|
||||
H5T__conv_fcomplex_ulong);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_ulong", native_double_complex, native_ulong,
|
||||
H5T__conv_dcomplex_ulong);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_ulong", native_ldouble_complex, native_ulong,
|
||||
H5T__conv_lcomplex_ulong);
|
||||
|
||||
/* From complex numbers to long long */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_llong", native_float_complex, native_llong,
|
||||
H5T__conv_fcomplex_llong);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_llong", native_double_complex, native_llong,
|
||||
H5T__conv_dcomplex_llong);
|
||||
#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_llong", native_ldouble_complex, native_llong,
|
||||
H5T__conv_lcomplex_llong);
|
||||
#endif
|
||||
|
||||
/* From complex numbers to unsigned long long */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_ullong", native_float_complex, native_ullong,
|
||||
H5T__conv_fcomplex_ullong);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_ullong", native_double_complex, native_ullong,
|
||||
H5T__conv_dcomplex_ullong);
|
||||
#ifdef H5T_CONV_INTERNAL_LDOUBLE_ULLONG
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_ullong", native_ldouble_complex, native_ullong,
|
||||
H5T__conv_lcomplex_ullong);
|
||||
#endif
|
||||
|
||||
/* From complex numbers to floats */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_flt", native_float_complex, native_float,
|
||||
H5T__conv_fcomplex_float);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_dbl", native_float_complex, native_double,
|
||||
H5T__conv_fcomplex_double);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_ldbl", native_float_complex, native_ldouble,
|
||||
H5T__conv_fcomplex_ldouble);
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_flt16", native_float_complex, native_float16,
|
||||
H5T__conv_fcomplex__Float16);
|
||||
#endif
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_flt", native_double_complex, native_float,
|
||||
H5T__conv_dcomplex_float);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_dbl", native_double_complex, native_double,
|
||||
H5T__conv_dcomplex_double);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_ldbl", native_double_complex, native_ldouble,
|
||||
H5T__conv_dcomplex_ldouble);
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_flt16", native_double_complex, native_float16,
|
||||
H5T__conv_dcomplex__Float16);
|
||||
#endif
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_flt", native_ldouble_complex, native_float,
|
||||
H5T__conv_lcomplex_float);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_dbl", native_ldouble_complex, native_double,
|
||||
H5T__conv_lcomplex_double);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_ldbl", native_ldouble_complex, native_ldouble,
|
||||
H5T__conv_lcomplex_ldouble);
|
||||
#if defined(H5_HAVE__FLOAT16) && defined(H5T_CONV_INTERNAL_LDOUBLE_FLOAT16)
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_flt16", native_ldouble_complex, native_float16,
|
||||
H5T__conv_lcomplex__Float16);
|
||||
#endif
|
||||
|
||||
/* From complex numbers to complex numbers */
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_dcomplex", native_float_complex,
|
||||
native_double_complex, H5T__conv_fcomplex_dcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "fcomplex_lcomplex", native_float_complex,
|
||||
native_ldouble_complex, H5T__conv_fcomplex_lcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_fcomplex", native_double_complex,
|
||||
native_float_complex, H5T__conv_dcomplex_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "dcomplex_lcomplex", native_double_complex,
|
||||
native_ldouble_complex, H5T__conv_dcomplex_lcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_fcomplex", native_ldouble_complex,
|
||||
native_float_complex, H5T__conv_lcomplex_fcomplex);
|
||||
status |= H5T__register_int(H5T_PERS_HARD, "lcomplex_dcomplex", native_ldouble_complex,
|
||||
native_double_complex, H5T__conv_lcomplex_dcomplex);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The special no-op conversion is the fastest, so we list it last. The
|
||||
* data types we use are not important as long as the source and
|
||||
@ -1652,6 +2067,8 @@ done:
|
||||
(void)H5T_close_real(vlen);
|
||||
if (array != NULL)
|
||||
(void)H5T_close_real(array);
|
||||
if (cplx != NULL)
|
||||
(void)H5T_close_real(cplx);
|
||||
|
||||
/* Error cleanup */
|
||||
if (ret_value < 0) {
|
||||
@ -1765,6 +2182,13 @@ H5T_top_term_package(void)
|
||||
H5T_IEEE_F64BE_g = H5I_INVALID_HID;
|
||||
H5T_IEEE_F64LE_g = H5I_INVALID_HID;
|
||||
|
||||
H5T_COMPLEX_IEEE_F16BE_g = H5I_INVALID_HID;
|
||||
H5T_COMPLEX_IEEE_F16LE_g = H5I_INVALID_HID;
|
||||
H5T_COMPLEX_IEEE_F32BE_g = H5I_INVALID_HID;
|
||||
H5T_COMPLEX_IEEE_F32LE_g = H5I_INVALID_HID;
|
||||
H5T_COMPLEX_IEEE_F64BE_g = H5I_INVALID_HID;
|
||||
H5T_COMPLEX_IEEE_F64LE_g = H5I_INVALID_HID;
|
||||
|
||||
H5T_STD_I8BE_g = H5I_INVALID_HID;
|
||||
H5T_STD_I8LE_g = H5I_INVALID_HID;
|
||||
H5T_STD_I16BE_g = H5I_INVALID_HID;
|
||||
@ -1802,30 +2226,33 @@ H5T_top_term_package(void)
|
||||
|
||||
H5T_FORTRAN_S1_g = H5I_INVALID_HID;
|
||||
|
||||
H5T_NATIVE_SCHAR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_UCHAR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_SHORT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_USHORT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_INT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_UINT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_ULONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LLONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_ULLONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_FLOAT16_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_FLOAT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_DOUBLE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LDOUBLE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B8_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B16_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B32_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B64_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_OPAQUE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HADDR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HSIZE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HSSIZE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HERR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HBOOL_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_SCHAR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_UCHAR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_SHORT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_USHORT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_INT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_UINT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_ULONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LLONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_ULLONG_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_FLOAT16_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_FLOAT_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_DOUBLE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LDOUBLE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_FLOAT_COMPLEX_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_DOUBLE_COMPLEX_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_LDOUBLE_COMPLEX_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B8_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B16_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B32_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_B64_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_OPAQUE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HADDR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HSIZE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HSSIZE_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HERR_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_HBOOL_g = H5I_INVALID_HID;
|
||||
|
||||
H5T_NATIVE_INT8_g = H5I_INVALID_HID;
|
||||
H5T_NATIVE_UINT8_g = H5I_INVALID_HID;
|
||||
@ -1968,19 +2395,19 @@ H5Tcreate(H5T_class_t type, size_t size)
|
||||
H5T_t *dt = NULL; /* New datatype constructed */
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* check args. We support string (fixed-size or variable-length) now. */
|
||||
if (size <= 0 && size != H5T_VARIABLE)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive");
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size must be positive");
|
||||
|
||||
/* create the type */
|
||||
if (NULL == (dt = H5T__create(type, size)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type");
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to create type");
|
||||
|
||||
/* Get an ID for the datatype */
|
||||
if ((ret_value = H5I_register(H5I_DATATYPE, dt, true)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID");
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype ID");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
@ -2390,7 +2817,7 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, bool from_api)
|
||||
HGOTO_DONE(true);
|
||||
|
||||
/* Recurse if it's VL, compound, enum or array */
|
||||
if (H5T_IS_COMPLEX(dt->shared->u.compnd.memb[i].type->shared->type))
|
||||
if (H5T_IS_COMPOSITE(dt->shared->u.compnd.memb[i].type->shared->type))
|
||||
if ((nested_ret = H5T_detect_class(dt->shared->u.compnd.memb[i].type, cls, from_api)) !=
|
||||
false)
|
||||
HGOTO_DONE(nested_ret);
|
||||
@ -2402,6 +2829,9 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, bool from_api)
|
||||
case H5T_ENUM:
|
||||
HGOTO_DONE(H5T_detect_class(dt->shared->parent, cls, from_api));
|
||||
break;
|
||||
case H5T_COMPLEX:
|
||||
HGOTO_DONE(H5T_detect_class(dt->shared->parent, cls, from_api));
|
||||
break;
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_INTEGER:
|
||||
case H5T_FLOAT:
|
||||
@ -2537,7 +2967,9 @@ H5Tset_size(hid_t type_id, size_t size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length");
|
||||
if (H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined");
|
||||
if (H5T_REFERENCE == dt->shared->type)
|
||||
if (H5T_ARRAY == dt->shared->type || H5T_REFERENCE == dt->shared->type || H5T_COMPLEX == dt->shared->type)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype");
|
||||
if (H5T_VLEN == dt->shared->type && H5T_VLEN_STRING != dt->shared->u.vlen.type)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype");
|
||||
|
||||
/* Modify the datatype */
|
||||
@ -3269,11 +3701,11 @@ H5Tdecode(const void *buf)
|
||||
H5T_t *dt;
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* Check args */
|
||||
if (buf == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer");
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "empty buffer");
|
||||
|
||||
/* Create datatype by decoding buffer
|
||||
* There is no way to get the size of the buffer, so we pass in
|
||||
@ -3282,11 +3714,11 @@ H5Tdecode(const void *buf)
|
||||
* takes a size parameter.
|
||||
*/
|
||||
if (NULL == (dt = H5T_decode(SIZE_MAX, (const unsigned char *)buf)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object");
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, H5I_INVALID_HID, "can't decode object");
|
||||
|
||||
/* Register the type and return the ID */
|
||||
if ((ret_value = H5I_register(H5I_DATATYPE, dt, true)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type");
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
@ -3492,6 +3924,9 @@ H5T__create(H5T_class_t type, size_t size)
|
||||
case H5T_ARRAY: /* Array datatype */
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()");
|
||||
|
||||
case H5T_COMPLEX: /* Complex number datatype */
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tcomplex_create()");
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_NCLASSES:
|
||||
@ -3793,6 +4228,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo
|
||||
case H5T_TIME:
|
||||
case H5T_STRING:
|
||||
case H5T_BITFIELD:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
break;
|
||||
@ -4162,6 +4598,7 @@ H5T__free(H5T_t *dt)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
break;
|
||||
@ -4342,18 +4779,15 @@ H5T__set_size(H5T_t *dt, size_t size)
|
||||
assert(dt);
|
||||
assert(dt->shared);
|
||||
assert(size != 0);
|
||||
assert(H5T_ARRAY != dt->shared->type);
|
||||
assert(H5T_REFERENCE != dt->shared->type);
|
||||
assert(H5T_COMPLEX != dt->shared->type);
|
||||
assert(H5T_VLEN != dt->shared->type || H5T_VLEN_STRING == dt->shared->u.vlen.type);
|
||||
assert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs));
|
||||
|
||||
if (dt->shared->parent) {
|
||||
if (H5T__set_size(dt->shared->parent, size) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type");
|
||||
|
||||
/* Adjust size of datatype appropriately */
|
||||
if (dt->shared->type == H5T_ARRAY)
|
||||
dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem;
|
||||
else if (dt->shared->type != H5T_VLEN)
|
||||
dt->shared->size = dt->shared->parent->shared->size;
|
||||
}
|
||||
else {
|
||||
if (H5T_IS_ATOMIC(dt->shared)) {
|
||||
@ -4475,6 +4909,7 @@ H5T__set_size(H5T_t *dt, size_t size)
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_COMPLEX:
|
||||
assert("can't happen" && 0);
|
||||
break;
|
||||
|
||||
@ -4863,6 +5298,23 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset)
|
||||
HGOTO_DONE(1);
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
/* Make sure the complex number datatypes are both in the same form */
|
||||
tmp = (dt1->shared->u.cplx.form > dt2->shared->u.cplx.form) -
|
||||
(dt1->shared->u.cplx.form < dt2->shared->u.cplx.form);
|
||||
if (tmp < 0)
|
||||
HGOTO_DONE(-1);
|
||||
if (tmp > 0)
|
||||
HGOTO_DONE(1);
|
||||
|
||||
tmp = H5T_cmp(dt1->shared->parent, dt2->shared->parent, superset);
|
||||
if (tmp < 0)
|
||||
HGOTO_DONE(-1);
|
||||
if (tmp > 0)
|
||||
HGOTO_DONE(1);
|
||||
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_INTEGER:
|
||||
case H5T_FLOAT:
|
||||
@ -4993,6 +5445,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, bool superset)
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
assert("not implemented yet" && 0);
|
||||
@ -5693,6 +6146,7 @@ H5T_path_match_find_type_with_volobj(const H5T_t *datatype, const H5VL_object_t
|
||||
case H5T_OPAQUE:
|
||||
case H5T_REFERENCE: /* Should have been determined by above check */
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NO_CLASS: /* Error value, but simplify logic for a true/false return value */
|
||||
case H5T_NCLASSES: /* Error value, but simplify logic for a true/false return value */
|
||||
default:
|
||||
@ -6243,6 +6697,7 @@ H5T_is_sensible(const H5T_t *dt)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
/* Assume all other datatype are sensible to store on disk */
|
||||
@ -6296,7 +6751,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
|
||||
/* Recurse if it's VL, compound, enum or array */
|
||||
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */
|
||||
if (dt->shared->parent->shared->force_conv &&
|
||||
H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
|
||||
H5T_IS_COMPOSITE(dt->shared->parent->shared->type)) {
|
||||
/* Keep the old base element size for later */
|
||||
old_size = dt->shared->parent->shared->size;
|
||||
|
||||
@ -6337,7 +6792,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
|
||||
/* Recurse if it's VL, compound, enum or array */
|
||||
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse)
|
||||
*/
|
||||
if (memb_type->shared->force_conv && H5T_IS_COMPLEX(memb_type->shared->type)) {
|
||||
if (memb_type->shared->force_conv && H5T_IS_COMPOSITE(memb_type->shared->type)) {
|
||||
/* Keep the old field size for later */
|
||||
old_size = memb_type->shared->size;
|
||||
|
||||
@ -6379,7 +6834,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
|
||||
* them as part of the same blob)*/
|
||||
/* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */
|
||||
if (dt->shared->parent->shared->force_conv &&
|
||||
H5T_IS_COMPLEX(dt->shared->parent->shared->type) &&
|
||||
H5T_IS_COMPOSITE(dt->shared->parent->shared->type) &&
|
||||
(dt->shared->parent->shared->type != H5T_REFERENCE)) {
|
||||
if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location");
|
||||
@ -6408,6 +6863,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
|
||||
case H5T_BITFIELD:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
break;
|
||||
@ -6504,6 +6960,7 @@ H5T__detect_vlen_ref(const H5T_t *dt)
|
||||
case H5T_BITFIELD:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
break;
|
||||
@ -6589,6 +7046,11 @@ H5T__upgrade_version_cb(H5T_t *dt, void *op_value)
|
||||
dt->shared->version = dt->shared->parent->shared->version;
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
if (dt->shared->parent->shared->version > dt->shared->version)
|
||||
dt->shared->version = dt->shared->parent->shared->version;
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_INTEGER:
|
||||
case H5T_FLOAT:
|
||||
@ -6627,7 +7089,7 @@ H5T__upgrade_version(H5T_t *dt, unsigned new_version)
|
||||
assert(dt);
|
||||
|
||||
/* Iterate over entire datatype, upgrading the version of components, if it's useful */
|
||||
if (H5T__visit(dt, (H5T_VISIT_SIMPLE | H5T_VISIT_COMPLEX_LAST), H5T__upgrade_version_cb, &new_version) <
|
||||
if (H5T__visit(dt, (H5T_VISIT_SIMPLE | H5T_VISIT_COMPOSITE_LAST), H5T__upgrade_version_cb, &new_version) <
|
||||
0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "iteration to upgrade datatype encoding version failed");
|
||||
|
||||
|
@ -231,7 +231,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
uint64_t
|
||||
H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size)
|
||||
H5T__bit_get_d(const uint8_t *buf, size_t offset, size_t size)
|
||||
{
|
||||
uint64_t val = 0;
|
||||
size_t i, hs;
|
||||
|
152
src/H5Tcomplex.c
Normal file
152
src/H5Tcomplex.c
Normal file
@ -0,0 +1,152 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the COPYING file, which can be found at the root of the source code *
|
||||
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
||||
* If you do not have access to either file, you may request a copy from *
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Module Info: This module contains the functionality for complex number
|
||||
* datatypes in the H5T interface.
|
||||
*/
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#include "H5Tmodule.h" /* This source code file is part of the H5T module */
|
||||
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5Tpkg.h" /* Datatypes */
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/********************/
|
||||
/* Package Typedefs */
|
||||
/********************/
|
||||
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
|
||||
/*********************/
|
||||
/* Public Variables */
|
||||
/*********************/
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Tcomplex_create
|
||||
*
|
||||
* Purpose: Create a new complex number datatype based on the specified
|
||||
* base datatype ID.
|
||||
*
|
||||
* Return: Success: ID of new complex number datatype
|
||||
* Failure: H5I_INVALID_HID
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
hid_t
|
||||
H5Tcomplex_create(hid_t base_type_id)
|
||||
{
|
||||
H5T_t *base = NULL; /* base datatype */
|
||||
H5T_t *dt = NULL; /* new datatype */
|
||||
hid_t ret_value = H5I_INVALID_HID; /* return value */
|
||||
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
if (NULL == (base = (H5T_t *)H5I_object_verify(base_type_id, H5I_DATATYPE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid base datatype ID");
|
||||
|
||||
if (NULL == (dt = H5T__complex_create(base)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID,
|
||||
"can't create complex number datatype from base datatype");
|
||||
|
||||
if ((ret_value = H5I_register(H5I_DATATYPE, dt, true)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T__complex_create
|
||||
*
|
||||
* Purpose: Create a new complex number datatype based on the specified
|
||||
* base datatype.
|
||||
*
|
||||
* Return: Success: new complex number datatype
|
||||
* Failure: NULL
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5T_t *
|
||||
H5T__complex_create(const H5T_t *base)
|
||||
{
|
||||
H5T_t *dt = NULL; /* New complex number datatype */
|
||||
H5T_t *ret_value = NULL; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
/* Check args */
|
||||
assert(base);
|
||||
|
||||
/* Currently, only floating-point base datatypes are supported. */
|
||||
if (base->shared->type != H5T_FLOAT)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "base datatype is not a H5T_FLOAT datatype");
|
||||
if (base->shared->size == 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid base datatype size");
|
||||
if (base->shared->size > SIZE_MAX / 2)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL,
|
||||
"base datatype size too large - new datatype size would overflow");
|
||||
|
||||
/* Build new type */
|
||||
if (NULL == (dt = H5T__alloc()))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "memory allocation failed");
|
||||
dt->shared->type = H5T_COMPLEX;
|
||||
dt->shared->size = 2 * base->shared->size;
|
||||
|
||||
if (NULL == (dt->shared->parent = H5T_copy(base, H5T_COPY_ALL)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy base datatype");
|
||||
|
||||
/* Set complex number-specific fields */
|
||||
dt->shared->u.cplx.form = H5T_COMPLEX_RECTANGULAR; /* Only rectangular form is currently supported */
|
||||
|
||||
/* Complex number datatypes use a later version of the datatype object header message */
|
||||
dt->shared->version = MAX(base->shared->version, H5O_DTYPE_VERSION_5);
|
||||
|
||||
ret_value = dt;
|
||||
|
||||
done:
|
||||
if (!ret_value)
|
||||
if (dt && H5T_close(dt) < 0)
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "can't close datatype");
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
@ -503,6 +503,8 @@ H5T__pack(const H5T_t *dt)
|
||||
/* Adjust size of datatype appropriately */
|
||||
if (dt->shared->type == H5T_ARRAY)
|
||||
dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem;
|
||||
else if (dt->shared->type == H5T_COMPLEX)
|
||||
dt->shared->size = 2 * dt->shared->parent->shared->size;
|
||||
else if (dt->shared->type != H5T_VLEN)
|
||||
dt->shared->size = dt->shared->parent->shared->size;
|
||||
} /* end if */
|
||||
|
221
src/H5Tconv.c
221
src/H5Tconv.c
@ -28,21 +28,13 @@
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5CXprivate.h" /* API Contexts */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Tconv.h" /* Datatype Conversions */
|
||||
#include "H5Tpkg.h" /* Datatypes */
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/* Swap two elements (I & J) of an array using a temporary variable */
|
||||
#define H5_SWAP_BYTES(ARRAY, I, J) \
|
||||
do { \
|
||||
uint8_t _tmp; \
|
||||
_tmp = ARRAY[I]; \
|
||||
ARRAY[I] = ARRAY[J]; \
|
||||
ARRAY[J] = _tmp; \
|
||||
} while (0)
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
@ -185,27 +177,47 @@ H5T_get_force_conv(const H5T_t *dt)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5T__reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order)
|
||||
H5T__reverse_order(uint8_t *rev, uint8_t *s, const H5T_t *dtype)
|
||||
{
|
||||
size_t i;
|
||||
H5T_order_t order;
|
||||
size_t size;
|
||||
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
assert(s);
|
||||
assert(size);
|
||||
assert(dtype);
|
||||
assert(H5T_IS_ATOMIC(dtype->shared) || H5T_COMPLEX == dtype->shared->type);
|
||||
|
||||
size = dtype->shared->size;
|
||||
|
||||
if (H5T_IS_ATOMIC(dtype->shared))
|
||||
order = dtype->shared->u.atomic.order;
|
||||
else
|
||||
order = dtype->shared->parent->shared->u.atomic.order;
|
||||
|
||||
if (H5T_ORDER_VAX == order) {
|
||||
for (i = 0; i < size; i += 2) {
|
||||
for (size_t i = 0; i < size; i += 2) {
|
||||
rev[i] = s[(size - 2) - i];
|
||||
rev[i + 1] = s[(size - 1) - i];
|
||||
}
|
||||
}
|
||||
else if (H5T_ORDER_BE == order) {
|
||||
for (i = 0; i < size; i++)
|
||||
rev[size - (i + 1)] = s[i];
|
||||
if (H5T_IS_ATOMIC(dtype->shared)) {
|
||||
for (size_t i = 0; i < size; i++)
|
||||
rev[size - (i + 1)] = s[i];
|
||||
}
|
||||
else {
|
||||
size_t part_size = size / 2;
|
||||
for (size_t i = 0; i < part_size; i++)
|
||||
rev[part_size - (i + 1)] = s[i];
|
||||
rev += part_size;
|
||||
s += part_size;
|
||||
for (size_t i = 0; i < part_size; i++)
|
||||
rev[part_size - (i + 1)] = s[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < size; i++)
|
||||
for (size_t i = 0; i < size; i++)
|
||||
rev[i] = s[i];
|
||||
}
|
||||
|
||||
@ -255,12 +267,12 @@ done:
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T__conv_order
|
||||
*
|
||||
* Purpose: Convert one type to another when byte order is the only
|
||||
* difference.
|
||||
* Purpose: Convert one type to another when byte order is the only
|
||||
* difference.
|
||||
*
|
||||
* Note: This is a soft conversion function.
|
||||
* Note: This is a soft conversion function.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -269,10 +281,13 @@ H5T__conv_order(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t H5_ATTR_UNUSED *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t H5_ATTR_UNUSED bkg_stride, void *_buf, void H5_ATTR_UNUSED *background)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)_buf;
|
||||
size_t i;
|
||||
size_t j, md;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
H5T_order_t src_order, dst_order;
|
||||
uint8_t *buf = (uint8_t *)_buf;
|
||||
size_t src_offset, dst_offset;
|
||||
size_t src_size, dst_size;
|
||||
size_t i;
|
||||
size_t j, md;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
@ -281,12 +296,38 @@ H5T__conv_order(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
/* Capability query */
|
||||
if (NULL == src || NULL == dst)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
if (src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset ||
|
||||
0 != dst->shared->u.atomic.offset ||
|
||||
!((H5T_ORDER_BE == src->shared->u.atomic.order &&
|
||||
H5T_ORDER_LE == dst->shared->u.atomic.order) ||
|
||||
(H5T_ORDER_LE == src->shared->u.atomic.order &&
|
||||
H5T_ORDER_BE == dst->shared->u.atomic.order)))
|
||||
|
||||
src_size = src->shared->size;
|
||||
dst_size = dst->shared->size;
|
||||
if (src_size != dst_size)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
|
||||
if (src->shared->parent) {
|
||||
if (!H5T_IS_ATOMIC(src->shared->parent->shared))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
src_offset = src->shared->parent->shared->u.atomic.offset;
|
||||
src_order = src->shared->parent->shared->u.atomic.order;
|
||||
}
|
||||
else {
|
||||
src_offset = src->shared->u.atomic.offset;
|
||||
src_order = src->shared->u.atomic.order;
|
||||
}
|
||||
if (dst->shared->parent) {
|
||||
if (!H5T_IS_ATOMIC(dst->shared->parent->shared))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
dst_offset = dst->shared->parent->shared->u.atomic.offset;
|
||||
dst_order = dst->shared->parent->shared->u.atomic.order;
|
||||
}
|
||||
else {
|
||||
dst_offset = dst->shared->u.atomic.offset;
|
||||
dst_order = dst->shared->u.atomic.order;
|
||||
}
|
||||
|
||||
if (0 != src_offset || 0 != dst_offset)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
|
||||
if (!((H5T_ORDER_BE == src_order && H5T_ORDER_LE == dst_order) ||
|
||||
(H5T_ORDER_LE == src_order && H5T_ORDER_BE == dst_order)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
switch (src->shared->type) {
|
||||
case H5T_INTEGER:
|
||||
@ -307,6 +348,23 @@ H5T__conv_order(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
} /* end if */
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
const H5T_shared_t *src_base_sh = src->shared->parent->shared;
|
||||
const H5T_shared_t *dst_base_sh = dst->shared->parent->shared;
|
||||
|
||||
if (src_base_sh->u.atomic.u.f.sign != dst_base_sh->u.atomic.u.f.sign ||
|
||||
src_base_sh->u.atomic.u.f.epos != dst_base_sh->u.atomic.u.f.epos ||
|
||||
src_base_sh->u.atomic.u.f.esize != dst_base_sh->u.atomic.u.f.esize ||
|
||||
src_base_sh->u.atomic.u.f.ebias != dst_base_sh->u.atomic.u.f.ebias ||
|
||||
src_base_sh->u.atomic.u.f.mpos != dst_base_sh->u.atomic.u.f.mpos ||
|
||||
src_base_sh->u.atomic.u.f.msize != dst_base_sh->u.atomic.u.f.msize ||
|
||||
src_base_sh->u.atomic.u.f.norm != dst_base_sh->u.atomic.u.f.norm ||
|
||||
src_base_sh->u.atomic.u.f.pad != dst_base_sh->u.atomic.u.f.pad)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_TIME:
|
||||
case H5T_STRING:
|
||||
@ -328,11 +386,41 @@ H5T__conv_order(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
if (NULL == src)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
|
||||
buf_stride = buf_stride ? buf_stride : src->shared->size;
|
||||
md = src->shared->size / 2;
|
||||
for (i = 0; i < nelmts; i++, buf += buf_stride)
|
||||
for (j = 0; j < md; j++)
|
||||
H5_SWAP_BYTES(buf, j, src->shared->size - (j + 1));
|
||||
src_size = src->shared->size;
|
||||
buf_stride = buf_stride ? buf_stride : src_size;
|
||||
md = src_size / 2;
|
||||
|
||||
/* Complex number types are composed of two floating-point
|
||||
* elements, each of which is half the size of the datatype
|
||||
* and have to be converted separately. While halving the
|
||||
* source datatype size and doubling the number elements to
|
||||
* be converted works in some cases, structure padding can
|
||||
* cause issues with that approach, so we special-case
|
||||
* conversions on complex numbers here.
|
||||
*/
|
||||
if (H5T_COMPLEX == src->shared->type) {
|
||||
size_t part_size = src_size / 2;
|
||||
|
||||
md = part_size / 2;
|
||||
for (i = 0; i < nelmts; i++, buf += buf_stride) {
|
||||
uint8_t *cur_part = buf;
|
||||
|
||||
/* Convert real part of complex number element */
|
||||
for (j = 0; j < md; j++)
|
||||
H5_SWAP_BYTES(cur_part, j, part_size - (j + 1));
|
||||
|
||||
/* Convert imaginary part of complex number element */
|
||||
cur_part += part_size;
|
||||
for (j = 0; j < md; j++)
|
||||
H5_SWAP_BYTES(cur_part, j, part_size - (j + 1));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < nelmts; i++, buf += buf_stride)
|
||||
for (j = 0; j < md; j++)
|
||||
H5_SWAP_BYTES(buf, j, src_size - (j + 1));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case H5T_CONV_FREE:
|
||||
@ -350,13 +438,13 @@ done:
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T__conv_order_opt
|
||||
*
|
||||
* Purpose: Convert one type to another when byte order is the only
|
||||
* difference. This is the optimized version of H5T__conv_order()
|
||||
* for a handful of different sizes.
|
||||
* Purpose: Convert one type to another when byte order is the only
|
||||
* difference. This is the optimized version of
|
||||
* H5T__conv_order() for a handful of different sizes.
|
||||
*
|
||||
* Note: This is a soft conversion function.
|
||||
* Note: This is a soft conversion function.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -365,9 +453,12 @@ H5T__conv_order_opt(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t H5_ATTR_UNUSED *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t H5_ATTR_UNUSED bkg_stride, void *_buf, void H5_ATTR_UNUSED *background)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)_buf;
|
||||
size_t i;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
H5T_order_t src_order, dst_order;
|
||||
uint8_t *buf = (uint8_t *)_buf;
|
||||
size_t src_offset, dst_offset;
|
||||
size_t src_size, dst_size;
|
||||
size_t i;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
@ -376,19 +467,43 @@ H5T__conv_order_opt(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
/* Capability query */
|
||||
if (NULL == src || NULL == dst)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
|
||||
if (src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset ||
|
||||
0 != dst->shared->u.atomic.offset)
|
||||
|
||||
src_size = src->shared->size;
|
||||
dst_size = dst->shared->size;
|
||||
if (src_size != dst_size)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
|
||||
if (src->shared->parent) {
|
||||
if (!H5T_IS_ATOMIC(src->shared->parent->shared))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
src_offset = src->shared->parent->shared->u.atomic.offset;
|
||||
src_order = src->shared->parent->shared->u.atomic.order;
|
||||
}
|
||||
else {
|
||||
src_offset = src->shared->u.atomic.offset;
|
||||
src_order = src->shared->u.atomic.order;
|
||||
}
|
||||
if (dst->shared->parent) {
|
||||
if (!H5T_IS_ATOMIC(dst->shared->parent->shared))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
dst_offset = dst->shared->parent->shared->u.atomic.offset;
|
||||
dst_order = dst->shared->parent->shared->u.atomic.order;
|
||||
}
|
||||
else {
|
||||
dst_offset = dst->shared->u.atomic.offset;
|
||||
dst_order = dst->shared->u.atomic.order;
|
||||
}
|
||||
|
||||
if (0 != src_offset || 0 != dst_offset)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
if ((src->shared->type == H5T_REFERENCE && dst->shared->type != H5T_REFERENCE) ||
|
||||
(dst->shared->type == H5T_REFERENCE && src->shared->type != H5T_REFERENCE))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
if (src->shared->type != H5T_REFERENCE && !((H5T_ORDER_BE == src->shared->u.atomic.order &&
|
||||
H5T_ORDER_LE == dst->shared->u.atomic.order) ||
|
||||
(H5T_ORDER_LE == src->shared->u.atomic.order &&
|
||||
H5T_ORDER_BE == dst->shared->u.atomic.order)))
|
||||
if (src->shared->type != H5T_REFERENCE &&
|
||||
!((H5T_ORDER_BE == src_order && H5T_ORDER_LE == dst_order) ||
|
||||
(H5T_ORDER_LE == src_order && H5T_ORDER_BE == dst_order)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
if (src->shared->size != 1 && src->shared->size != 2 && src->shared->size != 4 &&
|
||||
src->shared->size != 8 && src->shared->size != 16)
|
||||
if (src_size != 1 && src_size != 2 && src_size != 4 && src_size != 8 && src_size != 16)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
switch (src->shared->type) {
|
||||
case H5T_INTEGER:
|
||||
@ -417,6 +532,10 @@ H5T__conv_order_opt(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
/* Complex numbers require some special-case logic for
|
||||
* proper handling. Defer to H5T__conv_order for these types.
|
||||
*/
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
|
||||
|
@ -25,6 +25,15 @@
|
||||
/* Length of debugging name buffer */
|
||||
#define H5T_NAMELEN 32
|
||||
|
||||
/* Swap two elements (I & J) of an array using a temporary variable */
|
||||
#define H5_SWAP_BYTES(ARRAY, I, J) \
|
||||
do { \
|
||||
uint8_t _tmp; \
|
||||
_tmp = ARRAY[I]; \
|
||||
ARRAY[I] = ARRAY[J]; \
|
||||
ARRAY[J] = _tmp; \
|
||||
} while (0)
|
||||
|
||||
/****************************/
|
||||
/* Library Private Typedefs */
|
||||
/****************************/
|
||||
@ -184,7 +193,7 @@ H5_DLL herr_t H5T__conv_order_opt(const H5T_t *src, const H5T_t *dst, H5T_cdata_
|
||||
size_t bkg_stride, void *_buf, void *bkg);
|
||||
|
||||
/* Utility functions */
|
||||
H5_DLL herr_t H5T__reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order);
|
||||
H5_DLL herr_t H5T__reverse_order(uint8_t *rev, uint8_t *s, const H5T_t *dtype);
|
||||
|
||||
/* Debugging functions */
|
||||
H5_DLL herr_t H5T__print_path_stats(H5T_path_t *path, int *nprint /*in,out*/);
|
||||
|
@ -106,7 +106,9 @@ H5T__conv_b_b(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, const H5T_
|
||||
}
|
||||
|
||||
/* Allocate space for order-reversed source buffer */
|
||||
src_rev = (uint8_t *)H5MM_calloc(src->shared->size);
|
||||
if (conv_ctx->u.conv.cb_struct.func)
|
||||
if (NULL == (src_rev = H5MM_calloc(src->shared->size)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "unable to allocate temporary buffer");
|
||||
|
||||
/* The conversion loop */
|
||||
H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
|
||||
@ -162,8 +164,7 @@ H5T__conv_b_b(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, const H5T_
|
||||
if (src->shared->u.atomic.prec > dst->shared->u.atomic.prec) {
|
||||
/*overflow*/
|
||||
if (conv_ctx->u.conv.cb_struct.func) { /*If user's exception handler is present, use it*/
|
||||
H5T__reverse_order(src_rev, s, src->shared->size,
|
||||
src->shared->u.atomic.order); /*reverse order first*/
|
||||
H5T__reverse_order(src_rev, s, src); /*reverse order first*/
|
||||
except_ret = (conv_ctx->u.conv.cb_struct.func)(
|
||||
H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id,
|
||||
conv_ctx->u.conv.dst_type_id, src_rev, d, conv_ctx->u.conv.cb_struct.user_data);
|
||||
|
2315
src/H5Tconv_complex.c
Normal file
2315
src/H5Tconv_complex.c
Normal file
File diff suppressed because it is too large
Load Diff
214
src/H5Tconv_complex.h
Normal file
214
src/H5Tconv_complex.h
Normal file
@ -0,0 +1,214 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the COPYING file, which can be found at the root of the source code *
|
||||
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
||||
* If you do not have access to either file, you may request a copy from *
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef H5Tconv_complex_H
|
||||
#define H5Tconv_complex_H
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include "H5Tpkg.h"
|
||||
|
||||
/***********************/
|
||||
/* Function Prototypes */
|
||||
/***********************/
|
||||
|
||||
/* Helper functions shared between conversion modules */
|
||||
H5_DLL herr_t H5T__conv_complex_f_matched(const H5T_t *src_p, const H5T_t *dst_p,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
void *buf);
|
||||
|
||||
/****************************************/
|
||||
/* Soft (emulated) conversion functions */
|
||||
/****************************************/
|
||||
|
||||
/* Conversion functions between complex number datatypes */
|
||||
H5_DLL herr_t H5T__conv_complex(const H5T_t *src_p, const H5T_t *dst_p, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
|
||||
/* Conversion functions from complex number datatype to another datatype class */
|
||||
H5_DLL herr_t H5T__conv_complex_i(const H5T_t *src_p, const H5T_t *dst_p, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_complex_f(const H5T_t *src_p, const H5T_t *dst_p, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_complex_compat(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *_buf, void *bkg);
|
||||
|
||||
/*********************************************/
|
||||
/* Hard (compiler cast) conversion functions */
|
||||
/*********************************************/
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/* Conversion functions for 'float _Complex' / '_Fcomplex' */
|
||||
H5_DLL herr_t H5T__conv_fcomplex_schar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_uchar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_short(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_ushort(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_int(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_uint(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_long(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_ulong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_llong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_ullong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
H5_DLL herr_t H5T__conv_fcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
H5_DLL herr_t H5T__conv_fcomplex_float(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_dcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_fcomplex_lcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
|
||||
/* Conversion functions for 'double _Complex' / '_Dcomplex' */
|
||||
H5_DLL herr_t H5T__conv_dcomplex_schar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_uchar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_short(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_ushort(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_int(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_uint(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_long(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_ulong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_llong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_ullong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
H5_DLL herr_t H5T__conv_dcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
H5_DLL herr_t H5T__conv_dcomplex_float(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_fcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_dcomplex_lcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
|
||||
/* Conversion functions for 'long double _Complex' / '_Lcomplex' */
|
||||
H5_DLL herr_t H5T__conv_lcomplex_schar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_uchar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_short(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_ushort(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_int(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_uint(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_long(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_ulong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG
|
||||
H5_DLL herr_t H5T__conv_lcomplex_llong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
#ifdef H5T_CONV_INTERNAL_LDOUBLE_ULLONG
|
||||
H5_DLL herr_t H5T__conv_lcomplex_ullong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
#if defined(H5_HAVE__FLOAT16) && defined(H5T_CONV_INTERNAL_LDOUBLE_FLOAT16)
|
||||
H5_DLL herr_t H5T__conv_lcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
H5_DLL herr_t H5T__conv_lcomplex_float(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_fcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_lcomplex_dcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif /* H5_HAVE_COMPLEX_NUMBERS */
|
||||
|
||||
#endif /* H5Tconv_complex_H */
|
2652
src/H5Tconv_float.c
2652
src/H5Tconv_float.c
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,40 @@
|
||||
/* Private headers needed by this file */
|
||||
#include "H5Tpkg.h"
|
||||
|
||||
/*************************/
|
||||
/* Module private macros */
|
||||
/*************************/
|
||||
|
||||
#define TEMP_FLOAT_CONV_BUFFER_SIZE 64
|
||||
|
||||
/****************************/
|
||||
/* Library Private Typedefs */
|
||||
/****************************/
|
||||
|
||||
/* floating-point value type (regular, +/-0, +/-Inf, NaN) */
|
||||
typedef enum {
|
||||
H5T_CONV_FLOAT_SPECVAL_REGULAR,
|
||||
H5T_CONV_FLOAT_SPECVAL_POSZERO,
|
||||
H5T_CONV_FLOAT_SPECVAL_NEGZERO,
|
||||
H5T_CONV_FLOAT_SPECVAL_POSINF,
|
||||
H5T_CONV_FLOAT_SPECVAL_NEGINF,
|
||||
H5T_CONV_FLOAT_SPECVAL_NAN,
|
||||
} H5T_conv_float_specval_t;
|
||||
|
||||
/***********************/
|
||||
/* Function Prototypes */
|
||||
/***********************/
|
||||
|
||||
/* Helper functions shared between conversion modules */
|
||||
H5_DLL herr_t H5T__conv_f_f_loop(const H5T_t *src_p, const H5T_t *dst_p, const H5T_conv_ctx_t *conv_ctx,
|
||||
size_t nelmts, size_t buf_stride, void *buf);
|
||||
H5_DLL herr_t H5T__conv_f_i_loop(const H5T_t *src_p, const H5T_t *dst_p, const H5T_conv_ctx_t *conv_ctx,
|
||||
size_t nelmts, size_t buf_stride, void *buf);
|
||||
|
||||
H5_DLL H5T_conv_float_specval_t H5T__conv_float_find_special(const uint8_t *src_buf,
|
||||
const H5T_atomic_t *src_atomic,
|
||||
uint64_t *sign_out);
|
||||
|
||||
/****************************************/
|
||||
/* Soft (emulated) conversion functions */
|
||||
/****************************************/
|
||||
@ -33,6 +63,9 @@ H5_DLL herr_t H5T__conv_f_f(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cda
|
||||
H5_DLL herr_t H5T__conv_f_i(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *_buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_f_complex(const H5T_t *src_p, const H5T_t *dst_p, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
|
||||
/*********************************************/
|
||||
/* Hard (compiler cast) conversion functions */
|
||||
@ -79,6 +112,17 @@ H5_DLL herr_t H5T__conv__Float16_double(const H5T_t *st, const H5T_t *dt, H5T_cd
|
||||
H5_DLL herr_t H5T__conv__Float16_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv__Float16_fcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv__Float16_dcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv__Float16_lcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'float' */
|
||||
@ -123,6 +167,17 @@ H5_DLL herr_t H5T__conv_float_double(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_float_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_float_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_float_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_float_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'double' */
|
||||
H5_DLL herr_t H5T__conv_double_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -166,6 +221,17 @@ H5_DLL herr_t H5T__conv_double_float(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_double_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_double_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_double_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_double_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'long double' */
|
||||
H5_DLL herr_t H5T__conv_ldouble_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -211,5 +277,16 @@ H5_DLL herr_t H5T__conv_ldouble_float(const H5T_t *src, const H5T_t *dst, H5T_cd
|
||||
H5_DLL herr_t H5T__conv_ldouble_double(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_ldouble_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ldouble_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ldouble_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
#endif /* H5Tconv_float_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,20 @@
|
||||
/* Private headers needed by this file */
|
||||
#include "H5Tpkg.h"
|
||||
|
||||
/*************************/
|
||||
/* Module private macros */
|
||||
/*************************/
|
||||
|
||||
#define TEMP_INT_CONV_BUFFER_SIZE 64
|
||||
|
||||
/***********************/
|
||||
/* Function Prototypes */
|
||||
/***********************/
|
||||
|
||||
/* Helper functions shared between conversion modules */
|
||||
H5_DLL herr_t H5T__conv_i_f_loop(const H5T_t *src_p, const H5T_t *dst_p, const H5T_conv_ctx_t *conv_ctx,
|
||||
size_t nelmts, size_t buf_stride, void *buf);
|
||||
|
||||
/****************************************/
|
||||
/* Soft (emulated) conversion functions */
|
||||
/****************************************/
|
||||
@ -33,6 +43,9 @@ H5_DLL herr_t H5T__conv_i_i(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cda
|
||||
H5_DLL herr_t H5T__conv_i_f(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *_buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_i_complex(const H5T_t *src_p, const H5T_t *dst_p, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
|
||||
/*********************************************/
|
||||
/* Hard (compiler cast) conversion functions */
|
||||
@ -80,6 +93,17 @@ H5_DLL herr_t H5T__conv_schar_double(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_schar_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_schar_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_schar_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_schar_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'unsigned char' */
|
||||
H5_DLL herr_t H5T__conv_uchar_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -123,6 +147,17 @@ H5_DLL herr_t H5T__conv_uchar_double(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_uchar_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_uchar_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_uchar_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_uchar_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'signed short' */
|
||||
H5_DLL herr_t H5T__conv_short_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -166,6 +201,17 @@ H5_DLL herr_t H5T__conv_short_double(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_short_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_short_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_short_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_short_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'unsigned short' */
|
||||
H5_DLL herr_t H5T__conv_ushort_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -209,6 +255,17 @@ H5_DLL herr_t H5T__conv_ushort_double(const H5T_t *src, const H5T_t *dst, H5T_cd
|
||||
H5_DLL herr_t H5T__conv_ushort_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_ushort_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ushort_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ushort_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'signed int' */
|
||||
H5_DLL herr_t H5T__conv_int_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -252,6 +309,17 @@ H5_DLL herr_t H5T__conv_int_double(const H5T_t *src, const H5T_t *dst, H5T_cdata
|
||||
H5_DLL herr_t H5T__conv_int_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_int_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_int_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_int_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'unsigned int' */
|
||||
H5_DLL herr_t H5T__conv_uint_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -295,6 +363,17 @@ H5_DLL herr_t H5T__conv_uint_double(const H5T_t *src, const H5T_t *dst, H5T_cdat
|
||||
H5_DLL herr_t H5T__conv_uint_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_uint_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_uint_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_uint_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'signed long' */
|
||||
H5_DLL herr_t H5T__conv_long_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -338,6 +417,17 @@ H5_DLL herr_t H5T__conv_long_double(const H5T_t *src, const H5T_t *dst, H5T_cdat
|
||||
H5_DLL herr_t H5T__conv_long_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_long_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_long_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_long_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'unsigned long' */
|
||||
H5_DLL herr_t H5T__conv_ulong_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -381,6 +471,17 @@ H5_DLL herr_t H5T__conv_ulong_double(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_ulong_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_ulong_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ulong_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ulong_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'signed long long' */
|
||||
H5_DLL herr_t H5T__conv_llong_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -424,6 +525,19 @@ H5_DLL herr_t H5T__conv_llong_double(const H5T_t *src, const H5T_t *dst, H5T_cda
|
||||
H5_DLL herr_t H5T__conv_llong_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_llong_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_llong_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE
|
||||
H5_DLL herr_t H5T__conv_llong_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Conversion functions for 'unsigned long long' */
|
||||
H5_DLL herr_t H5T__conv_ullong_schar(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
@ -467,5 +581,18 @@ H5_DLL herr_t H5T__conv_ullong_double(const H5T_t *src, const H5T_t *dst, H5T_cd
|
||||
H5_DLL herr_t H5T__conv_ullong_ldouble(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__conv_ullong_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
H5_DLL herr_t H5T__conv_ullong_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE
|
||||
H5_DLL herr_t H5T__conv_ullong_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata,
|
||||
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
|
||||
size_t bkg_stride, void *buf, void *bkg);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* H5Tconv_integer_H */
|
||||
|
@ -99,8 +99,8 @@ typedef struct H5T_conv_hw_t {
|
||||
* destination is at least as wide as the source. This case
|
||||
* cannot generate overflows.
|
||||
*
|
||||
* Ff: Floating-point values to floating-point values the source is at
|
||||
* least as large as the destination. Overflows can occur when
|
||||
* Ff: Floating-point values to floating-point values where the source is
|
||||
* at least as large as the destination. Overflows can occur when
|
||||
* the destination is narrower than the source.
|
||||
*
|
||||
* xF: Integers to float-point(float or double) values where the destination
|
||||
@ -118,6 +118,55 @@ typedef struct H5T_conv_hw_t {
|
||||
* wide as the destination. Overflows can occur when the destination is
|
||||
* narrower than the source.
|
||||
*
|
||||
* zZ: Complex number values to complex number values where the
|
||||
* destination is at least as wide as the source. This case
|
||||
* cannot generate overflows.
|
||||
*
|
||||
* Zz: Complex number values to complex number values where the
|
||||
* source is at least as large as the destination. Overflows can
|
||||
* occur when the destination is narrower than the source.
|
||||
*
|
||||
* zF: Complex number values to floating-point values where the
|
||||
* destination is at least as wide as the real part of the source
|
||||
* complex number value. This case cannot generate overflows.
|
||||
*
|
||||
* Zf: Complex number values to floating-point values where the real
|
||||
* part of the source complex number value is at least as large
|
||||
* as the destination. Overflows can occur when the destination
|
||||
* is narrower then the source.
|
||||
*
|
||||
* fZ: Floating-point values to complex number values where the
|
||||
* destination is at least as wide as the source. This case
|
||||
* cannot generate overflows.
|
||||
*
|
||||
* Fz: Floating-point values to complex number values where the source is
|
||||
* at least as large as the destination. Overflows can occur when
|
||||
* the destination is narrower than the source.
|
||||
*
|
||||
* zf: Complex number values to floating-point values where the real
|
||||
* part of the source complex number value is the same size as
|
||||
* the destination. This case cannot generate overflows.
|
||||
*
|
||||
* fz: Floating-point values to complex number values where the source
|
||||
* is the same size as the real part of the destination. This case
|
||||
* cannot generate overflows.
|
||||
*
|
||||
* xZ: Integers to complex number values where the destination is at
|
||||
* least as wide as the source. This case cannot generate overflows.
|
||||
*
|
||||
* Zx: Complex number values to integers where the real part of the
|
||||
* source complex number value is at least as wide as the destination.
|
||||
* Overflow can occur when the source magnitude is too large for
|
||||
* the destination.
|
||||
*
|
||||
* zX: Complex number values to integers where the destination is at
|
||||
* least as wide as the real part of the source complex number
|
||||
* value. This case cannot generate overflows.
|
||||
*
|
||||
* Xz: Integers to complex number values where the source is at least as
|
||||
* wide as the destination. Overflows can occur when the destination
|
||||
* is narrower than the source.
|
||||
*
|
||||
*
|
||||
* The macros take a subset of these arguments in the order listed here:
|
||||
*
|
||||
@ -804,6 +853,564 @@ typedef struct H5T_conv_hw_t {
|
||||
H5T_CONV(H5T_CONV_Xf, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
|
||||
} while (0)
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/*
|
||||
* NOTE: while it would be very nice to be able to use type-generic macros for
|
||||
* the complex number functions used below to reduce macro duplication between
|
||||
* the float, double and long double _Complex cases, support for the tgmath.h
|
||||
* header appears to be problematic and not particularly portable pre-C11. This
|
||||
* should be revisited if the minimum required C standard version is moved to
|
||||
* C11 or later.
|
||||
*/
|
||||
#define H5T_CONV_FLOAT_COMPLEX_REALVAL(S) float sr_val = crealf(*(S));
|
||||
#define H5T_CONV_DOUBLE_COMPLEX_REALVAL(S) double sr_val = creal(*(S));
|
||||
#define H5T_CONV_LDOUBLE_COMPLEX_REALVAL(S) long double sr_val = creall(*(S));
|
||||
#define H5T_CONV_FLOAT_COMPLEX_IMAGVAL(S) float si_val = cimagf(*(S));
|
||||
#define H5T_CONV_DOUBLE_COMPLEX_IMAGVAL(S) double si_val = cimag(*(S));
|
||||
#define H5T_CONV_LDOUBLE_COMPLEX_IMAGVAL(S) long double si_val = cimagl(*(S));
|
||||
|
||||
/*
|
||||
* Since MSVC defines complex numbers as structure types, they can't be cast
|
||||
* directly to other types, so we have to simulate the behavior of the standard
|
||||
* types here. When casting to a complex number type, a new complex number
|
||||
* value is constructed from the given real and imaginary parts. When casting
|
||||
* from a complex number type, the real and imaginary parts are extracted as
|
||||
* needed and used as appropriate. With other platforms/compilers, the
|
||||
* H5T_CONV_CAST_Z macro just maps this to direct casts.
|
||||
*/
|
||||
#ifndef H5_HAVE_C99_COMPLEX_NUMBERS
|
||||
#define H5T_CONV_CAST_TO_FLOAT_COMPLEX(S_REAL, S_IMAG, D, DT) \
|
||||
{ \
|
||||
*(D) = H5_CMPLXF(S_REAL, S_IMAG); \
|
||||
}
|
||||
#define H5T_CONV_CAST_TO_DOUBLE_COMPLEX(S_REAL, S_IMAG, D, DT) \
|
||||
{ \
|
||||
*(D) = H5_CMPLX(S_REAL, S_IMAG); \
|
||||
}
|
||||
#define H5T_CONV_CAST_TO_LDOUBLE_COMPLEX(S_REAL, S_IMAG, D, DT) \
|
||||
{ \
|
||||
*(D) = H5_CMPLXL(S_REAL, S_IMAG); \
|
||||
}
|
||||
|
||||
#define H5T_CONV_CAST_zZ(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
H5T_CONV_##STYPE##_IMAGVAL(S); /* Extract "imaginary" part of complex number */ \
|
||||
H5T_CONV_CAST_TO_##DTYPE(sr_val, si_val, D, DT) \
|
||||
}
|
||||
#define H5T_CONV_CAST_Zz(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_CAST_TO_##DTYPE(S_REAL, S_IMAG, D, DT) \
|
||||
}
|
||||
#define H5T_CONV_CAST_zF(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
*(D) = (DT)(sr_val); \
|
||||
}
|
||||
#define H5T_CONV_CAST_zf(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
*(D) = (DT)(sr_val); \
|
||||
}
|
||||
#define H5T_CONV_CAST_zX(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
*(D) = (DT)(sr_val); \
|
||||
}
|
||||
#define H5T_CONV_CAST_fZ(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_CAST_TO_##DTYPE(*(S), (ST)0.0, D, DT) \
|
||||
}
|
||||
#define H5T_CONV_CAST_Fz(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_CAST_TO_##DTYPE(*(S), (ST)0.0, D, DT) \
|
||||
}
|
||||
#define H5T_CONV_CAST_fz(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_CAST_TO_##DTYPE(*(S), (ST)0.0, D, DT) \
|
||||
}
|
||||
#define H5T_CONV_CAST_xZ(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
{ \
|
||||
H5T_CONV_CAST_TO_##DTYPE(*(S), (ST)0.0, D, DT) \
|
||||
}
|
||||
|
||||
#define H5T_CONV_CAST_Z(SYMBOLS, STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
do { \
|
||||
H5T_CONV_CAST_##SYMBOLS(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
/* Map all complex number casts to direct casts */
|
||||
#define H5T_CONV_CAST_Z(SYMBOLS, STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT) \
|
||||
do { \
|
||||
*(D) = (DT)(*(S)); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#define H5T_CONV_zZ_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(zZ, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_zZ_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_zZ_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/* Identical logic to H5T_CONV_fF, but special implementation is needed
|
||||
* here to deal with MSVC's complex number structure types.
|
||||
*/
|
||||
#define H5T_CONV_zZ(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert(sizeof(ST) <= sizeof(DT)); \
|
||||
H5T_CONV(H5T_CONV_zZ, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_Zz_CORE_IMP(STYPE, DTYPE, DBTYPE, S, D, ST, DT, SBT, DBT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
H5T_CONV_##STYPE##_IMAGVAL(S); /* Extract "imaginary" part of complex number */ \
|
||||
bool sr_over = (sr_val) > (SBT)(D_MAX); \
|
||||
bool sr_under = (sr_val) < (SBT)(D_MIN); \
|
||||
bool si_over = (si_val) > (SBT)(D_MAX); \
|
||||
bool si_under = (si_val) < (SBT)(D_MIN); \
|
||||
if (!sr_over && !sr_under && !si_over && !si_under) \
|
||||
H5T_CONV_CAST_Z(Zz, STYPE, DTYPE, S, sr_val, si_val, D, ST, DT); \
|
||||
else { \
|
||||
H5T_conv_ret_t except_ret = H5T_CONV_UNHANDLED; \
|
||||
\
|
||||
/* Since there's just one chance to raise a conversion exception here and either \
|
||||
* or both of the real and imaginary parts of a complex number could raise an \
|
||||
* exception, arbitrarily raise an exception in the order of: "overflow for either \
|
||||
* part" -> "underflow for either part". There are other orderings that may make \
|
||||
* more sense, such as "overflow for real part" -> "underflow for real part" -> \
|
||||
* "underflow..." -> "underflow...". For now, this will assume that the user's \
|
||||
* conversion exception function will inspect and handle both parts of the complex \
|
||||
* number. \
|
||||
*/ \
|
||||
if (sr_over || si_over) { \
|
||||
except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, \
|
||||
D, conv_ctx->u.conv.cb_struct.user_data); \
|
||||
} \
|
||||
else if (sr_under || si_under) { \
|
||||
except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, \
|
||||
S, D, conv_ctx->u.conv.cb_struct.user_data); \
|
||||
} \
|
||||
\
|
||||
/* If user conversion exception function handled the exception, do nothing. \
|
||||
* Otherwise, if explicitly left unhandled, create a complex number value \
|
||||
* to return based on the exception type. \
|
||||
*/ \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) { \
|
||||
DBT tmp_val[2]; /* [ real, imaginary ] */ \
|
||||
\
|
||||
if (sr_over) \
|
||||
tmp_val[0] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _POS_INF_g); \
|
||||
else if (sr_under) \
|
||||
tmp_val[0] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _NEG_INF_g); \
|
||||
else \
|
||||
tmp_val[0] = (DBT)(sr_val); \
|
||||
if (si_over) \
|
||||
tmp_val[1] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _POS_INF_g); \
|
||||
else if (si_under) \
|
||||
tmp_val[1] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _NEG_INF_g); \
|
||||
else \
|
||||
tmp_val[1] = (DBT)(si_val); \
|
||||
\
|
||||
H5T_CONV_CAST_Z(Zz, STYPE, DTYPE, (DT *)tmp_val, tmp_val[0], tmp_val[1], D, ST, DT); \
|
||||
} \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
} \
|
||||
}
|
||||
#define H5T_CONV_Zz_DOUBLE_COMPLEX_FLOAT_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_CORE_IMP(STYPE, DTYPE, FLOAT, S, D, ST, DT, double, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_DOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_DOUBLE_COMPLEX_##DTYPE##_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_LDOUBLE_COMPLEX_FLOAT_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_CORE_IMP(STYPE, DTYPE, FLOAT, S, D, ST, DT, long double, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_LDOUBLE_COMPLEX_DOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_CORE_IMP(STYPE, DTYPE, DOUBLE, S, D, ST, DT, long double, double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_LDOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_LDOUBLE_COMPLEX_##DTYPE##_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, DBTYPE, S, D, ST, DT, SBT, DBT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
H5T_CONV_##STYPE##_IMAGVAL(S); /* Extract "imaginary" part of complex number */ \
|
||||
bool sr_over = (sr_val) > (SBT)(D_MAX); \
|
||||
bool sr_under = (sr_val) < (SBT)(D_MIN); \
|
||||
bool si_over = (si_val) > (SBT)(D_MAX); \
|
||||
bool si_under = (si_val) < (SBT)(D_MIN); \
|
||||
if (!sr_over && !sr_under && !si_over && !si_under) \
|
||||
H5T_CONV_CAST_Z(Zz, STYPE, DTYPE, S, sr_val, si_val, D, ST, DT); \
|
||||
else { \
|
||||
DBT tmp_val[2]; /* [ real, imaginary ] */ \
|
||||
\
|
||||
if (sr_over) \
|
||||
tmp_val[0] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _POS_INF_g); \
|
||||
else if (sr_under) \
|
||||
tmp_val[0] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _NEG_INF_g); \
|
||||
else \
|
||||
tmp_val[0] = (DBT)(sr_val); \
|
||||
if (si_over) \
|
||||
tmp_val[1] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _POS_INF_g); \
|
||||
else if (si_under) \
|
||||
tmp_val[1] = H5_GLUE3(H5T_NATIVE_, DBTYPE, _NEG_INF_g); \
|
||||
else \
|
||||
tmp_val[1] = (DBT)(si_val); \
|
||||
\
|
||||
H5T_CONV_CAST_Z(Zz, STYPE, DTYPE, (DT *)tmp_val, tmp_val[0], tmp_val[1], D, ST, DT); \
|
||||
} \
|
||||
}
|
||||
#define H5T_CONV_Zz_DOUBLE_COMPLEX_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, FLOAT, S, D, ST, DT, double, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_DOUBLE_COMPLEX_##DTYPE##_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_LDOUBLE_COMPLEX_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, FLOAT, S, D, ST, DT, long double, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_LDOUBLE_COMPLEX_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, DOUBLE, S, D, ST, DT, long double, double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zz_LDOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zz_LDOUBLE_COMPLEX_##DTYPE##_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/*
|
||||
* Similar logic to H5T_CONV_Ff. The "real" and "imaginary" parts of the complex
|
||||
* number value are retrieved using one of the creal() and cimag() variants
|
||||
* (according to the source complex number type) and then are used for comparisons
|
||||
* when checking for overflow and underflow.
|
||||
*
|
||||
* To efficiently convert between complex number types, the macros need to be aware
|
||||
* of the base floating-point type for both the source and destination complex number
|
||||
* types. Since there are currently only three cases where H5T_CONV_Zz applies
|
||||
* (DOUBLE_COMPLEX -> FLOAT_COMPLEX, LDOUBLE_COMPLEX -> FLOAT_COMPLEX and
|
||||
* LDOUBLE_COMPLEX -> DOUBLE_COMPLEX), use some specialized macros above for this
|
||||
* for now. H5T_CONV_Zz directs the H5T_CONV macro to H5T_CONV_Zz_<source_type>_(NOEX_)CORE
|
||||
* (depending on whether conversion exceptions are handled), which then redirects to
|
||||
* H5T_CONV_Zz_<source_type>_<destination_type>_(NOEX_)CORE, ending at H5T_CONV_Zz_(NOEX_)CORE_IMP
|
||||
* after replacing values related to the source and destination datatypes that are
|
||||
* passed. While a bit difficult to reason through, alternative approaches proved to
|
||||
* be much more awkward.
|
||||
*/
|
||||
#define H5T_CONV_Zz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert(sizeof(ST) >= sizeof(DT)); \
|
||||
H5T_CONV(H5T_CONV_Zz_##STYPE, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_zF_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(zF, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_zF_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_zF_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/* Identical logic to H5T_CONV_fF, but special implementation is needed
|
||||
* here to deal with MSVC's complex number structure types.
|
||||
*/
|
||||
#define H5T_CONV_zF(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
H5T_CONV(H5T_CONV_zF, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, SBT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); \
|
||||
if ((sr_val) > (SBT)(D_MAX)) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else if ((sr_val) < (SBT)(D_MIN)) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else \
|
||||
*(D) = (DT)((sr_val)); \
|
||||
}
|
||||
#define H5T_CONV_Zf_FLOAT_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zf_DOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zf_LDOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, long double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, SBT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
if ((sr_val) > (SBT)(D_MAX)) \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \
|
||||
else if ((sr_val) < (SBT)(D_MIN)) \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \
|
||||
else \
|
||||
*(D) = (DT)((sr_val)); \
|
||||
}
|
||||
#define H5T_CONV_Zf_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zf_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zf_LDOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, long double, D_MIN, D_MAX)
|
||||
|
||||
/* Similar logic to H5T_CONV_Ff. The "real" part of the complex number is
|
||||
* retrieved using one of the creal() variants (according to the source
|
||||
* complex number type) and then is used for comparisons when checking for
|
||||
* overflow and underflow. Uses specialized macros above to also pass the
|
||||
* base floating-point C type of the complex number type for use in casts
|
||||
* during those comparisons.
|
||||
*/
|
||||
#define H5T_CONV_Zf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert(sizeof(ST) >= sizeof(DT)); \
|
||||
H5T_CONV(H5T_CONV_Zf_##STYPE, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_fZ_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(fZ, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_fZ_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_fZ_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/* Identical logic to H5T_CONV_fF, but special implementation is needed
|
||||
* here to deal with MSVC's complex number structure types.
|
||||
*/
|
||||
#define H5T_CONV_fZ(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert(sizeof(ST) <= sizeof(DT)); \
|
||||
H5T_CONV(H5T_CONV_fZ, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_Fz_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
if (*(S) > (ST)(D_MAX)) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else if (*(S) < (ST)(D_MIN)) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else \
|
||||
H5T_CONV_CAST_Z(Fz, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_Fz_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
if (*(S) > (ST)(D_MAX)) \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \
|
||||
else if (*(S) < (ST)(D_MIN)) \
|
||||
*(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \
|
||||
else \
|
||||
H5T_CONV_CAST_Z(Fz, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
|
||||
/* Similar logic to H5T_CONV_Ff. In the case of overflow or underflow, the
|
||||
* floating-point value is converted to a complex number value where the
|
||||
* "real" part of the value is set to positive or negative infinity and
|
||||
* the "imaginary" part of the value is set to 0.
|
||||
*/
|
||||
#define H5T_CONV_Fz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
H5T_CONV(H5T_CONV_Fz, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_zf_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(zf, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_zf_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_zf_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/* Convert a complex number value to the matching base floating-point type. Simple
|
||||
* direct cast where the imaginary part of the complex number value is discarded.
|
||||
* Special implementation is needed here to deal with MSVC's complex number
|
||||
* structure types.
|
||||
*/
|
||||
#define H5T_CONV_zf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert(sizeof(ST) == (2 * sizeof(DT))); \
|
||||
H5T_CONV(H5T_CONV_zf, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_fz_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(fz, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_fz_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_fz_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/* Convert a floating-point value to the matching complex number type. Simple direct
|
||||
* cast where the imaginary part should be a zero (positive or unsigned). Special
|
||||
* implementation is needed here to deal with MSVC's complex number structure types.
|
||||
*/
|
||||
#define H5T_CONV_fz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert((2 * sizeof(ST)) == sizeof(DT)); \
|
||||
H5T_CONV(H5T_CONV_fz, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_xZ_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
if (sprec > dprec) { \
|
||||
unsigned low_bit_pos, high_bit_pos; \
|
||||
\
|
||||
/* Detect high & low bits set in source */ \
|
||||
H5T_HI_LO_BIT_SET(ST, *(S), low_bit_pos, high_bit_pos) \
|
||||
\
|
||||
/* Check for more bits of precision in src than available in dst */ \
|
||||
if ((high_bit_pos - low_bit_pos) >= dprec) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_PRECISION, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, \
|
||||
S, D, conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
H5T_CONV_CAST_Z(xZ, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else \
|
||||
H5T_CONV_CAST_Z(xZ, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
} \
|
||||
else \
|
||||
H5T_CONV_CAST_Z(xZ, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_xZ_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(xZ, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
|
||||
/* Identical logic to H5T_CONV_xF */
|
||||
#define H5T_CONV_xZ(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
H5T_CONV(H5T_CONV_xZ, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, SBT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
if ((sr_val) > (SBT)(D_MAX) || (sprec < dprec && (sr_val) == (SBT)(D_MAX))) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = (DT)(D_MAX); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else if ((sr_val) < (SBT)(D_MIN)) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = (DT)(D_MIN); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else if ((sr_val) != (SBT)((DT)((sr_val)))) { \
|
||||
H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \
|
||||
H5T_CONV_EXCEPT_TRUNCATE, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \
|
||||
conv_ctx->u.conv.cb_struct.user_data); \
|
||||
if (except_ret == H5T_CONV_UNHANDLED) \
|
||||
/* Let compiler convert if case is ignored by user handler*/ \
|
||||
*(D) = (DT)((sr_val)); \
|
||||
else if (except_ret == H5T_CONV_ABORT) \
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \
|
||||
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
|
||||
} \
|
||||
else \
|
||||
*(D) = (DT)((sr_val)); \
|
||||
}
|
||||
#define H5T_CONV_Zx_FLOAT_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zx_DOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zx_LDOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, long double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, SBT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_##STYPE##_REALVAL(S); /* Extract "real" part of complex number */ \
|
||||
if ((sr_val) > (SBT)(D_MAX)) \
|
||||
*(D) = (DT)(D_MAX); \
|
||||
else if ((sr_val) < (SBT)(D_MIN)) \
|
||||
*(D) = (DT)(D_MIN); \
|
||||
else \
|
||||
*(D) = (DT)((sr_val)); \
|
||||
}
|
||||
#define H5T_CONV_Zx_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, float, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zx_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, double, D_MIN, D_MAX)
|
||||
#define H5T_CONV_Zx_LDOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, long double, D_MIN, D_MAX)
|
||||
|
||||
/* Similar logic to H5T_CONV_Fx. The "real" part of the complex number is
|
||||
* retrieved using one of the creal() variants (according to the source
|
||||
* complex number type) and then is used for comparisons when checking for
|
||||
* overflow and underflow. Uses specialized macros above to also pass the
|
||||
* base floating-point C type of the complex number type for use in casts
|
||||
* during those comparisons.
|
||||
*/
|
||||
#define H5T_CONV_Zx(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
H5T_CONV(H5T_CONV_Zx_##STYPE, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
|
||||
} while (0)
|
||||
|
||||
#define H5T_CONV_zX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
{ \
|
||||
H5T_CONV_CAST_Z(zX, STYPE, DTYPE, S, -, -, D, ST, DT); \
|
||||
}
|
||||
#define H5T_CONV_zX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \
|
||||
H5T_CONV_zX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX)
|
||||
|
||||
/* Identical logic to H5T_CONV_fX, but special implementation is needed
|
||||
* here to deal with MSVC's complex number structure types.
|
||||
*/
|
||||
#define H5T_CONV_zX(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
|
||||
do { \
|
||||
HDcompile_assert(sizeof(ST) <= sizeof(DT)); \
|
||||
H5T_CONV(H5T_CONV_zX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
|
||||
} while (0)
|
||||
|
||||
/* H5T_CONV_Xz is currently unused (as there is no standard _Complex type for
|
||||
* smaller floats than "float", though some compilers will allow this). When
|
||||
* implemented, the logic should be nearly identical to H5T_CONV_Xf, with the
|
||||
* comparisons being made against the "real" part of the complex number, as
|
||||
* extracted with the creal() variants (similar to H5T_CONV_Zx, foH5T_CONV_zX(r guidance).
|
||||
*/
|
||||
/* #define H5T_CONV_Xz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) */
|
||||
#endif
|
||||
|
||||
/* Since all "no exception" cores do the same thing (assign the value in the
|
||||
* source location to the destination location, using casting), use one "core"
|
||||
* to do them all.
|
||||
@ -831,17 +1438,21 @@ typedef struct H5T_conv_hw_t {
|
||||
#define H5T_CONV_SET_PREC_Y \
|
||||
/* Get source & destination precisions into a variable */ \
|
||||
tclass = st->shared->type; \
|
||||
assert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \
|
||||
assert(tclass == H5T_INTEGER || tclass == H5T_FLOAT || tclass == H5T_COMPLEX); \
|
||||
if (tclass == H5T_INTEGER) \
|
||||
sprec = st->shared->u.atomic.prec; \
|
||||
else \
|
||||
else if (tclass == H5T_FLOAT) \
|
||||
sprec = 1 + st->shared->u.atomic.u.f.msize; \
|
||||
else \
|
||||
sprec = 1 + st->shared->parent->shared->u.atomic.u.f.msize; \
|
||||
tclass = dt->shared->type; \
|
||||
assert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \
|
||||
assert(tclass == H5T_INTEGER || tclass == H5T_FLOAT || tclass == H5T_COMPLEX); \
|
||||
if (tclass == H5T_INTEGER) \
|
||||
dprec = dt->shared->u.atomic.prec; \
|
||||
else if (tclass == H5T_FLOAT) \
|
||||
dprec = 1 + dt->shared->u.atomic.u.f.msize; \
|
||||
else \
|
||||
dprec = 1 + dt->shared->u.atomic.u.f.msize;
|
||||
dprec = 1 + dt->shared->parent->shared->u.atomic.u.f.msize;
|
||||
|
||||
#define H5T_CONV_SET_PREC_N /*don't init precision variables */
|
||||
|
||||
|
@ -57,7 +57,7 @@ H5FL_BLK_DEFINE_STATIC(vlen_seq);
|
||||
* Function: H5T__conv_vlen_nested_free
|
||||
*
|
||||
* Purpose: Recursively locates and frees any nested VLEN components of
|
||||
* complex data types (including COMPOUND).
|
||||
* composite data types (including COMPOUND).
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure.
|
||||
*
|
||||
@ -101,6 +101,7 @@ H5T__conv_vlen_nested_free(uint8_t *buf, H5T_t *dt)
|
||||
case H5T_OPAQUE:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
/* These types cannot contain vl data */
|
||||
break;
|
||||
|
||||
|
51
src/H5Tdbg.c
51
src/H5Tdbg.c
@ -182,6 +182,31 @@ H5T_debug(const H5T_t *dt, FILE *stream)
|
||||
s1 = "struct";
|
||||
break;
|
||||
|
||||
case H5T_REFERENCE:
|
||||
switch (dt->shared->u.atomic.u.r.rtype) {
|
||||
case H5R_OBJECT1:
|
||||
s1 = "object reference (old)";
|
||||
break;
|
||||
case H5R_OBJECT2:
|
||||
s1 = "object reference (new)";
|
||||
break;
|
||||
case H5R_DATASET_REGION1:
|
||||
s1 = "region reference (old)";
|
||||
break;
|
||||
case H5R_DATASET_REGION2:
|
||||
s1 = "region reference (new)";
|
||||
break;
|
||||
case H5R_ATTR:
|
||||
s1 = "attribute reference";
|
||||
break;
|
||||
case H5R_BADTYPE:
|
||||
case H5R_MAXTYPE:
|
||||
default:
|
||||
s1 = "invalid reference";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case H5T_ENUM:
|
||||
s1 = "enum";
|
||||
break;
|
||||
@ -193,8 +218,14 @@ H5T_debug(const H5T_t *dt, FILE *stream)
|
||||
s1 = "vlen";
|
||||
break;
|
||||
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ARRAY:
|
||||
s1 = "array";
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
s1 = "complex number";
|
||||
break;
|
||||
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
s1 = "";
|
||||
@ -342,6 +373,7 @@ H5T_debug(const H5T_t *dt, FILE *stream)
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
/* No additional info */
|
||||
@ -407,6 +439,23 @@ H5T_debug(const H5T_t *dt, FILE *stream)
|
||||
else if (H5T_OPAQUE == dt->shared->type) {
|
||||
fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag);
|
||||
}
|
||||
else if (H5T_COMPLEX == dt->shared->type) {
|
||||
fprintf(stream, ", homogeneous");
|
||||
switch (dt->shared->u.cplx.form) {
|
||||
case H5T_COMPLEX_RECTANGULAR:
|
||||
fprintf(stream, ", rectangular form");
|
||||
break;
|
||||
case H5T_COMPLEX_POLAR:
|
||||
fprintf(stream, ", polar form");
|
||||
break;
|
||||
case H5T_COMPLEX_EXPONENTIAL:
|
||||
fprintf(stream, ", exponential form");
|
||||
break;
|
||||
default:
|
||||
fprintf(stream, ", invalid form");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Unknown */
|
||||
fprintf(stream, "unknown class %d\n", (int)(dt->shared->type));
|
||||
|
@ -172,6 +172,7 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class");
|
||||
@ -231,6 +232,7 @@ H5Tget_member_index(hid_t type_id, const char *name)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type");
|
||||
|
@ -23,13 +23,12 @@
|
||||
#include "H5Tpkg.h" /*data-type functions */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Tget_sign
|
||||
* Function: H5Tget_sign
|
||||
*
|
||||
* Purpose: Retrieves the sign type for an integer type.
|
||||
* Purpose: Retrieves the sign type for an integer type.
|
||||
*
|
||||
* Return: Success: The sign type.
|
||||
*
|
||||
* Failure: H5T_SGN_ERROR (Negative)
|
||||
* Return: Success: The sign type.
|
||||
* Failure: H5T_SGN_ERROR (Negative)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -52,14 +51,13 @@ done:
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T_get_sign
|
||||
* Function: H5T_get_sign
|
||||
*
|
||||
* Purpose: Private function for H5Tget_sign. Retrieves the sign type
|
||||
* Purpose: Private function for H5Tget_sign. Retrieves the sign type
|
||||
* for an integer type.
|
||||
*
|
||||
* Return: Success: The sign type.
|
||||
*
|
||||
* Failure: H5T_SGN_ERROR (Negative)
|
||||
* Return: Success: The sign type.
|
||||
* Failure: H5T_SGN_ERROR (Negative)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -88,11 +86,11 @@ done:
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Tset_sign
|
||||
* Function: H5Tset_sign
|
||||
*
|
||||
* Purpose: Sets the sign property for an integer.
|
||||
* Purpose: Sets the sign property for an integer.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
206
src/H5Tmodule.h
206
src/H5Tmodule.h
@ -71,7 +71,7 @@
|
||||
* An HDF5 datatype describes one specific layout of bits. A dataset has a single datatype which
|
||||
* applies to every data element. When a dataset is created, the storage datatype is defined. After
|
||||
* the dataset or attribute is created, the datatype cannot be changed.
|
||||
* \li The datatype describes the storage layout of a singledata element
|
||||
* \li The datatype describes the storage layout of a single data element
|
||||
* \li All elements of the dataset must have the same type
|
||||
* \li The datatype of a dataset is immutable
|
||||
*
|
||||
@ -168,6 +168,8 @@
|
||||
* \li Compound datatypes: structured records
|
||||
* \li Array: a multidimensional array of a datatype
|
||||
* \li Variable-length: a one-dimensional array of a datatype
|
||||
* \li Enumeration: a set of (name, value) pairs, similar to the C/C++ enum type
|
||||
* \li Complex: an aggregate of two similar floating-point datatypes
|
||||
*
|
||||
* <table>
|
||||
* <tr>
|
||||
@ -199,7 +201,7 @@
|
||||
* <th>
|
||||
* Description
|
||||
* </th>
|
||||
* <th>
|
||||
* <th>
|
||||
* Properties
|
||||
* </th>
|
||||
* <th>
|
||||
@ -351,6 +353,20 @@
|
||||
*
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* Complex
|
||||
* </td>
|
||||
* <td>
|
||||
* Data elements of two floating point numbers
|
||||
* </td>
|
||||
* <td>
|
||||
* Base floating point datatype
|
||||
* </td>
|
||||
* <td>
|
||||
* Other properties inherited from base floating point datatype
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* \subsubsection subsubsec_datatype_model_predefine Predefined Datatypes
|
||||
@ -745,6 +761,30 @@
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* #H5T_NATIVE_FLOAT_COMPLEX
|
||||
* </td>
|
||||
* <td span='3'>
|
||||
* float _Complex (MSVC _Fcomplex)
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* #H5T_NATIVE_DOUBLE_COMPLEX
|
||||
* </td>
|
||||
* <td span='3'>
|
||||
* double _Complex (MSVC _Dcomplex)
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* #H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
* </td>
|
||||
* <td span='3'>
|
||||
* long double _Complex (MSVC _Lcomplex)
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* #H5T_NATIVE_HSIZE
|
||||
* </td>
|
||||
* <td span='3'>
|
||||
@ -1005,12 +1045,51 @@
|
||||
* \ref hid_t \ref H5Tcreate (\ref H5T_class_t class, size_t size)
|
||||
* </td>
|
||||
* <td>
|
||||
* Create a new datatype object of datatype class . The following datatype classes care supported
|
||||
* with this function:
|
||||
* Create a new datatype object of the specified datatype class with the specified size. This
|
||||
* function is only used with the following datatype classes:
|
||||
* \li #H5T_COMPOUND
|
||||
* \li #H5T_OPAQUE
|
||||
* \li #H5T_ENUM
|
||||
* \li Other datatypes are created with \ref H5Tcopy().
|
||||
* \li #H5T_STRING
|
||||
* \li Other datatypes are created with a specialized datatype creation function such as
|
||||
* \ref H5Tarray_create2 or are copied from an existing predefined datatype with \ref H5Tcopy().
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* \ref hid_t \ref H5Tarray_create2 (\ref hid_t base_id, unsigned ndims, const \ref hsize_t dim[]);
|
||||
* </td>
|
||||
* <td>
|
||||
* Create a new array datatype object. \p base_id is the datatype of every element of the array, i.e.,
|
||||
* of the number at each position in the array. \p ndims is the number of dimensions and the size of
|
||||
* each dimension is specified in the array \p dim.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* \ref hid_t \ref H5Tvlen_create (\ref hid_t base_id);
|
||||
* </td>
|
||||
* <td>
|
||||
* Create a new one-dimensional variable-length array datatype object. \p base_id is the datatype of
|
||||
* every element of the array.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* \ref hid_t \ref H5Tenum_create (\ref hid_t base_id);
|
||||
* </td>
|
||||
* <td>
|
||||
* Create a new enumeration datatype object. \p base_id is the datatype of every element of the
|
||||
* enumeration datatype.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* \ref hid_t \ref H5Tcomplex_create (\ref hid_t base_type_id);
|
||||
* </td>
|
||||
* <td>
|
||||
* Create a new complex number datatype object. \p base_type_id is the datatype of both parts
|
||||
* of the complex number datatype and must be a floating point datatype.
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
@ -1044,7 +1123,8 @@
|
||||
* </td>
|
||||
* <td>
|
||||
* Releases resources associated with a datatype obtained from \ref H5Tcopy, \ref H5Topen, or
|
||||
* \ref H5Tcreate. It is illegal to close an immutable transient datatype (for example, predefined types).
|
||||
* \ref H5Tcreate / \ref H5Tarray_create2 / etc. It is illegal to close an immutable transient
|
||||
* datatype (for example, predefined types).
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
@ -1075,12 +1155,12 @@
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* In order to use a datatype, the object must be created (\ref H5Tcreate), or a reference obtained by
|
||||
* cloning from an existing type (\ref H5Tcopy), or opened (\ref H5Topen). In addition, a reference to the
|
||||
* datatype of a dataset or attribute can be obtained with \ref H5Dget_type or \ref H5Aget_type. For
|
||||
* composite datatypes a reference to the datatype for members or base types can be obtained
|
||||
* (\ref H5Tget_member_type, \ref H5Tget_super). When the datatype object is no longer needed, the
|
||||
* reference is discarded with \ref H5Tclose.
|
||||
* In order to use a datatype, the object must be created (\ref H5Tcreate / \ref H5Tarray_create2 / etc.),
|
||||
* or a reference obtained by cloning from an existing type (\ref H5Tcopy), or opened (\ref H5Topen).
|
||||
* In addition, a reference to the datatype of a dataset or attribute can be obtained with
|
||||
* \ref H5Dget_type or \ref H5Aget_type. For composite datatypes a reference to the datatype for
|
||||
* members or base types can be obtained (\ref H5Tget_member_type, \ref H5Tget_super). When the datatype
|
||||
* object is no longer needed, the reference is discarded with \ref H5Tclose.
|
||||
*
|
||||
* Two datatype objects can be tested to see if they are the same with \ref H5Tequal. This function
|
||||
* returns true if the two datatype references refer to the same datatype object. However, if two
|
||||
@ -1088,7 +1168,7 @@
|
||||
* they will not be considered ‘equal’.
|
||||
*
|
||||
* A datatype can be written to the file as a first class object (\ref H5Tcommit). This is a committed
|
||||
* datatype and can be used in thesame way as any other datatype.
|
||||
* datatype and can be used in the same way as any other datatype.
|
||||
*
|
||||
* \subsubsection subsubsec_datatype_program_discover Discovery of Datatype Properties
|
||||
* Any HDF5 datatype object can be queried to discover all of its datatype properties. For each
|
||||
@ -1115,7 +1195,7 @@
|
||||
* </td>
|
||||
* <td>
|
||||
* The datatype class: #H5T_INTEGER, #H5T_FLOAT, #H5T_STRING, #H5T_BITFIELD, #H5T_OPAQUE, #H5T_COMPOUND,
|
||||
* #H5T_REFERENCE, #H5T_ENUM, #H5T_VLEN, #H5T_ARRAY
|
||||
* #H5T_REFERENCE, #H5T_ENUM, #H5T_VLEN, #H5T_ARRAY, #H5T_COMPLEX
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
@ -1473,6 +1553,14 @@
|
||||
* #H5Tvlen_create
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>
|
||||
* COMPLEX
|
||||
* </td>
|
||||
* <td>
|
||||
* #H5Tcomplex_create
|
||||
* </td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* Once the datatype is created and the datatype properties set, the datatype object can be used.
|
||||
@ -2408,7 +2496,8 @@ filled according to the value of this property. The padding can be:
|
||||
* <li>#H5T_REFERENCE</li>
|
||||
* <li>#H5T_ENUM</li>
|
||||
* <li>#H5T_VLEN</li>
|
||||
* <li>#H5T_ARRAY</li></ul>
|
||||
* <li>#H5T_ARRAY</li>
|
||||
* <li>#H5T_COMPLEX</li></ul>
|
||||
* </li>
|
||||
* <li>If class is #H5T_COMPOUND, then go to step 2 and repeat all steps under step 3. If
|
||||
* class is not #H5T_COMPOUND, then a member is of an atomic class and can be read
|
||||
@ -2691,7 +2780,7 @@ filled according to the value of this property. The padding can be:
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* An array datatype may be multi-dimensional with 1 to #H5S_MAX_RANK(the maximum rank
|
||||
* An array datatype may be multi-dimensional with 1 to #H5S_MAX_RANK (the maximum rank
|
||||
* of a dataset is currently 32) dimensions. The dimensions can be any size greater than 0, but
|
||||
* unlimited dimensions are not supported (although the datatype can be a variable-length datatype).
|
||||
*
|
||||
@ -2727,7 +2816,7 @@ filled according to the value of this property. The padding can be:
|
||||
*
|
||||
* A variable-length (VL) datatype is a one-dimensional sequence of a datatype which are not fixed
|
||||
* in length from one dataset location to another. In other words, each data element may have a
|
||||
* different number of members. Variable-length datatypes cannot be divided;the entire data
|
||||
* different number of members. Variable-length datatypes cannot be divided; the entire data
|
||||
* element must be transferred.
|
||||
*
|
||||
* VL datatypes are useful to the scientific community in many different ways, possibly including:
|
||||
@ -2780,14 +2869,14 @@ filled according to the value of this property. The padding can be:
|
||||
* data is laid out in memory.
|
||||
*
|
||||
* An analogous procedure must be used to read the data. See the second example below. An
|
||||
* appropriate array of vl_t must be allocated, and the data read. It is then traversed one data
|
||||
* element at a time. The #H5Dvlen_reclaim call frees the data buffer for the buffer. With each
|
||||
* appropriate array of hvl_t must be allocated, and the data read. It is then traversed one data
|
||||
* element at a time. The #H5Treclaim call frees the data buffer for the buffer. With each
|
||||
* element possibly being of different sequence lengths for a dataset with a VL datatype, the
|
||||
* memory for the VL datatype must be dynamically allocated. Currently there are two methods of
|
||||
* managing the memory for VL datatypes: the standard C malloc/free memory allocation routines
|
||||
* or a method of calling user-defined memory management routines to allocate or free memory
|
||||
* (set with #H5Pset_vlen_mem_manager). Since the memory allocated when reading (or writing)
|
||||
* may be complicated to release, the #H5Dvlen_reclaim function is provided to traverse a memory
|
||||
* may be complicated to release, the #H5Treclaim function is provided to traverse a memory
|
||||
* buffer and free the VL datatype information without leaking memory.
|
||||
*
|
||||
* <em>Write VL data</em>
|
||||
@ -2815,7 +2904,7 @@ filled according to the value of this property. The padding can be:
|
||||
* printf(“ value: %u\n”,((unsigned int *)rdata[i].p)[j]);
|
||||
* }
|
||||
* }
|
||||
* ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
|
||||
* ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
|
||||
* \endcode
|
||||
*
|
||||
* <table>
|
||||
@ -2827,10 +2916,10 @@ filled according to the value of this property. The padding can be:
|
||||
* </table>
|
||||
*
|
||||
* The user program must carefully manage these relatively complex data structures. The
|
||||
* #H5Dvlen_reclaim function performs a standard traversal, freeing all the data. This function
|
||||
* #H5Treclaim function performs a standard traversal, freeing all the data. This function
|
||||
* analyzes the datatype and dataspace objects, and visits each VL data element, recursing through
|
||||
* nested types. By default, the system free is called for the pointer in each vl_t. Obviously, this
|
||||
* call assumes that all of this memory was allocated with the system malloc.
|
||||
* nested types. By default, the system free is called for the pointer in each hvl_t. Obviously,
|
||||
* this call assumes that all of this memory was allocated with the system malloc.
|
||||
*
|
||||
* The user program may specify custom memory manager routines, one for allocating and one for
|
||||
* freeing. These may be set with the #H5Pset_vlen_mem_manager, and must have the following
|
||||
@ -2853,6 +2942,44 @@ filled according to the value of this property. The padding can be:
|
||||
* destination storage (memory). The size value is adjusted for data conversion and alignment in the
|
||||
* destination.
|
||||
*
|
||||
* <h4>Complex</h4>
|
||||
*
|
||||
* A complex number datatype represents complex number data elements which consist of two floating
|
||||
* point parts. Complex number datatypes cannot be divided for I/O; the entire data element must be
|
||||
* transferred.
|
||||
*
|
||||
* A complex number datatype is created by calling #H5Tcomplex_create with a specified base floating
|
||||
* point datatype. The example below shows code that creates a complex number datatype of 16-bit
|
||||
* floating point values.
|
||||
*
|
||||
* <em>Create a complex number datatype of 2 IEEE little-endian 16-bit floating point values</em>
|
||||
* \code
|
||||
* tid1 = H5Tcomplex_create (H5T_IEEE_F16LE);
|
||||
*
|
||||
* dataset = H5Dcreate(fid1, “Dataset1”, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
* \endcode
|
||||
*
|
||||
* <em>Data element storage of a complex number datatype</em>
|
||||
*
|
||||
* Each part of a data element with a complex number datatype is stored contiguously. Complex number
|
||||
* datatypes have the same storage representation as an array datatype of 2 elements of a floating
|
||||
* point datatype or a compound datatype with 2 fields and no structure padding, where each field
|
||||
* is of the same floating point datatype. Thus, the following representations are equivalent:
|
||||
*
|
||||
* \code
|
||||
* float _Complex data;
|
||||
* \endcode
|
||||
* \code
|
||||
* float data[2];
|
||||
* \endcode
|
||||
* \code
|
||||
* struct
|
||||
* {
|
||||
* float real;
|
||||
* float imaginary;
|
||||
* } data;
|
||||
* \endcode
|
||||
*
|
||||
* \subsection subsec_datatype_other Other Non-numeric Datatypes
|
||||
* Several datatype classes define special types of objects.
|
||||
*
|
||||
@ -2917,13 +3044,13 @@ filled according to the value of this property. The padding can be:
|
||||
* is fast to access, but can waste storage space if the length of the Strings varies.
|
||||
*
|
||||
* A third alternative is to use a variable-length datatype. See item c in the figure above. This can
|
||||
* be done using the standard mechanisms described above. The program would use vl_t structures
|
||||
* be done using the standard mechanisms described above. The program would use hvl_t structures
|
||||
* to write and read the data.
|
||||
*
|
||||
* A fourth alternative is to use a special feature of the string datatype class to set the size of the
|
||||
* datatype to #H5T_VARIABLE. See item c in the figure above. The example below shows a
|
||||
* declaration of a datatype of type #H5T_C_S1 which is set to #H5T_VARIABLE. The HDF5
|
||||
* Library automatically translates between this and the vl_t structure. Note: the #H5T_VARIABLE
|
||||
* Library automatically translates between this and the hvl_t structure. Note: the #H5T_VARIABLE
|
||||
* size can only be used with string datatypes.
|
||||
*
|
||||
* <em>Set the string datatype size to H5T_VARIABLE</em>
|
||||
@ -2945,7 +3072,7 @@ filled according to the value of this property. The padding can be:
|
||||
* printf(“%d: len: %d, str is: %s\n”, i, strlen(rdata[i]), rdata[i]);
|
||||
* }
|
||||
*
|
||||
* ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
|
||||
* ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
|
||||
* \endcode
|
||||
*
|
||||
* \subsubsection subsubsec_datatype_other_refs Reference
|
||||
@ -3804,12 +3931,13 @@ filled according to the value of this property. The padding can be:
|
||||
* datatypes.
|
||||
*
|
||||
* The currently supported text format used by #H5LTtext_to_dtype and #H5LTdtype_to_text is the
|
||||
* data description language (DDL) and conforms to the \ref DDLBNF114. The portion of the
|
||||
* \ref DDLBNF114 that defines HDF5 datatypes appears below.
|
||||
* data description language (DDL) and conforms to the \ref DDLBNF200. The portion of the
|
||||
* \ref DDLBNF200 that defines HDF5 datatypes appears below.
|
||||
*
|
||||
* <em>The definition of HDF5 datatypes from the HDF5 DDL</em>
|
||||
* \code
|
||||
* <datatype> ::= <atomic_type> | <compound_type> | <variable_length_type> | <array_type>
|
||||
* <datatype> ::= <atomic_type> | <compound_type> | <variable_length_type> | <array_type> |
|
||||
* <complex_type>
|
||||
*
|
||||
* <atomic_type> ::= <integer> | <float> | <time> | <string> |
|
||||
* <bitfield> | <opaque> | <reference> | <enum>
|
||||
@ -3882,6 +4010,16 @@ filled according to the value of this property. The padding can be:
|
||||
* <enum_def> ::= <enum_symbol> <enum_val>;
|
||||
* <enum_symbol> ::= <identifier>
|
||||
* <enum_val> ::= <int_value>
|
||||
* <complex_type> ::= H5T_COMPLEX { <complex_base_type> <complex_base_type> } |
|
||||
* H5T_COMPLEX_IEEE_F16BE | H5T_COMPLEX_IEEE_F16LE |
|
||||
* H5T_COMPLEX_IEEE_F32BE | H5T_COMPLEX_IEEE_F32LE |
|
||||
* H5T_COMPLEX_IEEE_F64BE | H5T_COMPLEX_IEEE_F64LE |
|
||||
* H5T_NATIVE_FLOAT_COMPLEX | H5T_NATIVE_DOUBLE_COMPLEX |
|
||||
* H5T_NATIVE_LDOUBLE_COMPLEX
|
||||
* <complex_base_type> ::= <float>
|
||||
* // Currently complex number datatypes can only hold homogeneous floating-point
|
||||
* // type data, but they may be expanded in the future to hold heterogeneous
|
||||
* // floating-point type data or even non-floating-point type data
|
||||
* \endcode
|
||||
*
|
||||
* <em> Old definitions of the opaque and compound datatypes</em>
|
||||
@ -3992,6 +4130,14 @@ filled according to the value of this property. The padding can be:
|
||||
* \snippet{doc} tables/predefinedDatatypes.dox predefined_ieee_datatypes_table
|
||||
* </div>
|
||||
*
|
||||
* \defgroup PDTCOMPLEX Complex Number Datatypes
|
||||
* \ingroup PDT
|
||||
* \details Complex number types consisting of 2 floating point values in big-
|
||||
* and little-endian byte orders.
|
||||
* <div>
|
||||
* \snippet{doc} tables/predefinedDatatypes.dox predefined_complex_datatypes_table
|
||||
* </div>
|
||||
*
|
||||
* \defgroup PDTSTD Standard Datatypes
|
||||
* \ingroup PDT
|
||||
* \details These are "standard" types. For instance, signed (2's complement)
|
||||
|
138
src/H5Tnative.c
138
src/H5Tnative.c
@ -53,6 +53,10 @@ static herr_t H5T__cmp_offset(size_t *comp_size, size_t *offset, size_t elem_siz
|
||||
* H5T_NATIVE_DOUBLE
|
||||
* H5T_NATIVE_LDOUBLE
|
||||
*
|
||||
* H5T_NATIVE_FLOAT_COMPLEX (if available)
|
||||
* H5T_NATIVE_DOUBLE_COMPLEX (if available)
|
||||
* H5T_NATIVE_LDOUBLE_COMPLEX (if available)
|
||||
*
|
||||
* Compound, array, enum, and VL types all choose among these
|
||||
* types for their members. Time, Bitfield, Opaque, Reference
|
||||
* types are only copy out.
|
||||
@ -440,7 +444,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
size_t vl_size = 0;
|
||||
size_t super_size = 0;
|
||||
|
||||
/* Retrieve base type for array type */
|
||||
/* Retrieve base type for variable-length type */
|
||||
if (NULL == (super_type = H5T_get_super(dtype)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for VL type");
|
||||
/* Don't need alignment, offset information if this VL isn't a field of compound type. If it
|
||||
@ -453,7 +457,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
if (H5T_close_real(super_type) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype");
|
||||
|
||||
/* Create a new array type based on native type */
|
||||
/* Create a new variable-length type based on native type */
|
||||
if (NULL == (new_type = H5T__vlen_create(nat_super_type)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type");
|
||||
|
||||
@ -472,6 +476,38 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
|
||||
} /* end case */
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
size_t super_offset = 0;
|
||||
size_t super_size = 0;
|
||||
size_t super_align = 0;
|
||||
|
||||
/* Retrieve base type for complex number type */
|
||||
if (NULL == (super_type = H5T_get_super(dtype)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for complex number type");
|
||||
|
||||
if (NULL == (nat_super_type = H5T__get_native_type(super_type, direction, &super_align,
|
||||
&super_offset, &super_size)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed");
|
||||
|
||||
/* Close super type */
|
||||
if (H5T_close_real(super_type) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype");
|
||||
|
||||
/* Create a new complex number type based on native type */
|
||||
if (NULL == (new_type = H5T__complex_create(nat_super_type)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create complex number type");
|
||||
|
||||
/* Close base type */
|
||||
if (H5T_close_real(nat_super_type) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype");
|
||||
|
||||
if (H5T__cmp_offset(comp_size, offset, new_type->shared->size, 1, super_align, struct_align) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset");
|
||||
|
||||
ret_value = new_type;
|
||||
} /* end case */
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
@ -1266,3 +1302,101 @@ H5T__init_native_internal(void)
|
||||
|
||||
return SUCCEED;
|
||||
}
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T__init_native_complex_types
|
||||
*
|
||||
* Purpose: Initializes native complex number datatypes
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5T__init_native_complex_types(void)
|
||||
{
|
||||
H5T_t *native_float = NULL; /* Datatype structure for native float */
|
||||
H5T_t *native_double = NULL; /* Datatype structure for native double */
|
||||
H5T_t *native_ldouble = NULL; /* Datatype structure for native long double */
|
||||
H5T_t *dt = NULL;
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
/* Assumes that native floating-point types are already initialized */
|
||||
assert(H5T_NATIVE_FLOAT_g != H5I_INVALID_HID);
|
||||
assert(H5T_NATIVE_DOUBLE_g != H5I_INVALID_HID);
|
||||
assert(H5T_NATIVE_LDOUBLE_g != H5I_INVALID_HID);
|
||||
|
||||
/* Declare structure for finding alignment of each type */
|
||||
typedef struct {
|
||||
struct {
|
||||
char c;
|
||||
H5_float_complex x;
|
||||
} FLOAT_COMPLEX;
|
||||
struct {
|
||||
char c;
|
||||
H5_double_complex x;
|
||||
} DOUBLE_COMPLEX;
|
||||
struct {
|
||||
char c;
|
||||
H5_ldouble_complex x;
|
||||
} LDOUBLE_COMPLEX;
|
||||
} alignments_t;
|
||||
|
||||
if (NULL == (native_float = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get datatype structure for native float type");
|
||||
if (NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get datatype structure for native double type");
|
||||
if (NULL == (native_ldouble = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get datatype structure for native long double type");
|
||||
|
||||
/* H5T_NATIVE_FLOAT_COMPLEX */
|
||||
|
||||
if (NULL == (dt = H5T__complex_create(native_float)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create native float complex datatype");
|
||||
dt->shared->state = H5T_STATE_IMMUTABLE;
|
||||
|
||||
/* Register the type and set global variables */
|
||||
if ((H5T_NATIVE_FLOAT_COMPLEX_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for native float complex datatype");
|
||||
H5T_NATIVE_FLOAT_COMPLEX_ALIGN_g = TAG_ALIGNMENT(FLOAT_COMPLEX);
|
||||
|
||||
dt = NULL;
|
||||
|
||||
/* H5T_NATIVE_DOUBLE_COMPLEX */
|
||||
|
||||
if (NULL == (dt = H5T__complex_create(native_double)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create native double complex datatype");
|
||||
dt->shared->state = H5T_STATE_IMMUTABLE;
|
||||
|
||||
/* Register the type and set global variables */
|
||||
if ((H5T_NATIVE_DOUBLE_COMPLEX_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for native double complex datatype");
|
||||
H5T_NATIVE_DOUBLE_COMPLEX_ALIGN_g = TAG_ALIGNMENT(DOUBLE_COMPLEX);
|
||||
|
||||
dt = NULL;
|
||||
|
||||
/* H5T_NATIVE_LDOUBLE_COMPLEX */
|
||||
|
||||
if (NULL == (dt = H5T__complex_create(native_ldouble)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create native long double complex datatype");
|
||||
dt->shared->state = H5T_STATE_IMMUTABLE;
|
||||
|
||||
/* Register the type and set global variables */
|
||||
if ((H5T_NATIVE_LDOUBLE_COMPLEX_g = H5I_register(H5I_DATATYPE, dt, false)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"can't register ID for native long double complex datatype");
|
||||
H5T_NATIVE_LDOUBLE_COMPLEX_ALIGN_g = TAG_ALIGNMENT(LDOUBLE_COMPLEX);
|
||||
|
||||
dt = NULL;
|
||||
|
||||
done:
|
||||
if (ret_value < 0) {
|
||||
if (dt && (H5T_close(dt) < 0))
|
||||
HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype");
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
#endif
|
||||
|
@ -232,6 +232,8 @@ H5T__set_offset(const H5T_t *dt, size_t offset)
|
||||
/* Adjust size of datatype appropriately */
|
||||
if (dt->shared->type == H5T_ARRAY)
|
||||
dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem;
|
||||
else if (dt->shared->type == H5T_COMPLEX)
|
||||
dt->shared->size = 2 * dt->shared->parent->shared->size;
|
||||
else if (dt->shared->type != H5T_VLEN)
|
||||
dt->shared->size = dt->shared->parent->shared->size;
|
||||
}
|
||||
|
92
src/H5Tpkg.h
92
src/H5Tpkg.h
@ -41,9 +41,10 @@
|
||||
/* Other public headers needed by this file */
|
||||
#include "H5Spublic.h" /* Dataspace functions */
|
||||
|
||||
/* Macro to ease detecting "complex" datatypes (i.e. those with base types or fields) */
|
||||
#define H5T_IS_COMPLEX(t) \
|
||||
((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY || (t) == H5T_REFERENCE)
|
||||
/* Macro to ease detecting composite datatypes (i.e. those with base types or fields) */
|
||||
#define H5T_IS_COMPOSITE(t) \
|
||||
((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY || \
|
||||
(t) == H5T_REFERENCE || (t) == H5T_COMPLEX)
|
||||
|
||||
/* Macro to ease detecting fixed "string" datatypes */
|
||||
#define H5T_IS_FIXED_STRING(dt) (H5T_STRING == (dt)->type)
|
||||
@ -55,7 +56,7 @@
|
||||
#define H5T_IS_STRING(dt) (H5T_IS_FIXED_STRING(dt) || H5T_IS_VL_STRING(dt))
|
||||
|
||||
/* Macro to ease detecting atomic datatypes */
|
||||
#define H5T_IS_ATOMIC(dt) (!(H5T_IS_COMPLEX((dt)->type) || (dt)->type == H5T_OPAQUE))
|
||||
#define H5T_IS_ATOMIC(dt) (!(H5T_IS_COMPOSITE((dt)->type) || (dt)->type == H5T_OPAQUE))
|
||||
|
||||
/* Macro to ease retrieving class of shared datatype */
|
||||
/* (Externally, a VL string is a string; internally, a VL string is a VL. Lie
|
||||
@ -95,19 +96,26 @@
|
||||
*/
|
||||
#define H5O_DTYPE_VERSION_4 4
|
||||
|
||||
/* This is the version that adds support for complex number types and prevents
|
||||
* older versions of the library to attempt reading unknown types.
|
||||
*/
|
||||
#define H5O_DTYPE_VERSION_5 5
|
||||
|
||||
/* The latest version of the format. Look through the 'encode helper' routine
|
||||
* and 'size' callback for places to change when updating this. */
|
||||
#define H5O_DTYPE_VERSION_LATEST H5O_DTYPE_VERSION_4
|
||||
#define H5O_DTYPE_VERSION_LATEST H5O_DTYPE_VERSION_5
|
||||
|
||||
/* Flags for visiting datatype */
|
||||
#define H5T_VISIT_COMPLEX_FIRST 0x01 /* Visit complex datatype before visiting member/parent datatypes */
|
||||
#define H5T_VISIT_COMPLEX_LAST 0x02 /* Visit complex datatype after visiting member/parent datatypes */
|
||||
/* (setting both flags will mean visiting complex type twice) */
|
||||
#define H5T_VISIT_SIMPLE 0x04 /* Visit simple datatypes (at all) */
|
||||
/* (setting H5T_VISIT_SIMPLE and _not_ setting either H5T_VISIT_COMPLEX_FIRST or H5T_VISIT_COMPLEX_LAST will
|
||||
* mean visiting _only_ "simple" "leafs" in the "tree" */
|
||||
/* (_not_ setting H5T_VISIT_SIMPLE and setting either H5T_VISIT_COMPLEX_FIRST or H5T_VISIT_COMPLEX_LAST will
|
||||
* mean visiting all nodes _except_ "simple" "leafs" in the "tree" */
|
||||
#define H5T_VISIT_COMPOSITE_FIRST \
|
||||
0x01 /* Visit composite datatype before visiting member/parent datatypes \
|
||||
*/
|
||||
#define H5T_VISIT_COMPOSITE_LAST 0x02 /* Visit composite datatype after visiting member/parent datatypes */
|
||||
/* (setting both flags will mean visiting composite type twice) */
|
||||
#define H5T_VISIT_SIMPLE 0x04 /* Visit simple datatypes (at all) */
|
||||
/* (setting H5T_VISIT_SIMPLE and _not_ setting either H5T_VISIT_COMPOSITE_FIRST or H5T_VISIT_COMPOSITE_LAST
|
||||
* will mean visiting _only_ "simple" "leafs" in the "tree" */
|
||||
/* (_not_ setting H5T_VISIT_SIMPLE and setting either H5T_VISIT_COMPOSITE_FIRST or H5T_VISIT_COMPOSITE_LAST
|
||||
* will mean visiting all nodes _except_ "simple" "leafs" in the "tree" */
|
||||
|
||||
/* Define an internal macro for converting long long to long double. Mac OS 10.4 gives some
|
||||
* incorrect conversions. */
|
||||
@ -136,8 +144,6 @@
|
||||
* floating exception. */
|
||||
#if (H5_WANT_DATA_ACCURACY && defined(H5_LDOUBLE_TO_LLONG_ACCURATE)) || (!H5_WANT_DATA_ACCURACY)
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 1
|
||||
#else
|
||||
#define H5T_CONV_INTERNAL_LDOUBLE_ULLONG 0
|
||||
#endif
|
||||
|
||||
/* Define an internal macro for converting long double to _Float16. Mac OS 13
|
||||
@ -291,6 +297,18 @@ typedef struct H5T_array_t {
|
||||
size_t dim[H5S_MAX_RANK]; /* size in each dimension */
|
||||
} H5T_array_t;
|
||||
|
||||
/* Form (Rectangular, Polar, Exponential) of complex number */
|
||||
typedef enum H5T_complex_form_t {
|
||||
H5T_COMPLEX_RECTANGULAR,
|
||||
H5T_COMPLEX_POLAR,
|
||||
H5T_COMPLEX_EXPONENTIAL,
|
||||
} H5T_complex_form_t;
|
||||
|
||||
/* A complex number datatype */
|
||||
typedef struct H5T_complex_t {
|
||||
H5T_complex_form_t form; /* Form (Rectangular, Polar, Exponential) of complex number */
|
||||
} H5T_complex_t;
|
||||
|
||||
typedef enum H5T_state_t {
|
||||
H5T_STATE_TRANSIENT, /*type is a modifiable, closable transient */
|
||||
H5T_STATE_RDONLY, /*transient, not modifiable, closable */
|
||||
@ -310,12 +328,13 @@ typedef struct H5T_shared_t {
|
||||
struct H5T_t *parent; /*parent type for derived datatypes */
|
||||
H5VL_object_t *owned_vol_obj; /* Vol object owned by this type (free on close) */
|
||||
union {
|
||||
H5T_atomic_t atomic; /* an atomic datatype */
|
||||
H5T_compnd_t compnd; /* a compound datatype (struct) */
|
||||
H5T_enum_t enumer; /* an enumeration type (enum) */
|
||||
H5T_vlen_t vlen; /* a variable-length datatype */
|
||||
H5T_opaque_t opaque; /* an opaque datatype */
|
||||
H5T_array_t array; /* an array datatype */
|
||||
H5T_atomic_t atomic; /* an atomic datatype */
|
||||
H5T_compnd_t compnd; /* a compound datatype (struct) */
|
||||
H5T_enum_t enumer; /* an enumeration type (enum) */
|
||||
H5T_vlen_t vlen; /* a variable-length datatype */
|
||||
H5T_opaque_t opaque; /* an opaque datatype */
|
||||
H5T_array_t array; /* an array datatype */
|
||||
H5T_complex_t cplx; /* a complex number datatype */
|
||||
} u;
|
||||
} H5T_shared_t;
|
||||
|
||||
@ -384,6 +403,9 @@ H5_DLLVAR size_t H5T_NATIVE_FLOAT16_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_FLOAT_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_FLOAT_COMPLEX_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_COMPLEX_ALIGN_g;
|
||||
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_COMPLEX_ALIGN_g;
|
||||
|
||||
/* C9x alignment constraints */
|
||||
H5_DLLVAR size_t H5T_NATIVE_INT8_ALIGN_g;
|
||||
@ -420,12 +442,20 @@ H5_DLLVAR size_t H5T_NATIVE_UINT_FAST64_ALIGN_g;
|
||||
H5_DLLVAR H5__Float16 H5T_NATIVE_FLOAT16_POS_INF_g;
|
||||
H5_DLLVAR H5__Float16 H5T_NATIVE_FLOAT16_NEG_INF_g;
|
||||
#endif
|
||||
H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g;
|
||||
H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g;
|
||||
H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g;
|
||||
H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g;
|
||||
H5_DLLVAR double H5T_NATIVE_LDOUBLE_POS_INF_g;
|
||||
H5_DLLVAR double H5T_NATIVE_LDOUBLE_NEG_INF_g;
|
||||
H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g;
|
||||
H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g;
|
||||
H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g;
|
||||
H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g;
|
||||
H5_DLLVAR long double H5T_NATIVE_LDOUBLE_POS_INF_g;
|
||||
H5_DLLVAR long double H5T_NATIVE_LDOUBLE_NEG_INF_g;
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLLVAR H5_float_complex H5T_NATIVE_FLOAT_COMPLEX_POS_INF_g;
|
||||
H5_DLLVAR H5_float_complex H5T_NATIVE_FLOAT_COMPLEX_NEG_INF_g;
|
||||
H5_DLLVAR H5_double_complex H5T_NATIVE_DOUBLE_COMPLEX_POS_INF_g;
|
||||
H5_DLLVAR H5_double_complex H5T_NATIVE_DOUBLE_COMPLEX_NEG_INF_g;
|
||||
H5_DLLVAR H5_ldouble_complex H5T_NATIVE_LDOUBLE_COMPLEX_POS_INF_g;
|
||||
H5_DLLVAR H5_ldouble_complex H5T_NATIVE_LDOUBLE_COMPLEX_NEG_INF_g;
|
||||
#endif
|
||||
|
||||
/* Declare extern the free lists for H5T_t's and H5T_shared_t's */
|
||||
H5FL_EXTERN(H5T_t);
|
||||
@ -434,6 +464,9 @@ H5FL_EXTERN(H5T_shared_t);
|
||||
/* Common functions */
|
||||
H5_DLL herr_t H5T__init_native_float_types(void);
|
||||
H5_DLL herr_t H5T__init_native_internal(void);
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
H5_DLL herr_t H5T__init_native_complex_types(void);
|
||||
#endif
|
||||
H5_DLL H5T_t *H5T__create(H5T_class_t type, size_t size);
|
||||
H5_DLL H5T_t *H5T__alloc(void);
|
||||
H5_DLL herr_t H5T__free(H5T_t *dt);
|
||||
@ -453,7 +486,7 @@ H5_DLL void H5T__bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *sr
|
||||
size_t size);
|
||||
H5_DLL herr_t H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size);
|
||||
H5_DLL void H5T__bit_set(uint8_t *buf, size_t offset, size_t size, bool value);
|
||||
H5_DLL uint64_t H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size);
|
||||
H5_DLL uint64_t H5T__bit_get_d(const uint8_t *buf, size_t offset, size_t size);
|
||||
H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val);
|
||||
H5_DLL ssize_t H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction,
|
||||
bool value);
|
||||
@ -490,4 +523,7 @@ H5_DLL char *H5T__get_member_name(H5T_t const *dt, unsigned membno) H5_ATTR_MAL
|
||||
H5_DLL herr_t H5T__sort_value(const H5T_t *dt, int *map);
|
||||
H5_DLL herr_t H5T__sort_name(const H5T_t *dt, int *map);
|
||||
|
||||
/* Complex number functions */
|
||||
H5_DLL H5T_t *H5T__complex_create(const H5T_t *base);
|
||||
|
||||
#endif /* H5Tpkg_H */
|
||||
|
@ -193,6 +193,8 @@ H5T__set_precision(const H5T_t *dt, size_t prec)
|
||||
/* Adjust size of datatype appropriately */
|
||||
if (dt->shared->type == H5T_ARRAY)
|
||||
dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem;
|
||||
else if (dt->shared->type == H5T_COMPLEX)
|
||||
dt->shared->size = 2 * dt->shared->parent->shared->size;
|
||||
else if (dt->shared->type != H5T_VLEN)
|
||||
dt->shared->size = dt->shared->parent->shared->size;
|
||||
}
|
||||
@ -237,6 +239,7 @@ H5T__set_precision(const H5T_t *dt, size_t prec)
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class");
|
||||
|
105
src/H5Tpublic.h
105
src/H5Tpublic.h
@ -40,6 +40,7 @@ typedef enum H5T_class_t {
|
||||
H5T_ENUM = 8, /**< enumeration types */
|
||||
H5T_VLEN = 9, /**< variable-Length types */
|
||||
H5T_ARRAY = 10, /**< array types */
|
||||
H5T_COMPLEX = 11, /**< complex number types */
|
||||
|
||||
H5T_NCLASSES /**< sentinel: this must be last */
|
||||
} H5T_class_t;
|
||||
@ -279,6 +280,46 @@ H5_DLLVAR hid_t H5T_IEEE_F32LE_g;
|
||||
H5_DLLVAR hid_t H5T_IEEE_F64BE_g;
|
||||
H5_DLLVAR hid_t H5T_IEEE_F64LE_g;
|
||||
|
||||
/*
|
||||
* Complex number types made up of IEEE floating point types
|
||||
*/
|
||||
/**
|
||||
* \ingroup PDTCOMPLEX
|
||||
* Complex number of 2 16-bit little-endian IEEE floating-point numbers
|
||||
*/
|
||||
#define H5T_COMPLEX_IEEE_F16BE (H5OPEN H5T_COMPLEX_IEEE_F16BE_g)
|
||||
/**
|
||||
* \ingroup PDTCOMPLEX
|
||||
* Complex number of 2 16-bit big-endian IEEE floating-point numbers
|
||||
*/
|
||||
#define H5T_COMPLEX_IEEE_F16LE (H5OPEN H5T_COMPLEX_IEEE_F16LE_g)
|
||||
/**
|
||||
* \ingroup PDTCOMPLEX
|
||||
* Complex number of 2 32-bit big-endian IEEE floating-point numbers
|
||||
*/
|
||||
#define H5T_COMPLEX_IEEE_F32BE (H5OPEN H5T_COMPLEX_IEEE_F32BE_g)
|
||||
/**
|
||||
* \ingroup PDTCOMPLEX
|
||||
* Complex number of 2 32-bit little-endian IEEE floating-point numbers
|
||||
*/
|
||||
#define H5T_COMPLEX_IEEE_F32LE (H5OPEN H5T_COMPLEX_IEEE_F32LE_g)
|
||||
/**
|
||||
* \ingroup PDTCOMPLEX
|
||||
* Complex number of 2 64-bit big-endian IEEE floating-point numbers
|
||||
*/
|
||||
#define H5T_COMPLEX_IEEE_F64BE (H5OPEN H5T_COMPLEX_IEEE_F64BE_g)
|
||||
/**
|
||||
* \ingroup PDTCOMPLEX
|
||||
* Complex number of 2 64-bit little-endian IEEE floating-point numbers
|
||||
*/
|
||||
#define H5T_COMPLEX_IEEE_F64LE (H5OPEN H5T_COMPLEX_IEEE_F64LE_g)
|
||||
H5_DLLVAR hid_t H5T_COMPLEX_IEEE_F16BE_g;
|
||||
H5_DLLVAR hid_t H5T_COMPLEX_IEEE_F16LE_g;
|
||||
H5_DLLVAR hid_t H5T_COMPLEX_IEEE_F32BE_g;
|
||||
H5_DLLVAR hid_t H5T_COMPLEX_IEEE_F32LE_g;
|
||||
H5_DLLVAR hid_t H5T_COMPLEX_IEEE_F64BE_g;
|
||||
H5_DLLVAR hid_t H5T_COMPLEX_IEEE_F64LE_g;
|
||||
|
||||
/*
|
||||
* These are "standard" types. For instance, signed (2's complement) and
|
||||
* unsigned integers of various sizes and byte orders.
|
||||
@ -797,7 +838,7 @@ H5_DLLVAR hid_t H5T_VAX_F64_g;
|
||||
#define H5T_NATIVE_ULLONG (H5OPEN H5T_NATIVE_ULLONG_g)
|
||||
/**
|
||||
* \ingroup PDTNAT
|
||||
* C-style \TText{_Float16}
|
||||
* C-style \TText{_Float16} (May be \TText{H5I_INVALID_HID} if platform doesn't support \TText{_Float16} type)
|
||||
*/
|
||||
#define H5T_NATIVE_FLOAT16 (H5OPEN H5T_NATIVE_FLOAT16_g)
|
||||
/**
|
||||
@ -815,6 +856,24 @@ H5_DLLVAR hid_t H5T_VAX_F64_g;
|
||||
* C-style \TText{long double}
|
||||
*/
|
||||
#define H5T_NATIVE_LDOUBLE (H5OPEN H5T_NATIVE_LDOUBLE_g)
|
||||
/**
|
||||
* \ingroup PDTNAT
|
||||
* C-style \TText{float _Complex} / (MSVC) \TText{_Fcomplex} (May be \TText{H5I_INVALID_HID} if platform
|
||||
* doesn't support \TText{float _Complex}/\TText{_Fcomplex} type)
|
||||
*/
|
||||
#define H5T_NATIVE_FLOAT_COMPLEX (H5OPEN H5T_NATIVE_FLOAT_COMPLEX_g)
|
||||
/**
|
||||
* \ingroup PDTNAT
|
||||
* C-style \TText{double _Complex} / (MSVC) \TText{_Dcomplex} (May be \TText{H5I_INVALID_HID} if platform
|
||||
* doesn't support \TText{double _Complex}/\TText{_Dcomplex} type)
|
||||
*/
|
||||
#define H5T_NATIVE_DOUBLE_COMPLEX (H5OPEN H5T_NATIVE_DOUBLE_COMPLEX_g)
|
||||
/**
|
||||
* \ingroup PDTNAT
|
||||
* C-style \TText{long double _Complex} / (MSVC) \TText{_Lcomplex} (May be \TText{H5I_INVALID_HID} if platform
|
||||
* doesn't support \TText{long double _Complex}/\TText{_Lcomplex} type)
|
||||
*/
|
||||
#define H5T_NATIVE_LDOUBLE_COMPLEX (H5OPEN H5T_NATIVE_LDOUBLE_COMPLEX_g)
|
||||
/**
|
||||
* \ingroup PDTNAT
|
||||
* HDF5 8-bit bitfield based on native types
|
||||
@ -879,6 +938,9 @@ H5_DLLVAR hid_t H5T_NATIVE_FLOAT16_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_FLOAT_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_DOUBLE_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_LDOUBLE_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_FLOAT_COMPLEX_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_DOUBLE_COMPLEX_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_LDOUBLE_COMPLEX_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_B8_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_B16_g;
|
||||
H5_DLLVAR hid_t H5T_NATIVE_B32_g;
|
||||
@ -1723,6 +1785,33 @@ H5_DLL int H5Tget_array_ndims(hid_t type_id);
|
||||
*/
|
||||
H5_DLL int H5Tget_array_dims2(hid_t type_id, hsize_t dims[]);
|
||||
|
||||
/* Operations defined on complex number datatypes */
|
||||
/**
|
||||
* \ingroup COMPLEX
|
||||
*
|
||||
* \brief Creates a new complex number datatype
|
||||
*
|
||||
* \type_id{base_type_id}, datatype identifier for the base datatype of the
|
||||
* complex number datatype. Must be a floating-point datatype.
|
||||
*
|
||||
* \return \hid_t{complex number datatype}
|
||||
*
|
||||
* \details H5Tcomplex_create() creates a new complex number datatype consisting
|
||||
* of real and imaginary number parts. The datatype for both parts of
|
||||
* the new complex number datatype is based on \p base_type_id, which
|
||||
* must be a floating-point datatype.
|
||||
*
|
||||
* When necessary, use H5Tget_super() to determine the base datatype
|
||||
* of the complex number datatype.
|
||||
*
|
||||
* The datatype identifier returned from this function should be
|
||||
* released with H5Tclose() or resource leaks will result.
|
||||
*
|
||||
* \since 2.0.0
|
||||
*
|
||||
*/
|
||||
H5_DLL hid_t H5Tcomplex_create(hid_t base_type_id);
|
||||
|
||||
/* Operations defined on opaque datatypes */
|
||||
/**
|
||||
* \ingroup OPAQUE
|
||||
@ -2335,6 +2424,10 @@ H5_DLL htri_t H5Tis_variable_str(hid_t type_id);
|
||||
* \li #H5T_NATIVE_DOUBLE
|
||||
* \li #H5T_NATIVE_LDOUBLE
|
||||
*
|
||||
* \li #H5T_NATIVE_FLOAT_COMPLEX (if available)
|
||||
* \li #H5T_NATIVE_DOUBLE_COMPLEX (if available)
|
||||
* \li #H5T_NATIVE_LDOUBLE_COMPLEX (if available)
|
||||
*
|
||||
* \li #H5T_NATIVE_B8
|
||||
* \li #H5T_NATIVE_B16
|
||||
* \li #H5T_NATIVE_B32
|
||||
@ -2409,8 +2502,8 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction);
|
||||
*
|
||||
* \li Ineligible datatypes: This function cannot be used with
|
||||
* enumerated datatypes (#H5T_ENUM), array datatypes (#H5T_ARRAY),
|
||||
* variable-length array datatypes (#H5T_VLEN), or reference datatypes
|
||||
* (#H5T_REFERENCE).
|
||||
* variable-length array datatypes (#H5T_VLEN), reference datatypes
|
||||
* (#H5T_REFERENCE), or complex number datatypes (#H5T_COMPLEX).
|
||||
*
|
||||
* \see H5Tget_size()
|
||||
*
|
||||
@ -2483,6 +2576,9 @@ H5_DLL herr_t H5Tset_order(hid_t type_id, H5T_order_t order);
|
||||
* locations and sizes of the sign, mantissa, and exponent fields
|
||||
* first.
|
||||
*
|
||||
* When called with a #H5T_COMPLEX datatype, H5Tset_precision() sets
|
||||
* the precision for the base datatype of the complex number datatype.
|
||||
*
|
||||
* \since 1.0.0
|
||||
*
|
||||
*/
|
||||
@ -2517,6 +2613,9 @@ H5_DLL herr_t H5Tset_precision(hid_t type_id, size_t prec);
|
||||
*
|
||||
* The offset of an #H5T_STRING cannot be set to anything but zero.
|
||||
*
|
||||
* When called with a #H5T_COMPLEX datatype, H5Tset_offset() sets
|
||||
* the offset for the base datatype of the complex number datatype.
|
||||
*
|
||||
* \since 1.0.0
|
||||
*
|
||||
*/
|
||||
|
@ -80,7 +80,7 @@
|
||||
herr_t
|
||||
H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value)
|
||||
{
|
||||
bool is_complex; /* Flag indicating current datatype is "complex" */
|
||||
bool is_composite; /* Flag indicating current datatype is composite */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
@ -89,11 +89,11 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value)
|
||||
assert(dt);
|
||||
assert(op);
|
||||
|
||||
/* Check for complex datatype */
|
||||
is_complex = H5T_IS_COMPLEX(dt->shared->type);
|
||||
/* Check for composite datatype */
|
||||
is_composite = H5T_IS_COMPOSITE(dt->shared->type);
|
||||
|
||||
/* If the callback is to be made on the datatype first, do that */
|
||||
if (is_complex && (visit_flags & H5T_VISIT_COMPLEX_FIRST))
|
||||
if (is_composite && (visit_flags & H5T_VISIT_COMPOSITE_FIRST))
|
||||
if (op(dt, op_value) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed");
|
||||
|
||||
@ -112,6 +112,7 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value)
|
||||
case H5T_ARRAY:
|
||||
case H5T_VLEN:
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
/* Visit parent type */
|
||||
if (H5T__visit(dt->shared->parent, visit_flags, op, op_value) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit parent datatype");
|
||||
@ -139,7 +140,7 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value)
|
||||
} /* end switch */
|
||||
|
||||
/* If the callback is to be made on the datatype last, do that */
|
||||
if (is_complex && (visit_flags & H5T_VISIT_COMPLEX_LAST))
|
||||
if (is_composite && (visit_flags & H5T_VISIT_COMPOSITE_LAST))
|
||||
if (op(dt, op_value) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed");
|
||||
|
||||
|
@ -125,14 +125,13 @@ static const H5T_vlen_class_t H5T_vlen_disk_g = {
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Tvlen_create
|
||||
* Function: H5Tvlen_create
|
||||
*
|
||||
* Purpose: Create a new variable-length datatype based on the specified
|
||||
* BASE_TYPE.
|
||||
* Purpose: Create a new variable-length datatype based on the
|
||||
* specified base datatype ID.
|
||||
*
|
||||
* Return: Success: ID of new VL datatype
|
||||
*
|
||||
* Failure: Negative
|
||||
* Return: Success: ID of new VL datatype
|
||||
* Failure: H5I_INVALID_HID
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -143,33 +142,32 @@ H5Tvlen_create(hid_t base_id)
|
||||
H5T_t *dt = NULL; /*new datatype */
|
||||
hid_t ret_value; /*return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* Check args */
|
||||
if (NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype");
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype");
|
||||
|
||||
/* Create up VL datatype */
|
||||
if ((dt = H5T__vlen_create(base)) == NULL)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid VL location");
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "invalid VL location");
|
||||
|
||||
/* Register the type */
|
||||
if ((ret_value = H5I_register(H5I_DATATYPE, dt, true)) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype");
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Tvlen_create() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5T__vlen_create
|
||||
* Function: H5T__vlen_create
|
||||
*
|
||||
* Purpose: Create a new variable-length datatype based on the specified
|
||||
* BASE_TYPE.
|
||||
* Purpose: Create a new variable-length datatype based on the
|
||||
* specified base datatype.
|
||||
*
|
||||
* Return: Success: new VL datatype
|
||||
*
|
||||
* Failure: NULL
|
||||
* Return: Success: new VL datatype
|
||||
* Failure: NULL
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -948,7 +946,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info
|
||||
switch (dt->shared->type) {
|
||||
case H5T_ARRAY:
|
||||
/* Recurse on each element, if the array's base type is array, VL, enum or compound */
|
||||
if (H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
|
||||
if (H5T_IS_COMPOSITE(dt->shared->parent->shared->type)) {
|
||||
void *off; /* offset of field */
|
||||
|
||||
/* Calculate the offset member and recurse on it */
|
||||
@ -964,7 +962,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info
|
||||
/* Check each field and recurse on VL, compound, enum or array ones */
|
||||
for (u = 0; u < dt->shared->u.compnd.nmembs; u++) {
|
||||
/* Recurse if it's VL, compound, enum or array */
|
||||
if (H5T_IS_COMPLEX(dt->shared->u.compnd.memb[u].type->shared->type)) {
|
||||
if (H5T_IS_COMPOSITE(dt->shared->u.compnd.memb[u].type->shared->type)) {
|
||||
void *off; /* offset of field */
|
||||
|
||||
/* Calculate the offset member and recurse on it */
|
||||
@ -983,7 +981,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info
|
||||
/* Check if there is anything actually in this sequence */
|
||||
if (vl->len != 0) {
|
||||
/* Recurse if it's VL, array, enum or compound */
|
||||
if (H5T_IS_COMPLEX(dt->shared->parent->shared->type)) {
|
||||
if (H5T_IS_COMPOSITE(dt->shared->parent->shared->type)) {
|
||||
void *off; /* offset of field */
|
||||
|
||||
/* Calculate the offset of each array element and recurse on it */
|
||||
@ -1022,6 +1020,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info
|
||||
case H5T_BITFIELD:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
break;
|
||||
|
||||
/* Should never have these values */
|
||||
|
16
src/H5VL.c
16
src/H5VL.c
@ -682,11 +682,11 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id)
|
||||
H5VL_object_t *file_vol_obj = NULL; /* VOL object for file */
|
||||
hid_t ret_value = -1; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
FUNC_ENTER_API(H5I_INVALID_HID)
|
||||
|
||||
/* Check args */
|
||||
if (!file_obj)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "no file object supplied");
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "no file object supplied");
|
||||
if (NULL == (dtype = H5I_object_verify(dtype_id, H5I_DATATYPE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
|
||||
if (NULL == (connector = H5I_object_verify(connector_id, H5I_VOL)))
|
||||
@ -700,22 +700,22 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id)
|
||||
|
||||
/* Copy the datatype */
|
||||
if (NULL == (file_type = H5T_copy(dtype, H5T_COPY_TRANSIENT)))
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy datatype");
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, H5I_INVALID_HID, "unable to copy datatype");
|
||||
|
||||
/* Register file type id */
|
||||
if ((file_type_id = H5I_register(H5I_DATATYPE, file_type, false)) < 0) {
|
||||
(void)H5T_close_real(file_type);
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register file datatype");
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file datatype");
|
||||
} /* end if */
|
||||
|
||||
/* Set the location of the datatype to be in the file */
|
||||
if (H5T_set_loc(file_type, file_vol_obj, H5T_LOC_DISK) < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't set datatype location");
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "can't set datatype location");
|
||||
|
||||
/* Release our reference to file_type */
|
||||
if (file_vol_obj) {
|
||||
if (H5VL_free_object(file_vol_obj) < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object");
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID, "unable to free VOL object");
|
||||
file_vol_obj = NULL;
|
||||
} /* end if */
|
||||
|
||||
@ -726,9 +726,9 @@ done:
|
||||
/* Cleanup on error */
|
||||
if (ret_value < 0) {
|
||||
if (file_vol_obj && H5VL_free_object(file_vol_obj) < 0)
|
||||
HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object");
|
||||
HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID, "unable to free VOL object");
|
||||
if (file_type_id >= 0 && H5I_dec_ref(file_type_id) < 0)
|
||||
HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close file datatype");
|
||||
HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID, "unable to close file datatype");
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
|
@ -246,6 +246,7 @@ H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_COMPLEX:
|
||||
/* Other datatype classes: nbit does no compression */
|
||||
H5Z__calc_parms_nooptype(cd_values_actual_nparms);
|
||||
break;
|
||||
@ -340,6 +341,7 @@ H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_COMPLEX:
|
||||
/* Other datatype classes: nbit does no compression */
|
||||
H5Z__calc_parms_nooptype(cd_values_actual_nparms);
|
||||
break;
|
||||
@ -570,6 +572,7 @@ H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v
|
||||
case H5T_OPAQUE:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
if (H5Z__set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0)
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype");
|
||||
break;
|
||||
@ -707,6 +710,7 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c
|
||||
case H5T_OPAQUE:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_COMPLEX:
|
||||
/* other datatype that nbit does no compression */
|
||||
if (H5Z__set_parms_nooptype(dtype_member, cd_values_index, cd_values) < 0)
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype");
|
||||
@ -800,6 +804,7 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_COMPLEX:
|
||||
/* No need to calculate other datatypes at top level */
|
||||
break;
|
||||
|
||||
@ -872,6 +877,7 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
|
||||
case H5T_REFERENCE:
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_COMPLEX:
|
||||
/* No need to set parameters for other datatypes at top level */
|
||||
break;
|
||||
|
||||
|
@ -988,6 +988,7 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype class not supported by scaleoffset");
|
||||
|
@ -39,6 +39,10 @@
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
#include <complex.h>
|
||||
#endif
|
||||
|
||||
/* POSIX headers */
|
||||
#ifdef H5_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
@ -574,6 +578,19 @@ typedef struct {
|
||||
typedef struct stat h5_stat_t;
|
||||
#endif
|
||||
|
||||
/* Platform-independent definition for complex number types. For Win32,
|
||||
* see H5win32defs.h. Note that these types cannot be used for casts
|
||||
* (other than pointer casts) anywhere in the library that will be
|
||||
* compiled by MSVC. MSVC will fail to compile since it uses structure
|
||||
* types for complex numbers and casts can't be made between structure
|
||||
* types and other types.
|
||||
*/
|
||||
#if defined(H5_HAVE_COMPLEX_NUMBERS) && defined(H5_HAVE_C99_COMPLEX_NUMBERS)
|
||||
typedef float _Complex H5_float_complex;
|
||||
typedef double _Complex H5_double_complex;
|
||||
typedef long double _Complex H5_ldouble_complex;
|
||||
#endif
|
||||
|
||||
/* __int64 is the correct type for the st_size field of the _stati64
|
||||
* struct on Windows (MSDN isn't very clear about this). POSIX systems use
|
||||
* off_t. Both of these are typedef'd to HDoff_t in H5public.h.
|
||||
@ -757,6 +774,31 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
|
||||
#define HDwrite(F, M, Z) write(F, M, Z)
|
||||
#endif
|
||||
|
||||
/* Simple macros to construct complex numbers. Necessary since MSVC's use
|
||||
* of structure types for complex numbers means that arithmetic operators
|
||||
* can't be used directly on variables of complex number types. These macros
|
||||
* abstract away the construction of complex numbers across platforms.
|
||||
*
|
||||
* Note that the use of _Complex_I means that an imaginary part of -0 may
|
||||
* be converted to +0. If the minimum required C standard is moved to C11
|
||||
* or later, these can be simplified to the standard CMPLXF/CMPLX/CMPLXL
|
||||
* macros, which don't have this problem.
|
||||
*/
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
#ifndef H5_CMPLXF
|
||||
#define H5_CMPLXF(real, imag) \
|
||||
((H5_float_complex)((float)(real) + (float)(imag) * (H5_float_complex)_Complex_I))
|
||||
#endif
|
||||
#ifndef H5_CMPLX
|
||||
#define H5_CMPLX(real, imag) \
|
||||
((H5_double_complex)((double)(real) + (double)(imag) * (H5_double_complex)_Complex_I))
|
||||
#endif
|
||||
#ifndef H5_CMPLXL
|
||||
#define H5_CMPLXL(real, imag) \
|
||||
((H5_ldouble_complex)((long double)(real) + (long double)(imag) * (H5_ldouble_complex)_Complex_I))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */
|
||||
/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */
|
||||
#define H5_STRINGIZE(x) #x
|
||||
|
@ -1667,6 +1667,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
|
||||
H5RS_acat(rs, "H5T_NATIVE_DOUBLE");
|
||||
else if (obj == H5T_NATIVE_LDOUBLE_g)
|
||||
H5RS_acat(rs, "H5T_NATIVE_LDOUBLE");
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
else if (obj == H5T_NATIVE_FLOAT_COMPLEX_g)
|
||||
H5RS_acat(rs, "H5T_NATIVE_FLOAT_COMPLEX");
|
||||
else if (obj == H5T_NATIVE_DOUBLE_COMPLEX_g)
|
||||
H5RS_acat(rs, "H5T_NATIVE_DOUBLE_COMPLEX");
|
||||
else if (obj == H5T_NATIVE_LDOUBLE_COMPLEX_g)
|
||||
H5RS_acat(rs, "H5T_NATIVE_LDOUBLE_COMPLEX");
|
||||
#endif
|
||||
else if (obj == H5T_IEEE_F16BE_g)
|
||||
H5RS_acat(rs, "H5T_IEEE_F16BE");
|
||||
else if (obj == H5T_IEEE_F16LE_g)
|
||||
@ -1679,6 +1687,18 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
|
||||
H5RS_acat(rs, "H5T_IEEE_F64BE");
|
||||
else if (obj == H5T_IEEE_F64LE_g)
|
||||
H5RS_acat(rs, "H5T_IEEE_F64LE");
|
||||
else if (obj == H5T_COMPLEX_IEEE_F16BE_g)
|
||||
H5RS_acat(rs, "H5T_COMPLEX_IEEE_F16BE");
|
||||
else if (obj == H5T_COMPLEX_IEEE_F16LE_g)
|
||||
H5RS_acat(rs, "H5T_COMPLEX_IEEE_F16LE");
|
||||
else if (obj == H5T_COMPLEX_IEEE_F32BE_g)
|
||||
H5RS_acat(rs, "H5T_COMPLEX_IEEE_F32BE");
|
||||
else if (obj == H5T_COMPLEX_IEEE_F32LE_g)
|
||||
H5RS_acat(rs, "H5T_COMPLEX_IEEE_F32LE");
|
||||
else if (obj == H5T_COMPLEX_IEEE_F64BE_g)
|
||||
H5RS_acat(rs, "H5T_COMPLEX_IEEE_F64BE");
|
||||
else if (obj == H5T_COMPLEX_IEEE_F64LE_g)
|
||||
H5RS_acat(rs, "H5T_COMPLEX_IEEE_F64LE");
|
||||
else if (obj == H5T_STD_I8BE_g)
|
||||
H5RS_acat(rs, "H5T_STD_I8BE");
|
||||
else if (obj == H5T_STD_I8LE_g)
|
||||
@ -2864,6 +2884,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
|
||||
H5RS_acat(rs, "H5T_ARRAY");
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
H5RS_acat(rs, "H5T_COMPLEX");
|
||||
break;
|
||||
|
||||
case H5T_NCLASSES:
|
||||
H5RS_acat(rs, "H5T_NCLASSES");
|
||||
break;
|
||||
|
@ -62,6 +62,24 @@ struct timezone {
|
||||
#define HDfseek(F, O, W) _fseeki64(F, O, W)
|
||||
#endif
|
||||
|
||||
#if defined(H5_HAVE_COMPLEX_NUMBERS) && !defined(H5_HAVE_C99_COMPLEX_NUMBERS)
|
||||
/*
|
||||
* MSVC uses its own types for complex numbers that are separate from the
|
||||
* C99 standard types, so we must use a typedef. These types are structure
|
||||
* types, so we also need some wrapper functions for interacting with them,
|
||||
* as the arithmetic operators can't be used on them. These types also may
|
||||
* not be used for casts (other than pointer casts) anywhere in the library
|
||||
* that will be compiled by MSVC, as casts can't be made between structure
|
||||
* types and other types and MSVC will fail to compile.
|
||||
*/
|
||||
typedef _Fcomplex H5_float_complex;
|
||||
typedef _Dcomplex H5_double_complex;
|
||||
typedef _Lcomplex H5_ldouble_complex;
|
||||
#define H5_CMPLXF _FCbuild
|
||||
#define H5_CMPLX _Cbuild
|
||||
#define H5_CMPLXL _LCbuild
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -91,9 +91,10 @@ libhdf5_la_SOURCES= H5.c H5build_settings.c H5checksum.c H5dbg.c H5system.c \
|
||||
H5Sselect.c H5Stest.c \
|
||||
H5SL.c \
|
||||
H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \
|
||||
H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \
|
||||
H5Tconv_integer.c H5Tconv_float.c H5Tconv_string.c H5Tconv_bitfield.c \
|
||||
H5Tconv_compound.c H5Tconv_reference.c H5Tconv_enum.c H5Tconv_vlen.c H5Tconv_array.c \
|
||||
H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcomplex.c H5Tcompound.c \
|
||||
H5Tconv.c H5Tconv_array.c H5Tconv_bitfield.c H5Tconv_complex.c H5Tconv_compound.c \
|
||||
H5Tconv_enum.c H5Tconv_float.c H5Tconv_integer.c H5Tconv_reference.c \
|
||||
H5Tconv_string.c H5Tconv_vlen.c \
|
||||
H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \
|
||||
H5Tfloat.c H5Tinit_float.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
|
||||
H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c \
|
||||
|
@ -1277,10 +1277,13 @@ test_create_dataset_predefined_types(void)
|
||||
hid_t fspace_id = H5I_INVALID_HID;
|
||||
hid_t dset_id = H5I_INVALID_HID;
|
||||
hid_t predefined_type_test_table[] = {
|
||||
H5T_STD_U8LE, H5T_STD_U8BE, H5T_STD_I8LE, H5T_STD_I8BE, H5T_STD_U16LE, H5T_STD_U16BE,
|
||||
H5T_STD_I16LE, H5T_STD_I16BE, H5T_STD_U32LE, H5T_STD_U32BE, H5T_STD_I32LE, H5T_STD_I32BE,
|
||||
H5T_STD_U64LE, H5T_STD_U64BE, H5T_STD_I64LE, H5T_STD_I64BE, H5T_IEEE_F16LE, H5T_IEEE_F16BE,
|
||||
H5T_IEEE_F32LE, H5T_IEEE_F32BE, H5T_IEEE_F64LE, H5T_IEEE_F64BE};
|
||||
H5T_STD_U8LE, H5T_STD_U8BE, H5T_STD_I8LE, H5T_STD_I8BE,
|
||||
H5T_STD_U16LE, H5T_STD_U16BE, H5T_STD_I16LE, H5T_STD_I16BE,
|
||||
H5T_STD_U32LE, H5T_STD_U32BE, H5T_STD_I32LE, H5T_STD_I32BE,
|
||||
H5T_STD_U64LE, H5T_STD_U64BE, H5T_STD_I64LE, H5T_STD_I64BE,
|
||||
H5T_IEEE_F16LE, H5T_IEEE_F16BE, H5T_IEEE_F32LE, H5T_IEEE_F32BE,
|
||||
H5T_IEEE_F64LE, H5T_IEEE_F64BE, H5T_COMPLEX_IEEE_F16BE, H5T_COMPLEX_IEEE_F16LE,
|
||||
H5T_COMPLEX_IEEE_F32BE, H5T_COMPLEX_IEEE_F32LE, H5T_COMPLEX_IEEE_F64BE, H5T_COMPLEX_IEEE_F64LE};
|
||||
|
||||
TESTING("dataset creation with predefined datatypes");
|
||||
|
||||
|
@ -46,6 +46,10 @@
|
||||
*/
|
||||
#define NUM_PREDEFINED_FLOAT_TYPES 6
|
||||
|
||||
/* The number of predefined complex number types in HDF5
|
||||
*/
|
||||
#define NUM_PREDEFINED_COMPLEX_TYPES 6
|
||||
|
||||
/* The maximum number of members allowed in an HDF5 compound type, as
|
||||
* generated by the generate_random_datatype() function, for ease of
|
||||
* development.
|
||||
@ -85,6 +89,7 @@ static hid_t generate_random_datatype_compound(H5T_class_t parent_class, bool is
|
||||
static hid_t generate_random_datatype_reference(H5T_class_t parent_class, bool is_compact);
|
||||
static hid_t generate_random_datatype_enum(H5T_class_t parent_class, bool is_compact);
|
||||
static hid_t generate_random_datatype_array(H5T_class_t parent_class, bool is_compact);
|
||||
static hid_t generate_random_datatype_complex(H5T_class_t parent_class, bool is_compact);
|
||||
|
||||
/*
|
||||
* Helper function to generate a random HDF5 datatype in order to thoroughly
|
||||
@ -166,6 +171,9 @@ roll_datatype:
|
||||
|
||||
gen_func = generate_random_datatype_array;
|
||||
break;
|
||||
case H5T_COMPLEX:
|
||||
gen_func = generate_random_datatype_complex;
|
||||
break;
|
||||
default:
|
||||
printf(" invalid datatype class\n");
|
||||
goto done;
|
||||
@ -600,6 +608,53 @@ done:
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
static hid_t
|
||||
generate_random_datatype_complex(H5T_class_t H5_ATTR_UNUSED parent_class, bool H5_ATTR_UNUSED is_compact)
|
||||
{
|
||||
hid_t type_to_copy = H5I_INVALID_HID;
|
||||
hid_t datatype = H5I_INVALID_HID;
|
||||
hid_t ret_value = H5I_INVALID_HID;
|
||||
|
||||
switch (rand() % NUM_PREDEFINED_COMPLEX_TYPES) {
|
||||
case 0:
|
||||
type_to_copy = H5T_COMPLEX_IEEE_F16BE;
|
||||
break;
|
||||
case 1:
|
||||
type_to_copy = H5T_COMPLEX_IEEE_F16LE;
|
||||
break;
|
||||
case 2:
|
||||
type_to_copy = H5T_COMPLEX_IEEE_F32BE;
|
||||
break;
|
||||
case 3:
|
||||
type_to_copy = H5T_COMPLEX_IEEE_F32LE;
|
||||
break;
|
||||
case 4:
|
||||
type_to_copy = H5T_COMPLEX_IEEE_F64BE;
|
||||
break;
|
||||
case 5:
|
||||
type_to_copy = H5T_COMPLEX_IEEE_F64LE;
|
||||
break;
|
||||
default:
|
||||
printf(" invalid value for complex number type; should not happen\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((datatype = H5Tcopy(type_to_copy)) < 0) {
|
||||
printf(" couldn't copy predefined complex number type\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret_value = datatype;
|
||||
|
||||
done:
|
||||
if ((ret_value == H5I_INVALID_HID) && (datatype >= 0)) {
|
||||
if (H5Tclose(datatype) < 0)
|
||||
printf(" couldn't close datatype\n");
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function to generate a random HDF5 dataspace in order to thoroughly
|
||||
* test support for dataspaces.
|
||||
|
26
test/dsets.c
26
test/dsets.c
@ -3918,7 +3918,7 @@ test_nbit_compound_2(hid_t file)
|
||||
unsigned int v;
|
||||
char b[2][2];
|
||||
atomic d[2][2];
|
||||
} complex;
|
||||
} cplx;
|
||||
|
||||
hid_t i_tid, c_tid, s_tid, f_tid, v_tid;
|
||||
hid_t cmpd_tid1; /* atomic compound datatype */
|
||||
@ -3937,8 +3937,8 @@ test_nbit_compound_2(hid_t file)
|
||||
const hsize_t chunk_size[2] = {2, 5};
|
||||
const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
|
||||
{-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
|
||||
complex orig_data[2][5];
|
||||
complex new_data[2][5];
|
||||
cplx orig_data[2][5];
|
||||
cplx new_data[2][5];
|
||||
unsigned int i_mask, s_mask, c_mask, b_mask;
|
||||
double power;
|
||||
size_t i, j, m, n, b_failed, d_failed;
|
||||
@ -4035,15 +4035,15 @@ test_nbit_compound_2(hid_t file)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
/* Create a memory complex compound datatype before setting the order */
|
||||
if ((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
|
||||
if ((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(cplx))) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
|
||||
if (H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(cplx, a), mem_cmpd_tid1) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
|
||||
if (H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(cplx, v), v_tid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
|
||||
if (H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(cplx, b), array_tid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
|
||||
if (H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(cplx, d), mem_array_cmplx_tid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
/* Set order of dataset other complex compound member datatype */
|
||||
@ -4051,15 +4051,15 @@ test_nbit_compound_2(hid_t file)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
/* Create a dataset complex compound datatype and insert members */
|
||||
if ((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
|
||||
if ((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(cplx))) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
|
||||
if (H5Tinsert(cmpd_tid2, "a", HOFFSET(cplx, a), cmpd_tid1) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
|
||||
if (H5Tinsert(cmpd_tid2, "v", HOFFSET(cplx, v), v_tid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
|
||||
if (H5Tinsert(cmpd_tid2, "b", HOFFSET(cplx, b), array_tid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
if (H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
|
||||
if (H5Tinsert(cmpd_tid2, "d", HOFFSET(cplx, d), array_cmplx_tid) < 0)
|
||||
FAIL_STACK_ERROR;
|
||||
|
||||
/* Create the data space */
|
||||
|
5555
test/dt_arith.c
5555
test/dt_arith.c
File diff suppressed because it is too large
Load Diff
2846
test/dtypes.c
2846
test/dtypes.c
File diff suppressed because it is too large
Load Diff
131
test/ntypes.c
131
test/ntypes.c
@ -43,6 +43,9 @@ static const char *FILENAME[] = {"ntypes", NULL};
|
||||
#ifdef H5_HAVE__FLOAT16
|
||||
#define DSET_FLOAT16_NAME "_Float16_type"
|
||||
#endif
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
#define DSET_COMPLEX_NAME "float_complex_type"
|
||||
#endif
|
||||
|
||||
#define SPACE1_DIM1 4
|
||||
#define SPACE1_RANK 1
|
||||
@ -3168,6 +3171,130 @@ error:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
static herr_t
|
||||
test_complex(hid_t file)
|
||||
{
|
||||
hsize_t dims[2];
|
||||
hid_t dataset = H5I_INVALID_HID;
|
||||
hid_t space = H5I_INVALID_HID;
|
||||
hid_t dtype = H5I_INVALID_HID;
|
||||
hid_t native_type = H5I_INVALID_HID;
|
||||
struct {
|
||||
H5_float_complex arr[DIM0][DIM1];
|
||||
} *ipoints = NULL;
|
||||
struct {
|
||||
H5_float_complex arr[DIM0][DIM1];
|
||||
} *icheck = NULL;
|
||||
|
||||
TESTING("float complex datatype");
|
||||
|
||||
if (NULL == (ipoints = calloc(1, sizeof(*ipoints))))
|
||||
TEST_ERROR;
|
||||
if (NULL == (icheck = calloc(1, sizeof(*icheck))))
|
||||
TEST_ERROR;
|
||||
|
||||
/* Initialize the data */
|
||||
for (size_t i = 0; i < DIM0; i++)
|
||||
for (size_t j = 0; j < DIM1; j++) {
|
||||
float real = (float)(rand() / (double)RAND_MAX);
|
||||
float imag = (float)(rand() / (double)RAND_MAX);
|
||||
ipoints->arr[i][j] = H5_CMPLXF(real, imag);
|
||||
}
|
||||
|
||||
/* Create the data space */
|
||||
dims[0] = DIM0;
|
||||
dims[1] = DIM1;
|
||||
if ((space = H5Screate_simple(2, dims, NULL)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if ((dataset = H5Dcreate2(file, DSET_COMPLEX_NAME, H5T_COMPLEX_IEEE_F32BE, space, H5P_DEFAULT,
|
||||
H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Write the data to the dataset */
|
||||
if (H5Dwrite(dataset, H5T_NATIVE_FLOAT_COMPLEX, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Close dataset */
|
||||
if (H5Dclose(dataset) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Open dataset again to check H5Tget_native_type */
|
||||
if ((dataset = H5Dopen2(file, DSET_COMPLEX_NAME, H5P_DEFAULT)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if ((dtype = H5Dget_type(dataset)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
if ((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Verify the datatype retrieved and converted */
|
||||
if (H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_FLOAT_COMPLEX))
|
||||
TEST_ERROR;
|
||||
if (H5Tget_size(native_type) != H5Tget_size(H5T_COMPLEX_IEEE_F32BE))
|
||||
TEST_ERROR;
|
||||
if (H5T_COMPLEX != H5Tget_class(native_type))
|
||||
TEST_ERROR;
|
||||
|
||||
/* Read the dataset back */
|
||||
if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, icheck) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
/* Check that the values read are the same as the values written */
|
||||
for (size_t i = 0; i < DIM0; i++)
|
||||
for (size_t j = 0; j < DIM1; j++) {
|
||||
float real_points = crealf(ipoints->arr[i][j]);
|
||||
float imag_points = cimagf(ipoints->arr[i][j]);
|
||||
float real_check = crealf(icheck->arr[i][j]);
|
||||
float imag_check = cimagf(icheck->arr[i][j]);
|
||||
|
||||
if (!H5_FLT_ABS_EQUAL(real_points, real_check) || !H5_FLT_ABS_EQUAL(imag_points, imag_check)) {
|
||||
H5_FAILED();
|
||||
printf(" Read different values than written.\n");
|
||||
printf(" At index %zu,%zu\n", i, j);
|
||||
printf(" Written: %f%+fi, Read: %f%+fi\n", (double)real_points, (double)imag_points,
|
||||
(double)real_check, (double)imag_check);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (H5Sclose(space) < 0)
|
||||
TEST_ERROR;
|
||||
if (H5Dclose(dataset) < 0)
|
||||
TEST_ERROR;
|
||||
if (H5Tclose(native_type) < 0)
|
||||
TEST_ERROR;
|
||||
if (H5Tclose(dtype) < 0)
|
||||
TEST_ERROR;
|
||||
|
||||
free(ipoints);
|
||||
ipoints = NULL;
|
||||
free(icheck);
|
||||
icheck = NULL;
|
||||
|
||||
PASSED();
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5Dclose(dataset);
|
||||
H5Tclose(native_type);
|
||||
H5Tclose(dtype);
|
||||
H5Sclose(space);
|
||||
}
|
||||
H5E_END_TRY
|
||||
|
||||
free(ipoints);
|
||||
free(icheck);
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
@ -3222,6 +3349,10 @@ main(void)
|
||||
nerrors += test__Float16(file) < 0 ? 1 : 0;
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
nerrors += test_complex(file) < 0 ? 1 : 0;
|
||||
#endif
|
||||
|
||||
if (H5Fclose(file) < 0)
|
||||
goto error;
|
||||
|
||||
|
166
test/tarray.c
166
test/tarray.c
@ -1150,9 +1150,9 @@ test_array_vlen_atomic(void)
|
||||
sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
|
||||
CHECK(sid1, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Create a compound datatype to refer to */
|
||||
/* Create a variable-length datatype to refer to */
|
||||
tid2 = H5Tvlen_create(H5T_NATIVE_UINT);
|
||||
CHECK(tid2, FAIL, "H5Tcreate");
|
||||
CHECK(tid2, FAIL, "H5Tvlen_create");
|
||||
|
||||
/* Create an array datatype to refer to */
|
||||
tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
|
||||
@ -1583,6 +1583,164 @@ test_array_vlen_array(void)
|
||||
|
||||
} /* end test_array_vlen_array() */
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
static void
|
||||
test_array_complex(void)
|
||||
{
|
||||
H5_float_complex wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
|
||||
H5_float_complex rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */
|
||||
H5T_class_t mclass; /* Datatype class for VL */
|
||||
hsize_t sdims1[] = {SPACE1_DIM1}; /* Dataset dimensions */
|
||||
hsize_t tdims1[] = {ARRAY1_DIM1}; /* Array type dimensions */
|
||||
hid_t fid1; /* HDF5 File IDs */
|
||||
hid_t dataset; /* Dataset ID */
|
||||
hid_t sid1; /* Dataspace ID */
|
||||
hid_t tid1; /* Array Datatype ID */
|
||||
hid_t tid2; /* Complex Number Datatype ID */
|
||||
hid_t tid3; /* Atomic Datatype ID */
|
||||
int ndims; /* Array rank for reading */
|
||||
hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Testing 1-D Array of Complex Number Datatypes Functionality\n"));
|
||||
|
||||
memset(wdata, 0, sizeof(wdata));
|
||||
memset(rdata, 0, sizeof(rdata));
|
||||
|
||||
/* Initialize array data to write */
|
||||
for (size_t i = 0; i < SPACE1_DIM1; i++)
|
||||
for (size_t j = 0; j < ARRAY1_DIM1; j++)
|
||||
wdata[i][j] = H5_CMPLXF((float)(i * 100), (float)(j * 10));
|
||||
|
||||
/* Create file */
|
||||
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(fid1, FAIL, "H5Fcreate");
|
||||
|
||||
/* Create dataspace for datasets */
|
||||
sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
|
||||
CHECK(sid1, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Create a complex number datatype to refer to */
|
||||
tid2 = H5Tcomplex_create(H5T_IEEE_F32LE);
|
||||
CHECK(tid2, FAIL, "H5Tcomplex_create");
|
||||
|
||||
/* Create an array datatype to refer to */
|
||||
tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
|
||||
CHECK(tid1, FAIL, "H5Tarray_create2");
|
||||
|
||||
/* Close complex number datatype */
|
||||
ret = H5Tclose(tid2);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
/* Create a dataset */
|
||||
dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(dataset, FAIL, "H5Dcreate2");
|
||||
|
||||
/* Write dataset to disk */
|
||||
ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
|
||||
CHECK(ret, FAIL, "H5Dwrite");
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
CHECK(ret, FAIL, "H5Dclose");
|
||||
|
||||
/* Close datatype */
|
||||
ret = H5Tclose(tid1);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
/* Close disk dataspace */
|
||||
ret = H5Sclose(sid1);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
/* Close file */
|
||||
ret = H5Fclose(fid1);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
|
||||
/* Re-open file */
|
||||
fid1 = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
CHECK(fid1, FAIL, "H5Fopen");
|
||||
|
||||
/* Open the dataset */
|
||||
dataset = H5Dopen2(fid1, "Dataset1", H5P_DEFAULT);
|
||||
CHECK(dataset, FAIL, "H5Dopen2");
|
||||
|
||||
/* Get the dataspace */
|
||||
sid1 = H5Dget_space(dataset);
|
||||
CHECK(sid1, FAIL, "H5Dget_space");
|
||||
|
||||
/* Get the datatype */
|
||||
tid1 = H5Dget_type(dataset);
|
||||
CHECK(tid1, FAIL, "H5Dget_type");
|
||||
|
||||
/* Check the array rank */
|
||||
ndims = H5Tget_array_ndims(tid1);
|
||||
VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims");
|
||||
|
||||
/* Get the array dimensions */
|
||||
ret = H5Tget_array_dims2(tid1, rdims1);
|
||||
CHECK(ret, FAIL, "H5Tget_array_dims2");
|
||||
|
||||
/* Check the array dimensions */
|
||||
for (size_t i = 0; i < (size_t)ndims; i++)
|
||||
if (rdims1[i] != tdims1[i]) {
|
||||
TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%" PRIuHSIZE
|
||||
", tdims1[%d]=%" PRIuHSIZE "\n",
|
||||
(int)i, rdims1[i], (int)i, tdims1[i]);
|
||||
}
|
||||
|
||||
/* Get the complex number datatype */
|
||||
tid2 = H5Tget_super(tid1);
|
||||
CHECK(tid2, FAIL, "H5Tget_super");
|
||||
|
||||
/* Get the 2nd field's class */
|
||||
mclass = H5Tget_class(tid2);
|
||||
VERIFY(mclass, H5T_COMPLEX, "H5Tget_class");
|
||||
|
||||
/* Check the complex number datatype's base type */
|
||||
tid3 = H5Tget_super(tid2);
|
||||
CHECK(tid3, FAIL, "H5Tget_super");
|
||||
|
||||
if ((ret = H5Tequal(tid3, H5T_IEEE_F32LE)) <= 0)
|
||||
TestErrPrintf("VL base datatype is incorrect!, ret=%d\n", (int)ret);
|
||||
|
||||
/* Close the array's base type datatype */
|
||||
ret = H5Tclose(tid3);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
/* Close complex number datatype */
|
||||
ret = H5Tclose(tid2);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
/* Read dataset from disk */
|
||||
ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
|
||||
CHECK(ret, FAIL, "H5Dread");
|
||||
|
||||
/* Compare data read in */
|
||||
for (size_t i = 0; i < SPACE1_DIM1; i++) {
|
||||
for (size_t j = 0; j < ARRAY1_DIM1; j++) {
|
||||
if (0 != memcmp(&wdata[i][j], &rdata[i][j], sizeof(H5_float_complex)))
|
||||
TestErrPrintf(
|
||||
"Complex number data doesn't match!, wdata[%d][%d]=%f%+fi, rdata[%d][%d]=%f%+fi\n",
|
||||
(int)i, (int)j, (double)crealf(wdata[i][j]), (double)cimagf(wdata[i][j]), (int)i, (int)j,
|
||||
(double)crealf(wdata[i][j]), (double)cimagf(wdata[i][j]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Close Datatype */
|
||||
ret = H5Tclose(tid1);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
/* Close Dataset */
|
||||
ret = H5Dclose(dataset);
|
||||
CHECK(ret, FAIL, "H5Dclose");
|
||||
|
||||
/* Close file */
|
||||
ret = H5Fclose(fid1);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_array_bkg
|
||||
*
|
||||
@ -2232,6 +2390,10 @@ test_array(const void H5_ATTR_UNUSED *params)
|
||||
test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
|
||||
test_array_funcs(); /* Test type functions with array types */
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
test_array_complex();
|
||||
#endif
|
||||
|
||||
test_array_bkg(); /* Read compound datatype with array fields and background fields read */
|
||||
|
||||
/* This test uses a custom file */
|
||||
|
@ -786,7 +786,7 @@ test_attr_compound_write(hid_t fapl)
|
||||
sid2 = H5Screate_simple(ATTR4_RANK, dims2, NULL);
|
||||
CHECK(sid2, FAIL, "H5Screate_simple");
|
||||
|
||||
/* Create complex attribute for the dataset */
|
||||
/* Create compound attribute for the dataset */
|
||||
attr = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT);
|
||||
CHECK(attr, FAIL, "H5Acreate2");
|
||||
|
||||
@ -798,7 +798,7 @@ test_attr_compound_write(hid_t fapl)
|
||||
H5E_END_TRY
|
||||
VERIFY(ret_id, FAIL, "H5Acreate2");
|
||||
|
||||
/* Write complex attribute data */
|
||||
/* Write compound attribute data */
|
||||
ret = H5Awrite(attr, tid1, attr_data4);
|
||||
CHECK(ret, FAIL, "H5Awrite");
|
||||
|
||||
@ -12006,8 +12006,8 @@ test_attr(const void H5_ATTR_UNUSED *params)
|
||||
test_attr_plist(my_fapl); /* Test attribute property lists */
|
||||
|
||||
/* These next two tests use the same file information */
|
||||
test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */
|
||||
test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */
|
||||
test_attr_compound_write(my_fapl); /* Test compound datatype H5A writing code */
|
||||
test_attr_compound_read(my_fapl); /* Test compound datatype H5A reading code */
|
||||
|
||||
/* These next two tests use the same file information */
|
||||
test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */
|
||||
|
48
test/tfile.c
48
test/tfile.c
@ -7041,6 +7041,7 @@ test_libver_bounds_datatype(hid_t fapl)
|
||||
{
|
||||
hid_t tid = H5I_INVALID_HID, tid_enum = H5I_INVALID_HID, tid_array = H5I_INVALID_HID; /* Datatype IDs */
|
||||
hid_t tid_compound = H5I_INVALID_HID, tid_vlen = H5I_INVALID_HID; /* Datatype IDs */
|
||||
hid_t tid_complex = H5I_INVALID_HID; /* Datatype IDs */
|
||||
int enum_value; /* Value for enum datatype */
|
||||
typedef struct s1 { /* Data structure for compound datatype */
|
||||
char c;
|
||||
@ -7085,6 +7086,12 @@ test_libver_bounds_datatype(hid_t fapl)
|
||||
/* Verify datatype message version */
|
||||
test_libver_bounds_datatype_check(fapl, tid_vlen);
|
||||
|
||||
/* Create complex number datatype */
|
||||
tid_complex = H5Tcomplex_create(H5T_NATIVE_FLOAT);
|
||||
|
||||
/* Verify datatype message version */
|
||||
test_libver_bounds_datatype_check(fapl, tid_complex);
|
||||
|
||||
/* Close the datatypes */
|
||||
ret = H5Tclose(tid);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
@ -7101,6 +7108,9 @@ test_libver_bounds_datatype(hid_t fapl)
|
||||
ret = H5Tclose(tid_vlen);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
ret = H5Tclose(tid_complex);
|
||||
CHECK(ret, FAIL, "H5Tclose");
|
||||
|
||||
} /* end test_libver_bounds_datatype() */
|
||||
|
||||
/****************************************************************
|
||||
@ -7143,15 +7153,21 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
|
||||
hsize_t chunks[2] = {2, 3}; /* Chunk dimension sizes */
|
||||
H5T_t *dtype = NULL; /* Internal datatype pointer */
|
||||
H5T_t *str_dtype = NULL; /* Internal datatype pointer for the string datatype */
|
||||
H5F_t *f = NULL; /* Internal file pointer */
|
||||
H5F_libver_t low, high; /* Low and high bounds */
|
||||
herr_t ret; /* Return value */
|
||||
H5T_t *str_dtype = NULL; /* Internal datatype pointer for the string datatype */
|
||||
H5F_t *f = NULL; /* Internal file pointer */
|
||||
bool is_complex = false; /* If datatype is a complex number type */
|
||||
H5F_libver_t low, high; /* Low and high bounds */
|
||||
herr_t ret; /* Return value */
|
||||
|
||||
/* Retrieve the low/high version bounds from the input fapl */
|
||||
ret = H5Pget_libver_bounds(fapl, &low, &high);
|
||||
CHECK(ret, FAIL, "H5Pget_libver_bounds");
|
||||
|
||||
/* Complex numbers can't be created with a high version bound < 2.0 */
|
||||
is_complex = (H5T_COMPLEX == H5Tget_class(tid));
|
||||
if (is_complex && high < H5F_LIBVER_V200)
|
||||
return;
|
||||
|
||||
/* Create the file with the input fapl */
|
||||
fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
||||
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
|
||||
@ -7187,7 +7203,10 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
/* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY:
|
||||
* --the library will set version according to low_bound
|
||||
* --H5T_ARRAY: the earliest version the library will set is 2
|
||||
* H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_REFERENCE:
|
||||
* H5T_COMPLEX:
|
||||
* --the earliest version the library will set is 5
|
||||
* H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE,
|
||||
* H5T_REFERENCE:
|
||||
* --the library will only use basic version
|
||||
*/
|
||||
|
||||
@ -7198,6 +7217,10 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
else
|
||||
VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds");
|
||||
}
|
||||
else if (is_complex) {
|
||||
/* Complex number datatypes do not currently upgrade */
|
||||
VERIFY(dtype->shared->version, H5O_DTYPE_VERSION_5, "H5O_dtype_ver_bounds");
|
||||
}
|
||||
else
|
||||
VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
|
||||
|
||||
@ -7232,7 +7255,7 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
/* Loop through all the combinations of low/high bounds */
|
||||
/* Open the file and create the chunked dataset with the input tid */
|
||||
/* Verify the dataset's datatype message version */
|
||||
/* Also verify the committed atatype message version */
|
||||
/* Also verify the committed datatype message version */
|
||||
for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
|
||||
for (high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
|
||||
H5E_BEGIN_TRY
|
||||
@ -7244,6 +7267,10 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
if (ret < 0) /* Invalid low/high combinations */
|
||||
continue;
|
||||
|
||||
/* Complex numbers can't be created with a high version bound < 2.0 */
|
||||
if (is_complex && high < H5F_LIBVER_V200)
|
||||
continue;
|
||||
|
||||
/* Open the file */
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
@ -7289,7 +7316,10 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
/* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY:
|
||||
* --the library will set version according to low_bound
|
||||
* --H5T_ARRAY: the earliest version the library will set is 2
|
||||
* H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_REFERENCE:
|
||||
* H5T_COMPLEX:
|
||||
* --the earliest version the library will set is 5
|
||||
* H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE,
|
||||
* H5T_REFERENCE:
|
||||
* --the library will only use basic version
|
||||
*/
|
||||
if (dtype->shared->type == H5T_COMPOUND || dtype->shared->type == H5T_ENUM ||
|
||||
@ -7300,6 +7330,10 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
|
||||
VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[f->shared->low_bound],
|
||||
"H5O_dtype_ver_bounds");
|
||||
}
|
||||
else if (is_complex) {
|
||||
/* Complex number datatypes do not currently upgrade */
|
||||
VERIFY(dtype->shared->version, H5O_DTYPE_VERSION_5, "H5O_dtype_ver_bounds");
|
||||
}
|
||||
else
|
||||
VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST],
|
||||
"H5O_dtype_ver_bounds");
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1012,6 +1012,7 @@ diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1,
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_REFERENCE:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
|
@ -175,6 +175,7 @@ print_type(hid_t type)
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
case H5T_ARRAY:
|
||||
case H5T_COMPLEX:
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
@ -310,6 +311,9 @@ get_class(H5T_class_t tclass)
|
||||
case H5T_ARRAY:
|
||||
return ("H5T_ARRAY");
|
||||
|
||||
case H5T_COMPLEX:
|
||||
return ("H5T_COMPLEX");
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
|
@ -1987,6 +1987,28 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
|
||||
}
|
||||
} break;
|
||||
|
||||
case H5T_COMPLEX: {
|
||||
hid_t memb = H5I_INVALID_HID;
|
||||
|
||||
H5TOOLS_DEBUG("H5T_COMPLEX");
|
||||
|
||||
/* get the base datatype for each complex number element */
|
||||
memb = H5Tget_super(tid);
|
||||
|
||||
for (block_index = 0; block_index < block_nelmts; block_index++) {
|
||||
mem = ((unsigned char *)_mem) + block_index * size;
|
||||
|
||||
/* dump the complex number element */
|
||||
if (render_bin_output(stream, container, memb, mem, 2) < 0) {
|
||||
H5Tclose(memb);
|
||||
H5TOOLS_THROW((-1), "render_bin_output failed");
|
||||
}
|
||||
}
|
||||
|
||||
H5Tclose(memb);
|
||||
break;
|
||||
}
|
||||
|
||||
case H5T_TIME:
|
||||
case H5T_OPAQUE:
|
||||
H5TOOLS_DEBUG("H5T_OPAQUE");
|
||||
|
@ -184,6 +184,8 @@ typedef struct h5tools_dump_header_t {
|
||||
const char *strblockend;
|
||||
const char *vlenblockbegin;
|
||||
const char *vlenblockend;
|
||||
const char *complexblockbegin;
|
||||
const char *complexblockend;
|
||||
const char *structblockbegin;
|
||||
const char *structblockend;
|
||||
const char *subsettingblockbegin;
|
||||
@ -227,88 +229,103 @@ typedef struct h5tool_format_t {
|
||||
* data in hexadecimal format without translating from what appears on
|
||||
* disk.
|
||||
*
|
||||
* raw: If set then print all data as hexadecimal without
|
||||
* performing any conversion from disk.
|
||||
* raw: If set then print all data as hexadecimal without
|
||||
* performing any conversion from disk.
|
||||
*
|
||||
* fmt_raw: The printf() format for each byte of raw data. The
|
||||
* default is `%02x'.
|
||||
* fmt_raw: The printf() format for each byte of raw data. The
|
||||
* default is `%02x'.
|
||||
*
|
||||
* fmt_int: The printf() format to use when rendering data which is
|
||||
* typed `int'. The default is `%d'.
|
||||
* fmt_schar: The printf() format to use when rendering data which is
|
||||
* typed `signed char'. The default is `%d'. This format is
|
||||
* used only if the `ascii' field is zero.
|
||||
*
|
||||
* fmt_uint: The printf() format to use when rendering data which is
|
||||
* typed `unsigned'. The default is `%u'.
|
||||
* fmt_uchar: The printf() format to use when rendering data which is
|
||||
* typed `unsigned char'. The default is `%u'. This format
|
||||
* is used only if the `ascii' field is zero.
|
||||
*
|
||||
* fmt_schar: The printf() format to use when rendering data which is
|
||||
* typed `signed char'. The default is `%d'. This format is
|
||||
* used only if the `ascii' field is zero.
|
||||
* fmt_short: The printf() format to use when rendering data which is
|
||||
* typed `short'. The default is `%d'.
|
||||
*
|
||||
* fmt_uchar: The printf() format to use when rendering data which is
|
||||
* typed `unsigned char'. The default is `%u'. This format
|
||||
* is used only if the `ascii' field is zero.
|
||||
* fmt_ushort: The printf() format to use when rendering data which is
|
||||
* typed `unsigned short'. The default is `%u'.
|
||||
*
|
||||
* fmt_short: The printf() format to use when rendering data which is
|
||||
* typed `short'. The default is `%d'.
|
||||
* fmt_int: The printf() format to use when rendering data which is
|
||||
* typed `int'. The default is `%d'.
|
||||
*
|
||||
* fmt_ushort: The printf() format to use when rendering data which is
|
||||
* typed `unsigned short'. The default is `%u'.
|
||||
* fmt_uint: The printf() format to use when rendering data which is
|
||||
* typed `unsigned'. The default is `%u'.
|
||||
*
|
||||
* fmt_long: The printf() format to use when rendering data which is
|
||||
* typed `long'. The default is `%ld'.
|
||||
* fmt_long: The printf() format to use when rendering data which is
|
||||
* typed `long'. The default is `%ld'.
|
||||
*
|
||||
* fmt_ulong: The printf() format to use when rendering data which is
|
||||
* typed `unsigned long'. The default is `%lu'.
|
||||
* fmt_ulong: The printf() format to use when rendering data which is
|
||||
* typed `unsigned long'. The default is `%lu'.
|
||||
*
|
||||
* fmt_llong: The printf() format to use when rendering data which is
|
||||
* typed `long long'. The default depends on what printf()
|
||||
* format is available to print this datatype.
|
||||
* fmt_llong: The printf() format to use when rendering data which is
|
||||
* typed `long long'. The default depends on what printf()
|
||||
* format is available to print this datatype.
|
||||
*
|
||||
* fmt_ullong: The printf() format to use when rendering data which is
|
||||
* typed `unsigned long long'. The default depends on what
|
||||
* printf() format is available to print this datatype.
|
||||
* fmt_ullong: The printf() format to use when rendering data which is
|
||||
* typed `unsigned long long'. The default depends on what
|
||||
* printf() format is available to print this datatype.
|
||||
*
|
||||
* fmt_ldouble: The printf() format to use when rendering data which is
|
||||
* typed `long double'. The default is `%Lg'.
|
||||
* fmt_float: The printf() format to use when rendering data which is
|
||||
* typed `float'. The default is `%g'.
|
||||
*
|
||||
* fmt_double: The printf() format to use when rendering data which is
|
||||
* typed `double'. The default is `%g'.
|
||||
* fmt_double: The printf() format to use when rendering data which is
|
||||
* typed `double'. The default is `%g'.
|
||||
*
|
||||
* fmt_float: The printf() format to use when rendering data which is
|
||||
* typed `float'. The default is `%g'.
|
||||
* fmt_ldouble: The printf() format to use when rendering data which is
|
||||
* typed `long double'. The default is `%Lg'.
|
||||
*
|
||||
* ascii: If set then print 1-byte integer values as an ASCII
|
||||
* character (no quotes). If the character is one of the
|
||||
* standard C escapes then print the escaped version. If
|
||||
* the character is unprintable then print a 3-digit octal
|
||||
* escape. If `ascii' is zero then then 1-byte integers are
|
||||
* printed as numeric values. The default is zero.
|
||||
* fmt_float_complex: The printf() format to use when rendering data which is
|
||||
* typed `float _Complex' / `_Fcomplex'. The default is
|
||||
* `%g%+gi'.
|
||||
*
|
||||
* str_locale: Determines how strings are printed. If zero then strings
|
||||
* are printed like in C except. If set to ESCAPE_HTML then
|
||||
* strings are printed using HTML encoding where each
|
||||
* character not in the class [a-zA-Z0-9] is substituted
|
||||
* with `%XX' where `X' is a hexadecimal digit.
|
||||
* fmt_double_complex: The printf() format to use when rendering data which is
|
||||
* typed `double _Complex' / `_Dcomplex'. The default is
|
||||
* `%g%+gi'.
|
||||
*
|
||||
* str_repeat: If set to non-zero then any character value repeated N
|
||||
* or more times is printed as 'C'*N
|
||||
* fmt_ldouble_complex: The printf() format to use when rendering data which is
|
||||
* typed `long double _Complex' / `_Lcomplex'. The default
|
||||
* is `%Lg%+Lgi'.
|
||||
*
|
||||
* ascii: If set then print 1-byte integer values as an ASCII
|
||||
* character (no quotes). If the character is one of the
|
||||
* standard C escapes then print the escaped version. If
|
||||
* the character is unprintable then print a 3-digit octal
|
||||
* escape. If `ascii' is zero then then 1-byte integers are
|
||||
* printed as numeric values. The default is zero.
|
||||
*
|
||||
* str_locale: Determines how strings are printed. If zero then strings
|
||||
* are printed like in C except. If set to ESCAPE_HTML then
|
||||
* strings are printed using HTML encoding where each
|
||||
* character not in the class [a-zA-Z0-9] is substituted
|
||||
* with `%XX' where `X' is a hexadecimal digit.
|
||||
*
|
||||
* str_repeat: If set to non-zero then any character value repeated N
|
||||
* or more times is printed as 'C'*N
|
||||
*
|
||||
* Numeric data is also subject to the formats for individual elements.
|
||||
*/
|
||||
bool raw;
|
||||
const char *fmt_raw;
|
||||
const char *fmt_int;
|
||||
const char *fmt_uint;
|
||||
const char *fmt_schar;
|
||||
const char *fmt_uchar;
|
||||
const char *fmt_short;
|
||||
const char *fmt_ushort;
|
||||
const char *fmt_int;
|
||||
const char *fmt_uint;
|
||||
const char *fmt_long;
|
||||
const char *fmt_ulong;
|
||||
const char *fmt_llong;
|
||||
const char *fmt_ullong;
|
||||
const char *fmt_ldouble;
|
||||
const char *fmt_double;
|
||||
const char *fmt_float;
|
||||
const char *fmt_double;
|
||||
const char *fmt_ldouble;
|
||||
const char *fmt_float_complex;
|
||||
const char *fmt_double_complex;
|
||||
const char *fmt_ldouble_complex;
|
||||
int ascii;
|
||||
int str_locale;
|
||||
unsigned str_repeat;
|
||||
|
@ -24,20 +24,23 @@
|
||||
h5tool_format_t h5tools_dataformat = {
|
||||
0, /*raw */
|
||||
|
||||
"", /*fmt_raw */
|
||||
"%d", /*fmt_int */
|
||||
"%u", /*fmt_uint */
|
||||
"%hhd", /*fmt_schar */
|
||||
"%u", /*fmt_uchar */
|
||||
"%d", /*fmt_short */
|
||||
"%u", /*fmt_ushort */
|
||||
"%ld", /*fmt_long */
|
||||
"%lu", /*fmt_ulong */
|
||||
NULL, /*fmt_llong */
|
||||
NULL, /*fmt_ullong */
|
||||
"%Lg", /*fmt_ldouble */
|
||||
"%g", /*fmt_double */
|
||||
"%g", /*fmt_float */
|
||||
"", /*fmt_raw */
|
||||
"%hhd", /*fmt_schar */
|
||||
"%u", /*fmt_uchar */
|
||||
"%d", /*fmt_short */
|
||||
"%u", /*fmt_ushort */
|
||||
"%d", /*fmt_int */
|
||||
"%u", /*fmt_uint */
|
||||
"%ld", /*fmt_long */
|
||||
"%lu", /*fmt_ulong */
|
||||
NULL, /*fmt_llong */
|
||||
NULL, /*fmt_ullong */
|
||||
"%g", /*fmt_float */
|
||||
"%g", /*fmt_double */
|
||||
"%Lg", /*fmt_ldouble */
|
||||
"%g%+gi", /*fmt_float_complex */
|
||||
"%g%+gi", /*fmt_double_complex */
|
||||
"%Lg%+Lgi", /*fmt_ldouble_complex */
|
||||
|
||||
0, /*ascii */
|
||||
0, /*str_locale */
|
||||
@ -164,6 +167,8 @@ const h5tools_dump_header_t h5tools_standardformat = {
|
||||
"}", /*strblockend */
|
||||
"H5T_VLEN { ", /*vlenblockbegin */
|
||||
" }", /*vlenblockend */
|
||||
"H5T_COMPLEX { ", /*complexblockbegin */
|
||||
" }", /*complexblockend */
|
||||
"{", /*structblockbegin */
|
||||
"}", /*structblockend */
|
||||
"{", /*subsettingblockbegin */
|
||||
@ -2628,6 +2633,46 @@ found_string_type:
|
||||
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
if (H5Tequal(type, H5T_COMPLEX_IEEE_F16BE) == true)
|
||||
h5tools_str_append(buffer, "H5T_COMPLEX_IEEE_F16BE");
|
||||
else if (H5Tequal(type, H5T_COMPLEX_IEEE_F16LE) == true)
|
||||
h5tools_str_append(buffer, "H5T_COMPLEX_IEEE_F16LE");
|
||||
else if (H5Tequal(type, H5T_COMPLEX_IEEE_F32BE) == true)
|
||||
h5tools_str_append(buffer, "H5T_COMPLEX_IEEE_F32BE");
|
||||
else if (H5Tequal(type, H5T_COMPLEX_IEEE_F32LE) == true)
|
||||
h5tools_str_append(buffer, "H5T_COMPLEX_IEEE_F32LE");
|
||||
else if (H5Tequal(type, H5T_COMPLEX_IEEE_F64BE) == true)
|
||||
h5tools_str_append(buffer, "H5T_COMPLEX_IEEE_F64BE");
|
||||
else if (H5Tequal(type, H5T_COMPLEX_IEEE_F64LE) == true)
|
||||
h5tools_str_append(buffer, "H5T_COMPLEX_IEEE_F64LE");
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
else if (H5Tequal(type, H5T_NATIVE_FLOAT_COMPLEX) == true)
|
||||
h5tools_str_append(buffer, "H5T_NATIVE_FLOAT_COMPLEX");
|
||||
else if (H5Tequal(type, H5T_NATIVE_DOUBLE_COMPLEX) == true)
|
||||
h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE_COMPLEX");
|
||||
else if (H5Tequal(type, H5T_NATIVE_LDOUBLE_COMPLEX) == true)
|
||||
h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE_COMPLEX");
|
||||
#endif
|
||||
else {
|
||||
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->complexblockbegin);
|
||||
|
||||
/* Get complex number base type */
|
||||
if ((super = H5Tget_super(type)) < 0)
|
||||
H5TOOLS_ERROR((-1), "H5Tget_super failed");
|
||||
else {
|
||||
/* Print base type */
|
||||
h5tools_print_datatype(stream, buffer, info, ctx, super, true);
|
||||
|
||||
if (H5Tclose(super) < 0)
|
||||
H5TOOLS_ERROR((-1), "H5Tclose failed");
|
||||
}
|
||||
|
||||
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->complexblockend);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
|
@ -1356,6 +1356,74 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
|
||||
H5Tclose(memb);
|
||||
} break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
H5TOOLS_DEBUG("H5T_COMPLEX");
|
||||
|
||||
#ifdef H5_HAVE_COMPLEX_NUMBERS
|
||||
/* If complex number support is available, use creal/cimag function
|
||||
* variants to retrieve the real and imaginary parts of the complex
|
||||
* number and print them in real+imaginary"i" format.
|
||||
*/
|
||||
if (H5Tequal(type, H5T_NATIVE_FLOAT_COMPLEX) == true) {
|
||||
H5_float_complex fc;
|
||||
float real, imag;
|
||||
|
||||
memcpy(&fc, vp, sizeof(H5_float_complex));
|
||||
|
||||
real = crealf(fc);
|
||||
imag = cimagf(fc);
|
||||
|
||||
h5tools_str_append(str, OPT(info->fmt_float_complex, "%g%+gi"), (double)real,
|
||||
(double)imag);
|
||||
}
|
||||
else if (H5Tequal(type, H5T_NATIVE_DOUBLE_COMPLEX) == true) {
|
||||
H5_double_complex dc;
|
||||
double real, imag;
|
||||
|
||||
memcpy(&dc, vp, sizeof(H5_double_complex));
|
||||
|
||||
real = creal(dc);
|
||||
imag = cimag(dc);
|
||||
|
||||
h5tools_str_append(str, OPT(info->fmt_double_complex, "%g%+gi"), real, imag);
|
||||
}
|
||||
else if (H5Tequal(type, H5T_NATIVE_LDOUBLE_COMPLEX) == true) {
|
||||
H5_ldouble_complex ldc;
|
||||
long double real, imag;
|
||||
|
||||
memcpy(&ldc, vp, sizeof(H5_ldouble_complex));
|
||||
|
||||
real = creall(ldc);
|
||||
imag = cimagl(ldc);
|
||||
|
||||
h5tools_str_append(str, OPT(info->fmt_ldouble_complex, "%Lg%+Lgi"), real, imag);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
h5tools_str_t real_part, imag_part;
|
||||
size_t part_size;
|
||||
|
||||
/* Get the base datatype for the complex number type */
|
||||
memb = H5Tget_super(type);
|
||||
part_size = H5Tget_size(memb);
|
||||
|
||||
memset(&real_part, 0, sizeof(h5tools_str_t));
|
||||
memset(&imag_part, 0, sizeof(h5tools_str_t));
|
||||
|
||||
h5tools_str_sprint(&real_part, info, container, memb, vp, ctx);
|
||||
h5tools_str_sprint(&imag_part, info, container, memb, (uint8_t *)vp + part_size, ctx);
|
||||
|
||||
h5tools_str_append(str, "%s+%si", real_part.s, imag_part.s);
|
||||
|
||||
h5tools_str_close(&real_part);
|
||||
h5tools_str_close(&imag_part);
|
||||
|
||||
H5Tclose(memb);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case H5T_TIME:
|
||||
case H5T_BITFIELD:
|
||||
case H5T_OPAQUE: {
|
||||
|
@ -74,6 +74,15 @@ h5tools_get_little_endian_type(hid_t tid)
|
||||
p_type = H5Tcopy(H5T_STD_B64LE);
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
if (size == 4)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F16LE);
|
||||
else if (size == 8)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F32LE);
|
||||
else if (size == 16)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F64LE);
|
||||
break;
|
||||
|
||||
case H5T_TIME:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_STRING:
|
||||
@ -155,6 +164,15 @@ h5tools_get_big_endian_type(hid_t tid)
|
||||
p_type = H5Tcopy(H5T_STD_B64BE);
|
||||
break;
|
||||
|
||||
case H5T_COMPLEX:
|
||||
if (size == 4)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F16BE);
|
||||
else if (size == 8)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F32BE);
|
||||
else if (size == 16)
|
||||
p_type = H5Tcopy(H5T_COMPLEX_IEEE_F64BE);
|
||||
break;
|
||||
|
||||
case H5T_TIME:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_STRING:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user