@@ -2008,12 +2008,13 @@ filled according to the value of this property. The padding can be:
2008
2008
* an instance of the struct. The HDF5 C library includes a macro, #HOFFSET (s, m), which
2009
2009
* calculates the offset of member \Emph{m} within struct \Emph{s}. Alternatively, the
2010
2010
* `offsetof(s, m)` macro, defined in \Emph{stddef.h}, serves the same purpose as the
2011
- * `HOFFSET` macro. For Fortran users, the HDF5 library provides the function #H5OFFSETOF
2012
- * to determine the offset of a member. Note, in the past, the HDF5 Fortran applications
2013
- * had to calculate offsets by using sizes of members datatypes and by considering the order
2014
- * of members in the Fortran derived type, thuse offsets of fortran structure members
2015
- * corresponded to the offsets within a packed datatype (see explanation below)
2016
- * stored in an HDF5 file.
2011
+ * `HOFFSET` macro. For Fortran users, the HDF5 library provides the function
2012
+ * \ref h5lib.h5offsetof to determine the offset of a member. To find the size of a
2013
+ * scalar derived type, the fortran function equivalant of the \Emph{sizeof} can be used.
2014
+ * Note, in the past, the HDF5 Fortran applications had to calculate offsets by using sizes of
2015
+ * members datatypes and by considering the order of members in the Fortran derived type, thus
2016
+ * offsets of Fortran structure members corresponded to the offsets within a packed datatype
2017
+ * (see explanation below) stored in an HDF5 file.
2017
2018
*
2018
2019
* Each member of a compound datatype must have a descriptive name which is the key used to
2019
2020
* uniquely identify the member within the compound datatype. A member name in an HDF5
@@ -2051,7 +2052,10 @@ filled according to the value of this property. The padding can be:
2051
2052
* and each component is DOUBLE PRECISION. An equivalent Fortran TYPE whose type is defined
2052
2053
* by the TYPE complex_t is shown.
2053
2054
*
2054
- * <em>A compound datatype for complex numbers in Fortran 2003</em>
2055
+ * <em>A compound datatype for complex numbers in Fortran</em>
2056
+ *
2057
+ * <div class="tabbed">
2058
+ * - <b class="tab-title">Fortran 2003</b>
2055
2059
* \code
2056
2060
* TYPE complex_t
2057
2061
* DOUBLE PRECISION re ! real part
@@ -2066,8 +2070,7 @@ filled according to the value of this property. The padding can be:
2066
2070
* offset = H5OFFSETOF(C_LOC(cmplx),C_LOC(cmplx%im))
2067
2071
* CALL h5tinsert_f(type_id, “imaginary”, offset, H5T_NATIVE_DOUBLE, error)
2068
2072
* \endcode
2069
- *
2070
- * <em>A compound datatype for complex numbers, pre-Fortran2003 (Obsolete)</em>
2073
+ * - <b class="tab-title">Fortran (Obsolete)</b>
2071
2074
* \code
2072
2075
* TYPE complex_t
2073
2076
* DOUBLE PRECISION re ! real part
@@ -2083,7 +2086,8 @@ filled according to the value of this property. The padding can be:
2083
2086
* offset = offset + re_size
2084
2087
* CALL h5tinsert_f(type_id, “imaginary”, offset, H5T_NATIVE_DOUBLE, error)
2085
2088
* \endcode
2086
-
2089
+ * </div>
2090
+ *
2087
2091
* Important Note: The compound datatype is created with a size sufficient to hold all its members.
2088
2092
* In the C example above, the size of the C struct and the #HOFFSET macro are used as a
2089
2093
* convenient mechanism to determine the appropriate size and offset. Alternatively, the size and
@@ -2215,7 +2219,6 @@ filled according to the value of this property. The padding can be:
2215
2219
* to the sum of the sizes of the previous members. However, with the introduction of Fortran 2003,
2216
2220
* this is no longer the case, and the same considerations that apply to C also apply to Fortran.
2217
2221
*
2218
- *
2219
2222
* <em>Create a packed compound datatype in Fortran</em>
2220
2223
* \code
2221
2224
* CALL h5tcopy_f(s1_id, s2_id, error)
@@ -2233,7 +2236,6 @@ filled according to the value of this property. The padding can be:
2233
2236
* The example below shows a C example of creating and writing a dataset with a compound
2234
2237
* datatype.
2235
2238
*
2236
- *
2237
2239
* <em>Create and write a dataset with a compound datatype in C</em>
2238
2240
* \code
2239
2241
* typedef struct s1_t {
@@ -2385,10 +2387,12 @@ filled according to the value of this property. The padding can be:
2385
2387
* }
2386
2388
* \endcode
2387
2389
*
2388
- * The preferred example below contains a Fortran 2003 demonstration that creates
2389
- * and writes a dataset using a compound datatype.
2390
+ * <em>Create and write a dataset with a compound datatype in Fortran </em>
2390
2391
*
2391
- * <em>Create and write a dataset with a compound datatype, Fortran 2003</em>
2392
+ * <div class="tabbed">
2393
+ * - <b class="tab-title">Fortran 2003</b>
2394
+ * The following example demonstrates how to create and write a dataset using a compound
2395
+ * datatype in Fortran 2003.
2392
2396
* \code
2393
2397
* TYPE s1_t
2394
2398
* INTEGER :: a
@@ -2419,13 +2423,11 @@ filled according to the value of this property. The padding can be:
2419
2423
* CALL H5Dcreate_f(file_id, “SDScompound.h5”, s1_t, space_id, dataset_id, error)
2420
2424
* CALL H5Dwrite_f(dataset_id, s1_tid, C_LOC(data(1)), error)
2421
2425
* \endcode
2422
- *
2423
- * The example below contains a pre-Fortran 2003 (obsolete) example that creates and writes a
2424
- * dataset with a compound datatype. As this example illustrates, writing and reading compound
2425
- * datatypes in Fortran 90 is always done by fields. The content of the written file is the same
2426
- * as shown in the example above.
2427
- *
2428
- * <em>Create and write a dataset with a compound datatype, pre-Fortran 2003 (obsolete)</em>
2426
+ * - <b class="tab-title">Fortran (Obsolete)</b>
2427
+ * The following example demonstrates creating and writing a dataset with a compound datatype
2428
+ * using pre-Fortran 2003 standards. As illustrated in Fortran 90, writing and reading compound
2429
+ * datatypes is always done by fields. The content of the written file matches the example
2430
+ * provided previously.
2429
2431
* \code
2430
2432
* ! One cannot write an array of a derived datatype in
2431
2433
* ! Fortran 90.
@@ -2521,6 +2523,7 @@ filled according to the value of this property. The padding can be:
2521
2523
* CALL h5dwrite_f(dset_id, dt2_id, b, data_dims, error, xfer_prp = plist_id)
2522
2524
* CALL h5dwrite_f(dset_id, dt1_id, a, data_dims, error, xfer_prp = plist_id)
2523
2525
* \endcode
2526
+ * </div>
2524
2527
*
2525
2528
* <h4>Reading Datasets with Compound Datatypes</h4>
2526
2529
*
0 commit comments