diff options
author | Roland Haas <roland.haas@physics.gatech.edu> | 2012-09-05 20:05:23 -0400 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2012-09-11 18:23:36 +0100 |
commit | a9fdc11a9981cd3cddf453724379e0d05a5210f8 (patch) | |
tree | 9af7822f5d4bdb5dca5997f431e7cd9fb5f8377e | |
parent | 49044804c879b4b80b35737c63420b07f2a80916 (diff) |
Carpet: add parameter to ignore variables during Requirements check
all variables and groups listed in carpet::ignore_these_variables are
ignored by the requirements check, ie they are always assumed to be
valid and never set.
-rw-r--r-- | Carpet/Carpet/param.ccl | 5 | ||||
-rw-r--r-- | Carpet/Carpet/src/Requirements.cc | 25 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Carpet/Carpet/param.ccl b/Carpet/Carpet/param.ccl index 259012844..64cb3fb7c 100644 --- a/Carpet/Carpet/param.ccl +++ b/Carpet/Carpet/param.ccl @@ -607,3 +607,8 @@ BOOLEAN requirements_verbose "Output details when checking requirements" STEERAB BOOLEAN requirement_inconsistencies_are_fatal "Abort when encountering inconsistencies in requirements" STEERABLE=always { } "no" + +STRING ignore_these_variables "Assume that these variables are always valid everywhere" STEERABLE=recover +{ + "([A-Za-z0-9_]+[:][:][A-Za-z0-9_]+([[:space:]]+|$))*" :: "space separated list of variables of groups" +} "" diff --git a/Carpet/Carpet/src/Requirements.cc b/Carpet/Carpet/src/Requirements.cc index b2a79fc67..068610e66 100644 --- a/Carpet/Carpet/src/Requirements.cc +++ b/Carpet/Carpet/src/Requirements.cc @@ -13,6 +13,7 @@ #include <cstdlib> #include <cstring> #include <map> +#include <set> #include <string> #include <vector> @@ -234,6 +235,11 @@ namespace Carpet { all_clauses_t all_clauses; + + // ignore requirements in these variables. Used for internally updated + // variables. Putting a variable in this set asserts that it is always + // valid. + std::set<int> ignore_these_varindices; // Keep track of which time levels contain good data; modify this @@ -372,6 +378,13 @@ namespace Carpet { all_state_t all_state; + static void add_ignored_variable(int id, const char * opstring, void * callback_arg) + { + std::set<int>& ignore_these_variables = + *static_cast<std::set<int>*>(callback_arg); + + ignore_these_variables.insert(id); + } void Setup(int const maps) { @@ -382,6 +395,9 @@ namespace Carpet { "Requirements: Setup maps=%d", maps); } all_state.setup(maps); + CCTK_TraverseString(ignore_these_variables, add_ignored_variable, + (void*)&ignore_these_varindices, + CCTK_GROUP_OR_VAR); } if (requirement_inconsistencies_are_fatal and there_was_an_error) { CCTK_WARN(CCTK_WARN_ABORT, @@ -821,6 +837,9 @@ namespace Carpet { ++ivar) { int const vi = *ivar; + + if (ignore_these_varindices.count(vi)) + continue; // Loop over all (refinement levels, maps, time levels) reflevels_t const& rls = vars.AT(vi); @@ -983,6 +1002,9 @@ namespace Carpet { int const v0 = CCTK_FirstVarIndexI(gi); int const nv = CCTK_NumVarsInGroupI(gi); for (int vi=v0; vi<v0+nv; ++vi) { + if (ignore_these_varindices.count(vi)) + continue; + reflevels_t& rls = vars.AT(vi); maps_t& ms = rls.AT(rl); int const maps = int(ms.size()); @@ -1075,6 +1097,9 @@ namespace Carpet { int const v0 = CCTK_FirstVarIndexI(gi); int const nv = CCTK_NumVarsInGroupI(gi); for (int vi=v0; vi<v0+nv; ++vi) { + if (ignore_these_varindices.count(vi)) + continue; + reflevels_t& rls = vars.AT(vi); int const reflevels = int(rls.size()); maps_t& ms = rls.AT(rl); |