2 #include <athena/athena.hpp>
5 #include <yaml-cpp/yaml.h>
7 #include <application/exceptions.hpp>
22 std::vector<std::string>
const& names, std::string band_name,
23 YAML::Node
const& rad) {
26 for (
auto& name : names) {
28 for (
auto& my : rad[
"opacity-sources"]) {
29 if (name == my[
"name"].as<std::string>()) {
37 throw NotFoundError(
"AbsorberFactory",
"Opacity " + name);
45 std::string band_name) {
47 throw NotFoundError(
"AbsorberFactory",
"'name' field in absorber");
51 throw NotFoundError(
"AbsorberFactory",
"'class' field in absorber " +
52 my[
"name"].as<std::string>());
56 my[
"class"].as<std::string>());
59 ab->SetOpacityFile(my[
"data"].as<std::string>());
61 ab->SetOpacityFile(
"kcoeff-" + band_name +
".nc");
64 if (my[
"dependent-species"]) {
65 auto species = my[
"dependent-species"].as<std::vector<std::string>>();
66 ab->SetSpeciesIndex(species);
70 ab->SetModel(my[
"model"].as<std::string>());
73 if (my[
"parameters"]) {
74 ab->SetRealsFrom(my[
"parameters"]);
88 if (type ==
"XIZ-H2-H2-CIA") {
89 ab = std::make_shared<XizH2H2CIA>();
90 }
else if (type ==
"XIZ-H2-He-CIA") {
91 ab = std::make_shared<XizH2HeCIA>();
92 }
else if (type ==
"Hitran") {
93 ab = std::make_shared<HitranAbsorber>(name);
94 }
else if (type ==
"freedman_simple") {
95 ab = std::make_shared<FreedmanSimple>();
96 }
else if (type ==
"freedman_mean") {
97 ab = std::make_shared<FreedmanSimple>();
98 }
else if (type ==
"radio-NH3") {
99 ab = std::make_shared<gp::MwrAbsorberNH3>();
100 }
else if (type ==
"radio-H2O") {
101 ab = std::make_shared<gp::MwrAbsorberH2O>();
102 }
else if (type ==
"radio-H2S") {
103 ab = std::make_shared<gp::MwrAbsorberH2S>();
104 }
else if (type ==
"radio-PH3") {
105 ab = std::make_shared<gp::MwrAbsorberPH3>();
106 }
else if (type ==
"radio-CIA") {
107 ab = std::make_shared<gp::MwrAbsorberCIA>();
108 }
else if (type ==
"radio-Electron") {
109 ab = std::make_shared<gp::MwrAbsorberElectron>();
111 throw NotFoundError(
"createAbsorberPartial",
"Class = " + type);
std::shared_ptr< Absorber > AbsorberPtr
std::vector< AbsorberPtr > AbsorberContainer
static AbsorberPtr createAbsorberPartial(std::string name, std::string type)
Only create an absorber based on its name and class.
static AbsorberPtr CreateFrom(YAML::Node const &my, std::string band_name)
Create an absorber from YAML node.
This file contains declaration of Absorber.