aboutsummaryrefslogtreecommitdiff
path: root/src/GHExtension.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r--src/GHExtension.c205
1 files changed, 0 insertions, 205 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
deleted file mode 100644
index d7d90e9..0000000
--- a/src/GHExtension.c
+++ /dev/null
@@ -1,205 +0,0 @@
- /*@@
- @file GHExtension.c
- @date Tue 9th Feb 1999
- @author Gabrielle Allen
- @desc
- IOUtil GH extension stuff.
- @enddesc
- @version $Id$
- @@*/
-
-/*#define DEBUG_IO 1*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "cctk.h"
-#include "cctk_Parameters.h"
-
-#include "util_String.h"
-#include "StoreNamedData.h"
-
-#include "CactusBase/IOUtil/src/ioutil_Utils.h"
-#include "ioGH.h"
-
-
-static const char *rcsid = "$Header$";
-CCTK_FILEVERSION(CactusBase_IOUtil_GHExtension_c)
-
-
-/********************************************************************
- ********************* External Routines **********************
- ********************************************************************/
-int IOUtil_InitGH (cGH *GH);
-void *IOUtil_SetupGH (tFleshConfig *config,
- int convergence_level,
- cGH *GH);
-
- /*@@
- @routine IOUtil_SetupGH
- @date Tue May 09 2000
- @author Thomas Radke
- @desc
- Allocates the IOUtil GH extension structure.
- @enddesc
- @calledby CCTK scheduler at CCTK_INITIALIZE
- @var config
- @vdesc flesh configuration structure (unused)
- @vtype tFleshConfig *
- @vio in
- @endvar
- @var convergence_level
- @vdesc convergence level (unused)
- @vtype int
- @vio in
- @endvar
- @var GH
- @vdesc pointer to grid hierarchy
- @vtype cGH *
- @vio in
- @endvar
-@@*/
-void *IOUtil_SetupGH (tFleshConfig *config,
- int convergence_level,
- cGH *GH)
-{
- /* avoid compiler warnings about unused parameters */
- config = config;
- convergence_level = convergence_level;
- GH = GH;
-
- return (malloc (sizeof (ioGH)));
-}
-
-
- /*@@
- @routine IOUtil_InitGH
- @date Tue May 09 2000
- @author Thomas Radke
- @desc
- The GH initialization routine for IOUtil.
- Necessary output dirs are created.
- Checkpoint/recovery timers are created
- if timing information was requested.
- @enddesc
- @calledby CCTK scheduler at CCTK_INITIALIZE
- @var GH
- @vdesc pointer to grid hierarchy
- @vtype cGH *
- @vio in
- @endvar
-@@*/
-int IOUtil_InitGH (cGH *GH)
-{
- DECLARE_CCTK_PARAMETERS
- int i;
- int maxdim;
- ioGH *myGH;
-
-
- myGH = (ioGH *) CCTK_GHExtension (GH, "IO");
-
- if (CCTK_Equals (out3D_mode, "proc"))
- {
- myGH->ioproc = CCTK_MyProc (GH);
- myGH->nioprocs = CCTK_nProcs (GH);
- myGH->ioproc_every = 1;
- }
- else if (CCTK_Equals (out3D_mode, "np"))
- {
- if (out3D_procs > CCTK_nProcs (GH))
- {
- myGH->ioproc_every = CCTK_nProcs (GH);
- CCTK_VInfo (CCTK_THORNSTRING, "Reducing 'IO::ioproc_every' to %d",
- myGH->ioproc_every);
- }
- else
- {
- myGH->ioproc_every = out3D_procs;
- }
-
- myGH->nioprocs = CCTK_nProcs (GH) / myGH->ioproc_every +
- (CCTK_nProcs (GH) % myGH->ioproc_every ? 1 : 0);
- myGH->ioproc = CCTK_MyProc (GH) -
- CCTK_MyProc (GH) % myGH->ioproc_every;
- }
- else /* IO::out3D_mode = "onefile" */
- {
- myGH->ioproc = 0;
- myGH->nioprocs = 1;
- myGH->ioproc_every = CCTK_nProcs (GH);
- }
-
- /* For now we can only have unchunked for a single output file */
- if (out3D_unchunked || CCTK_nProcs (GH) == 1)
- {
- if (myGH->ioproc_every >= CCTK_nProcs (GH))
- {
- myGH->unchunked = 1;
- }
- else
- {
- CCTK_INFO ("Unchunked output not supported for multiple "
- "output files. Output will be chunked.");
- myGH->unchunked = 0;
- }
- }
- else
- {
- myGH->unchunked = 0;
- }
-
- /* create the checkpoint directory */
- i = IOUtil_CreateDirectory (GH, checkpoint_dir,
- ! CCTK_Equals (out3D_mode, "onefile"),
- myGH->ioproc);
- if (i < 0)
- {
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Problem creating checkpoint directory '%s'",
- checkpoint_dir);
- }
- else if (i > 0 && CCTK_Equals (newverbose, "full"))
- {
- CCTK_VInfo (CCTK_THORNSTRING,
- "IOUtil_InitGH: checkpoint directory '%s' already exists",
- checkpoint_dir);
- }
-
- /* save downsampling parameters in ioUtilGH because they are temporarily
- reset during checkpointing */
- /* for now we have only parameters for the first 3 dimensions
- the rest is constantly initialized to 1 */
- maxdim = CCTK_MaxDim ();
- myGH->downsample = (int *) malloc (maxdim * sizeof (int));
-
- i = maxdim > 3 ? 3 : maxdim;
- switch (i)
- {
- case 3 : myGH->downsample [2] = out3D_downsample_z;
- case 2 : myGH->downsample [1] = out3D_downsample_y;
- case 1 : myGH->downsample [0] = out3D_downsample_x;
- }
-
- for (i = 3; i < maxdim; i++)
- {
- myGH->downsample [i] = 1;
- }
-
- /* evaluate the 'IO::out_single' parameter only
- if Cactus was compiled with double precision */
-#ifdef SINGLE_PRECISION
- myGH->out_single = 0;
-#else
- myGH->out_single = out3D_single;
-#endif
-
- /* reset the flag incidicating restart from recovery */
- myGH->recovered = 0;
-
- /* reset the flags array for the file reader */
- myGH->do_inVars = NULL;
-
- return (0);
-}