aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
blob: 81f3f4ca69c8381f98e186357de8441a5e905874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 /*@@
   @file      Startup.c
   @date      Fri May 21 1999
   @author    Thomas Radke
   @desc 
   Startup routines for IOFlexIO.
   @enddesc 
   @history
   @hauthor Thomas Radke @hdate May 21 1999
   @hdesc Just copied from thorn IOFlexIO.
   @endhistory
 @@*/

#include <stdio.h>
#include <string.h>

#include "cctk.h"
#include "cctk_Parameters.h"
#include "CactusBase/IOUtil/src/ioGH.h"

/* prototypes of functions to be registered */
int IOFlexIO_Output2DGH (cGH *GH);
int IOFlexIO_TriggerOutput2D (cGH *GH, int);
int IOFlexIO_TimeFor2D (cGH *GH, int);
int IOFlexIO_Output2DVarAs (cGH *GH, const char *var, const char *alias);
int IOFlexIO_Output3DGH (cGH *GH);
int IOFlexIO_TriggerOutput3D (cGH *GH, int);
int IOFlexIO_TimeFor3D (cGH *GH, int);
int IOFlexIO_Output3DVarAs (cGH *GH, const char *var, const char *alias);
void *IOFlexIO_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
int IOFlexIO_InitGH (cGH *GH);
int IOFlexIO_Recover (cGH *GH, const char *basename, int called_from);



 /*@@
   @routine   IOFlexIO_Startup
   @date      Fri May 21 1999
   @author    Thomas Radke
   @desc 
   The startup registration routine for IOFlexIO.
   Registers the GH extensions needed for IOFlexIO and
   the registerable routines used for each method of IOFlexIO.
   IOFlexIO does not overload any functions.
   @enddesc 
   @calledby   CCTK scheduler at STARTUP
   @history 
 
   @endhistory 

@@*/
void IOFlexIO_Startup (void)
{
  DECLARE_CCTK_PARAMETERS
  int IO_GHExtension;
  int IOMethod;


  if (CCTK_GHExtensionHandle ("IO") < 0)
  {
    CCTK_WARN (1, "Thorn IOUtil was not activated. "
                  "No IOFlexIO IO methods will be enabled.");
    return;
  }
  if (CCTK_GHExtensionHandle ("PUGH") < 0)
  {
    CCTK_WARN (1, "Thorn PUGH was not activated. "
                  "No IOFlexIO IO methods will be enabled.");
    return;
  }

  IO_GHExtension = CCTK_RegisterGHExtension ("IOFlexIO");
  CCTK_RegisterGHExtensionSetupGH (IO_GHExtension, IOFlexIO_SetupGH);
  CCTK_RegisterGHExtensionInitGH (IO_GHExtension, IOFlexIO_InitGH);

  /* Register the 2D and 3D IOFlexIO routines as output methods  */
  IOMethod = CCTK_RegisterIOMethod ("IOFlexIO_2D");
  CCTK_RegisterIOMethodOutputGH (IOMethod, IOFlexIO_Output2DGH);
  CCTK_RegisterIOMethodOutputVarAs (IOMethod, IOFlexIO_Output2DVarAs);
  CCTK_RegisterIOMethodTimeToOutput (IOMethod, IOFlexIO_TimeFor2D);
  CCTK_RegisterIOMethodTriggerOutput (IOMethod, IOFlexIO_TriggerOutput2D);

  IOMethod = CCTK_RegisterIOMethod ("IOFlexIO_3D");
  CCTK_RegisterIOMethodOutputGH (IOMethod, IOFlexIO_Output3DGH);
  CCTK_RegisterIOMethodOutputVarAs (IOMethod, IOFlexIO_Output3DVarAs);
  CCTK_RegisterIOMethodTimeToOutput (IOMethod, IOFlexIO_TimeFor3D);
  CCTK_RegisterIOMethodTriggerOutput (IOMethod, IOFlexIO_TriggerOutput3D);

  /* Register the IOFlexIO recovery routine to thorn IOUtil */
  if (IOUtil_RegisterRecover ("IOFlexIO recovery", IOFlexIO_Recover) < 0)
    CCTK_WARN (1, "Failed to register IOFlexIO recovery routine");

  
}