diff options
-rw-r--r-- | Carpet/Carpet/src/carpet.cc | 10 | ||||
-rw-r--r-- | Carpet/CarpetIOASCII/schedule.ccl | 4 | ||||
-rw-r--r-- | Carpet/CarpetIOASCII/src/ioascii.cc | 28 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/defs.hh | 3 | ||||
-rw-r--r-- | CarpetAttic/CarpetIOFlexIO/schedule.ccl | 4 | ||||
-rw-r--r-- | CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc | 32 |
6 files changed, 49 insertions, 32 deletions
diff --git a/Carpet/Carpet/src/carpet.cc b/Carpet/Carpet/src/carpet.cc index 72d950d36..c74c72933 100644 --- a/Carpet/Carpet/src/carpet.cc +++ b/Carpet/Carpet/src/carpet.cc @@ -1,10 +1,13 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Attic/carpet.cc,v 1.14 2001/03/17 22:26:52 eschnett Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Attic/carpet.cc,v 1.15 2001/03/18 05:20:20 eschnett Exp $ // It is assumed that the number of components of all arrays is equal // to the number of components of the grid functions, and that their // distribution onto the processors is the same, and that all // processors own the same number of components. +// Scalar variables currently exist in one single incarnation for all +// refinement levels and all components. + #include <algorithm> #include <cassert> #include <cmath> @@ -33,7 +36,7 @@ #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Attic/carpet.cc,v 1.14 2001/03/17 22:26:52 eschnett Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Attic/carpet.cc,v 1.15 2001/03/18 05:20:20 eschnett Exp $"; @@ -1343,7 +1346,8 @@ namespace Carpet { default: abort(); } - if (hh->is_local(reflevel,component)) { + if (CCTK_GroupTypeFromVarI(n)==CCTK_SCALAR + || hh->is_local(reflevel,component)) { assert (cgh->data[n][ti]); } else { assert (! cgh->data[n][ti]); diff --git a/Carpet/CarpetIOASCII/schedule.ccl b/Carpet/CarpetIOASCII/schedule.ccl index 15ff1192e..da776c850 100644 --- a/Carpet/CarpetIOASCII/schedule.ccl +++ b/Carpet/CarpetIOASCII/schedule.ccl @@ -1,7 +1,7 @@ # Schedule definitions for thorn CarpetIOASCII -# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/schedule.ccl,v 1.1 2001/03/01 13:40:10 eschnett Exp $ +# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/schedule.ccl,v 1.2 2001/03/18 05:20:24 eschnett Exp $ -schedule CarpetIOASCIIStartup at STARTUP after IOUtilStartup +schedule CarpetIOASCIIStartup at STARTUP after IOUtil_Startup { LANG: C } "Startup routine" diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc index 6df502412..71798fd04 100644 --- a/Carpet/CarpetIOASCII/src/ioascii.cc +++ b/Carpet/CarpetIOASCII/src/ioascii.cc @@ -4,6 +4,8 @@ #include <cstdlib> #include <cstring> #include <fstream> +#include <sys/stat.h> +#include <sys/types.h> #include <vector> #include "cctk.h" @@ -20,7 +22,7 @@ #include "ioascii.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.8 2001/03/16 21:32:17 eschnett Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.9 2001/03/18 05:20:24 eschnett Exp $"; @@ -85,7 +87,7 @@ void* CarpetIOASCII<outdim> DECLARE_CCTK_PARAMETERS; // Truncate all files if this is not a restart - do_truncate.resize(CCTK_NumVars(), ! IOUtil_RestartFromRecovery(cgh)); + do_truncate.resize(CCTK_NumVars(), true); // No iterations have yet been output last_output.resize(maxreflevels); @@ -228,16 +230,20 @@ int CarpetIOASCII<outdim> // the root processor if (do_truncate[n]) { 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]]; + struct stat fileinfo; + if (! IOUtil_RestartFromRecovery(cgh) + || stat(filename, &fileinfo)!=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()); } } diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh index bc2547d87..9071bad2b 100644 --- a/Carpet/CarpetLib/src/defs.hh +++ b/Carpet/CarpetLib/src/defs.hh @@ -5,7 +5,7 @@ copyright : (C) 2000 by Erik Schnetter email : schnetter@astro.psu.edu - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.hh,v 1.2 2001/03/07 13:00:57 eschnett Exp $ + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.hh,v 1.3 2001/03/18 05:20:24 eschnett Exp $ ***************************************************************************/ @@ -26,6 +26,7 @@ #endif #include <algorithm> +#include <iostream> #include <list> #include <set> #include <vector> diff --git a/CarpetAttic/CarpetIOFlexIO/schedule.ccl b/CarpetAttic/CarpetIOFlexIO/schedule.ccl index 515c142bc..ad6119623 100644 --- a/CarpetAttic/CarpetIOFlexIO/schedule.ccl +++ b/CarpetAttic/CarpetIOFlexIO/schedule.ccl @@ -1,7 +1,7 @@ # Schedule definitions for thorn CarpetIOFlexIO -# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIO/schedule.ccl,v 1.2 2001/03/17 22:37:21 eschnett Exp $ +# $Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIO/schedule.ccl,v 1.3 2001/03/18 05:20:24 eschnett Exp $ -schedule CarpetIOFlexIOStartup at STARTUP after IOUtilStartup +schedule CarpetIOFlexIOStartup at STARTUP after IOUtil_Startup { LANG: C } "Startup routine" diff --git a/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc b/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc index 60ce437e7..5efd8460c 100644 --- a/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc +++ b/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc @@ -4,6 +4,8 @@ #include <cstdlib> #include <cstring> #include <fstream> +#include <sys/stat.h> +#include <sys/types.h> #include <vector> #include <AMRwriter.hh> @@ -29,7 +31,7 @@ #include "ioflexio.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc,v 1.4 2001/03/17 22:37:28 eschnett Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc,v 1.5 2001/03/18 05:20:24 eschnett Exp $"; @@ -80,7 +82,7 @@ namespace CarpetIOFlexIO { DECLARE_CCTK_PARAMETERS; // Truncate all files if this is not a restart - do_truncate.resize(CCTK_NumVars(), ! IOUtil_RestartFromRecovery(cgh)); + do_truncate.resize(CCTK_NumVars(), true); // No iterations have yet been output last_output.resize(maxreflevels); @@ -175,20 +177,24 @@ namespace CarpetIOFlexIO { // If this is the first time, then create and truncate the // file if (do_truncate[n]) { - writer = 0; - if (CCTK_Equals(out3D_format, "IEEE")) { - writer = new IEEEIO(filename, IObase::Create); + struct stat fileinfo; + if (! IOUtil_RestartFromRecovery(cgh) + || stat(filename, &fileinfo)!=0) { + writer = 0; + if (CCTK_Equals(out3D_format, "IEEE")) { + writer = new IEEEIO(filename, IObase::Create); #ifdef HDF5 - } else if (CCTK_Equals(out3D_format, "HDF4")) { - writer = new HDFIO(filename, IObase::Create); - } else if (CCTK_Equals(out3D_format, "HDF5")) { - writer = new H5IO(filename, IObase::Create); + } else if (CCTK_Equals(out3D_format, "HDF4")) { + writer = new HDFIO(filename, IObase::Create); + } else if (CCTK_Equals(out3D_format, "HDF5")) { + writer = new H5IO(filename, IObase::Create); #endif - } else { - abort(); + } else { + abort(); + } + delete writer; + writer = 0; } - delete writer; - writer = 0; } // Open the file |