aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOBasic
diff options
context:
space:
mode:
authorroland haas <roland.haas@physics.gatech.edu>2012-02-22 07:32:10 -0800
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:23:02 +0100
commit12b4a99653dc25c21c567afb6a5a1b841b8d5e77 (patch)
treeea5ec6350e3b432edb2a28ccdf81695254b6badd /Carpet/CarpetIOBasic
parentdfec0b5d039b1a64d366bf6180115704565e47ef (diff)
CarpetIOBasic: implement individual reductions lists for output variables
This patch imports Thomas Radke's improvements to IOScalar to IOBasic. --8<-- By default, CarpetIOScalar outputs all reductions as listed in the IOScalar::outScalar_reductions parameter (defaulting to all norms available). Now it is possible to overwrite this default for individual variables in an option string, eg. as in IOScalar::outScalar_vars = "grid::x grid::y{reductions = 'minimum maximum'}". --8<--
Diffstat (limited to 'Carpet/CarpetIOBasic')
-rw-r--r--Carpet/CarpetIOBasic/src/iobasic.cc33
1 files changed, 27 insertions, 6 deletions
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc
index 14b4c28b8..2d0dcb895 100644
--- a/Carpet/CarpetIOBasic/src/iobasic.cc
+++ b/Carpet/CarpetIOBasic/src/iobasic.cc
@@ -59,6 +59,7 @@ namespace CarpetIOBasic {
bool TimeToOutput (const cGH* cctkGH);
void OutputHeader (const cGH* cctkGH);
void OutputVar (const cGH* cctkGH, int vindex);
+ void OutputVar (const cGH* cctkGH, int vindex, const char* out_reductions);
void CheckSteerableParameters (const cGH * cctkGH);
void
@@ -182,7 +183,12 @@ namespace CarpetIOBasic {
int const numvars = CCTK_NumVars();
for (int vindex=0; vindex<numvars; ++vindex) {
if (IOparameters.requests[vindex]) {
- OutputVar (cctkGH, vindex);
+ // use individual reductions list for this variable when given
+ // otherwise IOScalar::outInfo_reductions
+ const char* out_reductions = IOparameters.requests[vindex]->reductions;
+ if (not out_reductions) out_reductions = outInfo_reductions;
+
+ OutputVar (cctkGH, vindex, out_reductions);
}
}
@@ -213,10 +219,6 @@ namespace CarpetIOBasic {
if (CCTK_MyProc(cctkGH) == 0) {
- // Find the set of desired reductions
- vector<string> const reductions = ParseReductions (outInfo_reductions);
- int const numreds = reductions.size();
-
int const numvars = CCTK_NumVars();
// The header consists of four lines:
@@ -269,6 +271,15 @@ namespace CarpetIOBasic {
assert (0);
}
+ // use individual reductions list for this variable when given
+ // otherwise IOScalar::outInfo_reductions
+ const char* out_reductions = IOparameters.requests[vindex]->reductions;
+ if (not out_reductions) out_reductions = outInfo_reductions;
+
+ // Find the set of desired reductions
+ vector<string> const reductions = ParseReductions (out_reductions);
+ int const numreds = reductions.size();
+
int const width = isint ? int_width : real_width;
int const mynumreds = isscalar ? 1 : numreds;
@@ -325,6 +336,16 @@ namespace CarpetIOBasic {
OutputVar (const cGH * const cctkGH,
int const n)
{
+ DECLARE_CCTK_PARAMETERS;
+
+ OutputVar (cctkGH, n, outInfo_reductions);
+ }
+
+ void
+ OutputVar (const cGH * const cctkGH,
+ int n,
+ const char* out_reductions)
+ {
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
@@ -360,7 +381,7 @@ namespace CarpetIOBasic {
// Find the set of desired reductions
vector<string> const reductionstrings
- = ParseReductions (outInfo_reductions);
+ = ParseReductions (out_reductions);
list<info> reductions;
for (vector<string>::const_iterator ireduction = reductionstrings.begin();
ireduction != reductionstrings.end();