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
No related merge requests found
...@@ -19,7 +19,7 @@ namespace corsika { ...@@ -19,7 +19,7 @@ namespace corsika {
, medium_(medium) {} , medium_(medium) {}
template <typename T> template <typename T>
inline Medium MediumPropertyModel<T>::getMedium(Point const&) const { inline Medium MediumPropertyModel<T>::getMedium() const {
return medium_; return medium_;
} }
......
...@@ -32,8 +32,7 @@ namespace corsika::proposal { ...@@ -32,8 +32,7 @@ namespace corsika::proposal {
_env.getUniverse()->walk([&](auto& vtn) { _env.getUniverse()->walk([&](auto& vtn) {
if (vtn.hasModelProperties()) { if (vtn.hasModelProperties()) {
const auto& prop = vtn.getModelProperties(); const auto& prop = vtn.getModelProperties();
const auto& medium = mediumData( const auto& medium = mediumData(prop.getMedium());
prop.getMedium(Point(_env.getCoordinateSystem(), 0_cm, 0_cm, 0_cm)));
auto comp_vec = std::vector<PROPOSAL::Component>(); auto comp_vec = std::vector<PROPOSAL::Component>();
const auto& comp = prop.getNuclearComposition(); const auto& comp = prop.getNuclearComposition();
......
...@@ -31,7 +31,7 @@ namespace corsika { ...@@ -31,7 +31,7 @@ namespace corsika {
* @param point The location to evaluate at. * @param point The location to evaluate at.
* @returns The media type * @returns The media type
*/ */
virtual Medium getMedium(Point const&) const = 0; virtual Medium getMedium() const = 0;
/** /**
* A virtual default destructor. * A virtual default destructor.
......
...@@ -36,7 +36,7 @@ namespace corsika { ...@@ -36,7 +36,7 @@ namespace corsika {
* @param point The location to evaluate at. * @param point The location to evaluate at.
* @returns The medium type as enum environment::Medium * @returns The medium type as enum environment::Medium
*/ */
Medium getMedium(Point const&) const override; Medium getMedium() const override;
/** /**
* Set the medium type. * Set the medium type.
......
...@@ -41,7 +41,7 @@ using namespace std; ...@@ -41,7 +41,7 @@ using namespace std;
* and a critical energy. * and a critical energy.
* *
* It resembles one of the most simple cascades you can simulate with CORSIKA8. * It resembles one of the most simple cascades you can simulate with CORSIKA8.
**/ */
/* /*
The dummy env (here) doesn't need to have any propoerties The dummy env (here) doesn't need to have any propoerties
...@@ -65,7 +65,7 @@ auto make_dummy_env() { ...@@ -65,7 +65,7 @@ auto make_dummy_env() {
/** /**
* *
* For the Heitler model we don't need particle transport. * For the Heitler model we don't need particle transport.
**/ */
class DummyTracking { class DummyTracking {
public: public:
......
...@@ -68,6 +68,12 @@ TEST_CASE("Geometry CoordinateSystems") { ...@@ -68,6 +68,12 @@ TEST_CASE("Geometry CoordinateSystems") {
CHECK(p2.getX(rootCS) == 0_m); CHECK(p2.getX(rootCS) == 0_m);
CHECK(p2.getY(rootCS) == 4_m); CHECK(p2.getY(rootCS) == 4_m);
CHECK(p2.getZ(rootCS) == 0_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") { SECTION("multiple translations") {
...@@ -270,7 +276,8 @@ TEST_CASE("Geometry Trajectories") { ...@@ -270,7 +276,8 @@ TEST_CASE("Geometry Trajectories") {
Point r0(rootCS, {0_m, 0_m, 0_m}); Point r0(rootCS, {0_m, 0_m, 0_m});
SECTION("Line") { 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); Line const line(r0, v0);
CHECK( CHECK(
...@@ -311,6 +318,10 @@ TEST_CASE("Geometry Trajectories") { ...@@ -311,6 +318,10 @@ TEST_CASE("Geometry Trajectories") {
std::numeric_limits<TimeType::value_type>::infinity() * 1_s); std::numeric_limits<TimeType::value_type>::infinity() * 1_s);
base2.setDuration(10_s); base2.setDuration(10_s);
CHECK(base2.getDuration() / 1_s == Approx(10)); 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") { SECTION("Helix") {
...@@ -412,5 +423,9 @@ TEST_CASE("Path") { ...@@ -412,5 +423,9 @@ TEST_CASE("Path") {
CHECK(P3.getLength() / 1_m == Approx(3)); // Check RemoveFromEnd() else case CHECK(P3.getLength() / 1_m == Approx(3)); // Check RemoveFromEnd() else case
// Check GetNSegments() // Check GetNSegments()
CHECK(P3.getNSegments() - 3 == Approx(0)); 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") { ...@@ -68,10 +68,7 @@ TEST_CASE("MediumPropertyModel w/ Homogeneous") {
AtmModel medium(type, density, protonComposition); AtmModel medium(type, density, protonComposition);
// and require that it is constant // and require that it is constant
CHECK(type == medium.getMedium(Point(gCS, -10_m, 4_m, 35_km))); CHECK(type == medium.getMedium());
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)));
// a new refractive index // a new refractive index
const Medium type2 = corsika::Medium::StandardRock; const Medium type2 = corsika::Medium::StandardRock;
...@@ -80,10 +77,7 @@ TEST_CASE("MediumPropertyModel w/ Homogeneous") { ...@@ -80,10 +77,7 @@ TEST_CASE("MediumPropertyModel w/ Homogeneous") {
medium.setMedium(type2); medium.setMedium(type2);
// check that the returned refractive index is correct // check that the returned refractive index is correct
CHECK(type2 == medium.getMedium(Point(gCS, -10_m, 4_m, 35_km))); CHECK(type2 == medium.getMedium());
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)));
// define our axis vector // define our axis vector
Vector const axis(gCS, QuantityVector<dimensionless_d>(0, 0, 1)); 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