blob: 2daa32dc26993bfea98dfb3455774dbaccbe823e (
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
|
#include <cassert>
#include <sstream>
#include <string>
#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
namespace CarpetTracker {
using namespace std;
// Maximum number of tracked surfaces
int const num_surfaces = 10;
extern "C" {
void
CarpetTracker_SetPositions (CCTK_ARGUMENTS);
}
void
CarpetTracker_SetPositions (CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
for (int n = 0; n < num_surfaces; ++ n) {
int const sn = surface[n];
if (sn >= 0) {
assert (sn >= 0 and sn < nsurfaces);
if (sf_valid[sn] > 0) {
if (verbose) {
CCTK_VInfo (CCTK_THORNSTRING,
"Setting position of refined region #%d from surface #%d to (%g,%g,%g)",
n + 1, sn,
static_cast <double> (sf_centroid_x[sn]),
static_cast <double> (sf_centroid_y[sn]),
static_cast <double> (sf_centroid_z[sn]));
}
// Set position in CarpetRegrid2
position_x[n] = sf_centroid_x[sn];
position_y[n] = sf_centroid_y[sn];
position_z[n] = sf_centroid_z[sn];
} else {
if (verbose) {
CCTK_VInfo (CCTK_THORNSTRING,
"No position information available for refined region #%d from surface #%d",
n + 1, sn);
}
} // if valid
} // if sn > 0
} // for n
}
} // namespace CarpetTracker
|