diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-07-29 18:14:21 -0700 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-07-29 18:14:21 -0700 |
commit | 5460dec57150cfee432bb79de47eac264d72efa0 (patch) | |
tree | ba43ccc662b49da501cb25cca2be0e46a7d3db59 | |
parent | 320d6af5dd93dc1b5e124ba40679a48c201b2058 (diff) |
Carpet: Support group tag "map0group"
This tag indicates that this variable group should have storage only on map 0.
-rw-r--r-- | Carpet/Carpet/src/Storage.cc | 4 | ||||
-rw-r--r-- | Carpet/Carpet/src/carpet.hh | 3 | ||||
-rw-r--r-- | Carpet/Carpet/src/helpers.cc | 26 |
3 files changed, 30 insertions, 3 deletions
diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc index f8f6f3516..eee79cbcb 100644 --- a/Carpet/Carpet/src/Storage.cc +++ b/Carpet/Carpet/src/Storage.cc @@ -168,7 +168,11 @@ namespace Carpet { // Set the new number of active time levels groupdata.AT(group).activetimelevels.AT(ml).AT(rl) = tls[n]; + // Allocate storage only on map 0? + const bool ismap0group = IsMap0Group(group); + for (int m=0; m<(int)arrdata.AT(group).size(); ++m) { + if (ismap0group) continue; for (int var=0; var<gp.numvars; ++var) { #ifdef CCTK_HAVE_CONTIGUOUS_GROUPS bool const contiguous = gp.contiguous; diff --git a/Carpet/Carpet/src/carpet.hh b/Carpet/Carpet/src/carpet.hh index f9e3fb898..8c802ab0b 100644 --- a/Carpet/Carpet/src/carpet.hh +++ b/Carpet/Carpet/src/carpet.hh @@ -84,6 +84,9 @@ namespace Carpet { // Error output void UnsupportedVarType (int vindex); + // Check for a map0group + bool IsMap0Group(int gindex); + } // namespace Carpet #endif // !defined(CARPET_HH) diff --git a/Carpet/Carpet/src/helpers.cc b/Carpet/Carpet/src/helpers.cc index 6938fd658..a34fd974c 100644 --- a/Carpet/Carpet/src/helpers.cc +++ b/Carpet/Carpet/src/helpers.cc @@ -1,6 +1,7 @@ #include <cctk.h> #include <cctk_FortranString.h> #include <cctk_Parameters.h> +#include <util_Table.h> #include <algorithm> #include <cassert> @@ -548,11 +549,30 @@ namespace Carpet { void UnsupportedVarType (const int vindex) { assert (vindex>=0 and vindex<CCTK_NumVars()); - CCTK_VWarn - (0, __LINE__, __FILE__, CCTK_THORNSTRING, + CCTK_VError + (__LINE__, __FILE__, CCTK_THORNSTRING, "Carpet does not support the type of the variable \"%s\".\n" "Either enable support for this type, " "or change the type of this variable.", CCTK_FullName(vindex)); } - + + + + bool IsMap0Group(const int gindex) + { + assert(gindex>=0 and gindex<CCTK_NumGroups()); + const int table = CCTK_GroupTagsTableI(gindex); + assert(table>=0); + CCTK_INT map0group; + int status = Util_TableGetInt(table, &map0group, "map0group"); + if (status==UTIL_ERROR_TABLE_NO_SUCH_KEY) { + map0group = false; + status = 1; + } + if (status!=1) { + CCTK_ERROR("illegal table value"); + } + return map0group; + } + } // namespace Carpet |