diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-09-03 16:19:15 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 16:42:31 +0000 |
commit | 11c4d98017cbb86d08e15fd1b549180184b58a26 (patch) | |
tree | 2546a154c6f7bc0bec87de7316125ae7d1453569 /Carpet/CarpetIOScalar | |
parent | f520477b1c14e02f1495cfa8d3e09f4e21ab34d0 (diff) |
Import Carpet
Ignore-this: 309b4dd613f4af2b84aa5d6743fdb6b3
Diffstat (limited to 'Carpet/CarpetIOScalar')
-rw-r--r-- | Carpet/CarpetIOScalar/README | 7 | ||||
-rw-r--r-- | Carpet/CarpetIOScalar/src/ioscalar.cc | 45 | ||||
-rw-r--r--[-rwxr-xr-x] | Carpet/CarpetIOScalar/src/util/mergeCarpetIOScalar.pl | 0 |
3 files changed, 35 insertions, 17 deletions
diff --git a/Carpet/CarpetIOScalar/README b/Carpet/CarpetIOScalar/README index cfce28fd4..a6cc34d50 100644 --- a/Carpet/CarpetIOScalar/README +++ b/Carpet/CarpetIOScalar/README @@ -1,8 +1,9 @@ Cactus Code Thorn CarpetIOScalar -Thorn Author(s) : Erik Schnetter <schnetter@aei.mpg.de> -Thorn Maintainer(s) : Erik Schnetter <schnetter@aei.mpg.de> +Author(s) : Erik Schnetter <schnetter@cct.lsu.edu> +Maintainer(s): Erik Schnetter <schnetter@cct.lsu.edu> +Licence : GPLv2+ -------------------------------------------------------------------------- -Purpose of the thorn: +1. Purpose This thorn provides scalar output for Carpet. diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc index b25241659..b96528698 100644 --- a/Carpet/CarpetIOScalar/src/ioscalar.cc +++ b/Carpet/CarpetIOScalar/src/ioscalar.cc @@ -54,6 +54,7 @@ namespace CarpetIOScalar { static void* SetupGH (tFleshConfig* fc, int convLevel, cGH* cctkGH); static int OutputGH (const cGH* cctkGH); static int OutputVarAs (const cGH* cctkGH, const char* varname, const char* alias); + static int OutputVarAs (const cGH* cctkGH, const char* varname, const char* alias, const char* out_reductions); static int TimeToOutput (const cGH* cctkGH, int vindex); static int TriggerOutput (const cGH* cctkGH, int vindex); @@ -169,6 +170,19 @@ namespace CarpetIOScalar { OutputVarAs (const cGH * const cctkGH, const char* const varname, const char* const alias) { + DECLARE_CCTK_PARAMETERS; + + int const retval = OutputVarAs (cctkGH, varname, alias, + outScalar_reductions); + + return retval; + } + + int + OutputVarAs (const cGH * const cctkGH, + const char* const varname, const char* const alias, + const char* out_reductions) + { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -233,7 +247,7 @@ namespace CarpetIOScalar { // Find the set of desired reductions list<info> reductions; - string const redlist (outScalar_reductions); + string const redlist (out_reductions); string::const_iterator p = redlist.begin(); while (p!=redlist.end()) { while (p!=redlist.end() and isspace(*p)) ++p; @@ -613,6 +627,11 @@ namespace CarpetIOScalar { assert (vindex>=0 and vindex<CCTK_NumVars()); + // use individual reductions list for this variable when given + // otherwise IOScalar::outScalar_reductions + const char* out_reductions = IOparameters.requests[vindex]->reductions; + if (not out_reductions) out_reductions = outScalar_reductions; + int retval; if (one_file_per_group) { @@ -621,7 +640,7 @@ namespace CarpetIOScalar { int const gindex = CCTK_GroupIndexFromVarI(vindex); char* const groupname = CCTK_GroupName(gindex); for (char* p=groupname; *p; ++p) *p=tolower(*p); - retval = OutputVarAs (cctkGH, fullname, groupname); + retval = OutputVarAs (cctkGH, fullname, groupname, out_reductions); free (fullname); free (groupname); @@ -635,7 +654,7 @@ namespace CarpetIOScalar { char* const fullname = CCTK_FullName(vindex); char const* const varname = CCTK_VarName(vindex); - retval = OutputVarAs (cctkGH, fullname, varname); + retval = OutputVarAs (cctkGH, fullname, varname, out_reductions); free (fullname); last_output.at(vindex) = cctk_iteration; @@ -661,20 +680,18 @@ namespace CarpetIOScalar { // notify the user about the new setting if (not CCTK_Equals (verbose, "none")) { int count = 0; - string msg ("Periodic scalar output requested for '"); - for (int i = CCTK_NumVars () - 1; i >= 0; i--) { - if (IOparameters.requests[i]) { - if (count++) { - msg += "', '"; - } - char *fullname = CCTK_FullName (i); - msg += fullname; + ostringstream msg; + msg << "Periodic scalar output requested for:"; + for (int vi=0; vi<CCTK_NumVars(); ++vi) { + if (IOparameters.requests[vi]) { + ++count; + char* const fullname = CCTK_FullName(vi); + msg << eol << " " << fullname; free (fullname); } } - if (count) { - msg += "'"; - CCTK_INFO (msg.c_str()); + if (count > 0) { + CCTK_INFO (msg.str().c_str()); } } diff --git a/Carpet/CarpetIOScalar/src/util/mergeCarpetIOScalar.pl b/Carpet/CarpetIOScalar/src/util/mergeCarpetIOScalar.pl index 3aae60c3b..3aae60c3b 100755..100644 --- a/Carpet/CarpetIOScalar/src/util/mergeCarpetIOScalar.pl +++ b/Carpet/CarpetIOScalar/src/util/mergeCarpetIOScalar.pl |