From dacd91bb5504ab769340bd20fb6b56a1eb689258 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 13 Dec 1999 18:29:24 +0000 Subject: Moved the test, if storage was assigned to a variable to be output, from the TimeToOutput() routines into the lower level WriteOutput() routines. Fixing by that * the behaviour of triggers, where TimeToOutput() is called BEFORE storage is possibly assigned (BR 170) * a potential bug when calling OutputVarAs() where no such test was done before git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@18 b589c3ab-70e8-4b4d-a09f-cba2dd200880 --- src/Output.c | 15 --------------- src/OutputInfo.c | 15 --------------- src/Write.c | 14 ++++++++++++++ src/WriteGF.c | 14 ++++++++++++++ src/WriteInfo.c | 14 ++++++++++++++ 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/Output.c b/src/Output.c index fdfd92c..f7fd147 100644 --- a/src/Output.c +++ b/src/Output.c @@ -55,19 +55,6 @@ int IOBasic_OutputGH (cGH *GH) CCTK_WARN (2, msg); free (msg); } - /* Check GF has storage */ - else if (grouptype == GROUP_GF && - ! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (i))) - { - char *msg, *varname; - - varname = CCTK_VarName(i); - msg = (char *) malloc (200 * sizeof (char) + strlen (varname)); - sprintf (msg, "No 0D output in IOBasic_OutputGH for '%s' " - "(no storage)", varname); - CCTK_WARN (2, msg); - free (msg); - } else { @@ -140,8 +127,6 @@ int IOBasic_OutputVarAs (cGH *GH, const char *fullname, const char *alias) @calls CCTK_GHExtensionHandle CCTK_GroupTypeFromVar CCTK_WARN - CCTK_QueryGroupStorage - CCTK_GroupFromVar @calledby @history diff --git a/src/OutputInfo.c b/src/OutputInfo.c index f55388f..6eaae92 100644 --- a/src/OutputInfo.c +++ b/src/OutputInfo.c @@ -25,7 +25,6 @@ int IOBasic_OutputInfoGH (cGH *GH) { DECLARE_CCTK_PARAMETERS int i; - int grouptype; char *name=NULL; iobasicGH *myGH; @@ -70,8 +69,6 @@ int IOBasic_OutputInfoGH (cGH *GH) /* Loop over all variables */ for (i = 0; i < CCTK_NumVars (); i++) { - grouptype = CCTK_GroupTypeFromVarI (i); - /* Check this Variable should be output */ if (myGH->do_outInfo [i]) { @@ -80,18 +77,6 @@ int IOBasic_OutputInfoGH (cGH *GH) printf("%12.8f |%12.8f |",myGH->infovals[i][0],myGH->infovals[i][1]); - } - /* Check GF has storage */ - else if (grouptype == GROUP_GF && ! CCTK_QueryGroupStorageI (GH, - CCTK_GroupIndexFromVarI (i))){ - char *msg, *varname; - - varname = CCTK_VarName(i); - msg = (char *) malloc (200 * sizeof (char) + strlen (varname)); - sprintf (msg, "No info output in IOBasic_OutputInfoGH for '%s' " - "(no storage)", varname); - CCTK_WARN (2, msg); - free (msg); } else { /* Get the variable name for this index (for filename) */ diff --git a/src/Write.c b/src/Write.c index c2c9531..7eca768 100644 --- a/src/Write.c +++ b/src/Write.c @@ -28,6 +28,20 @@ void IOBasic_Write (cGH *GH, int index, const char *alias) CCTK_REAL *data_real; CCTK_INT *data_int; + + /* first, check if variable has storage assigned */ + if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) { + char *msg, *fullname; + + fullname = CCTK_FullName (index); + msg = (char *) malloc (200 * sizeof (char) + strlen (fullname)); + sprintf (msg, "No scalar output for '%s' (no storage)", fullname); + CCTK_WARN (2, msg); + free (fullname); + free (msg); + return; + } + /* Open the file (we write only on proc0) */ if (CCTK_MyProc (GH) == 0) { diff --git a/src/WriteGF.c b/src/WriteGF.c index ddfb516..cf8133b 100644 --- a/src/WriteGF.c +++ b/src/WriteGF.c @@ -28,6 +28,20 @@ void IOBasic_WriteGF (cGH *GH, int index, const char *alias) char *openmode; FILE *file[4]; + + /* first, check if variable has storage assigned */ + if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) { + char *msg, *fullname; + + fullname = CCTK_FullName (index); + msg = (char *) malloc (200 * sizeof (char) + strlen (fullname)); + sprintf (msg, "No 0D output for '%s' (no storage)", fullname); + CCTK_WARN (2, msg); + free (fullname); + free (msg); + return; + } + /* Open the file (we write only on proc0) */ if (CCTK_MyProc (GH) == 0) { diff --git a/src/WriteInfo.c b/src/WriteInfo.c index e3a17a7..d8f1a9d 100644 --- a/src/WriteInfo.c +++ b/src/WriteInfo.c @@ -24,6 +24,20 @@ CCTK_REAL IOBasic_WriteInfo (cGH *GH, int index, const char *operator, const cha int reduce_handle; CCTK_REAL retval; + + /* first, check if variable has storage assigned */ + if (! CCTK_QueryGroupStorageI (GH, CCTK_GroupIndexFromVarI (index))) { + char *msg, *fullname; + + fullname = CCTK_FullName (index); + msg = (char *) malloc (200 * sizeof (char) + strlen (fullname)); + sprintf (msg, "No info output for '%s' (no storage)", fullname); + CCTK_WARN (2, msg); + free (fullname); + free (msg); + return (0); + } + reduce_handle = CCTK_ReductionHandle(operator); if (reduce_handle > -1) -- cgit v1.2.3