/** @page LBGrpCreate Creating an Group
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
Some HDF5 pre-defined native datatypes and corresponding standard (file) type
C Type |
HDF5 Memory Type |
HDF5 File Type* |
Integer |
int |
#H5T_NATIVE_INT |
#H5T_STD_I32BE or #H5T_STD_I32LE |
short |
#H5T_NATIVE_SHORT |
#H5T_STD_I16BE or #H5T_STD_I16LE |
long |
#H5T_NATIVE_LONG |
#H5T_STD_I32BE, #H5T_STD_I32LE,
#H5T_STD_I64BE or #H5T_STD_I64LE |
long long |
#H5T_NATIVE_LLONG |
#H5T_STD_I64BE or #H5T_STD_I64LE |
unsigned int |
#H5T_NATIVE_UINT |
#H5T_STD_U32BE or #H5T_STD_U32LE |
unsigned short |
#H5T_NATIVE_USHORT |
#H5T_STD_U16BE or #H5T_STD_U16LE |
unsigned long |
#H5T_NATIVE_ULONG |
#H5T_STD_U32BE, #H5T_STD_U32LE,
#H5T_STD_U64BE or #H5T_STD_U64LE |
unsigned long long |
#H5T_NATIVE_ULLONG |
#H5T_STD_U64BE or #H5T_STD_U64LE |
Float |
_Float16 |
#H5T_NATIVE_FLOAT16 |
#H5T_IEEE_F16BE or #H5T_IEEE_F16LE |
float |
#H5T_NATIVE_FLOAT |
#H5T_IEEE_F32BE or #H5T_IEEE_F32LE |
double |
#H5T_NATIVE_DOUBLE |
#H5T_IEEE_F64BE or #H5T_IEEE_F64LE |
Examples of HDF5 predefined datatypes
Function |
Description |
#H5Sget_select_npoints |
Returns the number of elements in the hyperslab |
#H5Sget_select_hyper_nblocks |
Returns the number of blocks in the hyperslab |
#H5Sget_select_hyper_blocklist |
Returns the "lower left" and "upper right" coordinates of the blocks in the hyperslab selection |
#H5Sget_select_bounds |
Returns the coordinates of the "minimal" block containing a hyperslab selection |
#H5Sget_select_elem_npoints |
Returns the number of points in the element selection |
#H5Sget_select_elem_pointlist |
Returns the coordinates of points in the element selection |
\subsection subsecLBDtypeSpecStr String
A simple example of creating a derived datatype is using the string datatype,
#H5T_C_S1 (#H5T_FORTRAN_S1) to create strings of more than one character. Strings
can be stored as either fixed or variable length, and may have different rules
for padding of unused storage.
\subsubsection subsecLBDtypeSpecStrFix Fixed Length 5-character String Datatype
\code
hid_t strtype; /* Datatype ID */
herr_t status;
strtype = H5Tcopy (H5T_C_S1);
status = H5Tset_size (strtype, 5); /* create string of length 5 */
\endcode
\subsubsection subsecLBDtypeSpecStrVar Variable Length String Datatype
\code
strtype = H5Tcopy (H5T_C_S1);
status = H5Tset_size (strtype, H5T_VARIABLE);
\endcode
The ability to derive datatypes from pre-defined types allows users to create any number of datatypes,
from simple to very complex.
As the term implies, variable length strings are strings of varying lengths. They are stored internally
in a heap, potentially impacting efficiency in the following ways:
\li Heap storage requires more space than regular raw data storage.
\li Heap access generally reduces I/O efficiency because it requires individual read or write operations
for each data element rather than one read or write per dataset or per data selection.
\li A variable length dataset consists of pointers to the heaps of data, not the actual data. Chunking
and filters, including compression, are not available for heaps.
See \ref subsubsec_datatype_other_strings in the \ref UG, for more information on how fixed and variable
length strings are stored.
\subsection subsecLBDtypeSpecVL Variable Length
Variable-length (VL) datatypes are sequences of an existing datatype (atomic, VL, or compound)
which are not fixed in length from one dataset location to another. In essence, they are similar
to C character strings -- a sequence of a type which is pointed to by a particular type of
pointer -- although they are implemented more closely to FORTRAN strings by including an explicit
length in the pointer instead of using a particular value to terminate the sequence.
VL datatypes are useful to the scientific community in many different ways, some of which are listed below: