KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
data_type_utilities.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // license: HDF5Application/license.txt
9 //
10 // Main author: Suneth Warnakulasuriya
11 //
12 
13 // System includes
14 #include "hdf5.h"
15 #include <type_traits>
16 
17 // Project includes
19 
20 // Application includes
21 
22 
23 namespace Kratos
24 {
25 namespace HDF5
26 {
27 namespace Internals
28 {
29 
30 // H5 data types
31 template <class TDataType> hid_t GetPrimitiveH5Type()
32 {
33  using primitive_type = typename DataTypeTraits<TDataType>::PrimitiveType;
34 
35  if constexpr(std::is_same_v<primitive_type, char>) {
36  return H5T_NATIVE_CHAR;
37  } else if constexpr(std::is_same_v<primitive_type, int>) {
38  return H5T_NATIVE_INT;
39  } else if constexpr(std::is_same_v<primitive_type, double>) {
40  return H5T_NATIVE_DOUBLE;
41  } else if constexpr(std::is_same_v<primitive_type, hsize_t>) {
42  return H5T_NATIVE_HSIZE;
43  } else {
44  static_assert(!std::is_same_v<primitive_type, primitive_type>, "Unsupported data type.");
45  }
46 }
47 
48 } // namespace Internals
49 } // namespace HDF5
50 } // namespace Kratos
TDataType PrimitiveType
Definition: data_type_traits.h:42
hid_t GetPrimitiveH5Type()
Definition: data_type_utilities.h:31
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21