From 7a99eee603df1194809db30f916d3eeb730c39ee Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 4 Apr 2013 12:12:39 -0400 Subject: Requirements: Modify iteration arguments in Requirements.hh Use int instead of CCTK_INT; all other arguments are also int. Change argument order in Sync; move iteration next to reflevel. Add iteration argument to BeforeRoutine; AfterRoutine also takes it. Change name from cctk_iteration to iteration; no other variables have a cctk_ prefix. Update callers in Carpet. --- Carpet/Requirements/src/Requirements.cc | 32 ++++++++++++++++++-------------- Carpet/Requirements/src/Requirements.hh | 12 ++++++------ Carpet/Requirements/src/all_state.cc | 21 +++++++++++---------- Carpet/Requirements/src/all_state.hh | 12 ++++++------ 4 files changed, 41 insertions(+), 36 deletions(-) (limited to 'Carpet/Requirements') diff --git a/Carpet/Requirements/src/Requirements.cc b/Carpet/Requirements/src/Requirements.cc index b496d5049..d4a9dfd3c 100644 --- a/Carpet/Requirements/src/Requirements.cc +++ b/Carpet/Requirements/src/Requirements.cc @@ -142,13 +142,14 @@ namespace Requirements { } void BeforeRoutine(cFunctionData const* const function_data, - int const reflevel, int const map, + int const iteration, int const reflevel, int const map, int const timelevel, int const timelevel_offset) { DECLARE_CCTK_PARAMETERS; if (check_requirements) { all_state.before_routine(function_data, all_clauses, - reflevel, map, timelevel, timelevel_offset); + iteration, reflevel, map, + timelevel, timelevel_offset); } if (inconsistencies_are_fatal and gridpoint_t::there_was_an_error) { CCTK_WARN(CCTK_WARN_ABORT, @@ -156,14 +157,15 @@ namespace Requirements { } } - void AfterRoutine(cFunctionData const* const function_data, CCTK_INT cctk_iteration, - int const reflevel, int const map, + void AfterRoutine(cFunctionData const* const function_data, + int const iteration, int const reflevel, int const map, int const timelevel, int const timelevel_offset) { DECLARE_CCTK_PARAMETERS; if (check_requirements) { - all_state.after_routine(function_data, all_clauses, cctk_iteration, - reflevel, map, timelevel, timelevel_offset); + all_state.after_routine(function_data, all_clauses, + iteration, reflevel, map, + timelevel, timelevel_offset); } if (inconsistencies_are_fatal and gridpoint_t::there_was_an_error) { CCTK_WARN(CCTK_WARN_ABORT, @@ -172,9 +174,8 @@ namespace Requirements { } void Sync(cFunctionData const* const function_data, - CCTK_INT cctk_iteration, vector const& groups, - int const reflevel, int const timelevel) + int const iteration, int const reflevel, int const timelevel) { DECLARE_CCTK_PARAMETERS; if (check_requirements) { @@ -183,7 +184,7 @@ namespace Requirements { "Sync reflevel=%d timelevel=%d", reflevel, timelevel); } - all_state.sync(function_data, cctk_iteration, groups, reflevel, timelevel); + all_state.sync(function_data, groups, iteration, reflevel, timelevel); } if (inconsistencies_are_fatal and gridpoint_t::there_was_an_error) { CCTK_WARN(CCTK_WARN_ABORT, @@ -191,7 +192,8 @@ namespace Requirements { } } - void Restrict(vector const& groups, CCTK_INT const cctk_iteration, int const reflevel) + void Restrict(vector const& groups, + int const iteration, int const reflevel) { DECLARE_CCTK_PARAMETERS; if (check_requirements) { @@ -200,7 +202,7 @@ namespace Requirements { "Restrict reflevel=%d", reflevel); } - all_state.restrict1(groups, cctk_iteration, reflevel); + all_state.restrict1(groups, iteration, reflevel); } if (inconsistencies_are_fatal and gridpoint_t::there_was_an_error) { CCTK_WARN(CCTK_WARN_ABORT, @@ -244,7 +246,8 @@ namespace Requirements { temp_function_data.ReadsClauses = (char const**)&reads; all_clauses.get_clauses(&temp_function_data); BeforeRoutine(&temp_function_data, - reflevel, map, timelevel, timelevel_offset); + cctkGH->cctk_iteration, reflevel, map, + timelevel, timelevel_offset); all_clauses.remove_clauses(&temp_function_data); free(fullname); free(reads); @@ -285,8 +288,9 @@ namespace Requirements { temp_function_data.n_ReadsClauses = 0; temp_function_data.ReadsClauses = NULL; all_clauses.get_clauses(&temp_function_data); - AfterRoutine(&temp_function_data, cctkGH->cctk_iteration, - reflevel, map, timelevel, timelevel_offset); + AfterRoutine(&temp_function_data, + cctkGH->cctk_iteration, reflevel, map, + timelevel, timelevel_offset); all_clauses.remove_clauses(&temp_function_data); free(fullname); free(writes); diff --git a/Carpet/Requirements/src/Requirements.hh b/Carpet/Requirements/src/Requirements.hh index a82093ce1..8c682f6dd 100644 --- a/Carpet/Requirements/src/Requirements.hh +++ b/Carpet/Requirements/src/Requirements.hh @@ -42,20 +42,20 @@ namespace Requirements { // TODO: Either combine these "before" and "after" routines, or // split the other routines as well void BeforeRoutine(cFunctionData const* function_data, - int reflevel, int map, + int iteration, int reflevel, int map, int timelevel, int timelevel_offset); // After calling a routine: update according to writes clauses void AfterRoutine(cFunctionData const* function_data, - CCTK_INT cctk_iteration, - int reflevel, int map, + int iteration, int reflevel, int map, int timelevel, int timelevel_offset); // Synchronise and prolongate // TODO: This does not handle variables that are not prolongated // TODO: This does not handle buffer zones - void Sync(cFunctionData const* function_data, CCTK_INT cctk_iteration, - vector const& groups, int reflevel, int timelevel); + void Sync(cFunctionData const* function_data, + vector const& groups, + int iteration, int reflevel, int timelevel); // Restrict - void Restrict(vector const& groups, CCTK_INT cctk_iteration, int reflevel); + void Restrict(vector const& groups, int iteration, int reflevel); } // namespace Requirements diff --git a/Carpet/Requirements/src/all_state.cc b/Carpet/Requirements/src/all_state.cc index bb1e4c40f..1a7d10dab 100644 --- a/Carpet/Requirements/src/all_state.cc +++ b/Carpet/Requirements/src/all_state.cc @@ -347,6 +347,7 @@ namespace Requirements { // function is executed void all_state_t::before_routine(cFunctionData const* const function_data, all_clauses_t &all_clauses, + int const iteration, int const reflevel, int const map, int const timelevel, int const timelevel_offset) @@ -417,7 +418,7 @@ namespace Requirements { // executed to reflect the fact that some variables are now valid void all_state_t::after_routine(cFunctionData const* const function_data, all_clauses_t &all_clauses, - CCTK_INT cctk_iteration, + int const iteration, int const reflevel, int const map, int const timelevel, int const timelevel_offset) @@ -430,7 +431,7 @@ namespace Requirements { info += " in "; info += function_data->where; loc.info = info.c_str(); - loc.it = cctk_iteration; + loc.it = iteration; // Loop over all clauses clauses_t const& clauses = all_clauses.get_clauses(function_data); for (vector::const_iterator iclause = clauses.writes.begin(); @@ -455,8 +456,8 @@ namespace Requirements { min_rl = reflevel; max_rl = min_rl+1; } for (int rl=min_rl; rl const& groups, + int const iteration, int const reflevel, int const timelevel) { location_t loc; loc.info = "sync"; + loc.it = iteration; loc.rl = reflevel; loc.tl = timelevel; - loc.it = cctk_iteration; // Loop over all variables for (vector::const_iterator igi = groups.begin(); igi != groups.end(); ++igi) @@ -533,18 +534,17 @@ namespace Requirements { int const v0 = CCTK_FirstVarIndexI(gi); int const nv = CCTK_NumVarsInGroupI(gi); for (int vi=v0; vi const& groups, CCTK_INT const cctk_iteration, int const reflevel) + void all_state_t::restrict1(vector const& groups, + int const iteration, int const reflevel) { location_t loc; loc.info = "restrict"; + loc.it = iteration; loc.rl = reflevel; - loc.it = cctk_iteration; // Loop over all variables for (vector::const_iterator igi = groups.begin(); igi != groups.end(); ++igi) diff --git a/Carpet/Requirements/src/all_state.hh b/Carpet/Requirements/src/all_state.hh index fff6a437a..78f03fc83 100644 --- a/Carpet/Requirements/src/all_state.hh +++ b/Carpet/Requirements/src/all_state.hh @@ -40,16 +40,16 @@ namespace Requirements { void cycle(int reflevel); void before_routine(cFunctionData const* function_data, all_clauses_t &all_clauses, - int reflevel, int map, + int iteration, int reflevel, int map, int timelevel, int timelevel_offset) const; void after_routine(cFunctionData const* function_data, all_clauses_t &all_clauses, - CCTK_INT cctk_iteration, - int reflevel, int map, + int iteration, int reflevel, int map, int timelevel, int timelevel_offset); - void sync(cFunctionData const* function_data, CCTK_INT cctk_iteration, - vector const& groups, int reflevel, int timelevel); - void restrict1(vector const& groups, CCTK_INT cctk_iteration, int reflevel); + void sync(cFunctionData const* function_data, + vector const& groups, + int iteration, int reflevel, int timelevel); + void restrict1(vector const& groups, int iteration, int reflevel); void invalidate(vector const& vars, int reflevel, int map, int timelevel); -- cgit v1.2.3