summaryrefslogtreecommitdiff
path: root/src/main/CactusDefaultInitialise.c
blob: 0ef962b3e6bcd7b855b3e02105c4d8a7d98503af (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 /*@@
   @file      CactusDefaultInitialise.c
   @date      Tue Sep 29 12:45:04 1998
   @author    Tom Goodale
   @desc 
   Default cactus initialisation routine.
   @enddesc 
 @@*/


#include <stdio.h>
#include <stdlib.h>

#include "flesh.h"
#include "CactusMainDefaults.h"
#include "CactusCommFunctions.h"
#include "parameters.h"
#include "rfr_constants.h"
#include "Dummies.h"

static char *rcsid = "$Id$";


 /*@@
   @routine    CactusDefaultInitialise
   @date       Tue Sep 29 12:45:04 1998
   @author     Tom Goodale
   @desc 
   Default initialisation routine.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
int CactusDefaultInitialise(tFleshConfig *config)
{
  cGH *GH;
  int convergence_level;

  CactusStartTimer(config->timer[INITIALISATION]);

  CactusResetTimer(config->timer[ELLIPTIC]);

  convergence_level = 0;
  while((GH = CCTK_SetupGH(config, convergence_level)))
  {
    CCTK_AddGH(config, convergence_level, GH);

    Cactus_InitialiseGH(GH);

    convergence_level++;
  };

  CactusStopTimer(config->timer[INITIALISATION]);
  
  return 0;
}



 /*@@
   @routine    CactusDefaultShutdown
   @date       Tue Sep 29 12:45:04 1998
   @author     Tom Goodale
   @desc 
   DEfault shutdown routine.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
int CactusDefaultShutdown(tFleshConfig *config)
{
  printf("I'm in the default shutdown routine\n");
  
  return 0;
}


 /*@@
   @routine    Cactus_InitialiseGH
   @date       Mon Feb  1 12:13:09 1999
   @author     Tom Goodale
   @desc 
   Responsible for initialising a GH.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
int Cactus_InitialiseGH(cGH *GH)
{

  int Rstep;

  /*
  SetupFortranArrays(GH);
  */
  
  
  /* Setup the rfr_top on this GH */

  GH->rfr_top = NULL;

  rfrInitTree(&(GH->rfr_top), 
	      CCTK_DummyStorageOn,
	      CCTK_DummyStorageOff,
	      CCTK_DummyCommunicationOn,
	      CCTK_DummyCommunicationOff,
	      CCTK_DummyTriggerable,
	      CCTK_DummyTriggerSaysGo,
	      CCTK_DummyTriggerAction,
	      CCTK_DummyCallFunc);

  /* Do the rfr initialisation on this GH */
  CCTK_BindingsScheduleRegister("RFRINIT", (void *)GH);


  /* Initialise all the extensions. */
  CCTK_InitGHExtensions(GH);


  /* Do various rfr traversals.  Will tidy up later. */

  CCTK_rfrTraverse(GH, CACTUS_BASEGRID); 
  CCTK_rfrTraverse(GH,CACTUS_INITIAL0);

  /* Loops like this should go eventually... */
  for (Rstep = CACTUS_INITIAL; Rstep <= CACTUS_INITIAL9; Rstep++)
  {
    CCTK_rfrTraverse(GH,Rstep);
  }

  /* Ignore checkpointing for now.
   * CCTK_rfrTraverse(GH,CACTUS_RECOVER);
   * CCTK_rfrTraverse(GH,CACTUS_CPINITIAL);
   */

  for (Rstep = CACTUS_POSTSTEP; Rstep <= CACTUS_POSTSTEP10; Rstep++)
  {
    CCTK_rfrTraverse(GH,Rstep);
  }

}