aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2000-09-21 13:28:34 +0000
committertradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880>2000-09-21 13:28:34 +0000
commitaff631d72074a67a01bbc34e1e54904b8b94e421 (patch)
tree4f335a40883d65f2b631b2727c82f3c54df810e4
parenta5d7feeaab6b0403614556138cfe14ac7bae0a52 (diff)
Include ioutil_AdvertisedFiles.h and ioutil_CheckpointRecovery.h
instead of ioGH.h. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@70 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r--src/Write.c11
-rw-r--r--src/WriteGF.c18
-rw-r--r--src/WriteInfo.c1
3 files changed, 16 insertions, 14 deletions
diff --git a/src/Write.c b/src/Write.c
index 1faa4a0..388a37f 100644
--- a/src/Write.c
+++ b/src/Write.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"
@@ -32,7 +33,6 @@ void IOBasic_Write (cGH *GH, int index, const char *alias)
FILE *file;
void *data;
char *fname;
- ioGH *ioUtilGH;
iobasicGH *myGH;
char *format_str_real, *format_str_int;
struct stat fileinfo;
@@ -69,8 +69,7 @@ void IOBasic_Write (cGH *GH, int index, const char *alias)
format_str_int = "%e %d\n";
}
- /* get the GH extensions for IOUtil and IOBasic */
- ioUtilGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")];
+ /* get the GH extensions for IOBasic */
myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")];
/* build the output filename */
@@ -82,7 +81,7 @@ void IOBasic_Write (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 (fname, &fileinfo) == 0 ? "a" : "w";
else
openmode = "w";
@@ -105,7 +104,7 @@ void IOBasic_Write (cGH *GH, int index, const char *alias)
if (*openmode == 'w')
{
char title_start_char;
- IOUtil_AdvertisedFileDesc_t advertised_file;
+ ioAdvertisedFileDesc advertised_file;
if (CCTK_Equals (outScalar_style, "gnuplot"))
{
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,
diff --git a/src/WriteInfo.c b/src/WriteInfo.c
index 326f66f..0fa3ffa 100644
--- a/src/WriteInfo.c
+++ b/src/WriteInfo.c
@@ -17,7 +17,6 @@
#include <stdlib.h>
#include "cctk.h"
-#include "CactusBase/IOUtil/src/ioGH.h"
int IOBasic_WriteInfo (cGH *GH,
CCTK_REAL *val,