From 6cb64a2b780a4ca3d2e60f7cdf8db483de82bc0f Mon Sep 17 00:00:00 2001 From: eschnett <> Date: Sun, 18 Mar 2001 04:20:00 +0000 Subject: Fixed bugs that popped up in the SGI version. darcs-hash:20010318042020-f6438-c8ca8a890f74608f4abda1a3b791811e40328342.gz --- CarpetAttic/CarpetIOFlexIO/schedule.ccl | 4 ++-- CarpetAttic/CarpetIOFlexIO/src/ioflexio.cc | 32 ++++++++++++++++++------------ 2 files changed, 21 insertions(+), 15 deletions(-) (limited to 'CarpetAttic') 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 #include #include +#include +#include #include #include @@ -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 -- cgit v1.2.3