blob: 1adde5e5a3232f3fdb26ee6ed292d4477a8f7c6f (
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
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
|
#include <cassert>
#include <hdf5.h>
#include "cctk.h"
#include "defs.hh"
#include "simulation.hh"
#include "utils.hh"
namespace CarpetIOF5 {
namespace F5 {
using std::ostringstream;
simulation_t::
simulation_t (timestep_t & timestep,
char const * const name)
: m_timestep (timestep),
m_name (name)
{
m_hdf5_simulation
= open_or_create_group (m_timestep.get_hdf5_timestep(),
m_name.c_str());
assert (m_hdf5_simulation >= 0);
cGH const * const cctkGH = m_timestep.get_file().get_cctkGH();
write_or_check_attribute
(m_hdf5_simulation, "TimeStep", cctkGH->cctk_iteration);
assert (invariant());
}
simulation_t::
~ simulation_t()
{
check (not H5Gclose (m_hdf5_simulation));
}
timestep_t & simulation_t::
get_timestep ()
const
{
return m_timestep;
}
hid_t simulation_t::
get_hdf5_simulation()
const
{
return m_hdf5_simulation;
}
void simulation_t::
get_link_destination (int const proc,
string & filename,
string & objectname)
const
{
get_timestep().get_link_destination (proc, filename, objectname);
if (objectname.empty())
{
objectname = m_name;
}
else
{
objectname += string ("/") + m_name;
}
}
bool simulation_t::
invariant()
const
{
return m_hdf5_simulation >= 0;
}
} // namespace F5
} // namespace CarpetIOF5
|