aboutsummaryrefslogtreecommitdiff
path: root/CarpetDev/CarpetIOF5/src/utils.hh
blob: c379cc7758a27049683f412c896b9c84d403162a (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
#ifndef UTILS_HH
#define UTILS_HH

#include <hdf5.h>

#include "cctk.h"

#include "vect.hh"



namespace CarpetIOF5 {
  
  namespace F5 {
    
    hid_t
    hdf5_datatype_from_dummy (signed char const & dummy);
    hid_t
    hdf5_datatype_from_dummy (short const & dummy);
    hid_t
    hdf5_datatype_from_dummy (int const & dummy);
    hid_t
    hdf5_datatype_from_dummy (long const & dummy);
    hid_t
    hdf5_datatype_from_dummy (long long const & dummy);
    hid_t
    hdf5_datatype_from_dummy (float const & dummy);
    hid_t
    hdf5_datatype_from_dummy (double const & dummy);
    hid_t
    hdf5_datatype_from_dummy (long double const & dummy);
#ifdef HAVE_CCTK_COMPLEX8
    hid_t
    hdf5_datatype_from_dummy (CCTK_COMPLEX8 const & dummy);
#endif
#ifdef HAVE_CCTK_COMPLEX16
    hid_t
    hdf5_datatype_from_dummy (CCTK_COMPLEX16 const & dummy);
#endif
#ifdef HAVE_CCTK_COMPLEX32
    hid_t
    hdf5_datatype_from_dummy (CCTK_COMPLEX32 const & dummy);
#endif
    
    template<typename T, typename R>
    hid_t
    hdf5_complex_datatype_from_dummy (T const & dummy, R const & real);
    
    hid_t
    hdf5_datatype_from_cactus_datatype (int cactus_datatype);
    
    
    
    hid_t
    open_or_create_group (hid_t where,
                          char const * name);
    
    
    
    template<typename T>
    void
    write_or_check_attribute (hid_t where,
                              char const * name,
                              T const * values,
                              int num_values);
    
    template<typename T>
    void
    write_or_check_attribute (hid_t where,
                              char const * name,
                              T const & value);
    
    template<typename T, int D>
    void
    write_or_check_attribute (hid_t where,
                              char const * name,
                              vect<T,D> const & value);
    
  } // namespace F5

} // namespace CarpetIOF5

#endif  // #ifndef UTILS_HH