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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
/*@@
@file InitialiseCactus.c
@date Fri Sep 18 14:04:02 1998
@author Tom Goodale
@desc
Responsible for doing any cactus specific initialisations
@enddesc
@version $Id$
@@*/
#include <stdio.h>
#include <time.h>
#include "cctk_Flesh.h"
#include "cctk_Parameter.h"
#include "cctk_Schedule.h"
#include "cctk_WarnLevel.h"
#include "cctk_Misc.h"
#include "cctki_Banner.h"
#include "cctki_Bindings.h"
#include "cctki_Schedule.h"
#include "cctki_Cache.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(main_InitialiseCactus_c);
/********************************************************************
********************* Local Routine Prototypes *********************
********************************************************************/
static int CCTKi_InitialiseScheduler (tFleshConfig *ConfigData);
/********************************************************************
********************* Other Routine Prototypes *********************
********************************************************************/
int CCTKBindings_RegisterThornFunctions (void);
int CCTKi_InitialiseSubsystemDefaults (void);
int CCTKi_BindingsParameterRecoveryInitialise (void);
/********************************************************************
********************* Local Data *****************************
********************************************************************/
static time_t startuptime;
/*@@
@routine CCTKi_InitialiseCactus
@date Fri Sep 18 14:05:21 1998
@author Tom Goodale
@desc
Calls all CCTK-internal initialization routines.
@enddesc
@calls CCTKi_InitialiseSubsystemDefaults
CCTKi_ProcessEnvironment
CCTKi_ProcessCommandLine
CCTKi_CactusBanner
CCTKi_InitialiseDataStructures
CCTKi_ProcessParameterDatabase
CCTKi_BindingsVariablesInitialise
CCTKi_InitialiseScheduler
CCTKi_CallStartupFunctions
CCTKi_PrintBanners
@var argc
@vdesc The number of command line arguments
@vtype int *
@vio inout
@endvar
@var argv
@vdesc The command line arguments
@vtype char ***
@vio inout
@endvar
@var config
@vdesc Flesh configuration data
@vtype tFleshConfig *
@vio inout
@endvar
@returntype int
@returndesc
0 - success
@endreturndesc
@@*/
int CCTKi_InitialiseCactus (int *argc, char ***argv, tFleshConfig *config)
{
startuptime = time (NULL);
CCTKi_InitialiseSubsystemDefaults ();
CCTKi_ProcessEnvironment (argc, argv, config);
CCTKi_ProcessCommandLine (argc, argv, config);
CCTKi_CactusBanner ();
CCTKi_InitialiseDataStructures (config);
CCTKi_ProcessParameterDatabase (config);
CCTKi_SetupCache();
CCTKi_BindingsVariablesInitialise ();
if (CCTKBindings_RegisterThornFunctions ())
{
CCTK_Warn (0, __LINE__, __FILE__, "Cactus",
"Failed to register/provide aliased functions for active thorns");
}
CCTKi_InitialiseScheduler (config);
CCTKi_CallStartupFunctions (config);
CCTKi_PrintBanners ();
return (0);
}
/*@@
@routine CCTK_RunTime
@date Tue Oct 3 2000
@author Gabrielle Allen
@desc
Seconds since startup
@enddesc
@returntype int
@returndesc
The number of seconds since the run started.
@endreturndesc
@@*/
int CCTK_RunTime (void)
{
return ((int) (time (NULL) - startuptime));
}
/********************************************************************
********************* Local Routines *************************
********************************************************************/
/*@@
@routine CCTKi_InitialiseScheduler
@date Fri Sep 17 19:34:55 1999
@author Tom Goodale
@desc
Initialise all scheduled items
@enddesc
@calls CCTKi_SetParameterSetMask
CCTKi_BindingsParameterRecoveryInitialise
CCTKi_BindingsScheduleInitialise
CCTKi_DoScheduleSortAllGroups
CCTK_SchedulePrint
@var config
@vdesc Flesh configuration data
@vtype tFleshConfig *
@vio out
@endvar
@returntype int
@returndesc
return code of @seeroutine CCTKi_DoScheduleSortAllGroups
@endreturndesc
@@*/
static int CCTKi_InitialiseScheduler (tFleshConfig *config)
{
int retval;
const CCTK_INT *cctk_show_schedule;
extern void CCTKi_SetParameterSetMask (int mask);
CCTKi_SetParameterSetMask (PARAMETER_RECOVERY_IN);
config->recovered = CCTKi_BindingsParameterRecoveryInitialise ();
if (config->recovered < 0)
{
CCTK_Warn (0, __LINE__, __FILE__, "Cactus", "Failed to recover parameters");
}
CCTKi_SetParameterSetMask (PARAMETER_RECOVERY_POST);
CCTKi_BindingsScheduleInitialise ();
retval = CCTKi_DoScheduleSortAllGroups ();
cctk_show_schedule = (const CCTK_INT *)
CCTK_ParameterGet ("cctk_show_schedule", "Cactus", NULL);
if (*cctk_show_schedule)
{
puts ("-------------------------------------------------------------------"
"-------------");
CCTK_SchedulePrint (NULL);
puts ("-------------------------------------------------------------------"
"-------------");
}
return (retval);
}
|