blob: 8c9d8c4ac958e7a99949160df21598ebf14541da (
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
|
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cctk.h>
#include <cctk_Parameters.h>
#include <Timer.hh>
#include <dist.hh>
#include <carpet.hh>
namespace Carpet {
using namespace std;
int OutputGH (cGH const * const cctkGH)
{
DECLARE_CCTK_PARAMETERS;
static Timers::Timer timer ("OutputGH");
timer.start();
Checkpoint ("OutputGH");
int const num_methods = CCTK_NumIOMethods();
if (num_methods == 0) {
timer.stop();
return -1;
}
static vector<Timers::Timer *> timers;
timers.resize (num_methods, NULL);
int num_vars = 0;
for (int handle = 0; handle < num_methods; ++ handle) {
IOMethod const * const method = CCTK_IOMethod (handle);
assert (method);
if (not timers.AT(handle)) {
ostringstream buf;
buf << method->implementation
<< "::" << method->name
<< " [" << handle << "]";
timers.AT(handle) = new Timers::Timer (buf.str().c_str());
}
timers.AT(handle)->start();
num_vars += method->OutputGH (cctkGH);
timers.AT(handle)->stop();
} // for handle
timer.stop();
return num_vars;
}
} // namespace Carpet
|