blob: 11b61175480f12a586d7a13c6fd31a98d7c2945e (
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
|
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include "cctk.h"
#include "cctk_Parameters.h"
#include "dist.hh"
#include "carpet.hh"
#include "Timers.hh"
namespace Carpet {
using namespace std;
int OutputGH (cGH const * const cctkGH)
{
DECLARE_CCTK_PARAMETERS;
static Timer timer ("OutputGH");
timer.start();
Checkpoint ("OutputGH");
int const num_methods = CCTK_NumIOMethods();
if (num_methods == 0) {
return -1;
}
static vector<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 << "OutputGH"
<< "::" << method->implementation
<< "::" << method->name
<< " [" << handle << "]";
timers.at(handle) = new 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
|