blob: c1575f232aa8d2e75834ec307d654378e1d19412 (
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
|
#include <cassert>
#include <cstdlib>
#include "cctk.h"
#include "tensor_component.hh"
#include "utils.hh"
namespace CarpetIOF5 {
namespace F5 {
tensor_component_t::
tensor_component_t (physical_quantity_t & physical_quantity,
int const variable)
: m_physical_quantity (physical_quantity),
m_variable (variable)
{
assert (variable >= 0 and variable < CCTK_NumVars());
char const * const name = CCTK_VarName (variable);
assert (name != 0);
m_hdf5_tensor_component
= open_or_create_group (m_physical_quantity
.get_hdf5_physical_quantity(),
name);
assert (m_hdf5_tensor_component >= 0);
assert (invariant());
}
tensor_component_t::
~ tensor_component_t ()
{
herr_t const herr = H5Gclose (m_hdf5_tensor_component);
assert (not herr);
}
physical_quantity_t & tensor_component_t::
get_physical_quantity ()
const
{
return m_physical_quantity;
}
hid_t tensor_component_t::
get_variable ()
const
{
return m_variable;
}
hid_t tensor_component_t::
get_hdf5_tensor_component ()
const
{
return m_hdf5_tensor_component;
}
bool tensor_component_t::
invariant ()
const
{
return (m_variable >= 0 and m_variable < CCTK_NumVars()
and m_hdf5_tensor_component >= 0);
}
} // namespace F5
} // namespace CarpetIOF5
|