aboutsummaryrefslogtreecommitdiff
path: root/src/GHExtension.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r--src/GHExtension.c134
1 files changed, 0 insertions, 134 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
deleted file mode 100644
index df3d69c..0000000
--- a/src/GHExtension.c
+++ /dev/null
@@ -1,134 +0,0 @@
- /*@@
- @file GHExtension.c
- @date Friday 18th September
- @author Gabrielle Allen
- @desc
- IO GH extension stuff.
- @enddesc
- @@*/
-
-/* #define DEBUG_IO */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "cctk.h"
-#include "cctk_Parameters.h"
-#include "iobasicGH.h"
-
-static const char *rcsid = "$Header$";
-
-CCTK_FILEVERSION(CactusBase_IOBasic_GHExtension_c)
-
-void *IOBasic_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
-{
- int i;
- iobasicGH *newGH;
-
- newGH = (iobasicGH *) malloc (sizeof (iobasicGH));
- newGH->infovals = (CCTK_REAL **)
- malloc (CCTK_NumVars () * sizeof (CCTK_REAL *));
- for (i=0;i<CCTK_NumVars ();i++)
- {
- newGH->infovals[i] = (CCTK_REAL *) malloc (2 * sizeof (CCTK_REAL));
- }
-
- newGH->do_outScalar = (char *) malloc (CCTK_NumVars () * sizeof (char));
- newGH->outScalar_last = (int *) malloc (CCTK_NumVars () * sizeof (int));
-
- newGH->do_outInfo = (char *) malloc (CCTK_NumVars () * sizeof (char));
- newGH->outInfo_last = (int *) malloc (CCTK_NumVars () * sizeof (int));
-
- return newGH;
-}
-
-int IOBasic_InitGH (cGH *GH)
-{
- int i;
- iobasicGH *myGH;
- DECLARE_CCTK_PARAMETERS
-
- /* get the handles for IOBasic extensions */
- myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")];
- myGH->filenameListScalar = NULL;
-
- /* How often to output */
- myGH->outInfo_every = out_every > 0 ? out_every : -1;
- if (outInfo_every > 0)
- {
- myGH->outInfo_every = outInfo_every;
- }
-
- myGH->outScalar_every = out_every > 0 ? out_every : -1;
- if (outScalar_every > 0)
- {
- myGH->outScalar_every = outScalar_every;
- }
-
- /* Check whether "outdirScalar" was set.
- If so take this dir otherwise default to "IO::outdir" */
- if (CCTK_ParameterQueryTimesSet ("outdirScalar", CCTK_THORNSTRING) > 0)
- {
- myGH->outdirScalar = strdup (outdirScalar);
- }
- else
- {
- myGH->outdirScalar = strdup (outdir);
- }
-
- /* create the output dir */
- if (CCTK_MyProc (GH) == 0)
- {
- i = CCTK_CreateDirectory (0755,myGH->outdirScalar);
- if (i < 0)
- {
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "IOBasic_InitGH: Problem creating Scalar output directory '%s'",
- myGH->outdirScalar);
- }
- if (i > 0)
- {
- CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
- "IOBasic_InitGH: Scalar output directory '%s' already exists",
- myGH->outdirScalar);
- }
- }
-
- for (i=0; i<CCTK_NumVars(); i++)
- {
- myGH->outScalar_last[i] = -1;
- myGH->outInfo_last [i] = -1;
- myGH->infovals[i][0] = 0.0;
- myGH->infovals[i][1] = 0.0;
- }
-
- myGH->filenameListScalar = NULL;
-
- /* Provide Information */
- if (CCTK_Equals(newverbose,"standard") || CCTK_Equals(newverbose,"full"))
- {
- if (myGH->outInfo_every > 0)
- {
- CCTK_VInfo("IOBasic","Info: Output every %d iterations",
- myGH->outInfo_every);
- }
- else
- {
- CCTK_VInfo("IOBasic","Info: No output requested");
- }
- CCTK_INFO("Info: Output to screen (standard output)");
- if (myGH->outScalar_every > 0)
- {
- CCTK_VInfo("IOBasic","Scalar: Output every %d iterations",
- myGH->outScalar_every);
- }
- else
- {
- CCTK_VInfo("IOBasic","Scalar: No output requested");
- }
- CCTK_VInfo("IOBasic","Scalar: Output to directory %s",myGH->outdirScalar);
- }
-
- return 0;
-}