aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Carpet/CarpetIOBasic/src/iobasic.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc
index 161671391..c6179a938 100644
--- a/Carpet/CarpetIOBasic/src/iobasic.cc
+++ b/Carpet/CarpetIOBasic/src/iobasic.cc
@@ -434,6 +434,14 @@ namespace CarpetIOBasic {
// Output in global mode
BEGIN_GLOBAL_MODE(cctkGH) {
+ // Remember cout state
+ int oldprec;
+ ios_base::fmtflags oldflags;
+ if (CCTK_MyProc(cctkGH) == 0) {
+ oldprec = cout.precision();
+ oldflags = cout.flags();
+ }
+
// Print vertical separator
if (CCTK_MyProc(cctkGH) == 0) {
cout << " |";
@@ -524,6 +532,12 @@ namespace CarpetIOBasic {
} // not isscalar
+ // Restore cout state
+ if (CCTK_MyProc(cctkGH) == 0) {
+ cout.precision (oldprec);
+ cout.setf (oldflags);
+ }
+
} END_GLOBAL_MODE;
}