| 1 |
// Copyright(C) 1999-2020 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#ifndef IOSS_Ioad_TemplateToValue_hpp |
| 8 |
#define IOSS_Ioad_TemplateToValue_hpp |
| 9 |
|
| 10 |
#include "Ioss_Field.h" // for Field, etc |
| 11 |
|
| 12 |
namespace Ioad { |
| 13 |
|
| 14 |
template <typename T> constexpr Ioss::Field::BasicType template_to_basic_type() noexcept |
| 15 |
{ |
| 16 |
return Ioss::Field::BasicType::INVALID; |
| 17 |
} |
| 18 |
|
| 19 |
template <> constexpr Ioss::Field::BasicType template_to_basic_type<double>() noexcept |
| 20 |
{ |
| 21 |
return Ioss::Field::BasicType::DOUBLE; |
| 22 |
} |
| 23 |
|
| 24 |
template <> constexpr Ioss::Field::BasicType template_to_basic_type<int32_t>() noexcept |
| 25 |
{ |
| 26 |
return Ioss::Field::BasicType::INT32; |
| 27 |
} |
| 28 |
|
| 29 |
template <> constexpr Ioss::Field::BasicType template_to_basic_type<int64_t>() noexcept |
| 30 |
{ |
| 31 |
return Ioss::Field::BasicType::INT64; |
| 32 |
} |
| 33 |
|
| 34 |
template <> constexpr Ioss::Field::BasicType template_to_basic_type<Complex>() noexcept |
| 35 |
{ |
| 36 |
return Ioss::Field::BasicType::COMPLEX; |
| 37 |
} |
| 38 |
|
| 39 |
template <> constexpr Ioss::Field::BasicType template_to_basic_type<std::string>() noexcept |
| 40 |
{ |
| 41 |
return Ioss::Field::BasicType::STRING; |
| 42 |
} |
| 43 |
|
| 44 |
template <> constexpr Ioss::Field::BasicType template_to_basic_type<char>() noexcept |
| 45 |
{ |
| 46 |
return Ioss::Field::BasicType::CHARACTER; |
| 47 |
} |
| 48 |
|
| 49 |
template <> constexpr char const *get_entity_type<Ioss::SideBlock>() noexcept |
| 50 |
{ |
| 51 |
return "SideBlock"; |
| 52 |
} |
| 53 |
|
| 54 |
template <> constexpr char const *get_entity_type<Ioss::SideSet>() noexcept { return "SideSet"; } |
| 55 |
|
| 56 |
template <> constexpr char const *get_entity_type<Ioss::NodeBlock>() noexcept |
| 57 |
{ |
| 58 |
return "NodeBlock"; |
| 59 |
} |
| 60 |
|
| 61 |
template <> constexpr char const *get_entity_type<Ioss::EdgeBlock>() noexcept |
| 62 |
{ |
| 63 |
return "EdgeBlock"; |
| 64 |
} |
| 65 |
|
| 66 |
template <> constexpr char const *get_entity_type<Ioss::FaceBlock>() noexcept |
| 67 |
{ |
| 68 |
return "FaceBlock"; |
| 69 |
} |
| 70 |
|
| 71 |
template <> constexpr char const *get_entity_type<Ioss::ElementBlock>() noexcept |
| 72 |
{ |
| 73 |
return "ElementBlock"; |
| 74 |
} |
| 75 |
|
| 76 |
template <> constexpr char const *get_entity_type<Ioss::NodeSet>() noexcept { return "NodeSet"; } |
| 77 |
|
| 78 |
template <> constexpr char const *get_entity_type<Ioss::EdgeSet>() noexcept { return "EdgeSet"; } |
| 79 |
|
| 80 |
template <> constexpr char const *get_entity_type<Ioss::FaceSet>() noexcept { return "FaceSet"; } |
| 81 |
|
| 82 |
template <> constexpr char const *get_entity_type<Ioss::ElementSet>() noexcept |
| 83 |
{ |
| 84 |
return "ElementSet"; |
| 85 |
} |
| 86 |
|
| 87 |
template <> constexpr char const *get_entity_type<Ioss::CommSet>() noexcept { return "CommSet"; } |
| 88 |
|
| 89 |
template <class T> inline std::string GetType() noexcept { return "compound"; } |
| 90 |
template <> inline std::string GetType<void>() noexcept { return "unknown"; } |
| 91 |
|
| 92 |
template <> inline std::string GetType<std::string>() noexcept { return "string"; } |
| 93 |
|
| 94 |
template <> inline std::string GetType<char>() noexcept { return "char"; } |
| 95 |
template <> inline std::string GetType<signed char>() noexcept { return "signed char"; } |
| 96 |
template <> inline std::string GetType<unsigned char>() noexcept { return "unsigned char"; } |
| 97 |
template <> inline std::string GetType<short>() noexcept { return "short"; } |
| 98 |
template <> inline std::string GetType<unsigned short>() noexcept { return "unsigned short"; } |
| 99 |
template <> inline std::string GetType<int>() noexcept { return "int"; } |
| 100 |
template <> inline std::string GetType<unsigned int>() noexcept { return "unsigned int"; } |
| 101 |
template <> inline std::string GetType<long int>() noexcept { return "long int"; } |
| 102 |
template <> inline std::string GetType<unsigned long int>() noexcept |
| 103 |
{ |
| 104 |
return "unsigned long int"; |
| 105 |
} |
| 106 |
template <> inline std::string GetType<long long int>() noexcept { return "long long int"; } |
| 107 |
template <> inline std::string GetType<unsigned long long int>() noexcept |
| 108 |
{ |
| 109 |
return "unsigned long long int"; |
| 110 |
} |
| 111 |
template <> inline std::string GetType<float>() noexcept { return "float"; } |
| 112 |
template <> inline std::string GetType<double>() noexcept { return "double"; } |
| 113 |
template <> inline std::string GetType<long double>() noexcept { return "long double"; } |
| 114 |
template <> inline std::string GetType<std::complex<float>>() noexcept { return "float complex"; } |
| 115 |
template <> inline std::string GetType<std::complex<double>>() noexcept |
| 116 |
{ |
| 117 |
return "double complex"; |
| 118 |
} |
| 119 |
|
| 120 |
} // namespace Ioad |
| 121 |
|
| 122 |
#endif |