diff options
author | eschnett <> | 2001-03-18 04:20:00 +0000 |
---|---|---|
committer | eschnett <> | 2001-03-18 04:20:00 +0000 |
commit | 6cb64a2b780a4ca3d2e60f7cdf8db483de82bc0f (patch) | |
tree | a6bea7231dd6ac0a1ee5e6d7da3a5803565d59fe /CarpetAttic | |
parent | 0dfa2fdef205aa30ff894083eb0dcb70f592660f (diff) |
Fixed bugs that popped up in the SGI version.
darcs-hash:20010318042020-f6438-c8ca8a890f74608f4abda1a3b791811e40328342.gz
Diffstat (limited to 'CarpetAttic')
-rw-r--r-- | CarpetAttic/CarpetIOFlexIO/schedule.ccl | 4 | ||||
-rw-r--r-- | CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc | 32 |
2 files changed, 21 insertions, 15 deletions
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 |