IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 0f868194 authored by Nikos Karastathis's avatar Nikos Karastathis :ocean: Committed by Ralf Ulrich
Browse files

clang format

parent 128eed1f
No related branches found
No related tags found
1 merge request!402Resolve "ExponentialRefractiveIndex assumes a flat environment"
......@@ -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();
......
......@@ -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]);
}
......
......@@ -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)
......
......@@ -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();
}
......
......@@ -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);
}
......
......@@ -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);
/**
......
......@@ -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()};
......
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