Skip to content

Commit

Permalink
removed tracer type
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Jan 12, 2024
1 parent 4b23073 commit eb8a830
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
1 change: 0 additions & 1 deletion include/open_atmos/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace open_atmos
std::string phase;

std::map<std::string, double> optional_numerical_properties;
std::map<std::string, std::string> optional_string_properties;

std::unordered_map<std::string, std::string> unknown_properties;
};
Expand Down
14 changes: 2 additions & 12 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,12 @@ namespace open_atmos
std::string phase = object[validation::keys.phase].get<std::string>();

std::map<std::string, double> numerical_properties{};
std::map<std::string, std::string> string_properties{};
for (const auto& key : validation::species.optional_keys)
{
if (object.contains(key))
{
if (key == validation::keys.tracer_type)
{
std::string val = object[key].get<std::string>();
string_properties[key] = val;
}
else
{
double val = object[key].get<double>();
numerical_properties[key] = val;
}
double val = object[key].get<double>();
numerical_properties[key] = val;
}
}

Expand All @@ -187,7 +178,6 @@ namespace open_atmos
species.name = name;
species.phase = phase;
species.optional_numerical_properties = numerical_properties;
species.optional_string_properties = string_properties;
species.unknown_properties = unknown_properties;

all_species.push_back(species);
Expand Down
2 changes: 0 additions & 2 deletions test/unit/test_parse_species.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ TEST(JsonParser, CanParseValidSpecies)
EXPECT_EQ(mechanism.species[2].optional_numerical_properties.size(), 2);
EXPECT_EQ(mechanism.species[2].optional_numerical_properties["molecular weight [kg mol-1]"], 0.5);
EXPECT_EQ(mechanism.species[2].optional_numerical_properties["density [kg m-3]"], 1000.0);
EXPECT_EQ(mechanism.species[2].optional_string_properties.size(), 1);
EXPECT_EQ(mechanism.species[2].optional_string_properties["tracer type"], "CONSTANT");
EXPECT_EQ(mechanism.species[2].unknown_properties.size(), 1);
EXPECT_EQ(mechanism.species[2].unknown_properties["__absolute tolerance"], "1e-20");
}
Expand Down
1 change: 0 additions & 1 deletion test/unit/unit_configs/valid_species.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"phase": "AEROSOL",
"molecular weight [kg mol-1]": 0.5,
"density [kg m-3]": 1000.0,
"tracer type" : "CONSTANT",
"__absolute tolerance": 1.0e-20
}
],
Expand Down

0 comments on commit eb8a830

Please sign in to comment.