QMCPACK
hdf_datatype.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 //
9 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 #ifndef QMCPLUSPLUS_H5DATATYPE_DEFINE_H
14 #define QMCPLUSPLUS_H5DATATYPE_DEFINE_H
15 
16 #include <type_traits>
17 #include <hdf5.h>
18 
19 namespace qmcplusplus
20 {
21 /** map C types to hdf5 native types
22  * bool is explicit removed due to the fact that it is implementation-dependant
23  */
24 template<typename T, typename ENABLE = std::enable_if_t<!std::is_same<bool, T>::value>>
25 inline hid_t get_h5_datatype(const T&);
26 
27 #define BOOSTSUB_H5_DATATYPE(CppType, H5DTYPE) \
28  template<> \
29  inline hid_t get_h5_datatype<CppType>(const CppType&) \
30  { \
31  return H5DTYPE; \
32  }
33 
34 BOOSTSUB_H5_DATATYPE(char, H5T_NATIVE_CHAR);
35 BOOSTSUB_H5_DATATYPE(short, H5T_NATIVE_SHORT);
36 BOOSTSUB_H5_DATATYPE(int, H5T_NATIVE_INT);
37 BOOSTSUB_H5_DATATYPE(long, H5T_NATIVE_LONG);
38 BOOSTSUB_H5_DATATYPE(long long, H5T_NATIVE_LLONG);
39 BOOSTSUB_H5_DATATYPE(unsigned char, H5T_NATIVE_UCHAR);
40 BOOSTSUB_H5_DATATYPE(unsigned short, H5T_NATIVE_USHORT);
41 BOOSTSUB_H5_DATATYPE(unsigned int, H5T_NATIVE_UINT);
42 BOOSTSUB_H5_DATATYPE(unsigned long, H5T_NATIVE_ULONG);
43 BOOSTSUB_H5_DATATYPE(unsigned long long, H5T_NATIVE_ULLONG);
44 BOOSTSUB_H5_DATATYPE(float, H5T_NATIVE_FLOAT);
45 BOOSTSUB_H5_DATATYPE(double, H5T_NATIVE_DOUBLE);
46 
47 } // namespace qmcplusplus
48 #endif
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
BOOSTSUB_H5_DATATYPE(char, H5T_NATIVE_CHAR)
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...