aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
blob: 1eb47c73258bae5b7b783c41e12f2ca11fd423a3 (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
 /*@@
   @file      Startup.c
   @date      01 Oct 1999
   @author    Jonghyun Lee
   @desc      Startup routines for IOPanda.
   @enddesc 
   @history
   @endhistory
 @@*/

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

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

/* prototypes of functions to be registered */
int IOPanda_Output3DGH (cGH *GH);
int IOPanda_TriggerOutput3D (cGH *GH, int);
int IOPanda_TimeFor3D (cGH *GH, int);
int IOPanda_Output3DVarAs (cGH *GH, const char *var, const char *alias);
void *IOPanda_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH);
int IOPanda_InitGH (cGH *GH);
int IOPanda_RecoverGH (cGH *GH, const char *basename, int called_from);

void Panda_Finalize(void);

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

@@*/
void IOPanda_Startup (void)
{
  int IO_GHExtension;
  int IOMethod;


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

  IO_GHExtension = CCTK_RegisterGHExtension ("IOPanda");
  CCTK_RegisterGHExtensionSetupGH (IO_GHExtension, IOPanda_SetupGH);
  CCTK_RegisterGHExtensionInitGH (IO_GHExtension, IOPanda_InitGH);

  /* Register the 3D IOPandaIO routines as output methods  */
  IOMethod = CCTK_RegisterIOMethod ("IOPandaIO_3D");
  CCTK_RegisterIOMethodOutputGH (IOMethod, IOPanda_Output3DGH);
  CCTK_RegisterIOMethodOutputVarAs (IOMethod, IOPanda_Output3DVarAs);
  CCTK_RegisterIOMethodTimeToOutput (IOMethod, IOPanda_TimeFor3D);
  CCTK_RegisterIOMethodTriggerOutput (IOMethod, IOPanda_TriggerOutput3D);

#if 0
  /* Register the IOPanda recovery routine to thorn IOUtil */
  if (IOUtil_RegisterRecover ("IOPanda recovery", IOPanda_RecoverGH) < 0)
    CCTK_WARN (1, "Failed to register IOPanda recovery routine");
  Panda_Create(1, 1);
#endif

}

void IOPanda_Finalize(void)
{
  Panda_Finalize();
}