IAP GITLAB

Skip to content
Snippets Groups Projects
Commit a4b5d1a9 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Alan Coleman
Browse files

Resolve "cxroot module not working anymore after update to latest master"

parent a599430b
No related branches found
No related tags found
1 merge request!499Resolve "cxroot module not working anymore after update to latest master"
...@@ -20,13 +20,7 @@ namespace corsika { ...@@ -20,13 +20,7 @@ namespace corsika {
TEnvironmentInterface, TExtraEnv>::create(center, constants::EarthRadius::Mean, TEnvironmentInterface, TExtraEnv>::create(center, constants::EarthRadius::Mean,
std::forward<TArgs>(args)...); std::forward<TArgs>(args)...);
// composition values from AIRES manual builder.setNuclearComposition(standardAirComposition);
builder.setNuclearComposition({{
Code::Nitrogen,
Code::Argon,
Code::Oxygen,
},
{0.7847, 0.0047, 1. - 0.7847 - 0.0047}});
// add the standard atmosphere layers // add the standard atmosphere layers
auto const params = atmosphereParameterList[static_cast<uint8_t>(atmId)]; auto const params = atmosphereParameterList[static_cast<uint8_t>(atmId)];
......
...@@ -46,7 +46,7 @@ namespace corsika { ...@@ -46,7 +46,7 @@ namespace corsika {
} }
template <typename TFunction> template <typename TFunction>
inline auto NuclearComposition::getWeighted(TFunction const& func) const { inline auto NuclearComposition::getWeighted(TFunction func) const {
using ResultQuantity = decltype(func(std::declval<Code>())); using ResultQuantity = decltype(func(std::declval<Code>()));
auto const product = [&](auto const compID, auto const fraction) { auto const product = [&](auto const compID, auto const fraction) {
return func(compID) * fraction; return func(compID) * fraction;
...@@ -66,7 +66,7 @@ namespace corsika { ...@@ -66,7 +66,7 @@ namespace corsika {
} // namespace corsika } // namespace corsika
template <typename TFunction> template <typename TFunction>
inline auto NuclearComposition::getWeightedSum(TFunction const& func) const inline auto NuclearComposition::getWeightedSum(TFunction func) const
-> decltype(func(std::declval<Code>())) { -> decltype(func(std::declval<Code>())) {
using ResultQuantity = decltype(func(std::declval<Code>())); using ResultQuantity = decltype(func(std::declval<Code>()));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include <corsika/framework/core/Logging.hpp> #include <corsika/framework/core/Logging.hpp>
#include <corsika/media/CORSIKA7Atmospheres.hpp>
#include <corsika/modules/conex/CONEXhybrid.hpp> #include <corsika/modules/conex/CONEXhybrid.hpp>
#include <corsika/modules/conex/CONEX_f.hpp> #include <corsika/modules/conex/CONEX_f.hpp>
#include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/random/RNGManager.hpp>
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include <iomanip> #include <numeric>
#include <utility> #include <utility>
namespace corsika { namespace corsika {
...@@ -83,6 +84,28 @@ namespace corsika { ...@@ -83,6 +84,28 @@ namespace corsika {
CORSIKA_LOG_DEBUG("showerCore (C8): {}", CORSIKA_LOG_DEBUG("showerCore (C8): {}",
showerCore_.getCoordinates(center.getCoordinateSystem())); showerCore_.getCoordinates(center.getCoordinateSystem()));
auto const& components = ::corsika::standardAirComposition.getComponents();
auto const& fractions = ::corsika::standardAirComposition.getFractions();
if (::corsika::standardAirComposition.getSize() != 3) {
throw std::runtime_error{"CONEXhybrid only usable with standard 3-component air"};
}
std::transform(components.cbegin(), components.cend(), ::conex::cxair_.aira.begin(),
get_nucleus_A);
std::transform(components.cbegin(), components.cend(), ::conex::cxair_.airz.begin(),
get_nucleus_Z);
std::copy(fractions.cbegin(), fractions.cend(), ::conex::cxair_.airw.begin());
::conex::cxair_.airava =
std::inner_product(::conex::cxair_.airw.cbegin(), ::conex::cxair_.airw.cend(),
::conex::cxair_.aira.cbegin(), 0.);
::conex::cxair_.airavz =
std::inner_product(::conex::cxair_.airw.cbegin(), ::conex::cxair_.airw.cend(),
::conex::cxair_.airz.cbegin(), 0.);
// this is the CONEX default but actually unused there
::conex::cxair_.airi = {82.0e-09, 95.0e-09, 188.e-09};
int randomSeeds[3] = {1234, 0, int randomSeeds[3] = {1234, 0,
0}; // SEEDS ARE NOT USED. All random numbers are obtained from 0}; // SEEDS ARE NOT USED. All random numbers are obtained from
// the CORSIKA 8 stream "conex" and "epos"! // the CORSIKA 8 stream "conex" and "epos"!
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <corsika/media/IRefractiveIndexModel.hpp> #include <corsika/media/IRefractiveIndexModel.hpp>
#include <corsika/media/LayeredSphericalAtmosphereBuilder.hpp> #include <corsika/media/LayeredSphericalAtmosphereBuilder.hpp>
#include <corsika/framework/utility/ImplementsMixin.hpp> #include <corsika/framework/utility/ImplementsMixin.hpp>
#include <corsika/media/NuclearComposition.hpp>
// for detail namespace, NoExtraModelInner, NoExtraModel and traits // for detail namespace, NoExtraModelInner, NoExtraModel and traits
#include <corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp> #include <corsika/detail/media/LayeredSphericalAtmosphereBuilder.hpp>
...@@ -204,6 +205,10 @@ namespace corsika { ...@@ -204,6 +205,10 @@ namespace corsika {
void create_5layer_atmosphere(TEnvironment& env, AtmosphereId const atmId, void create_5layer_atmosphere(TEnvironment& env, AtmosphereId const atmId,
Point const& center, TArgs... args); Point const& center, TArgs... args);
//! The standard/default air composition with fraction values based on CORSIKA 7
static inline NuclearComposition const standardAirComposition{
{Code::Nitrogen, Code::Oxygen, Code::Argon}, {0.78479, .21052, 0.00469}};
} // namespace corsika } // namespace corsika
#include <corsika/detail/media/CORSIKA7Atmospheres.inl> #include <corsika/detail/media/CORSIKA7Atmospheres.inl>
\ No newline at end of file
...@@ -51,7 +51,7 @@ namespace corsika { ...@@ -51,7 +51,7 @@ namespace corsika {
* @retval returns the vector with weighted return types of func. * @retval returns the vector with weighted return types of func.
*/ */
template <typename TFunction> template <typename TFunction>
auto getWeighted(TFunction const& func) const; auto getWeighted(TFunction func) const;
/** /**
* Sum all all relative composition weighted by func(element) * Sum all all relative composition weighted by func(element)
...@@ -65,8 +65,7 @@ namespace corsika { ...@@ -65,8 +65,7 @@ namespace corsika {
* @retval returns the weighted sum with the type defined by the return type of func. * @retval returns the weighted sum with the type defined by the return type of func.
*/ */
template <typename TFunction> template <typename TFunction>
auto getWeightedSum(TFunction const& func) const auto getWeightedSum(TFunction func) const -> decltype(func(std::declval<Code>()));
-> decltype(func(std::declval<Code>()));
/** /**
* Number of elements in the composition array * Number of elements in the composition array
......
...@@ -36,13 +36,18 @@ namespace conex { ...@@ -36,13 +36,18 @@ namespace conex {
extern double double_rndm_interface(); extern double double_rndm_interface();
extern "C" {}
// the CONEX fortran interface // the CONEX fortran interface
extern "C" { extern "C" {
extern struct { std::array<double, 16> dptl; } cxoptl_; extern struct { std::array<double, 16> dptl; } cxoptl_;
//! common block for atmosphere composition
extern struct {
std::array<double, 3> airz, aira, airw; //!< nuclear Z, A, composition fraction
double airavz, airava; //!< average Z, A
std::array<double, 3> airi; //!< ionization potential, not used in cxroot
} cxair_;
void cegs4_(int&, int&); void cegs4_(int&, int&);
void initconex_(int&, int*, int&, int&, void initconex_(int&, int*, int&, int&,
......
Subproject commit 344c875bed534590eb86aa5e12b0382a9868fc64 Subproject commit c26ca0fada6ef182147d014bb7d413814f9cf202
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