aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
blob: affbcf6a2c2b2e8ba3e89d828cab4a3f1141ea82 (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
 /*@@
   @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 "flesh.h"
#include "GHExtensions.h"
#include "declare_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_rfrTraverseGH (cGH *GH, int rfrpoint);
int IOFlexIO_RecoverGH (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 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

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

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

  /* Register the 2D and 3D IOFlexIO routines as output methods  */
  if (strlen (output2D) > 0) {
    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);
  }
  if (strlen (output3D) > 0) {
    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_RecoverGH) < 0)
    CCTK_WARN (1, "Failed to register IOFlexIO recovery routine");
}