diff options
Diffstat (limited to 'src/WriteGF.c')
-rw-r--r-- | src/WriteGF.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/WriteGF.c b/src/WriteGF.c index aa3a1d9..89cff1e 100644 --- a/src/WriteGF.c +++ b/src/WriteGF.c @@ -21,7 +21,8 @@ #include "cctk.h" #include "cctk_Parameters.h" -#include "CactusBase/IOUtil/src/ioGH.h" +#include "CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h" +#include "CactusBase/IOUtil/src/ioutil_CheckpointRecovery.h" #include "iobasicGH.h" @@ -30,7 +31,6 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias) DECLARE_CCTK_PARAMETERS int ierr; int i; - ioGH *ioUtilGH; iobasicGH *myGH; FILE *file; char *openmode; @@ -61,7 +61,8 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias) /* first, check if variable has storage assigned */ - if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) { + if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) + { char *fullname; fullname = CCTK_FullName (index); @@ -78,8 +79,7 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias) /* set the output style */ title_start_char = CCTK_Equals (outScalar_style, "gnuplot") ? '#' : 34; - /* get the GH extension handles for IOUtil and IOBasic */ - ioUtilGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")]; + /* get the GH extension handle for IOBasic */ myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")]; /* the extra characters should be sufficient @@ -118,10 +118,14 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias) { /* if restart from recovery, all existing files are opened in append mode */ - if (ioUtilGH->recovered) + if (IOUtil_RestartFromRecovery (GH)) + { openmode = stat (filename, &fileinfo) == 0 ? "a" : "w"; + } else + { openmode = "w"; + } } else { @@ -141,7 +145,7 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias) advertise the file, and save the filename in the database */ if (*openmode == 'w') { - IOUtil_AdvertisedFileDesc_t advertised_file; + ioAdvertisedFileDesc advertised_file; fprintf (file, "%c%s %s v time\n", title_start_char, alias, |