diff --git a/corsika/detail/framework/geometry/FourVector.inl b/corsika/detail/framework/geometry/FourVector.inl index 5d871430dad5390aaa7b80d8fb83d7e16c165f03..62542aae5c309e12f503b5b8c1884c79fe9db747 100644 --- a/corsika/detail/framework/geometry/FourVector.inl +++ b/corsika/detail/framework/geometry/FourVector.inl @@ -54,8 +54,8 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator+=(FourVector const& b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator+=(FourVector const& b) { timeLike_ += b.timeLike_; spaceLike_ += b.spaceLike_; @@ -63,39 +63,39 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator-=(FourVector const& b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator-=(FourVector const& b) { timeLike_ -= b.timeLike_; spaceLike_ -= b.spaceLike_; return *this; } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator*=(double const b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator*=(double const b) { timeLike_ *= b; spaceLike_ *= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator/=(double const b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator/=(double const b) { timeLike_ /= b; spaceLike_.getComponents() /= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: - operator/(double const b) { + inline FourVector<TTimeType, TSpaceVecType>& + FourVector<TTimeType, TSpaceVecType>::operator/(double const b) { *this /= b; return *this; } template <typename TTimeType, typename TSpaceVecType> inline typename FourVector<TTimeType, TSpaceVecType>::norm_type - FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { + FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * second)>::value) return timeLike_ * b.timeLike_ * constants::cSquared - spaceLike_.norm(); diff --git a/corsika/detail/framework/geometry/QuantityVector.inl b/corsika/detail/framework/geometry/QuantityVector.inl index a932e4de8b596217bde32b1bb672e69866f05dc6..c7f9457b98dc0935c710f6d93fef6c53aab69f56 100644 --- a/corsika/detail/framework/geometry/QuantityVector.inl +++ b/corsika/detail/framework/geometry/QuantityVector.inl @@ -17,8 +17,8 @@ namespace corsika { template <typename TDimension> - inline typename QuantityVector<TDimension>::quantity_type QuantityVector<TDimension>:: - operator[](size_t const index) const { + inline typename QuantityVector<TDimension>::quantity_type + QuantityVector<TDimension>::operator[](size_t const index) const { return quantity_type(phys::units::detail::magnitude_tag, eigenVector_[index]); } diff --git a/corsika/detail/media/ExponentialRefractiveIndex.inl b/corsika/detail/media/ExponentialRefractiveIndex.inl index 0c22d2e00f28301402887ac05468b5233b3c46ac..17263125073e487400194a0a06ac34199065e4ac 100644 --- a/corsika/detail/media/ExponentialRefractiveIndex.inl +++ b/corsika/detail/media/ExponentialRefractiveIndex.inl @@ -15,7 +15,8 @@ namespace corsika { template <typename T> template <typename... Args> ExponentialRefractiveIndex<T>::ExponentialRefractiveIndex( - double const n0, InverseLengthType const lambda, Point const center, LengthType const radius, Args&&... args) + double const n0, InverseLengthType const lambda, Point const center, + LengthType const radius, Args&&... args) : T(std::forward<Args>(args)...) , n0_(n0) , lambda_(lambda) diff --git a/corsika/detail/media/WeightProvider.inl b/corsika/detail/media/WeightProvider.inl index b9cf1be7ae0e94d0a99b66366373ae62861fffc6..2bbc58dd3b994977cb8dfcc8e373b7e9e10cb053 100644 --- a/corsika/detail/media/WeightProvider.inl +++ b/corsika/detail/media/WeightProvider.inl @@ -20,7 +20,7 @@ namespace corsika { template <class AConstIterator, class BConstIterator> inline typename WeightProviderIterator<AConstIterator, BConstIterator>::value_type - WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { + WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { return ((*aIter_) * (*bIter_)).magnitude(); } diff --git a/corsika/detail/modules/proposal/ProposalProcessBase.inl b/corsika/detail/modules/proposal/ProposalProcessBase.inl index c7c38c10423ab6fe270c0851f7b77ca21d8ab73c..936798ea1cd05340ba2f0c4b397d5af9c47a068e 100644 --- a/corsika/detail/modules/proposal/ProposalProcessBase.inl +++ b/corsika/detail/modules/proposal/ProposalProcessBase.inl @@ -56,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); } diff --git a/corsika/media/ExponentialRefractiveIndex.hpp b/corsika/media/ExponentialRefractiveIndex.hpp index 862d4131a2df2344e4250ed30cde903340032edb..02f74dfa88cd21a5bd9c2c4b8b0a6893730d9e3d 100644 --- a/corsika/media/ExponentialRefractiveIndex.hpp +++ b/corsika/media/ExponentialRefractiveIndex.hpp @@ -23,9 +23,9 @@ namespace corsika { class ExponentialRefractiveIndex : public T { double n0_; ///< n0 constant. - InverseLengthType lambda_; ///< lambda parameter. - LengthType radius_; ///< the planet radius. - Point center_; ///< center of the planet. + InverseLengthType lambda_; ///< lambda parameter. + LengthType radius_; ///< the planet radius. + Point center_; ///< center of the planet. public: /** @@ -38,7 +38,8 @@ namespace corsika { * @param field The refractive index to return to a given point. */ template <typename... Args> - ExponentialRefractiveIndex(double const n0, InverseLengthType const lambda, Point const center, LengthType const radius, + ExponentialRefractiveIndex(double const n0, InverseLengthType const lambda, + Point const center, LengthType const radius, Args&&... args); /** diff --git a/tests/media/testRefractiveIndex.cpp b/tests/media/testRefractiveIndex.cpp index aace8c2c0c05249f78f9797b027917f4f54c15e9..63d1310f3903671e3e35c50cb5de6b4dc3a04d79 100644 --- a/tests/media/testRefractiveIndex.cpp +++ b/tests/media/testRefractiveIndex.cpp @@ -10,6 +10,7 @@ #include <corsika/framework/geometry/Line.hpp> #include <corsika/framework/geometry/RootCoordinateSystem.hpp> #include <corsika/framework/geometry/Vector.hpp> + #include <corsika/media/Environment.hpp> #include <corsika/media/LayeredSphericalAtmosphereBuilder.hpp> #include <corsika/media/UniformMagneticField.hpp> @@ -19,6 +20,7 @@ #include <corsika/media/NuclearComposition.hpp> #include <corsika/media/UniformRefractiveIndex.hpp> #include <corsika/media/ExponentialRefractiveIndex.hpp> +#include <corsika/media/CORSIKA7Atmospheres.hpp> #include <SetupTestTrajectory.hpp> #include <corsika/setup/SetupTrajectory.hpp> @@ -124,18 +126,21 @@ TEST_CASE("ExponentialRefractiveIndex w/ Homogeneous medium") { // the center of the earth Point const center_{gCS, 0_m, 0_m, 0_m}; // earth's radius - LengthType const radius_ {constants::EarthRadius::Mean}; + LengthType const radius_{constants::EarthRadius::Mean}; // create the atmospheric model and check refractive index - AtmModel medium(n0, lambda, center_, constants::EarthRadius::Mean, density, protonComposition); - CHECK(n0 - medium.getRefractiveIndex(Point(gCS, 0_m, 0_m, constants::EarthRadius::Mean)) == Approx(0)); + AtmModel medium(n0, lambda, center_, constants::EarthRadius::Mean, density, + protonComposition); + CHECK(n0 - medium.getRefractiveIndex( + Point(gCS, 0_m, 0_m, constants::EarthRadius::Mean)) == + Approx(0)); // another refractive index const double n0_{1}; const InverseLengthType lambda_{1 / 1_km}; // distance from the center - LengthType const dist_ {4_km}; + LengthType const dist_{4_km}; // create the atmospheric model and check refractive index AtmModel medium_(n0_, lambda_, center_, dist_, density, protonComposition); @@ -172,7 +177,7 @@ TEST_CASE("ExponentialRefractiveIndex w/ Homogeneous medium") { REQUIRE((medium_.getArclengthFromGrammage(track, density * 5_m) / 5_m) == Approx(1)); } -TEST_CASE("ExponentialRefractiveIndex w/ Layered atmosphere") { +TEST_CASE("ExponentialRefractiveIndex w/ 5-layered atmosphere") { logging::set_level(logging::level::info); @@ -187,32 +192,18 @@ TEST_CASE("ExponentialRefractiveIndex w/ Layered atmosphere") { const InverseLengthType lambda{1 / 1_km}; // a reference point to calculate the refractive index there - Point const ref_ {gCS, 0_m, 0_m, constants::EarthRadius::Mean}; + Point const ref_{gCS, 0_m, 0_m, constants::EarthRadius::Mean}; - // setup a realistic environment + // setup a 5-layered environment using EnvironmentInterface = IRefractiveIndexModel<IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>>; using EnvType = Environment<EnvironmentInterface>; EnvType env; - auto builder = make_layered_spherical_atmosphere_builder< - EnvironmentInterface, MyExtraEnv>::create(center_, - constants::EarthRadius::Mean, n0, lambda, - center_, constants::EarthRadius::Mean, - Medium::AirDry1Atm, - MagneticFieldVector{gCS, 10_uT, - 0_T, 0_T}); - builder.setNuclearComposition( - {{Code::Nitrogen, Code::Oxygen}, - {0.7847f, 1.f - 0.7847f}}); - - builder.addExponentialLayer(1222.6562_g / (1_cm * 1_cm), 994186.38_cm, 2_km); - builder.addExponentialLayer(1222.6562_g / (1_cm * 1_cm), 994186.38_cm, 4_km); - builder.addExponentialLayer(1144.9069_g / (1_cm * 1_cm), 878153.55_cm, 10_km); - builder.addExponentialLayer(1305.5948_g / (1_cm * 1_cm), 636143.04_cm, 40_km); - builder.addExponentialLayer(540.1778_g / (1_cm * 1_cm), 772170.16_cm, 100_km); - builder.addLinearLayer(1e9_cm, 112.8_km + constants::EarthRadius::Mean); - builder.assemble(env); + create_5layer_atmosphere<EnvironmentInterface, MyExtraEnv>( + env, AtmosphereId::LinsleyUSStd, center_, n0, lambda, center_, + constants::EarthRadius::Mean, Medium::AirDry1Atm, + MagneticFieldVector{gCS, 0_T, 50_uT, 0_T}); // get the universe for this environment auto const* const universe{env.getUniverse().get()};