From 11cf65e2b4f3b4b1083d5d6a7170cb403e0f7096 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 17 Nov 2004 18:45:48 +0000 Subject: 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/CactusPUGHIO/IOFlexIO/trunk@332 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- interface.ccl | 5 +++++ src/Write.c | 2 +- src/Write2D.c | 9 +++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/interface.ccl b/interface.ccl index 2cdffbb..bd4cbd5 100644 --- a/interface.ccl +++ b/interface.ccl @@ -60,6 +60,11 @@ REQUIRES FUNCTION Hyperslab_LocalMappingByIndex REQUIRES FUNCTION Hyperslab_GlobalMappingByIndex REQUIRES FUNCTION Hyperslab_FreeMapping +CCTK_INT FUNCTION IO_TruncateOutputFiles \ + (CCTK_POINTER_TO_CONST IN GH) + +REQUIRES FUNCTION IO_TruncateOutputFiles + CCTK_INT FUNCTION Coord_GroupSystem \ (CCTK_POINTER_TO_CONST IN GH, \ CCTK_STRING IN groupname) diff --git a/src/Write.c b/src/Write.c index 6289c7c..2bc1641 100644 --- a/src/Write.c +++ b/src/Write.c @@ -329,7 +329,7 @@ static IEEEfile_t *OpenFile (const cGH *GH, int vindex, const char *alias, { if (myproc == ioUtilGH->ioproc) { - if (ioUtilGH->recovered) + if (! IO_TruncateOutputFiles (GH)) { file->iofile = IEEEopen (file->filename, "a"); *is_new_file = ! IOisValid (file->iofile); diff --git a/src/Write2D.c b/src/Write2D.c index c4d4933..4101c90 100644 --- a/src/Write2D.c +++ b/src/Write2D.c @@ -28,7 +28,6 @@ #include "cctk.h" #include "cctk_Parameters.h" #include "util_Table.h" -#include "CactusBase/IOUtil/src/ioGH.h" #include "ioFlexGH.h" static const char *rcsid = "$Id$"; @@ -70,7 +69,6 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) DECLARE_CCTK_PARAMETERS int dir; /* looper for directions */ int myproc; /* my processor ID */ - const ioGH *ioUtilGH; flexioGH *myGH; /* IOFlexIO's extensions */ int ioflex_type; /* IEEEIO output datatype */ int groupindex; /* variable's group index */ @@ -103,9 +101,8 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) return (-1); } - /* Get the handles for IOUtil and IOFlexIO extensions */ - myGH = (flexioGH *) GH->extensions[CCTK_GHExtensionHandle ("IOFlexIO")]; - ioUtilGH = (const ioGH *) GH->extensions[CCTK_GHExtensionHandle ("IO")]; + /* Get the handle for IOFlexIO extension */ + myGH = GH->extensions[CCTK_GHExtensionHandle ("IOFlexIO")]; /* What processor are we on? */ myproc = CCTK_MyProc (GH); @@ -157,7 +154,7 @@ int IOFlexIO_Write2D (const cGH *GH, int vindex, const char *alias) /* if restart from recovery, try to open an exisiting file ... */ IEEEfile_2D[dir] = NULL; - if (ioUtilGH->recovered) + if (! IO_TruncateOutputFiles (GH)) { IEEEfile_2D[dir] = IEEEopen (fname, "a"); } -- cgit v1.2.3