mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
[svn-r1362]
Changes since 19990616 ---------------------- ./src/H5T.c ./src/H5Tconv.c All conversion functions take an extra argument called `stride' which is the number of bytes to advance the source and destination pointers after each element is converted. If the value is zero then the old behavior is preserved (source and destination values are packed). This feature was necessary to implement the compound datatype conversion optimizations and it causes a minor change to the API (application-defined type conversion functions take an extra size_t stride argument). ./src/H5Tconv.c An additional compound data type conversion function was added which is applied unless the destination type is larger than the source type. I'm measuring significant performance increases for certain operations: Test Name Struct-Conv Noop-Conv New(Old) MB/s New(Old) MB/s ---------- ------------- ------------- Reordering 2.062(0.3936) 54087(0.9047) Subsetting 2.901(0.6581) 40192(1.1100) Shrinking 1.976(0.3925) 33628(1.1500) ---------- ------------- ------------- ./test/dtypes.c Added various compound datatype conversion tests. Fixed return values from functions. ./src/H5T.c Conversion timers are updated only if H5T debugging is turned on a runtime (in addition to compile time). This allows the data type layer to be compiled with debugging support without having to pay a big runtime penalty if the debugging isn't actually used. ./src/H5A.c ./src/H5D.c ./src/H5Ofill.c ./src/H5P.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5Tpublic.h Added the stride argument to the H5T_convert() calls. The stride is always zero, which means that the source and destination data values are packed. ./configure.in ./configure [REGENERATED] If API tracing is turned off then libhdf5.settings will say `no' instead of nothing. ./test/flush1.c ./test/flush2.c Added better error messages in a couple places.
This commit is contained in:
parent
ca9f4c3888
commit
8baa675250
15
configure
vendored
15
configure
vendored
@ -5137,6 +5137,7 @@ if test X = "X$TRACE" -o Xyes = "X$TRACE"; then
|
||||
CPPFLAGS="$CPPFLAGS -DH5_DEBUG_API"
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
TRACE_API=no
|
||||
CPPFLAGS="$CPPFLAGS -UH5_DEBUG_API"
|
||||
fi
|
||||
|
||||
@ -5151,7 +5152,7 @@ case "$CC_BASENAME" in
|
||||
# exists.
|
||||
PARALLEL=mpicc
|
||||
echo $ac_n "checking for mpirun""... $ac_c" 1>&6
|
||||
echo "configure:5155: checking for mpirun" >&5
|
||||
echo "configure:5156: checking for mpirun" >&5
|
||||
|
||||
# Find the path where mpicc is located.
|
||||
cmd=`echo $CC |cut -f1 -d' '`
|
||||
@ -5196,7 +5197,7 @@ fi
|
||||
|
||||
|
||||
echo $ac_n "checking for parallel support files""... $ac_c" 1>&6
|
||||
echo "configure:5200: checking for parallel support files" >&5
|
||||
echo "configure:5201: checking for parallel support files" >&5
|
||||
case "X-$enable_parallel" in
|
||||
X-|X-no|X-none)
|
||||
# Either we are not compiling for parallel or the header and library
|
||||
@ -5227,7 +5228,7 @@ case "X-$enable_parallel" in
|
||||
# is missing.
|
||||
PARALLEL=mpich
|
||||
echo $ac_n "checking for MPI_Init in -lmpich""... $ac_c" 1>&6
|
||||
echo "configure:5231: checking for MPI_Init in -lmpich" >&5
|
||||
echo "configure:5232: checking for MPI_Init in -lmpich" >&5
|
||||
ac_lib_var=`echo mpich'_'MPI_Init | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -5235,7 +5236,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lmpich $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5239 "configure"
|
||||
#line 5240 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -5246,7 +5247,7 @@ int main() {
|
||||
MPI_Init()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:5251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
@ -5295,10 +5296,10 @@ EOF
|
||||
|
||||
# Display what we found about running programs
|
||||
echo $ac_n "checking prefix for running on one processor""... $ac_c" 1>&6
|
||||
echo "configure:5299: checking prefix for running on one processor" >&5
|
||||
echo "configure:5300: checking prefix for running on one processor" >&5
|
||||
echo "$ac_t""$RUNSERIAL" 1>&6
|
||||
echo $ac_n "checking prefix for running in parallel""... $ac_c" 1>&6
|
||||
echo "configure:5302: checking prefix for running in parallel" >&5
|
||||
echo "configure:5303: checking prefix for running in parallel" >&5
|
||||
echo "$ac_t""$RUNPARALLEL" 1>&6
|
||||
|
||||
# Check that we can link a simple MPI and MPI-IO application
|
||||
|
@ -541,6 +541,7 @@ if test X = "X$TRACE" -o Xyes = "X$TRACE"; then
|
||||
CPPFLAGS="$CPPFLAGS -DH5_DEBUG_API"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
TRACE_API=no
|
||||
CPPFLAGS="$CPPFLAGS -UH5_DEBUG_API"
|
||||
fi
|
||||
|
||||
|
190
src/.distdep
190
src/.distdep
@ -1376,3 +1376,193 @@ H5TB.lo: \
|
||||
H5Iprivate.h \
|
||||
H5Ipublic.h \
|
||||
H5Eprivate.h
|
||||
H5A.lo: \
|
||||
H5A.c \
|
||||
H5private.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5Iprivate.h \
|
||||
H5Ipublic.h \
|
||||
H5Bprivate.h \
|
||||
H5Bpublic.h \
|
||||
H5Fprivate.h \
|
||||
H5Fpublic.h \
|
||||
H5Dpublic.h \
|
||||
H5Dprivate.h \
|
||||
H5Gprivate.h \
|
||||
H5Gpublic.h \
|
||||
H5Oprivate.h \
|
||||
H5Opublic.h \
|
||||
H5HGprivate.h \
|
||||
H5HGpublic.h \
|
||||
H5Tprivate.h \
|
||||
H5Tpublic.h \
|
||||
H5Sprivate.h \
|
||||
H5Spublic.h \
|
||||
H5Zprivate.h \
|
||||
H5Zpublic.h \
|
||||
H5Eprivate.h \
|
||||
H5Epublic.h \
|
||||
H5MMprivate.h \
|
||||
H5MMpublic.h \
|
||||
H5Pprivate.h \
|
||||
H5Ppublic.h \
|
||||
H5Apkg.h \
|
||||
H5Aprivate.h
|
||||
H5D.lo: \
|
||||
H5D.c \
|
||||
H5private.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5Iprivate.h \
|
||||
H5Ipublic.h \
|
||||
H5ACprivate.h \
|
||||
H5ACpublic.h \
|
||||
H5Fprivate.h \
|
||||
H5Fpublic.h \
|
||||
H5Dpublic.h \
|
||||
H5Dprivate.h \
|
||||
H5Gprivate.h \
|
||||
H5Gpublic.h \
|
||||
H5Bprivate.h \
|
||||
H5Bpublic.h \
|
||||
H5Oprivate.h \
|
||||
H5Opublic.h \
|
||||
H5HGprivate.h \
|
||||
H5HGpublic.h \
|
||||
H5Tprivate.h \
|
||||
H5Tpublic.h \
|
||||
H5Sprivate.h \
|
||||
H5Spublic.h \
|
||||
H5Zprivate.h \
|
||||
H5Zpublic.h \
|
||||
H5Eprivate.h \
|
||||
H5Epublic.h \
|
||||
H5HLprivate.h \
|
||||
H5HLpublic.h \
|
||||
H5MFprivate.h \
|
||||
H5MFpublic.h \
|
||||
H5MMprivate.h \
|
||||
H5MMpublic.h \
|
||||
H5Pprivate.h \
|
||||
H5Ppublic.h \
|
||||
H5TBprivate.h
|
||||
H5Ofill.lo: \
|
||||
H5Ofill.c \
|
||||
H5private.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5Eprivate.h \
|
||||
H5Epublic.h \
|
||||
H5Ipublic.h \
|
||||
H5Iprivate.h \
|
||||
H5MMprivate.h \
|
||||
H5MMpublic.h \
|
||||
H5Oprivate.h \
|
||||
H5Opublic.h \
|
||||
H5Fprivate.h \
|
||||
H5Fpublic.h \
|
||||
H5Dpublic.h \
|
||||
H5Gprivate.h \
|
||||
H5Gpublic.h \
|
||||
H5Bprivate.h \
|
||||
H5Bpublic.h \
|
||||
H5HGprivate.h \
|
||||
H5HGpublic.h \
|
||||
H5Tprivate.h
|
||||
H5P.lo: \
|
||||
H5P.c \
|
||||
H5private.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5Iprivate.h \
|
||||
H5Ipublic.h \
|
||||
H5Bprivate.h \
|
||||
H5Bpublic.h \
|
||||
H5Fprivate.h \
|
||||
H5Fpublic.h \
|
||||
H5Dpublic.h \
|
||||
H5Dprivate.h \
|
||||
H5Gprivate.h \
|
||||
H5Gpublic.h \
|
||||
H5Oprivate.h \
|
||||
H5Opublic.h \
|
||||
H5HGprivate.h \
|
||||
H5HGpublic.h \
|
||||
H5Tprivate.h \
|
||||
H5Tpublic.h \
|
||||
H5Sprivate.h \
|
||||
H5Spublic.h \
|
||||
H5Zprivate.h \
|
||||
H5Zpublic.h \
|
||||
H5Eprivate.h \
|
||||
H5Epublic.h \
|
||||
H5MMprivate.h
|
||||
H5T.lo: \
|
||||
H5T.c \
|
||||
H5private.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5Dprivate.h \
|
||||
H5Dpublic.h \
|
||||
H5Ipublic.h \
|
||||
H5Fprivate.h \
|
||||
H5Fpublic.h \
|
||||
H5Gprivate.h \
|
||||
H5Gpublic.h \
|
||||
H5Bprivate.h \
|
||||
H5Bpublic.h \
|
||||
H5Oprivate.h \
|
||||
H5Opublic.h \
|
||||
H5HGprivate.h \
|
||||
H5HGpublic.h \
|
||||
H5Tprivate.h \
|
||||
H5Tpublic.h \
|
||||
H5Sprivate.h \
|
||||
H5Spublic.h \
|
||||
H5Zprivate.h \
|
||||
H5Zpublic.h \
|
||||
H5Iprivate.h \
|
||||
H5Eprivate.h \
|
||||
H5Epublic.h \
|
||||
H5MMprivate.h
|
||||
H5Tconv.lo: \
|
||||
H5Tconv.c \
|
||||
H5Iprivate.h \
|
||||
H5Ipublic.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5private.h \
|
||||
H5Eprivate.h \
|
||||
H5Epublic.h \
|
||||
H5MMprivate.h \
|
||||
H5MMpublic.h \
|
||||
H5Tpkg.h \
|
||||
H5HGprivate.h \
|
||||
H5HGpublic.h \
|
||||
H5Fprivate.h \
|
||||
H5Fpublic.h \
|
||||
H5Dpublic.h \
|
||||
H5Rprivate.h \
|
||||
H5Rpublic.h \
|
||||
H5Tprivate.h \
|
||||
H5Tpublic.h \
|
||||
H5Gprivate.h \
|
||||
H5Gpublic.h \
|
||||
H5Bprivate.h \
|
||||
H5Bpublic.h
|
||||
H5TB.lo: \
|
||||
H5TB.c \
|
||||
H5private.h \
|
||||
H5public.h \
|
||||
H5config.h \
|
||||
H5api_adpt.h \
|
||||
H5Iprivate.h \
|
||||
H5Ipublic.h \
|
||||
H5Eprivate.h
|
||||
|
@ -667,7 +667,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
|
||||
}
|
||||
|
||||
/* Perform data type conversion */
|
||||
if (H5T_convert(tpath, src_id, dst_id, nelmts, tconv_buf, bkg_buf)<0) {
|
||||
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, tconv_buf, bkg_buf)<0) {
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
|
||||
"data type conversion failed");
|
||||
}
|
||||
@ -835,7 +835,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
|
||||
}
|
||||
|
||||
/* Perform data type conversion. */
|
||||
if (H5T_convert(tpath, src_id, dst_id, nelmts, tconv_buf, bkg_buf)<0) {
|
||||
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, tconv_buf, bkg_buf)<0) {
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
|
||||
"data type conversion failed");
|
||||
}
|
||||
|
@ -1751,7 +1751,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e
|
||||
/*
|
||||
* Perform data type conversion.
|
||||
*/
|
||||
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, tconv_buf,
|
||||
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, tconv_buf,
|
||||
bkg_buf)<0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
|
||||
"data type conversion failed");
|
||||
@ -2151,7 +2151,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
|
||||
/*
|
||||
* Perform data type conversion.
|
||||
*/
|
||||
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, tconv_buf,
|
||||
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, tconv_buf,
|
||||
bkg_buf)<0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
|
||||
"data type conversion failed");
|
||||
|
@ -359,7 +359,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type)
|
||||
}
|
||||
|
||||
/* Do the conversion */
|
||||
if (H5T_convert(tpath, src_id, dst_id, 1, buf, bkg)<0) {
|
||||
if (H5T_convert(tpath, src_id, dst_id, 1, 0, buf, bkg)<0) {
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"data type conversion failed");
|
||||
}
|
||||
|
@ -2722,7 +2722,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
|
||||
HDmemcpy(buf, plist->fill.buf, H5T_get_size(plist->fill.type));
|
||||
|
||||
/* Do the conversion */
|
||||
if (H5T_convert(tpath, src_id, type_id, 1, buf, bkg)<0) {
|
||||
if (H5T_convert(tpath, src_id, type_id, 1, 0, buf, bkg)<0) {
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"data type conversion failed");
|
||||
}
|
||||
|
44
src/H5T.c
44
src/H5T.c
@ -956,6 +956,9 @@ H5T_init_interface(void)
|
||||
status |= H5Tregister(H5T_PERS_SOFT, "struct",
|
||||
compound, compound,
|
||||
H5T_conv_struct);
|
||||
status |= H5Tregister(H5T_PERS_SOFT, "struct(opt)",
|
||||
compound, compound,
|
||||
H5T_conv_struct_opt);
|
||||
status |= H5Tregister(H5T_PERS_SOFT, "enum",
|
||||
enum_type, enum_type,
|
||||
H5T_conv_enum);
|
||||
@ -1355,7 +1358,7 @@ H5T_term_interface(void)
|
||||
H5T_print_stats(path, &nprint/*in,out*/);
|
||||
path->cdata.command = H5T_CONV_FREE;
|
||||
if ((path->func)(FAIL, FAIL, &(path->cdata),
|
||||
0, NULL, NULL)<0) {
|
||||
0, 0, NULL, NULL)<0) {
|
||||
#ifdef H5T_DEBUG
|
||||
if (H5DEBUG(T)) {
|
||||
fprintf (H5DEBUG(T), "H5T: conversion function "
|
||||
@ -4136,7 +4139,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
|
||||
}
|
||||
HDmemset(&cdata, 0, sizeof cdata);
|
||||
cdata.command = H5T_CONV_INIT;
|
||||
if ((func)(tmp_sid, tmp_did, &cdata, 0, NULL, NULL)<0) {
|
||||
if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, NULL, NULL)<0) {
|
||||
H5I_dec_ref(tmp_sid);
|
||||
H5I_dec_ref(tmp_did);
|
||||
tmp_sid = tmp_did = -1;
|
||||
@ -4168,7 +4171,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
|
||||
H5T_print_stats(old_path, &nprint);
|
||||
old_path->cdata.command = H5T_CONV_FREE;
|
||||
if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata),
|
||||
0, NULL, NULL)<0) {
|
||||
0, 0, NULL, NULL)<0) {
|
||||
#ifdef H5T_DEBUG
|
||||
if (H5DEBUG(T)) {
|
||||
fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx "
|
||||
@ -4284,7 +4287,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
|
||||
/* Shut down path */
|
||||
H5T_print_stats(path, &nprint);
|
||||
path->cdata.command = H5T_CONV_FREE;
|
||||
if ((path->func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) {
|
||||
if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, NULL, NULL)<0) {
|
||||
#ifdef H5T_DEBUG
|
||||
if (H5DEBUG(T)) {
|
||||
fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed "
|
||||
@ -4402,7 +4405,7 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
|
||||
"unable to convert between src and dst data types");
|
||||
}
|
||||
|
||||
if (H5T_convert(tpath, src_id, dst_id, nelmts, buf, background)<0) {
|
||||
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, buf, background)<0) {
|
||||
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"data type conversion failed");
|
||||
}
|
||||
@ -6399,7 +6402,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
|
||||
HDstrcpy(H5T_g.path[0]->name, "no-op");
|
||||
H5T_g.path[0]->func = H5T_conv_noop;
|
||||
H5T_g.path[0]->cdata.command = H5T_CONV_INIT;
|
||||
if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0,
|
||||
if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, 0,
|
||||
NULL, NULL)<0) {
|
||||
#ifdef H5T_DEBUG
|
||||
if (H5DEBUG(T)) {
|
||||
@ -6487,7 +6490,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
|
||||
"query");
|
||||
}
|
||||
path->cdata.command = H5T_CONV_INIT;
|
||||
if ((func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) {
|
||||
if ((func)(src_id, dst_id, &(path->cdata), 0, 0, NULL, NULL)<0) {
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
|
||||
"unable to initialize conversion function");
|
||||
}
|
||||
@ -6519,7 +6522,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
|
||||
}
|
||||
path->cdata.command = H5T_CONV_INIT;
|
||||
if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata),
|
||||
0, NULL, NULL)<0) {
|
||||
0, 0, NULL, NULL)<0) {
|
||||
HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t));
|
||||
H5E_clear(); /*ignore the error*/
|
||||
} else {
|
||||
@ -6541,7 +6544,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
|
||||
assert(table==H5T_g.path[md]);
|
||||
H5T_print_stats(table, &nprint/*in,out*/);
|
||||
table->cdata.command = H5T_CONV_FREE;
|
||||
if ((table->func)(FAIL, FAIL, &(table->cdata), 0, NULL, NULL)<0) {
|
||||
if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, NULL, NULL)<0) {
|
||||
#ifdef H5T_DEBUG
|
||||
if (H5DEBUG(T)) {
|
||||
fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free "
|
||||
@ -6605,12 +6608,20 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
|
||||
* Tuesday, December 15, 1998
|
||||
*
|
||||
* Modifications:
|
||||
* Robb Matzke, 1999-06-16
|
||||
* The timers are updated only if H5T debugging is enabled at
|
||||
* runtime in addition to compile time.
|
||||
*
|
||||
* Robb Matzke, 1999-06-16
|
||||
* Added support for non-zero strides. If STRIDE is non-zero
|
||||
* then convert one value at each memory location advancing
|
||||
* STRIDE bytes each time; otherwise assume both source and
|
||||
* destination values are packed.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts,
|
||||
void *buf, void *bkg)
|
||||
size_t stride, void *buf, void *bkg)
|
||||
{
|
||||
#ifdef H5T_DEBUG
|
||||
H5_timer_t timer;
|
||||
@ -6619,17 +6630,20 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts,
|
||||
FUNC_ENTER(H5T_convert, FAIL);
|
||||
|
||||
#ifdef H5T_DEBUG
|
||||
H5_timer_begin(&timer);
|
||||
if (H5DEBUG(T)) H5_timer_begin(&timer);
|
||||
#endif
|
||||
tpath->cdata.command = H5T_CONV_CONV;
|
||||
if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, buf, bkg)<0) {
|
||||
if ((tpath->func)(src_id, dst_id, &(tpath->cdata), nelmts, stride, buf,
|
||||
bkg)<0) {
|
||||
HRETURN_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
|
||||
"data type conversion failed");
|
||||
}
|
||||
#ifdef H5T_DEBUG
|
||||
H5_timer_end(&(tpath->stats.timer), &timer);
|
||||
tpath->stats.ncalls++;
|
||||
tpath->stats.nelmts += nelmts;
|
||||
if (H5DEBUG(T)) {
|
||||
H5_timer_end(&(tpath->stats.timer), &timer);
|
||||
tpath->stats.ncalls++;
|
||||
tpath->stats.nelmts += nelmts;
|
||||
}
|
||||
#endif
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
|
938
src/H5Tconv.c
938
src/H5Tconv.c
File diff suppressed because it is too large
Load Diff
216
src/H5Tpkg.h
216
src/H5Tpkg.h
@ -209,309 +209,321 @@ __DLLVAR__ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g;
|
||||
|
||||
/* Conversion functions */
|
||||
__DLL__ herr_t H5T_conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *buf,
|
||||
void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *_buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *_buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *_buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *_buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_struct_opt(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
size_t stride, void *_buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *_buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *_buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *_buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *_buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *_buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *_buf,
|
||||
void *bkg);
|
||||
__DLL__ herr_t H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *_buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *_buf,
|
||||
void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_short_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_short_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_int_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_int_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_long_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_long_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_llong_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_short(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_int(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_long(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
|
||||
__DLL__ herr_t H5T_conv_float_double(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_double_float(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *buf, void *bkg);
|
||||
size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_conv_i32le_f64le(hid_t src_id, hid_t dst_id,
|
||||
H5T_cdata_t *cdata, size_t nelmts,
|
||||
void *_buf, void *bkg);
|
||||
size_t stride, void *_buf, void *bkg);
|
||||
|
||||
/* Bit twiddling functions */
|
||||
__DLL__ void H5T_bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src,
|
||||
|
@ -97,7 +97,7 @@ __DLL__ H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst,
|
||||
__DLL__ herr_t H5T_sort_value(H5T_t *dt, int *map);
|
||||
__DLL__ herr_t H5T_sort_name(H5T_t *dt, int *map);
|
||||
__DLL__ herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
|
||||
size_t nelmts, void *buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *buf, void *bkg);
|
||||
__DLL__ herr_t H5T_set_size(H5T_t *dt, size_t size);
|
||||
__DLL__ herr_t H5T_set_precision(H5T_t *dt, size_t prec);
|
||||
__DLL__ herr_t H5T_set_offset(H5T_t *dt, size_t offset);
|
||||
|
@ -158,7 +158,8 @@ typedef struct {
|
||||
|
||||
/* All data type conversion functions are... */
|
||||
typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
|
||||
size_t nelmts, void *buf, void *bkg);
|
||||
size_t nelmts, size_t stride, void *buf,
|
||||
void *bkg);
|
||||
|
||||
/*
|
||||
* If an error occurs during a data type conversion then the function
|
||||
|
@ -1038,3 +1038,99 @@ fillval.lo: \
|
||||
../src/H5Fprivate.h \
|
||||
../src/H5Rprivate.h \
|
||||
../src/H5Tprivate.h
|
||||
dtypes.lo: \
|
||||
dtypes.c \
|
||||
h5test.h \
|
||||
../src/hdf5.h \
|
||||
../src/H5public.h \
|
||||
../src/H5config.h \
|
||||
../src/H5api_adpt.h \
|
||||
../src/H5Ipublic.h \
|
||||
../src/H5Apublic.h \
|
||||
../src/H5ACpublic.h \
|
||||
../src/H5Bpublic.h \
|
||||
../src/H5Dpublic.h \
|
||||
../src/H5Epublic.h \
|
||||
../src/H5Fpublic.h \
|
||||
../src/H5Gpublic.h \
|
||||
../src/H5HGpublic.h \
|
||||
../src/H5HLpublic.h \
|
||||
../src/H5MFpublic.h \
|
||||
../src/H5MMpublic.h \
|
||||
../src/H5Opublic.h \
|
||||
../src/H5Ppublic.h \
|
||||
../src/H5Zpublic.h \
|
||||
../src/H5Rpublic.h \
|
||||
../src/H5RApublic.h \
|
||||
../src/H5Spublic.h \
|
||||
../src/H5Tpublic.h \
|
||||
../src/H5private.h \
|
||||
../src/H5Tpkg.h \
|
||||
../src/H5HGprivate.h \
|
||||
../src/H5Fprivate.h \
|
||||
../src/H5Rprivate.h \
|
||||
../src/H5Tprivate.h
|
||||
flush1.lo: \
|
||||
flush1.c \
|
||||
h5test.h \
|
||||
../src/hdf5.h \
|
||||
../src/H5public.h \
|
||||
../src/H5config.h \
|
||||
../src/H5api_adpt.h \
|
||||
../src/H5Ipublic.h \
|
||||
../src/H5Apublic.h \
|
||||
../src/H5ACpublic.h \
|
||||
../src/H5Bpublic.h \
|
||||
../src/H5Dpublic.h \
|
||||
../src/H5Epublic.h \
|
||||
../src/H5Fpublic.h \
|
||||
../src/H5Gpublic.h \
|
||||
../src/H5HGpublic.h \
|
||||
../src/H5HLpublic.h \
|
||||
../src/H5MFpublic.h \
|
||||
../src/H5MMpublic.h \
|
||||
../src/H5Opublic.h \
|
||||
../src/H5Ppublic.h \
|
||||
../src/H5Zpublic.h \
|
||||
../src/H5Rpublic.h \
|
||||
../src/H5RApublic.h \
|
||||
../src/H5Spublic.h \
|
||||
../src/H5Tpublic.h \
|
||||
../src/H5private.h \
|
||||
../src/H5Tpkg.h \
|
||||
../src/H5HGprivate.h \
|
||||
../src/H5Fprivate.h \
|
||||
../src/H5Rprivate.h \
|
||||
../src/H5Tprivate.h
|
||||
flush2.lo: \
|
||||
flush2.c \
|
||||
h5test.h \
|
||||
../src/hdf5.h \
|
||||
../src/H5public.h \
|
||||
../src/H5config.h \
|
||||
../src/H5api_adpt.h \
|
||||
../src/H5Ipublic.h \
|
||||
../src/H5Apublic.h \
|
||||
../src/H5ACpublic.h \
|
||||
../src/H5Bpublic.h \
|
||||
../src/H5Dpublic.h \
|
||||
../src/H5Epublic.h \
|
||||
../src/H5Fpublic.h \
|
||||
../src/H5Gpublic.h \
|
||||
../src/H5HGpublic.h \
|
||||
../src/H5HLpublic.h \
|
||||
../src/H5MFpublic.h \
|
||||
../src/H5MMpublic.h \
|
||||
../src/H5Opublic.h \
|
||||
../src/H5Ppublic.h \
|
||||
../src/H5Zpublic.h \
|
||||
../src/H5Rpublic.h \
|
||||
../src/H5RApublic.h \
|
||||
../src/H5Spublic.h \
|
||||
../src/H5Tpublic.h \
|
||||
../src/H5private.h \
|
||||
../src/H5Tpkg.h \
|
||||
../src/H5HGprivate.h \
|
||||
../src/H5Fprivate.h \
|
||||
../src/H5Rprivate.h \
|
||||
../src/H5Tprivate.h
|
||||
|
443
test/dtypes.c
443
test/dtypes.c
@ -285,7 +285,7 @@ reset_hdf5(void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, December 9, 1997
|
||||
@ -294,7 +294,7 @@ reset_hdf5(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_classes(void)
|
||||
{
|
||||
H5T_class_t tcls;
|
||||
@ -317,7 +317,7 @@ test_classes(void)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -328,7 +328,7 @@ test_classes(void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, December 9, 1997
|
||||
@ -337,7 +337,7 @@ test_classes(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_copy(void)
|
||||
{
|
||||
hid_t a_copy;
|
||||
@ -362,18 +362,18 @@ test_copy(void)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_compound
|
||||
* Function: test_compound_1
|
||||
*
|
||||
* Purpose: Tests various things about compound data types.
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, January 7, 1998
|
||||
@ -382,8 +382,8 @@ test_copy(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_compound(void)
|
||||
static int
|
||||
test_compound_1(void)
|
||||
{
|
||||
complex_t tmp;
|
||||
hid_t complex_id;
|
||||
@ -404,9 +404,352 @@ test_compound(void)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_compound_2
|
||||
*
|
||||
* Purpose: Tests a compound type conversion where the source and
|
||||
* destination are the same except for the order of the
|
||||
* elements.
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, June 17, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_compound_2(void)
|
||||
{
|
||||
struct st {
|
||||
int a, b, c[4], d, e;
|
||||
} *s_ptr;
|
||||
struct dt {
|
||||
int e, d, c[4], b, a;
|
||||
} *d_ptr;
|
||||
|
||||
const int nelmts = 200000;
|
||||
const size_t four = 4;
|
||||
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
|
||||
hid_t st=-1, dt=-1;
|
||||
int i;
|
||||
|
||||
TESTING("compound element reordering");
|
||||
|
||||
/* Sizes should be the same, but be careful just in case */
|
||||
buf = malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
|
||||
bkg = malloc(nelmts * sizeof(struct dt));
|
||||
orig = malloc(nelmts * sizeof(struct st));
|
||||
for (i=0; i<nelmts; i++) {
|
||||
s_ptr = ((struct st*)orig) + i;
|
||||
s_ptr->a = i*8+0;
|
||||
s_ptr->b = i*8+1;
|
||||
s_ptr->c[0] = i*8+2;
|
||||
s_ptr->c[1] = i*8+3;
|
||||
s_ptr->c[2] = i*8+4;
|
||||
s_ptr->c[3] = i*8+5;
|
||||
s_ptr->d = i*8+6;
|
||||
s_ptr->e = i*8+7;
|
||||
}
|
||||
memcpy(buf, orig, nelmts*sizeof(struct st));
|
||||
|
||||
/* Build hdf5 datatypes */
|
||||
if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
|
||||
H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert_array(st, "c", HOFFSET(struct st, c), 1, &four, NULL,
|
||||
H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
|
||||
goto error;
|
||||
|
||||
if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
|
||||
H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert_array(dt, "c", HOFFSET(struct dt, c), 1, &four, NULL,
|
||||
H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
|
||||
goto error;
|
||||
|
||||
/* Perform the conversion */
|
||||
if (H5Tconvert(st, dt, nelmts, buf, bkg)<0) goto error;
|
||||
|
||||
/* Compare results */
|
||||
for (i=0; i<nelmts; i++) {
|
||||
s_ptr = ((struct st*)orig) + i;
|
||||
d_ptr = ((struct dt*)buf) + i;
|
||||
if (s_ptr->a != d_ptr->a ||
|
||||
s_ptr->b != d_ptr->b ||
|
||||
s_ptr->c[0] != d_ptr->c[0] ||
|
||||
s_ptr->c[1] != d_ptr->c[1] ||
|
||||
s_ptr->c[2] != d_ptr->c[2] ||
|
||||
s_ptr->c[3] != d_ptr->c[3] ||
|
||||
s_ptr->d != d_ptr->d ||
|
||||
s_ptr->e != d_ptr->e) {
|
||||
FAILED();
|
||||
printf(" i=%d\n", i);
|
||||
printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
|
||||
s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
|
||||
s_ptr->c[3], s_ptr->d, s_ptr->e);
|
||||
printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
|
||||
d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
|
||||
d_ptr->c[3], d_ptr->d, d_ptr->e);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release resources */
|
||||
free(buf);
|
||||
free(bkg);
|
||||
free(orig);
|
||||
if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error;
|
||||
|
||||
PASSED();
|
||||
reset_hdf5();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_compound_3
|
||||
*
|
||||
* Purpose: Tests compound conversions where the source and destination
|
||||
* are the same except the destination is missing a couple
|
||||
* members which appear in the source.
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, June 17, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_compound_3(void)
|
||||
{
|
||||
struct st {
|
||||
int a, b, c[4], d, e;
|
||||
} *s_ptr;
|
||||
struct dt {
|
||||
int a, c[4], e;
|
||||
} *d_ptr;
|
||||
|
||||
const int nelmts = 200000;
|
||||
const size_t four = 4;
|
||||
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
|
||||
hid_t st=-1, dt=-1;
|
||||
int i;
|
||||
|
||||
TESTING("compound subset conversions");
|
||||
|
||||
/* Initialize */
|
||||
buf = malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
|
||||
bkg = malloc(nelmts * sizeof(struct dt));
|
||||
orig = malloc(nelmts * sizeof(struct st));
|
||||
for (i=0; i<nelmts; i++) {
|
||||
s_ptr = ((struct st*)orig) + i;
|
||||
s_ptr->a = i*8+0;
|
||||
s_ptr->b = i*8+1;
|
||||
s_ptr->c[0] = i*8+2;
|
||||
s_ptr->c[1] = i*8+3;
|
||||
s_ptr->c[2] = i*8+4;
|
||||
s_ptr->c[3] = i*8+5;
|
||||
s_ptr->d = i*8+6;
|
||||
s_ptr->e = i*8+7;
|
||||
}
|
||||
memcpy(buf, orig, nelmts*sizeof(struct st));
|
||||
|
||||
/* Build hdf5 datatypes */
|
||||
if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
|
||||
H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert_array(st, "c", HOFFSET(struct st, c), 1, &four, NULL,
|
||||
H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
|
||||
goto error;
|
||||
|
||||
if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
|
||||
H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert_array(dt, "c", HOFFSET(struct dt, c), 1, &four, NULL,
|
||||
H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
|
||||
goto error;
|
||||
|
||||
/* Perform the conversion */
|
||||
if (H5Tconvert(st, dt, nelmts, buf, bkg)<0) goto error;
|
||||
|
||||
/* Compare results */
|
||||
for (i=0; i<nelmts; i++) {
|
||||
s_ptr = ((struct st*)orig) + i;
|
||||
d_ptr = ((struct dt*)buf) + i;
|
||||
if (s_ptr->a != d_ptr->a ||
|
||||
s_ptr->c[0] != d_ptr->c[0] ||
|
||||
s_ptr->c[1] != d_ptr->c[1] ||
|
||||
s_ptr->c[2] != d_ptr->c[2] ||
|
||||
s_ptr->c[3] != d_ptr->c[3] ||
|
||||
s_ptr->e != d_ptr->e) {
|
||||
FAILED();
|
||||
printf(" i=%d\n", i);
|
||||
printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
|
||||
s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
|
||||
s_ptr->c[3], s_ptr->d, s_ptr->e);
|
||||
printf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
|
||||
d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
|
||||
d_ptr->c[3], d_ptr->e);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release resources */
|
||||
free(buf);
|
||||
free(bkg);
|
||||
free(orig);
|
||||
if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error;
|
||||
|
||||
PASSED();
|
||||
reset_hdf5();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_compound_4
|
||||
*
|
||||
* Purpose: Tests compound conversions when the destination has the same
|
||||
* fields as the source but one or more of the fields are
|
||||
* smaller.
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, June 17, 1999
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
test_compound_4(void)
|
||||
{
|
||||
|
||||
struct st {
|
||||
int a, b, c[4], d, e;
|
||||
} *s_ptr;
|
||||
struct dt {
|
||||
short b;
|
||||
int a, c[4];
|
||||
short d;
|
||||
int e;
|
||||
} *d_ptr;
|
||||
|
||||
const int nelmts = 200000;
|
||||
const size_t four = 4;
|
||||
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
|
||||
hid_t st=-1, dt=-1;
|
||||
int i;
|
||||
|
||||
TESTING("compound element shrinking & reordering");
|
||||
|
||||
/* Sizes should be the same, but be careful just in case */
|
||||
buf = malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
|
||||
bkg = malloc(nelmts * sizeof(struct dt));
|
||||
orig = malloc(nelmts * sizeof(struct st));
|
||||
for (i=0; i<nelmts; i++) {
|
||||
s_ptr = ((struct st*)orig) + i;
|
||||
s_ptr->a = i*8+0;
|
||||
s_ptr->b = (i*8+1) & 0x7fff;
|
||||
s_ptr->c[0] = i*8+2;
|
||||
s_ptr->c[1] = i*8+3;
|
||||
s_ptr->c[2] = i*8+4;
|
||||
s_ptr->c[3] = i*8+5;
|
||||
s_ptr->d = (i*8+6) & 0x7fff;
|
||||
s_ptr->e = i*8+7;
|
||||
}
|
||||
memcpy(buf, orig, nelmts*sizeof(struct st));
|
||||
|
||||
/* Build hdf5 datatypes */
|
||||
if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st)))<0 ||
|
||||
H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert_array(st, "c", HOFFSET(struct st, c), 1, &four, NULL,
|
||||
H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "d", HOFFSET(struct st, d), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(st, "e", HOFFSET(struct st, e), H5T_NATIVE_INT)<0)
|
||||
goto error;
|
||||
|
||||
if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt)))<0 ||
|
||||
H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT)<0 ||
|
||||
H5Tinsert_array(dt, "c", HOFFSET(struct dt, c), 1, &four, NULL,
|
||||
H5T_NATIVE_INT)<0 ||
|
||||
H5Tinsert(dt, "d", HOFFSET(struct dt, d), H5T_NATIVE_SHORT)<0 ||
|
||||
H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT)<0)
|
||||
goto error;
|
||||
|
||||
/* Perform the conversion */
|
||||
if (H5Tconvert(st, dt, nelmts, buf, bkg)<0) goto error;
|
||||
|
||||
/* Compare results */
|
||||
for (i=0; i<nelmts; i++) {
|
||||
s_ptr = ((struct st*)orig) + i;
|
||||
d_ptr = ((struct dt*)buf) + i;
|
||||
if (s_ptr->a != d_ptr->a ||
|
||||
s_ptr->b != d_ptr->b ||
|
||||
s_ptr->c[0] != d_ptr->c[0] ||
|
||||
s_ptr->c[1] != d_ptr->c[1] ||
|
||||
s_ptr->c[2] != d_ptr->c[2] ||
|
||||
s_ptr->c[3] != d_ptr->c[3] ||
|
||||
s_ptr->d != d_ptr->d ||
|
||||
s_ptr->e != d_ptr->e) {
|
||||
FAILED();
|
||||
printf(" i=%d\n", i);
|
||||
printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
|
||||
s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
|
||||
s_ptr->c[3], s_ptr->d, s_ptr->e);
|
||||
printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
|
||||
d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
|
||||
d_ptr->c[3], d_ptr->d, d_ptr->e);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release resources */
|
||||
free(buf);
|
||||
free(bkg);
|
||||
free(orig);
|
||||
if (H5Tclose(st)<0 || H5Tclose(dt)<0) goto error;
|
||||
|
||||
PASSED();
|
||||
reset_hdf5();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_transient
|
||||
@ -415,7 +758,7 @@ test_compound(void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, June 4, 1998
|
||||
@ -424,7 +767,7 @@ test_compound(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_transient (hid_t fapl)
|
||||
{
|
||||
static hsize_t ds_size[2] = {10, 20};
|
||||
@ -530,7 +873,7 @@ test_transient (hid_t fapl)
|
||||
H5Dclose (dset);
|
||||
H5Fclose (file);
|
||||
} H5E_END_TRY;
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +884,7 @@ test_transient (hid_t fapl)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, June 1, 1998
|
||||
@ -550,7 +893,7 @@ test_transient (hid_t fapl)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_named (hid_t fapl)
|
||||
{
|
||||
hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, attr1=-1;
|
||||
@ -715,7 +1058,7 @@ test_named (hid_t fapl)
|
||||
H5Dclose (dset);
|
||||
H5Fclose (file);
|
||||
} H5E_END_TRY;
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -754,7 +1097,7 @@ mkstr(size_t len, H5T_str_t strpad)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, August 10, 1998
|
||||
@ -763,7 +1106,7 @@ mkstr(size_t len, H5T_str_t strpad)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_conv_str_1(void)
|
||||
{
|
||||
char *buf=NULL;
|
||||
@ -993,7 +1336,7 @@ test_conv_str_1(void)
|
||||
|
||||
error:
|
||||
reset_hdf5();
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1004,7 +1347,7 @@ test_conv_str_1(void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, August 10, 1998
|
||||
@ -1013,14 +1356,14 @@ test_conv_str_1(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_conv_str_2(void)
|
||||
{
|
||||
char *buf=NULL, s[80];
|
||||
hid_t c_type, f_type;
|
||||
const size_t nelmts = 200000, ntests=NTESTS;
|
||||
size_t i, j, nchars;
|
||||
herr_t ret_value = -1;
|
||||
int ret_value = 1;
|
||||
|
||||
/*
|
||||
* Initialize types and buffer.
|
||||
@ -1066,7 +1409,7 @@ test_conv_str_2(void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, January 5, 1999
|
||||
@ -1075,14 +1418,14 @@ test_conv_str_2(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_conv_enum_1(void)
|
||||
{
|
||||
const int nelmts=200000, ntests=NTESTS;
|
||||
int i, val, *buf=NULL;
|
||||
hid_t t1, t2;
|
||||
char s[80];
|
||||
herr_t ret_value=FAIL;
|
||||
int ret_value = 1;
|
||||
|
||||
/* Build the data types */
|
||||
t1 = H5Tcreate(H5T_ENUM, sizeof(int));
|
||||
@ -1142,7 +1485,7 @@ test_conv_enum_1(void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, May 20, 1999
|
||||
@ -1219,7 +1562,7 @@ test_conv_bitfield(void)
|
||||
H5Tclose(st);
|
||||
H5Tclose(dt);
|
||||
reset_hdf5();
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1241,7 +1584,8 @@ test_conv_bitfield(void)
|
||||
*/
|
||||
static herr_t
|
||||
convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata,
|
||||
size_t UNUSED nelmts, void UNUSED *_buf, void UNUSED *bkg)
|
||||
size_t UNUSED nelmts, size_t UNUSED stride, void UNUSED *_buf,
|
||||
void UNUSED *bkg)
|
||||
{
|
||||
if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++;
|
||||
return 0;
|
||||
@ -1255,7 +1599,7 @@ convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata,
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, May 20, 1999
|
||||
@ -1312,7 +1656,7 @@ test_opaque(void)
|
||||
if (st>0) H5Tclose(st);
|
||||
if (dt>0) H5Tclose(dt);
|
||||
FAILED();
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1321,9 +1665,9 @@ test_opaque(void)
|
||||
*
|
||||
* Purpose: Test atomic number conversions.
|
||||
*
|
||||
* Return: Success:
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure:
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, June 10, 1998
|
||||
@ -1332,7 +1676,7 @@ test_opaque(void)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
static int
|
||||
test_conv_int (void)
|
||||
{
|
||||
unsigned char byte[4];
|
||||
@ -1431,7 +1775,7 @@ test_conv_int (void)
|
||||
|
||||
error:
|
||||
reset_hdf5();
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1449,7 +1793,7 @@ test_conv_int (void)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Monday, November 16, 1998
|
||||
@ -2581,7 +2925,7 @@ my_isnan(flt_t type, void *val)
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
* Failure: number of errors
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, June 23, 1998
|
||||
@ -3188,20 +3532,23 @@ main(void)
|
||||
}
|
||||
|
||||
/* Do the tests */
|
||||
nerrors += test_classes()<0 ? 1 : 0;
|
||||
nerrors += test_copy()<0 ? 1 : 0;
|
||||
nerrors += test_compound()<0 ? 1 : 0;
|
||||
nerrors += test_transient (fapl)<0 ? 1 : 0;
|
||||
nerrors += test_named (fapl)<0 ? 1 : 0;
|
||||
nerrors += test_classes();
|
||||
nerrors += test_copy();
|
||||
nerrors += test_compound_1();
|
||||
nerrors += test_transient (fapl);
|
||||
nerrors += test_named (fapl);
|
||||
h5_cleanup (fapl); /*must happen before first reset*/
|
||||
reset_hdf5();
|
||||
|
||||
nerrors += test_conv_str_1()<0 ? 1 : 0;
|
||||
nerrors += test_conv_str_2()<0 ? 1 : 0;
|
||||
nerrors += test_conv_int ()<0 ? 1 : 0;
|
||||
nerrors += test_conv_enum_1()<0 ? 1 : 0;
|
||||
nerrors += test_conv_bitfield()<0 ? 1 : 0;
|
||||
nerrors += test_opaque()<0 ? 1 : 0;
|
||||
nerrors += test_conv_str_1();
|
||||
nerrors += test_conv_str_2();
|
||||
nerrors += test_compound_2();
|
||||
nerrors += test_compound_3();
|
||||
nerrors += test_compound_4();
|
||||
nerrors += test_conv_int ();
|
||||
nerrors += test_conv_enum_1();
|
||||
nerrors += test_conv_bitfield();
|
||||
nerrors += test_opaque();
|
||||
|
||||
/* Does floating point overflow generate a SIGFPE? */
|
||||
generates_sigfpe();
|
||||
|
@ -69,7 +69,7 @@ main(void)
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
for (j=0; j<ds_size[1]; j++) {
|
||||
the_data[i][j] = (double)(hssize_t)i/((hssize_t)(j+1));
|
||||
the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
|
||||
}
|
||||
}
|
||||
if (H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT,
|
||||
|
@ -68,7 +68,14 @@ main(void)
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
error = fabs(the_data[i][j]-(double)(hssize_t)i/((hssize_t)j+1));
|
||||
assert(error<0.0001);
|
||||
if (error>0.0001) {
|
||||
FAILED();
|
||||
printf(" dset[%lu][%lu] = %g\n",
|
||||
(unsigned long)i, (unsigned long)j, the_data[i][j]);
|
||||
printf(" should be %g\n",
|
||||
(double)(hssize_t)i/(hssize_t)(j+1));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user