IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 10727ecb authored by Ralf Ulrich's avatar Ralf Ulrich
Browse files

Merge branch '319-follow-up-from-add-medium-type-as-new-property-air-water-rock' into 'master'

Resolve "Follow-up from "Add medium type, as new property (air, water, rock...)""

Closes #319

See merge request !399
parents f8f3f932 bef4fd4b
No related branches found
No related tags found
1 merge request!399Resolve "Follow-up from "Add medium type, as new property (air, water, rock...)""
Pipeline #5556 passed with warnings
......@@ -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();
......
......@@ -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.
......
......@@ -41,7 +41,7 @@ using namespace std;
* and a critical energy.
*
* It resembles one of the most simple cascades you can simulate with CORSIKA8.
**/
*/
/*
The dummy env (here) doesn't need to have any propoerties
......@@ -65,7 +65,7 @@ auto make_dummy_env() {
/**
*
* For the Heitler model we don't need particle transport.
**/
*/
class DummyTracking {
public:
......
......@@ -68,6 +68,12 @@ TEST_CASE("Geometry CoordinateSystems") {
CHECK(p2.getX(rootCS) == 0_m);
CHECK(p2.getY(rootCS) == 4_m);
CHECK(p2.getZ(rootCS) == 0_m);
CHECK(p2.getX(translatedCS) == 0_m);
CHECK(p2.getY(translatedCS) == 0_m);
CHECK(p2.getZ(translatedCS) == 0_m);
Vector<magnetic_flux_density_d> v2(translatedCS, components);
CHECK((v2 - v1).getNorm() / 1_T == Approx(0));
}
SECTION("multiple translations") {
......@@ -270,7 +276,8 @@ TEST_CASE("Geometry Trajectories") {
Point r0(rootCS, {0_m, 0_m, 0_m});
SECTION("Line") {
VelocityVector v0(rootCS, {3_m / second, 0_m / second, 0_m / second});
SpeedType const V0 = 3_m / second;
VelocityVector v0(rootCS, {V0, 0_m / second, 0_m / second});
Line const line(r0, v0);
CHECK(
......@@ -311,6 +318,10 @@ TEST_CASE("Geometry Trajectories") {
std::numeric_limits<TimeType::value_type>::infinity() * 1_s);
base2.setDuration(10_s);
CHECK(base2.getDuration() / 1_s == Approx(10));
base2.setLength(1.3_m);
CHECK(base2.getDuration() * V0 / meter == Approx(1.3));
CHECK(base2.getLength() / meter == Approx(1.3));
}
SECTION("Helix") {
......@@ -412,5 +423,9 @@ TEST_CASE("Path") {
CHECK(P3.getLength() / 1_m == Approx(3)); // Check RemoveFromEnd() else case
// Check GetNSegments()
CHECK(P3.getNSegments() - 3 == Approx(0));
P3.removeFromEnd();
P3.removeFromEnd();
P3.removeFromEnd();
CHECK(P3.getNSegments() == Approx(0));
}
}
\ No newline at end of file
......@@ -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