aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Carpet/CarpetIOScalar/src/ioscalar.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc
index 9854c9602..6dbb9eaae 100644
--- a/Carpet/CarpetIOScalar/src/ioscalar.cc
+++ b/Carpet/CarpetIOScalar/src/ioscalar.cc
@@ -412,17 +412,17 @@ namespace CarpetIOScalar {
= one_file_per_group ? CCTK_FirstVarIndexI(group) : n;
int const numvars
= one_file_per_group ? CCTK_NumVarsInGroupI(group) : 1;
- for (int n=firstvar; n<firstvar+numvars; ++n) {
- if (all_reductions_in_one_file) {
- for (list<info>::const_iterator jreduction = reductions.begin();
- jreduction != reductions.end();
- ++jreduction)
- {
- file << " " << col << ":" << CCTK_VarName(n) << "(" << jreduction->reduction << ")";
- col += CarpetSimpleMPIDatatypeLength (vartype);
- }
- } else {
+ list<info>::const_iterator first_reduction
+ = all_reductions_in_one_file ? reductions.begin() : ireduction;
+ list<info>::const_iterator end_reduction
+ = all_reductions_in_one_file ? reductions.end() : ++list<info>::const_iterator(ireduction);
+ for (list<info>::const_iterator jreduction = first_reduction;
+ jreduction != end_reduction;
+ ++jreduction)
+ {
+ for (int n=firstvar; n<firstvar+numvars; ++n) {
file << " " << col << ":" << CCTK_VarName(n);
+ if (all_reductions_in_one_file) file << "(" << jreduction->reduction << ")";
col += CarpetSimpleMPIDatatypeLength (vartype);
}
}