diff options
author | Roland Haas <roland.haas@physics.gatech.edu> | 2012-09-05 20:09:21 -0400 |
---|---|---|
committer | Roland Haas <roland.haas@physics.gatech.edu> | 2012-09-05 20:09:21 -0400 |
commit | 825bd3b6c5f50fe34eba0a8445a6185dc5a53373 (patch) | |
tree | 9c72264c7650a91b6162081292710d8b26f1030c | |
parent | 32e4f53c56bb4517ef959233f9f49e2221e9e44b (diff) |
Carpet: try to mimic enter_local_modes timelevel handling in
AfterRoutine and BeforeRoutine
in particular one has to handle routine that are called on past
timelevels during PostRegrid (or init_3_levels which likely currently
fails).
This requires more work yet.
-rw-r--r-- | Carpet/Carpet/src/Requirements.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Carpet/Carpet/src/Requirements.cc b/Carpet/Carpet/src/Requirements.cc index 068610e66..eda688e3c 100644 --- a/Carpet/Carpet/src/Requirements.cc +++ b/Carpet/Carpet/src/Requirements.cc @@ -866,8 +866,12 @@ namespace Carpet { int const timelevels = int(tls.size()); assert(timelevel != -1); assert(timelevels >= clause.min_num_timelevels()); - for (int tl=0; tl<timelevels; ++tl) { - if (timelevel==-1 or clause.active_on_timelevel(tl)) { + // TODO: properly handle timelevels the way enter_local_mode() does + const int mintl = timelevel == 0 || timelevels == 1 ? 0 : timelevel; + const int maxtl = timelevel == 0 || timelevels == 1 ? timelevels-1 : timelevel; + const int tl_of = timelevels > 1 ? timelevel : 0; + for (int tl=mintl; tl<=maxtl; ++tl) { + if (timelevel==-1 or clause.active_on_timelevel(tl-tl_of)) { gridpoint_t const& gp = tls.AT(tl); gp.check_state(clause, function_data, vi, rl, m, tl); } @@ -937,8 +941,12 @@ namespace Carpet { int const timelevels = int(tls.size()); assert(timelevel != -1); assert(timelevels >= clause.min_num_timelevels()); - for (int tl=0; tl<timelevels; ++tl) { - if (timelevel==-1 or clause.active_on_timelevel(tl)) { + // TODO: properly handle timelevels the way enter_local_mode() does + const int mintl = timelevel == 0 || timelevels == 1 ? 0 : timelevel; + const int maxtl = timelevel == 0 || timelevels == 1 ? timelevels-1 : timelevel; + const int tl_of = timelevels > 1 ? timelevel : 0; + for (int tl=mintl; tl<=maxtl; ++tl) { + if (timelevel==-1 or clause.active_on_timelevel(tl-tl_of)) { gridpoint_t& gp = tls.AT(tl); gp.update_state(clause); } |