From 4ae061131c1da2a4a944a1139117cec0c4eac02e Mon Sep 17 00:00:00 2001 From: Roland Haas Date: Wed, 1 Aug 2012 09:13:42 -0700 Subject: CarpetIOHDF5: only warn once about reading extra files once per variable, refinement level and time level that is. So still about ~3000 warnings in a typical simulation. --- Carpet/CarpetIOHDF5/src/Input.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc index f14146dd6..2214f74ff 100644 --- a/Carpet/CarpetIOHDF5/src/Input.cc +++ b/Carpet/CarpetIOHDF5/src/Input.cc @@ -406,11 +406,13 @@ int Recover (cGH* cctkGH, const char *basefilename, int called_from) // create a bbox set for each active timelevel of all variables // to mark how much has been read already const int numvars = CCTK_NumVars (); + vector > warned_about_multiple_files(numvars); vector > read_completely(numvars); vector > > bboxes_read (numvars); for (unsigned int vindex = 0; vindex < bboxes_read.size(); vindex++) { const int timelevels = CCTK_ActiveTimeLevelsVI (cctkGH, vindex); read_completely[vindex].resize (timelevels, false); + warned_about_multiple_files[vindex].resize (timelevels, false); bboxes_read[vindex].resize (timelevels); for (int tl = 0; tl < timelevels; tl++) { bboxes_read[vindex][tl].resize (maps); @@ -635,12 +637,17 @@ int Recover (cGH* cctkGH, const char *basefilename, int called_from) for (unsigned int tl = 0; tl < read_completely[vindex].size(); tl++) { all_done &= read_completely[vindex][tl]; - if (not read_completely[vindex][tl]) { + if (not read_completely[vindex][tl] and not warned_about_multiple_files[vindex][tl]) { + static bool warned_once_already = false; + const int warnlevel = warned_once_already ? CCTK_WARN_DEBUG : CCTK_WARN_COMPLAIN; char * const fullname = CCTK_FullName (vindex); - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Variable %s on rl %d and tl %d not read completely. Will have to look for it in other files", - fullname, reflevel, tl); + CCTK_VWarn (warnlevel, __LINE__, __FILE__, CCTK_THORNSTRING, + "Variable %s on rl %d and tl %d not read completely. Will have to look for it in other files.%s", + fullname, reflevel, tl, + warned_once_already ? "" : " Further warnings will be level 4."); free (fullname); + warned_about_multiple_files[vindex][tl] = true; + warned_once_already = true; } } } -- cgit v1.2.3