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
|
// register.cc -- register variables with various thorns that need-to-know
// $Header$
//
// GRHydro_register_GZPatchSystem - register with GZPatchSystem
//
// Cut 'n paste job from BackgroundWaveToy, author J Thornburg...
#include <cstdio>
#include <string>
#include "cctk.h"
#include "cctk_Arguments.h"
using namespace std;
//******************************************************************************
//
// This function is called by the Cactus scheduler to (maybe) register
// our to-be-interpatch-synchronized variables with GZPatchSystem. It
// checks if the GZPatchSystem registration function has been provided
// (which it should be if and only if GZPatchSystem is active), and if so,
// does the registration.
//
// If we're using Carpet, this function must be called in meta mode.
//
extern "C"void GRHydro_register_GZPatchSystem(CCTK_ARGUMENTS)
{
if (CCTK_IsFunctionAliased("GZPatchSystem_register_sync"))
{
CCTK_VInfo(CCTK_THORNSTRING,
"registering to-be-interpatch-synchronized variables "
"with GZPatchSystem");
string var[8] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps",
"HydroBase::vel",
"GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz",
"GRHydro::scon"};
for (int i = 0; i < 8; i++)
{
int status =
GZPatchSystem_register_sync(var[i].c_str());
if (status < 0)
{
CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
"***** GRHydro_register_GZPatchSystem():\n"
" error registering var group %s to be "
"interpatch-synchronized!\n"
" (GZPatchSystem_register_sync() error code %d)\n",
var[i].c_str(), status);
}
}
}
else
{
CCTK_WARN(1, "Function GZPatchSystem_register_sync not registered!");
}
if (CCTK_IsFunctionAliased("GZPatchSystem_register_cxform"))
{
CCTK_VInfo(CCTK_THORNSTRING,
"registering to-be-cxformed variables with GZPatchSystem");
string var[11] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps",
"HydroBase::vel",
"GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz",
"GRHydro::scon",
"ADMBase::metric", "ADMBase::curv", "ADMBase::shift"};
for (int i = 0; i < 11; i++)
for (int j = 0; j < 3; j++)
{
int ps_status =
GZPatchSystem_register_cxform(j, var[i].c_str());
if (ps_status < 0)
{
CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
"***** GRHydro_register_GZPatchSystem():\n"
" error registering var group %s to be "
"interpatch-cxformhronized!\n"
" (GZPatchSystem_register_cxform() error code %d)\n",
var[i].c_str(), ps_status);
}
}
}
else
{
CCTK_WARN(1, "Function GZPatchSystem_register_cxform not registered!");
}
}
|