aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorschnetter <>2001-12-14 16:59:00 +0000
committerschnetter <>2001-12-14 16:59:00 +0000
commit24f4fe527c1d94256702a904c43c96cd86d95c9f (patch)
tree267c58fc859249ea44cdbed9ff94114db4b269d1 /Carpet
parentf78f6ff07a44eb285372f776c1d8de5db9be141b (diff)
Added new thorns CarpetReduce and CarpetRegrid to parameter files.
darcs-hash:20011214165954-07bb3-e68f15a15027098cd26981663394a4365aee510d.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOASCII/param.ccl8
-rw-r--r--Carpet/CarpetIOASCII/src/ioascii.cc33
-rw-r--r--Carpet/CarpetReduce/src/reduce.hh8
3 files changed, 33 insertions, 16 deletions
diff --git a/Carpet/CarpetIOASCII/param.ccl b/Carpet/CarpetIOASCII/param.ccl
index 3d76ea736..2bf869427 100644
--- a/Carpet/CarpetIOASCII/param.ccl
+++ b/Carpet/CarpetIOASCII/param.ccl
@@ -1,5 +1,5 @@
# Parameter definitions for thorn CarpetIOASCII
-# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/param.ccl,v 1.2 2001/03/05 14:30:22 eschnett Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/param.ccl,v 1.3 2001/12/14 17:59:54 schnetter Exp $
@@ -41,6 +41,12 @@ restricted:
+BOOLEAN separate_grids "Separate grid levels in the output file by additional empty lines"
+{
+} "yes"
+
+
+
CCTK_STRING outdir1D "Name of 1D ASCII output directory, overrides outdir" STEERABLE = ALWAYS
{
.* :: "A regex which matches everything"
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc
index a309203a3..ce063b4f2 100644
--- a/Carpet/CarpetIOASCII/src/ioascii.cc
+++ b/Carpet/CarpetIOASCII/src/ioascii.cc
@@ -8,6 +8,7 @@
#include <sys/types.h>
#include <fstream>
+#include <iomanip>
#include <vector>
#include "cctk.h"
@@ -24,7 +25,7 @@
#include "ioascii.hh"
-static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.23 2001/12/07 18:23:29 schnetter Exp $";
+static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.24 2001/12/14 17:59:54 schnetter Exp $";
@@ -220,14 +221,16 @@ int CarpetIOASCII<outdim>
const char* const suffixes = "lpv";
sprintf (filename, "%s%c", filename, suffixes[outdim-1]);
- // If this is the first time, then write a nice header on
- // the root processor
- if (do_truncate[n]) {
- if (CCTK_MyProc(cgh)==0) {
+ ofstream file;
+
+ if (CCTK_MyProc(cgh)==0) {
+ // If this is the first time, then write a nice header on
+ // the root processor
+ if (do_truncate[n]) {
struct stat fileinfo;
if (! IOUtil_RestartFromRecovery(cgh)
|| stat(filename, &fileinfo)!=0) {
- ofstream file(filename, ios::out | ios::trunc);
+ file.open (filename, ios::out | ios::trunc);
assert (file.good());
file << "# " << varname;
for (int d=0; d<outdim; ++d) {
@@ -235,10 +238,15 @@ int CarpetIOASCII<outdim>
}
file << " (" << alias << ")" << endl;
file << "#" << endl;
- file.close();
assert (file.good());
}
}
+ if (! file.is_open()) {
+ file.open (filename, ios::app);
+ assert (file.good());
+ }
+ file << setprecision(15);
+ assert (file.good());
}
assert (outdim <= CCTK_GroupDimI(group));
@@ -326,20 +334,23 @@ int CarpetIOASCII<outdim>
const bbox<int,dim> ext = data->extent();
const vect<int,dim> offset1 = offset * ext.stride();
- data->write_ascii (filename, cgh->cctk_iteration, offset1, dirs,
+ data->write_ascii (file, cgh->cctk_iteration, offset1, dirs,
tl, reflevel, component, mglevel);
} END_COMPONENT_LOOP(cgh);
// Append EOL after every complete set of components
if (CCTK_MyProc(cgh)==0) {
- ofstream file(filename, ios::app);
- assert (file.good());
- file << endl;
+ if (separate_grids) {
+ assert (file.good());
+ file << endl;
+ }
file.close();
assert (file.good());
}
+ assert (! file.is_open());
+
} // if (desired)
} // if (ascending)
diff --git a/Carpet/CarpetReduce/src/reduce.hh b/Carpet/CarpetReduce/src/reduce.hh
index b2508ee34..4c701ed95 100644
--- a/Carpet/CarpetReduce/src/reduce.hh
+++ b/Carpet/CarpetReduce/src/reduce.hh
@@ -1,7 +1,7 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetReduce/src/reduce.hh,v 1.1 2001/12/11 13:08:59 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetReduce/src/reduce.hh,v 1.2 2001/12/14 17:59:55 schnetter Exp $
-#ifndef CARPETREDUCE_HH
-#define CARPETREDUCE_HH
+#ifndef REDUCE_HH
+#define REDUCE_HH
namespace CarpetReduce {
@@ -9,4 +9,4 @@ namespace CarpetReduce {
} // namespace CarpetReduce
-#endif // !defined(CARPETREDUCE_HH)
+#endif // !defined(REDUCE_HH)