diff options
author | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2004-11-17 18:44:04 +0000 |
---|---|---|
committer | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2004-11-17 18:44:04 +0000 |
commit | e888edd46d420786c41a918f2111cbdab296a93d (patch) | |
tree | ab94c7b7b3af327a020d7cb1a06e405a292ed5f3 | |
parent | c4fa6097dbef8188b858a63ad264a10aa7c94d98 (diff) |
Use aliased function IO_TruncateOutputFiles() to check whether or not
to truncate existing output files.
You must also update CactusBase/IOUtil now.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@160 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r-- | interface.ccl | 6 | ||||
-rw-r--r-- | src/WriteScalar.c | 7 |
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, |