diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-05-23 20:42:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-05-23 20:42:00 +0000 |
commit | 0d08638072386bd7aa10f3a438f65b0e1b3a5fa4 (patch) | |
tree | efdb3ed6e98ee21df8b90e7424a4fb1c7361c9d9 /Carpet | |
parent | ac006d859cc7761635d784327945a60c53fa45ac (diff) |
CarpetIOHDF5: Output unsuccessful file names when reading initial data
When no files can be found when reading initial data from files, then
output all files names that were tried. Since the file names are
constructed dynamically, this makes it easier to find errors in
parameter files.
darcs-hash:20070523204234-dae7b-676f945408731a162d2795ab2559b012eaf4fcaf.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetIOHDF5/src/Input.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc index 433b98de6..242181408 100644 --- a/Carpet/CarpetIOHDF5/src/Input.cc +++ b/Carpet/CarpetIOHDF5/src/Input.cc @@ -1,6 +1,8 @@ #include <cassert> #include <cstring> +#include <list> #include <sstream> +#include <string> #include <vector> #include "util_Table.h" @@ -550,6 +552,7 @@ static list<fileset_t>::iterator OpenFileSet (const cGH* const cctkGH, file_t file; fileset_t fileset; int error_count = 0; + list<string> filenames; DECLARE_CCTK_PARAMETERS; // first try to open a chunked file written on this processor @@ -560,6 +563,7 @@ static list<fileset_t>::iterator OpenFileSet (const cGH* const cctkGH, // try to open the file (prevent HDF5 error messages if it fails) H5E_BEGIN_TRY { + filenames.push_back (string (file.filename)); file.file = H5Fopen (file.filename, H5F_ACC_RDONLY, H5P_DEFAULT); } H5E_END_TRY; @@ -571,6 +575,7 @@ static list<fileset_t>::iterator OpenFileSet (const cGH* const cctkGH, file.filename = IOUtil_AssembleFilename (NULL, basefilename, "", ".h5", called_from, fileset.first_ioproc, 0); H5E_BEGIN_TRY { + filenames.push_back (string (file.filename)); file.file = H5Fopen (file.filename, H5F_ACC_RDONLY, H5P_DEFAULT); } H5E_END_TRY; } @@ -582,6 +587,7 @@ static list<fileset_t>::iterator OpenFileSet (const cGH* const cctkGH, file.filename = IOUtil_AssembleFilename (NULL, basefilename, "", ".h5", called_from, fileset.first_ioproc, 1); H5E_BEGIN_TRY { + filenames.push_back (string (file.filename)); file.file = H5Fopen (file.filename, H5F_ACC_RDONLY, H5P_DEFAULT); } H5E_END_TRY; } @@ -589,8 +595,14 @@ static list<fileset_t>::iterator OpenFileSet (const cGH* const cctkGH, // return if no valid checkpoint could be found if (file.file < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "No valid HDF5 file with basename '%s' found", basefilename); + "No valid HDF5 file with basename \"%s\" found", basefilename); free (file.filename); + for (list<string>::const_iterator + lsi = filenames.begin(); lsi != filenames.end(); ++ lsi) + { + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "Tried filename \"%s\"", lsi->c_str()); + } return (filesets.end()); } |