IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 17181560 authored by ralfulrich's avatar ralfulrich Committed by Ralf Ulrich
Browse files

getMedium not depend on Position

parent f8f3f932
No related branches found
No related tags found
1 merge request!399Resolve "Follow-up from "Add medium type, as new property (air, water, rock...)""
......@@ -19,7 +19,7 @@ namespace corsika {
, medium_(medium) {}
template <typename T>
inline Medium MediumPropertyModel<T>::getMedium(Point const&) const {
inline Medium MediumPropertyModel<T>::getMedium() const {
return medium_;
}
......
......@@ -32,8 +32,7 @@ namespace corsika::proposal {
_env.getUniverse()->walk([&](auto& vtn) {
if (vtn.hasModelProperties()) {
const auto& prop = vtn.getModelProperties();
const auto& medium = mediumData(
prop.getMedium(Point(_env.getCoordinateSystem(), 0_cm, 0_cm, 0_cm)));
const auto& medium = mediumData(prop.getMedium());
auto comp_vec = std::vector<PROPOSAL::Component>();
const auto& comp = prop.getNuclearComposition();
......@@ -57,8 +56,8 @@ namespace corsika::proposal {
PROPOSAL::InterpolationSettings::TABLES_PATH = corsika_data("PROPOSAL").c_str();
}
inline size_t ProposalProcessBase::hash::operator()(const calc_key_t& p) const
noexcept {
inline size_t ProposalProcessBase::hash::operator()(
const calc_key_t& p) const noexcept {
return p.first ^ std::hash<Code>{}(p.second);
}
......
......@@ -31,7 +31,7 @@ namespace corsika {
* @param point The location to evaluate at.
* @returns The media type
*/
virtual Medium getMedium(Point const&) const = 0;
virtual Medium getMedium() const = 0;
/**
* A virtual default destructor.
......
......@@ -36,7 +36,7 @@ namespace corsika {
* @param point The location to evaluate at.
* @returns The medium type as enum environment::Medium
*/
Medium getMedium(Point const&) const override;
Medium getMedium() const override;
/**
* Set the medium type.
......
......@@ -68,10 +68,7 @@ TEST_CASE("MediumPropertyModel w/ Homogeneous") {
AtmModel medium(type, density, protonComposition);
// and require that it is constant
CHECK(type == medium.getMedium(Point(gCS, -10_m, 4_m, 35_km)));
CHECK(type == medium.getMedium(Point(gCS, +210_m, 0_m, 7_km)));
CHECK(type == medium.getMedium(Point(gCS, 0_m, 0_m, 0_km)));
CHECK(type == medium.getMedium(Point(gCS, 100_km, 400_km, 350_km)));
CHECK(type == medium.getMedium());
// a new refractive index
const Medium type2 = corsika::Medium::StandardRock;
......@@ -80,10 +77,7 @@ TEST_CASE("MediumPropertyModel w/ Homogeneous") {
medium.setMedium(type2);
// check that the returned refractive index is correct
CHECK(type2 == medium.getMedium(Point(gCS, -10_m, 4_m, 35_km)));
CHECK(type2 == medium.getMedium(Point(gCS, +210_m, 0_m, 7_km)));
CHECK(type2 == medium.getMedium(Point(gCS, 0_m, 0_m, 0_km)));
CHECK(type2 == medium.getMedium(Point(gCS, 100_km, 400_km, 350_km)));
CHECK(type2 == medium.getMedium());
// define our axis vector
Vector const axis(gCS, QuantityVector<dimensionless_d>(0, 0, 1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment