diff --git a/corsika/detail/framework/utility/QuarticSolver.inl b/corsika/detail/framework/utility/QuarticSolver.inl index 84a9c516526c3a2d4a2275b602ca996e9cf9a0e3..81bda646e5b21aba7534df5265cf329997e35ed0 100644 --- a/corsika/detail/framework/utility/QuarticSolver.inl +++ b/corsika/detail/framework/utility/QuarticSolver.inl @@ -36,7 +36,7 @@ namespace corsika { std::vector<double> x3 = solve_cubic_real(1, a3, b3, c3, epsilon); if (!x3.size()) { - return {}; // no solution, numeric problem + return {}; // no solution, numeric problem (LCOV_EXCL_LINE) } long double y = x3[0]; // there is always at least one solution // The essence - choosing Y with maximal absolute value. diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index 7adc1730bfeee9f38646f957100e0e1eabb529d1..b3d4b916c5ea6af18ea40d23166d296ae173095b 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -31,6 +31,7 @@ namespace corsika { // tracking: Note, this is NOT a general solution and should be clearly revised with // a more robust tracking. #ifdef DEBUG if (deleteOnHit_) { + // since this is basically a bug, it cannot be tested LCOV_EXCL_START LengthType const check = (particle.getPosition() - plane_.getCenter()).dot(plane_.getNormal()); if (check < 0_m) { @@ -38,6 +39,7 @@ namespace corsika { CORSIKA_LOG_WARN("Temporary fix: write and remove particle."); } else return ProcessReturn::Ok; + // LCOV_EXCL_STOP } else // #endif return ProcessReturn::Ok; diff --git a/corsika/framework/geometry/LeapFrogTrajectory.hpp b/corsika/framework/geometry/LeapFrogTrajectory.hpp index e1c2bff3ba7d7d245c78b03430e84b963e5f0ff4..ddccc83c80165713130e216b7118e984b5875281 100644 --- a/corsika/framework/geometry/LeapFrogTrajectory.hpp +++ b/corsika/framework/geometry/LeapFrogTrajectory.hpp @@ -32,7 +32,7 @@ namespace corsika { * $ * \vec{x}(t_{i+0.5}) = \vec{x}(t_{i}) + \vec{v(t_{i})} * \Delta t / 2 \\ * \vec{v}(t_{i+1}) = \vec{v}(t_{i}) + \vec{v}(t_{i})\cross\vec{B}(x_{i}, t_{i}) * - *\Delta t \\ + * \Delta t \\ * \vec{x}(t_{i+1}) = \vec{x}(t_{i+0.5}) + \vec{v}(t_{i+1}) * \Delta t /2 \\ * $ * diff --git a/examples/hybrid_MC.cpp b/examples/hybrid_MC.cpp index a37fc84b1fb01d3588172f33b56afa2f7066f512..e065c4ee8ddc787e2bd56d2f8502f37cfb7d0bd1 100644 --- a/examples/hybrid_MC.cpp +++ b/examples/hybrid_MC.cpp @@ -110,7 +110,6 @@ private: Plane plane_; }; - template <typename T> using MyExtraEnv = MediumPropertyModel<UniformMagneticField<T>>; diff --git a/tests/framework/testSolver.cpp b/tests/framework/testSolver.cpp index efcd6277f2e3974ea1c2efbfd6e6ea3460fbc3df..197061b813ce2b7fdee427e9a450d6291f1a7785 100644 --- a/tests/framework/testSolver.cpp +++ b/tests/framework/testSolver.cpp @@ -305,10 +305,12 @@ TEST_CASE("Solver") { pol4(z4, a, b, c, d, e)); vector<double> s1 = andre::solve_quartic_real(a, b, c, d, e); - // vector<double> s1 = solve_quartic_real(a, b, c, d, e, epsilon); remove_duplicates(s1, epsilon_check * 10); + vector<double> s2 = solve_quartic_real(a, b, c, d, e); + remove_duplicates(s2, epsilon_check * 5); CORSIKA_LOG_INFO("N={}, s1=[{}]", s1.size(), fmt::join(s1, ", ")); + CORSIKA_LOG_INFO("N={}, s2=[{}]", s2.size(), fmt::join(s2, ", ")); CHECK(s1.size() == idegree + 1); for (double value : s1) { @@ -326,8 +328,27 @@ TEST_CASE("Solver") { (value == Approx(z4).epsilon(epsilon_check)))); } } + + // this is a bit less precise + CHECK(s2.size() == idegree + 1); + for (double value : s2) { + CORSIKA_LOG_INFO("value={}, z1={} z2={} z3={} z4={} eps_check={}", value, z1, + z2, z3, z4, epsilon_check); + if (std::abs(value) < epsilon_check) { + CHECK(((value == Approx(z1).margin(epsilon_check * 5)) || + (value == Approx(z2).margin(epsilon_check * 5)) || + (value == Approx(z3).margin(epsilon_check * 5)) || + (value == Approx(z4).margin(epsilon_check * 5)))); + } else { + CHECK(((value == Approx(z1).epsilon(epsilon_check * 5)) || + (value == Approx(z2).epsilon(epsilon_check * 5)) || + (value == Approx(z3).epsilon(epsilon_check * 5)) || + (value == Approx(z4).epsilon(epsilon_check * 5)))); + } + } } } } + } // quartic }