aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOASCII/src
diff options
context:
space:
mode:
authoreschnett <>2001-03-05 20:48:00 +0000
committereschnett <>2001-03-05 20:48:00 +0000
commitbf8a79404ea420deb2db0590e914be15aa716ae2 (patch)
tree7ce6962d390884f8dde308d329d4c3b8fb50d886 /Carpet/CarpetIOASCII/src
parent81af973d982aa9714d0dfdb25150820490ed2d9d (diff)
Made it work on multiple processors. Waved a dead chicken. Maybe the
Made it work on multiple processors. Waved a dead chicken. Maybe the debug output makes it work, maybe only the MPI startup procedure is flaky. darcs-hash:20010305204828-f6438-a2a24ca201018669042bb75cabb0868251cd61b7.gz
Diffstat (limited to 'Carpet/CarpetIOASCII/src')
-rw-r--r--Carpet/CarpetIOASCII/src/ioascii.cc29
1 files changed, 17 insertions, 12 deletions
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc
index b1179c0d2..91dfb4161 100644
--- a/Carpet/CarpetIOASCII/src/ioascii.cc
+++ b/Carpet/CarpetIOASCII/src/ioascii.cc
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.2 2001/03/05 14:30:27 eschnett Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.3 2001/03/05 21:48:33 eschnett Exp $
#include <cassert>
#include <cstdio>
@@ -136,7 +136,9 @@ int IOASCII<outdim>::OutputVarAs (cGH* const cgh, const char* const varname,
// Create the output directory
const char* myoutdir = GetStringParameter("outdir%dD", outdir);
- CCTK_CreateDirectory (0755, myoutdir);
+ if (CCTK_MyProc(cgh)==0) {
+ CCTK_CreateDirectory (0755, myoutdir);
+ }
// Loop over all direction combinations
vect<int,outdim> dirs;
@@ -204,18 +206,21 @@ int IOASCII<outdim>::OutputVarAs (cGH* const cgh, const char* const varname,
}
sprintf (filename, "%s%c", filename, "lpv"[outdim-1]);
- // If this is the first time, then write a nice header
+ // If this is the first time, then write a nice header on
+ // the root processor
if (do_truncate[n]) {
- ofstream file(filename, ios::trunc);
- assert (file.good());
- file << "# " << varname;
- for (int d=0; d<outdim; ++d) {
- file << " " << "xyz"[dirs[d]];
+ if (CCTK_MyProc(cgh)==0) {
+ ofstream file(filename, ios::trunc);
+ assert (file.good());
+ file << "# " << varname;
+ for (int d=0; d<outdim; ++d) {
+ file << " " << "xyz"[dirs[d]];
+ }
+ file << " (" << alias << ")" << endl;
+ file << "#" << endl;
+ file.close();
+ assert (file.good());
}
- file << " (" << alias << ")" << endl;
- file << "#" << endl;
- file.close();
- assert (file.good());
}
// Find the output offset