[Users] (possibly) inconsistent handling of ioffsetdenom in CarpetIOHDF5
Roland Haas
rhaas at tapir.caltech.edu
Sun May 4 15:39:47 CDT 2014
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello all,
due to some issues we have with recovering checkpoints I find myself
reading CarpetIOHDF5's Output.cc and Input.cc files.
In particular lines 849--860 of Output.cc:
849 ivect const ioffsetdenom = bbox.stride();
850 HDF5_ERROR (attr = H5Acreate (dataset, "ioffsetdenom", \
H5T_NATIVE_INT,
851 dataspace, H5P_DEFAULT));
852 HDF5_ERROR (H5Awrite (attr, H5T_NATIVE_INT, &ioffsetdenom[0]));
853 HDF5_ERROR (H5Aclose (attr));
854 ivect const ioffset =
855 ((bbox.lower() % bbox.stride()) + bbox.stride()) % \
bbox.stride();
856 HDF5_ERROR (attr = H5Acreate (dataset, "ioffset", H5T_NATIVE_INT,
857 dataspace, H5P_DEFAULT));
858 HDF5_ERROR (H5Awrite (attr, H5T_NATIVE_INT, &ioffset[0]));
859 HDF5_ERROR (H5Aclose (attr));
860 ivect const iorigin = (bbox.lower() - ioffset) / bbox.stride();
which as far as I can tell always just sets ioffsetdenom to the stride.
On the other hand, Input.cc in line 1399-1400:
1399 assert (all (stride % patch->ioffsetdenom == 0));
1400 ivect lower = patch->iorigin * stride + patch->ioffset * stride / \
patch->ioffsetdenom;
only requires stride to be a multiple of ioffsetdenom (rather than
being identical).
Finally if I read the code correctly then if actually stride !=
ioffsetdenom then the code produces incorrect results since Input.cc
would compute lower as:
lower = bbox.lower() - ioffset + patch->ioffset * stride / \
patch->ioffsetdenom
(substituting for patch->iorigin) which only ever evaluates to the
(presumably correct) bbox.lower() if stride == ioffsetdenom.
Any thoughts?
Yours,
Roland
- --
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://keys.gnupg.net.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iEYEARECAAYFAlNmpZMACgkQTiFSTN7SboXD/gCdGu62iL4LIlrpo2m3Lwv7pED+
3f4AnR8KHQ91nNR/zzNJRcvOZbrn5oXO
=5SNz
-----END PGP SIGNATURE-----
More information about the Users
mailing list