ABLATE Source Documentation  0.12.34
radiationProperties.hpp
1 #ifndef ABLATELIBRARY_RADIATIONMODEL_H
2 #define ABLATELIBRARY_RADIATIONMODEL_H
3 
4 #include <petscsystypes.h>
5 #include "eos/eos.hpp"
6 
7 namespace ablate::eos::radiationProperties {
8 
9 enum class RadiationProperty { Absorptivity, Emissivity };
10 
12  public:
13  virtual ~RadiationModel() = default;
14 
21  [[nodiscard]] virtual ThermodynamicTemperatureFunction GetRadiationPropertiesTemperatureFunction(RadiationProperty property, const std::vector<domain::Field>& fields) const = 0;
22 };
23 
29 constexpr std::string_view to_string(const RadiationProperty& prop) {
30  switch (prop) {
31  case RadiationProperty::Absorptivity:
32  return "absorptivity";
33  case RadiationProperty::Emissivity:
34  return "emissivity";
35  }
36  return "";
37 }
38 
44 constexpr RadiationProperty from_string(const std::string_view& prop) {
45  if (prop == "absorptivity") return RadiationProperty::Absorptivity;
46  if (prop == "emissivity") return RadiationProperty::Emissivity;
47  throw std::invalid_argument("No known RadiationProperty for " + std::string(prop));
48 }
49 
56 inline std::ostream& operator<<(std::ostream& out, const RadiationProperty& prop) {
57  auto string = to_string(prop);
58  out << string;
59  return out;
60 }
61 
68 inline std::istream& operator>>(std::istream& in, RadiationProperty& prop) {
69  std::string propString;
70  in >> propString;
71  prop = from_string(propString);
72  return in;
73 }
74 
75 } // namespace ablate::eos::radiationProperties
76 
77 #endif // ABLATELIBRARY_RADIATIONMODEL_H
Definition: radiationProperties.hpp:11
virtual ThermodynamicTemperatureFunction GetRadiationPropertiesTemperatureFunction(RadiationProperty property, const std::vector< domain::Field > &fields) const =0