diff options
author | Erik Schnetter <schnetter@gmail.com> | 2012-10-23 17:52:48 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2012-10-23 17:52:48 -0400 |
commit | 074db64b40e368eed04fffa75c5474c89763590b (patch) | |
tree | 832bdbb4950aad548f2fcfce621deb8c809c61af /Carpet/Carpet | |
parent | 1ab0d7d9c5f3a9044fa7e3b0c215ace4f7fcd74c (diff) |
Carpet: Requirements: Warn about unnecessary syncs
Diffstat (limited to 'Carpet/Carpet')
-rw-r--r-- | Carpet/Carpet/src/Requirements.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Carpet/Carpet/src/Requirements.cc b/Carpet/Carpet/src/Requirements.cc index cf7324c9b..c4cd52a6e 100644 --- a/Carpet/Carpet/src/Requirements.cc +++ b/Carpet/Carpet/src/Requirements.cc @@ -361,6 +361,7 @@ namespace Carpet { // levels they require/provide bool there_was_an_error = false; + bool there_was_a_warning = false; struct gridpoint_t { bool interior, boundary, ghostzones, boundary_ghostzones; @@ -380,6 +381,9 @@ namespace Carpet { void report_error(cFunctionData const* function_data, int vi, int rl, int m, int tl, char const* what, char const* where) const; + void report_warning(cFunctionData const* function_data, + int vi, int rl, int m, int tl, + char const* what, char const* where) const; void update_state(clause_t const& clause); // Input/Output helpers @@ -457,6 +461,39 @@ namespace Carpet { there_was_an_error = true; } + void gridpoint_t::report_warning(cFunctionData const* const function_data, + int const vi, + int const rl, int const m, int const tl, + char const* const what, + char const* const where) const + { + char* const fullname = CCTK_FullName(vi); + ostringstream state; + state << "current state: " << *this << std::endl; + if (function_data) { + // The error is related to a scheduled function + CCTK_VWarn(CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Schedule WRITES clause is superfluous: " + "Function %s::%s in %s: " + "Variable %s reflevel=%d map=%d timelevel=%d: " + "%s already valid for %s. %s", + function_data->thorn, function_data->routine, + function_data->where, + fullname, rl, m, tl, + where, what, state.str().c_str()); + } else { + // The error is not related to a scheduled function + CCTK_VWarn(CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Schedule WRITES clause already satisfied: " + "Variable %s reflevel=%d map=%d timelevel=%d: " + "%s already valid for %s. %s", + fullname, rl, m, tl, + where, what, state.str().c_str()); + } + free(fullname); + there_was_a_warning = true; + } + void gridpoint_t::update_state(clause_t const& clause) { if (clause.everywhere or clause.interior) { @@ -1191,6 +1228,19 @@ namespace Carpet { // Synchronising sets all ghost zones, and sets boundary // ghost zones if boundary zones are set + if (gp.boundary ) { + if (gp.ghostzones and gp.boundary_ghostzones) { + gp.report_warning + (function_data, vi, rl, m, tl, + "synchronising", "ghostzones+boundary_ghostzones"); + } + } else { + if (gp.ghostzones) { + gp.report_warning + (function_data, vi, rl, m, tl, + "synchronising", "ghostzones"); + } + } gp.ghostzones = true; gp.boundary_ghostzones = gp.boundary; } |