Why is there no H5Tget_native_type function for Fortran? What should you do to get the memory datatype for a compound datatype in F90?
We do not have the H5Tget_native_type function for F90, because
Fortran only supports the native types, H5T_NATIVE_INTEGER, H5T_NATIVE_REAL,
H5T_NATIVE_DOUBLE, and H5T_NATIVE_CHARACTER, which correspond to
integer, real, double precision, and character types in Fortran 90.
So if your compound datatype field is of integer type, then the only datatype you can use is H5T_NATIVE_INTEGER to describe the memory datatype. Please notice that if the integer in the file is 8 bytes, and the integer type for your compiler is 4 bytes, then precision may be lost during the read operation. This is a known limitation of the Fortran interface. Therefore, if we had this function and you used it, you would not get anything different for the native type.
Compound datatypes work well for C. However, if using Fortran or Java, then you have to read/write the data by field, and you have to do lots of queries to determine what the datatype is. This is because it is not possible to pass an array of Fortran structures to a C function in a portable manner. In any case, the Fortran layer has to repack the Fortran array to an array of C structures.
The main problem is that Fortran enforces type checking at compilation time and it is impossible to overload the h5dread/write_f function with a datatype that is defined by the user.