aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.ccl6
-rw-r--r--src/WriteScalar.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/interface.ccl b/interface.ccl
index fef1518..e702430 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -6,3 +6,9 @@ inherits: IO
real next_info_output_time type=scalar
real next_scalar_output_time type=scalar
+
+
+CCTK_INT FUNCTION IO_TruncateOutputFiles \
+ (CCTK_POINTER_TO_CONST IN GH)
+
+REQUIRES FUNCTION IO_TruncateOutputFiles
diff --git a/src/WriteScalar.c b/src/WriteScalar.c
index 02e64b8..f0ad792 100644
--- a/src/WriteScalar.c
+++ b/src/WriteScalar.c
@@ -16,7 +16,6 @@
#include "cctk.h"
#include "cctk_Parameters.h"
-#include "CactusBase/IOUtil/src/ioGH.h"
#include "CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h"
#include "iobasicGH.h"
@@ -367,16 +366,14 @@ static FILE *OpenScalarFile (const cGH *GH,
int first_time_through;
FILE *file;
iobasicGH *myGH;
- const ioGH *ioUtilGH;
char *fullname;
char comment_char, buffer[128];
ioAdvertisedFileDesc advertised_file;
DECLARE_CCTK_PARAMETERS
- /* get the GH extension handles for IOUtil and IOBasic */
+ /* get the GH extension handle for IOBasic */
myGH = CCTK_GHExtension (GH, "IOBasic");
- ioUtilGH = CCTK_GHExtension (GH, "IO");
/* get the variable's full name */
fullname = CCTK_FullName (vindex);
@@ -385,7 +382,7 @@ static FILE *OpenScalarFile (const cGH *GH,
If restart from recovery, existing files are opened in append mode. */
first_time_through = GetNamedData (myGH->filenameListScalar, filename)==NULL;
file = fopen (filename,
- ioUtilGH->recovered || ! first_time_through ? "a" : "w");
+ IO_TruncateOutputFiles (GH) && first_time_through ? "w" : "a");
if (! file)
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,