diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-05-13 22:48:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-05-13 22:48:00 +0000 |
commit | 6b0f73d17a68a34a631545122cbce24f6917ba1d (patch) | |
tree | 871f7bdd8a233f0b65ebffbd5304e1c5a4dfc85d /Carpet | |
parent | 3a6f87b5c0483e5abaa72c168be54646903f0f89 (diff) |
Carpet: Do not warn about insufficient storage during schedule initialisation
The scheduler allocates global storage for grid functions piecewise.
It may allocate first some time levels, then some later. Do not check
whether there are sufficient time levels until the scheduler has
finished initialising.
darcs-hash:20060513224820-dae7b-0b409e7da1260d85ac39983072cb71787ac0078f.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/Carpet/src/Initialise.cc | 2 | ||||
-rw-r--r-- | Carpet/Carpet/src/SetupGH.cc | 1 | ||||
-rw-r--r-- | Carpet/Carpet/src/Storage.cc | 90 | ||||
-rw-r--r-- | Carpet/Carpet/src/functions.hh | 4 | ||||
-rw-r--r-- | Carpet/Carpet/src/variables.cc | 3 | ||||
-rw-r--r-- | Carpet/Carpet/src/variables.hh | 3 |
6 files changed, 75 insertions, 28 deletions
diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc index 5f40d5473..10c434871 100644 --- a/Carpet/Carpet/src/Initialise.cc +++ b/Carpet/Carpet/src/Initialise.cc @@ -68,6 +68,8 @@ namespace Carpet { Waypoint ("Starting initialisation"); CCTKi_ScheduleGHInit (cgh); // Enable storage and communication + GroupsStorageCheck (cgh); + do_warn_about_storage = true; CCTKi_InitGHExtensions (cgh); diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc index bb2ddadaf..520ddb850 100644 --- a/Carpet/Carpet/src/SetupGH.cc +++ b/Carpet/Carpet/src/SetupGH.cc @@ -470,6 +470,7 @@ namespace Carpet { // Enable prolongating do_prolongate = true; + do_warn_about_storage = false; // This is enabled later finish_initialisation (cgh); diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc index c7b0d9734..1e564375f 100644 --- a/Carpet/Carpet/src/Storage.cc +++ b/Carpet/Carpet/src/Storage.cc @@ -23,6 +23,13 @@ namespace Carpet { const int* timelevels, int* status, const bool inc); + static void + GroupStorageCheck (cGH const * const cctkGH, + int const group, + int const ml, int const rl); + + + int GroupStorageCrease (const cGH* cgh, int n_groups, const int* groups, const int* timelevels, int* status, @@ -181,33 +188,7 @@ namespace Carpet { } // if really change the number of active time levels // Complain if there are not enough active time levels - if (gp.grouptype == CCTK_GF) { - if (max_refinement_levels > 1) { - if (groupdata.at(group).transport_operator != op_none - and groupdata.at(group).transport_operator != op_copy) { - if (groupdata.at(group).activetimelevels.at(ml).at(rl) != 0 - and (groupdata.at(group).activetimelevels.at(ml).at(rl) - < prolongation_order_time+1)) - { - static vector<bool> didwarn; - int const numgroups = CCTK_NumGroups(); - if (didwarn.size() < numgroups) { - didwarn.resize (numgroups, false); - } - if (not didwarn.at(group)) { - // Warn only once per group - didwarn.at(group) = true; - char * const groupname = CCTK_GroupName (group); - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "There are not enough time levels for the desired temporal prolongation order in the grid function group \"%s\". With Carpet::prolongation_order_time=%d, you need at least %d time levels.", - groupname, - prolongation_order_time, prolongation_order_time+1); - free (groupname); - } - } - } - } - } + GroupStorageCheck (cgh, group, ml, rl); // Record current number of time levels // Note: This adds the time levels of all refinement levels @@ -336,4 +317,59 @@ namespace Carpet { return 0; } + + + void + GroupStorageCheck (cGH const * const cctkGH, + int const group, + int const ml, int const rl) + { + DECLARE_CCTK_PARAMETERS; + + if (not do_warn_about_storage) return; + if (max_refinement_levels == 1) return; + + cGroup gp; + const int ierr = CCTK_GroupData (group, & gp); + assert (not ierr); + + if (gp.grouptype == CCTK_GF) { + if (groupdata.at(group).transport_operator != op_none + and groupdata.at(group).transport_operator != op_copy) { + if (groupdata.at(group).activetimelevels.at(ml).at(rl) != 0 + and (groupdata.at(group).activetimelevels.at(ml).at(rl) + < prolongation_order_time+1)) + { + static vector<bool> didwarn; + int const numgroups = CCTK_NumGroups(); + if (didwarn.size() < numgroups) { + didwarn.resize (numgroups, false); + } + if (not didwarn.at(group)) { + // Warn only once per group + didwarn.at(group) = true; + char * const groupname = CCTK_GroupName (group); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "There are not enough time levels for the desired temporal prolongation order in the grid function group \"%s\". With Carpet::prolongation_order_time=%d, you need at least %d time levels.", + groupname, + prolongation_order_time, prolongation_order_time+1); + free (groupname); + } + } + } + } + } + + void + GroupsStorageCheck (cGH const * const cctkGH) + { + for (int group = 0; group < CCTK_NumGroups(); ++ group) { + for (int ml = 0; ml < mglevels; ++ ml) { + for (int rl = 0; rl < reflevels; ++ rl) { + GroupStorageCheck (cctkGH, group, ml, rl); + } + } + } + } + } // namespace Carpet diff --git a/Carpet/Carpet/src/functions.hh b/Carpet/Carpet/src/functions.hh index 8fe744dcf..24a4de313 100644 --- a/Carpet/Carpet/src/functions.hh +++ b/Carpet/Carpet/src/functions.hh @@ -73,7 +73,9 @@ namespace Carpet { - + // Helpers for storage + void GroupsStorageCheck (cGH const * const cctkGH); + // Helpers for recomposing the grid hierarchy void Recompose (cGH const * const cctkGH, int const m, diff --git a/Carpet/Carpet/src/variables.cc b/Carpet/Carpet/src/variables.cc index 81b9a9ecb..47cd01728 100644 --- a/Carpet/Carpet/src/variables.cc +++ b/Carpet/Carpet/src/variables.cc @@ -87,6 +87,9 @@ namespace Carpet { // Is prolongation enabled? bool do_prolongate; + // Should we warn about groups with insufficiently many time levels? + bool do_warn_about_storage; + // Data for grid functions diff --git a/Carpet/Carpet/src/variables.hh b/Carpet/Carpet/src/variables.hh index 94bb57843..668d1bc0f 100644 --- a/Carpet/Carpet/src/variables.hh +++ b/Carpet/Carpet/src/variables.hh @@ -116,6 +116,9 @@ namespace Carpet { // Is prolongation enabled? extern bool do_prolongate; + // Should we warn about groups with insufficiently many time levels? + extern bool do_warn_about_storage; + // Data for grid functions |