From 7e813f46bd0f83a135bf1d0adefa3d39507008ce Mon Sep 17 00:00:00 2001 From: Hugo Brunie Date: Mon, 11 Jan 2021 03:02:45 -0800 Subject: [PATCH 1/5] Rename pde fokkerplanck 4p1a and 4p2 fokkerplanck1 from 4p1a to pitch E and fokkerplanck1 from 4p2 to pitch C and Change all 4p1a by pitch_E (into testing coefficients and time_advance too). clang format. Fix a non-initialized variable warning in lib_dispatch. --- src/coefficients_tests.cpp | 14 ++++++---- src/lib_dispatch.cpp | 2 +- src/main.cpp | 4 +++ src/pde.hpp | 16 +++++------ ..._4p2.hpp => pde_fokkerplanck1_pitch_C.hpp} | 4 +-- ...4p1a.hpp => pde_fokkerplanck1_pitch_E.hpp} | 6 ++-- src/program_options.hpp | 12 ++++---- src/time_advance_tests.cpp | 28 +++++++++---------- ...lanck1_pitch_C_coefficients_l5_d2_1_1.dat} | 0 ...tch_C_coefficients_norotate_l5_d2_1_1.dat} | 0 ...lanck1_pitch_E_coefficients_l4_d3_1_1.dat} | 0 ...tch_E_coefficients_norotate_l4_d3_1_1.dat} | 0 ... => fokkerplanck1_pitch_C_fg_l2_d2_t0.dat} | 0 ... => fokkerplanck1_pitch_C_fg_l2_d2_t1.dat} | 0 ... => fokkerplanck1_pitch_C_fg_l2_d2_t2.dat} | 0 ... => fokkerplanck1_pitch_C_fg_l2_d2_t3.dat} | 0 ... => fokkerplanck1_pitch_C_fg_l2_d2_t4.dat} | 0 ... => fokkerplanck1_pitch_C_sg_l2_d2_t0.dat} | 0 ... => fokkerplanck1_pitch_C_sg_l2_d2_t1.dat} | 0 ... => fokkerplanck1_pitch_C_sg_l2_d2_t2.dat} | 0 ... => fokkerplanck1_pitch_C_sg_l2_d2_t3.dat} | 0 ... => fokkerplanck1_pitch_C_sg_l2_d2_t4.dat} | 0 ... fokkerplanck1_pitch_E_ad_sg_l4_d4_t0.dat} | 0 ... fokkerplanck1_pitch_E_ad_sg_l4_d4_t1.dat} | 0 ... fokkerplanck1_pitch_E_ad_sg_l4_d4_t2.dat} | 0 ... fokkerplanck1_pitch_E_ad_sg_l4_d4_t3.dat} | 0 ... fokkerplanck1_pitch_E_ad_sg_l4_d4_t4.dat} | 0 ... => fokkerplanck1_pitch_E_sg_l2_d2_t0.dat} | 0 ... => fokkerplanck1_pitch_E_sg_l2_d2_t1.dat} | 0 ... => fokkerplanck1_pitch_E_sg_l2_d2_t2.dat} | 0 ... => fokkerplanck1_pitch_E_sg_l2_d2_t3.dat} | 0 ... => fokkerplanck1_pitch_E_sg_l2_d2_t4.dat} | 0 32 files changed, 46 insertions(+), 40 deletions(-) rename src/pde/{pde_fokkerplanck1_4p2.hpp => pde_fokkerplanck1_pitch_C.hpp} (98%) rename src/pde/{pde_fokkerplanck1_4p1a.hpp => pde_fokkerplanck1_pitch_E.hpp} (96%) rename testing/generated-inputs/coefficients/{fokkerplanck1_4p2_coefficients_l5_d2_1_1.dat => fokkerplanck1_pitch_C_coefficients_l5_d2_1_1.dat} (100%) rename testing/generated-inputs/coefficients/{fokkerplanck1_4p2_coefficients_norotate_l5_d2_1_1.dat => fokkerplanck1_pitch_C_coefficients_norotate_l5_d2_1_1.dat} (100%) rename testing/generated-inputs/coefficients/{fokkerplanck1_4p1a_coefficients_l4_d3_1_1.dat => fokkerplanck1_pitch_E_coefficients_l4_d3_1_1.dat} (100%) rename testing/generated-inputs/coefficients/{fokkerplanck1_4p1a_coefficients_norotate_l4_d3_1_1.dat => fokkerplanck1_pitch_E_coefficients_norotate_l4_d3_1_1.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_fg_l2_d2_t0.dat => fokkerplanck1_pitch_C_fg_l2_d2_t0.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_fg_l2_d2_t1.dat => fokkerplanck1_pitch_C_fg_l2_d2_t1.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_fg_l2_d2_t2.dat => fokkerplanck1_pitch_C_fg_l2_d2_t2.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_fg_l2_d2_t3.dat => fokkerplanck1_pitch_C_fg_l2_d2_t3.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_fg_l2_d2_t4.dat => fokkerplanck1_pitch_C_fg_l2_d2_t4.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_sg_l2_d2_t0.dat => fokkerplanck1_pitch_C_sg_l2_d2_t0.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_sg_l2_d2_t1.dat => fokkerplanck1_pitch_C_sg_l2_d2_t1.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_sg_l2_d2_t2.dat => fokkerplanck1_pitch_C_sg_l2_d2_t2.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_sg_l2_d2_t3.dat => fokkerplanck1_pitch_C_sg_l2_d2_t3.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p2_sg_l2_d2_t4.dat => fokkerplanck1_pitch_C_sg_l2_d2_t4.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_ad_sg_l4_d4_t0.dat => fokkerplanck1_pitch_E_ad_sg_l4_d4_t0.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_ad_sg_l4_d4_t1.dat => fokkerplanck1_pitch_E_ad_sg_l4_d4_t1.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_ad_sg_l4_d4_t2.dat => fokkerplanck1_pitch_E_ad_sg_l4_d4_t2.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_ad_sg_l4_d4_t3.dat => fokkerplanck1_pitch_E_ad_sg_l4_d4_t3.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_ad_sg_l4_d4_t4.dat => fokkerplanck1_pitch_E_ad_sg_l4_d4_t4.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_sg_l2_d2_t0.dat => fokkerplanck1_pitch_E_sg_l2_d2_t0.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_sg_l2_d2_t1.dat => fokkerplanck1_pitch_E_sg_l2_d2_t1.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_sg_l2_d2_t2.dat => fokkerplanck1_pitch_E_sg_l2_d2_t2.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_sg_l2_d2_t3.dat => fokkerplanck1_pitch_E_sg_l2_d2_t3.dat} (100%) rename testing/generated-inputs/time_advance/{fokkerplanck1_4p1a_sg_l2_d2_t4.dat => fokkerplanck1_pitch_E_sg_l2_d2_t4.dat} (100%) diff --git a/src/coefficients_tests.cpp b/src/coefficients_tests.cpp index 1532818d5..7de2173cc 100644 --- a/src/coefficients_tests.cpp +++ b/src/coefficients_tests.cpp @@ -174,11 +174,12 @@ TEMPLATE_TEST_CASE("continuity 6 terms", "[coefficients]", double, float) } } -TEMPLATE_TEST_CASE("fokkerplanck1_4p1a terms", "[coefficients]", double, float) +TEMPLATE_TEST_CASE("fokkerplanck1_pitch_E terms", "[coefficients]", double, + float) { - auto const pde_choice = PDE_opts::fokkerplanck_1d_4p1a; + auto const pde_choice = PDE_opts::fokkerplanck_1d_pitch_E; auto const gold_path = "../testing/generated-inputs/coefficients/" - "fokkerplanck1_4p1a_coefficients"; + "fokkerplanck1_pitch_E_coefficients"; TestType const tol_factor = std::is_same::value ? 1e-13 : 1e-5; @@ -191,11 +192,12 @@ TEMPLATE_TEST_CASE("fokkerplanck1_4p1a terms", "[coefficients]", double, float) } } -TEMPLATE_TEST_CASE("fokkerplanck1_4p2 terms", "[coefficients]", double, float) +TEMPLATE_TEST_CASE("fokkerplanck1_pitch_C terms", "[coefficients]", double, + float) { - auto const pde_choice = PDE_opts::fokkerplanck_1d_4p2; + auto const pde_choice = PDE_opts::fokkerplanck_1d_pitch_C; auto const gold_path = "../testing/generated-inputs/coefficients/" - "fokkerplanck1_4p2_coefficients"; + "fokkerplanck1_pitch_C_coefficients"; TestType const tol_factor = std::is_same::value ? 1e-14 : 1e-5; diff --git a/src/lib_dispatch.cpp b/src/lib_dispatch.cpp index bdfd7908a..fa5f11a38 100644 --- a/src/lib_dispatch.cpp +++ b/src/lib_dispatch.cpp @@ -268,7 +268,7 @@ P dot(int *n, P *x, int *incx, P *y, int *incy, resource const resrc) // no non-fp blas on device tools::expect(std::is_floating_point_v

); - P result = 0.0; + P result = 0.; // instantiated for these two fp types if constexpr (std::is_same::value) { diff --git a/src/main.cpp b/src/main.cpp index 009a3c51c..26e3bad19 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -215,6 +215,10 @@ int main(int argc, char **argv) << relative_errors(i) << " %" << '\n'; } } + else + { + node_out() << "No analytic solution found." << '\n'; + } // write output to file #ifdef ASGARD_IO_HIGHFIVE diff --git a/src/pde.hpp b/src/pde.hpp index cd0c21e51..a6048dd07 100644 --- a/src/pde.hpp +++ b/src/pde.hpp @@ -19,11 +19,11 @@ #include "pde/pde_continuity6.hpp" #include "pde/pde_diffusion1.hpp" #include "pde/pde_diffusion2.hpp" -#include "pde/pde_fokkerplanck1_4p1a.hpp" -#include "pde/pde_fokkerplanck1_4p2.hpp" #include "pde/pde_fokkerplanck1_4p3.hpp" #include "pde/pde_fokkerplanck1_4p4.hpp" #include "pde/pde_fokkerplanck1_4p5.hpp" +#include "pde/pde_fokkerplanck1_pitch_C.hpp" +#include "pde/pde_fokkerplanck1_pitch_E.hpp" #include "pde/pde_fokkerplanck2_complete.hpp" #include "tensors.hpp" @@ -53,10 +53,10 @@ std::unique_ptr> make_PDE(parser const &cli_input) return std::make_unique>(cli_input); case PDE_opts::continuity_6: return std::make_unique>(cli_input); - case PDE_opts::fokkerplanck_1d_4p1a: - return std::make_unique>(cli_input); - case PDE_opts::fokkerplanck_1d_4p2: - return std::make_unique>(cli_input); + case PDE_opts::fokkerplanck_1d_pitch_E: + return std::make_unique>(cli_input); + case PDE_opts::fokkerplanck_1d_pitch_C: + return std::make_unique>(cli_input); case PDE_opts::fokkerplanck_1d_4p3: return std::make_unique>(cli_input); case PDE_opts::fokkerplanck_1d_4p4: @@ -114,10 +114,10 @@ make_PDE(PDE_opts const pde_choice, int const level = parser::NO_USER_VALUE, case PDE_opts::continuity_6: return fk::vector(std::vector(6, level)); - case PDE_opts::fokkerplanck_1d_4p1a: + case PDE_opts::fokkerplanck_1d_pitch_E: return fk::vector(std::vector(1, level)); - case PDE_opts::fokkerplanck_1d_4p2: + case PDE_opts::fokkerplanck_1d_pitch_C: return fk::vector(std::vector(1, level)); case PDE_opts::fokkerplanck_1d_4p3: diff --git a/src/pde/pde_fokkerplanck1_4p2.hpp b/src/pde/pde_fokkerplanck1_pitch_C.hpp similarity index 98% rename from src/pde/pde_fokkerplanck1_4p2.hpp rename to src/pde/pde_fokkerplanck1_pitch_C.hpp index 5786046d8..fdddc6657 100644 --- a/src/pde/pde_fokkerplanck1_4p2.hpp +++ b/src/pde/pde_fokkerplanck1_pitch_C.hpp @@ -32,10 +32,10 @@ // // --------------------------------------------------------------------------- template -class PDE_fokkerplanck_1d_4p2 : public PDE

+class PDE_fokkerplanck_1d_pitch_C : public PDE

{ public: - PDE_fokkerplanck_1d_4p2(parser const &cli_input) + PDE_fokkerplanck_1d_pitch_C(parser const &cli_input) : PDE

(cli_input, num_dims_, num_sources_, num_terms_, dimensions_, terms_, sources_, exact_vector_funcs_, exact_scalar_func_, get_dt_, do_poisson_solve_, has_analytic_soln_) diff --git a/src/pde/pde_fokkerplanck1_4p1a.hpp b/src/pde/pde_fokkerplanck1_pitch_E.hpp similarity index 96% rename from src/pde/pde_fokkerplanck1_4p1a.hpp rename to src/pde/pde_fokkerplanck1_pitch_E.hpp index 4d5081969..c3668d9c9 100644 --- a/src/pde/pde_fokkerplanck1_4p1a.hpp +++ b/src/pde/pde_fokkerplanck1_pitch_E.hpp @@ -32,10 +32,10 @@ // // --------------------------------------------------------------------------- template -class PDE_fokkerplanck_1d_4p1a : public PDE

+class PDE_fokkerplanck_1d_pitch_E : public PDE

{ public: - PDE_fokkerplanck_1d_4p1a(parser const &cli_input) + PDE_fokkerplanck_1d_pitch_E(parser const &cli_input) : PDE

(cli_input, num_dims_, num_sources_, num_terms_, dimensions_, terms_, sources_, exact_vector_funcs_, exact_scalar_func_, get_dt_, do_poisson_solve_, has_analytic_soln_) @@ -68,7 +68,7 @@ class PDE_fokkerplanck_1d_4p1a : public PDE

// analytic solution static P phi(P const z, P const t) { return std::tanh(std::atanh(z) - t); } - static P f0(P const z) { return z * 0 + 1; } + static P f0(P const z) { return z * 0. + 1; } static fk::vector

analytic_solution_dim0(fk::vector

const z, P const t = 0) diff --git a/src/program_options.hpp b/src/program_options.hpp index 4d1a075fc..22a4f49b7 100644 --- a/src/program_options.hpp +++ b/src/program_options.hpp @@ -30,8 +30,8 @@ enum class PDE_opts continuity_2, continuity_3, continuity_6, - fokkerplanck_1d_4p1a, - fokkerplanck_1d_4p2, + fokkerplanck_1d_pitch_E, + fokkerplanck_1d_pitch_C, fokkerplanck_1d_4p3, fokkerplanck_1d_4p4, fokkerplanck_1d_4p5, @@ -70,14 +70,14 @@ static pde_map_t const pde_mapping = { PDE_opts::continuity_6)}, // the following are labelled according to figure number in the runaway // electron paper - {"fokkerplanck_1d_4p1a", + {"fokkerplanck_1d_pitch_E", PDE_descriptor( "1D pitch angle collisional term: df/dt == d/dz ( (1-z^2) df/dz", - PDE_opts::fokkerplanck_1d_4p1a)}, - {"fokkerplanck_1d_4p2", + PDE_opts::fokkerplanck_1d_pitch_E)}, + {"fokkerplanck_1d_pitch_C", PDE_descriptor( "1D pitch angle collisional term: df/dt == d/dz ( (1-z^2) df/dz", - PDE_opts::fokkerplanck_1d_4p2)}, + PDE_opts::fokkerplanck_1d_pitch_C)}, {"fokkerplanck_1d_4p3", PDE_descriptor("Radiation damping term: df/dt == -d/dz ( z(1-z^2)f )", PDE_opts::fokkerplanck_1d_4p3)}, diff --git a/src/time_advance_tests.cpp b/src/time_advance_tests.cpp index 6d718c586..2793fe545 100644 --- a/src/time_advance_tests.cpp +++ b/src/time_advance_tests.cpp @@ -213,14 +213,14 @@ TEST_CASE("adaptive time advance") time_advance_test(parse, gold_base, tol_factor); } - SECTION("fokkerplanck1_4p1a explicit") + SECTION("fokkerplanck1_pitch_E explicit") { auto const tol_factor = 1e-15; - std::string const pde_choice = "fokkerplanck_1d_4p1a"; + std::string const pde_choice = "fokkerplanck_1d_pitch_E"; auto const degree = 4; fk::vector const levels{4}; std::string const gold_base = "../testing/generated-inputs/time_advance/" - "fokkerplanck1_4p1a_ad_sg_l4_d4_t"; + "fokkerplanck1_pitch_E_ad_sg_l4_d4_t"; auto const full_grid = false; auto const use_implicit = parser::DEFAULT_USE_IMPLICIT; @@ -527,21 +527,21 @@ TEMPLATE_TEST_CASE("time advance - continuity 6", "[time_advance]", float, } } -TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_4p2", "[time_advance]", +TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_pitch_C", "[time_advance]", float, double) { - std::string const pde_choice = "fokkerplanck_1d_4p2"; + std::string const pde_choice = "fokkerplanck_1d_pitch_C"; TestType const cfl = 0.01; TestType const tol_factor = std::is_same::value ? 1e-15 : 1e-6; auto const num_dims = 1; - SECTION("fokkerplanck_1d_4p2, level 2, degree 2, sparse grid") + SECTION("fokkerplanck_1d_pitch_C, level 2, degree 2, sparse grid") { - int const degree = 2; - int const level = 2; - std::string const gold_base = - "../testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t"; + int const degree = 2; + int const level = 2; + std::string const gold_base = "../testing/generated-inputs/time_advance/" + "fokkerplanck1_pitch_C_sg_l2_d2_t"; auto const full_grid = false; parser const parse( @@ -579,21 +579,21 @@ TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_4p3", "[time_advance]", } } -TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_4p1a", "[time_advance]", +TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_pitch_E", "[time_advance]", float, double) { - std::string const pde_choice = "fokkerplanck_1d_4p1a"; + std::string const pde_choice = "fokkerplanck_1d_pitch_E"; TestType const cfl = 0.01; TestType const tol_factor = std::is_same::value ? 1e-15 : 1e-5; auto const num_dims = 1; - SECTION("fokkerplanck_1d_4p1a, level 2, degree 2, sparse grid") + SECTION("fokkerplanck_1d_pitch_E, level 2, degree 2, sparse grid") { int const degree = 2; int const level = 2; std::string const gold_base = "../testing/generated-inputs/time_advance/" - "fokkerplanck1_4p1a_sg_l2_d2_t"; + "fokkerplanck1_pitch_E_sg_l2_d2_t"; auto const full_grid = false; parser const parse( diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_4p2_coefficients_l5_d2_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_C_coefficients_l5_d2_1_1.dat similarity index 100% rename from testing/generated-inputs/coefficients/fokkerplanck1_4p2_coefficients_l5_d2_1_1.dat rename to testing/generated-inputs/coefficients/fokkerplanck1_pitch_C_coefficients_l5_d2_1_1.dat diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_4p2_coefficients_norotate_l5_d2_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_C_coefficients_norotate_l5_d2_1_1.dat similarity index 100% rename from testing/generated-inputs/coefficients/fokkerplanck1_4p2_coefficients_norotate_l5_d2_1_1.dat rename to testing/generated-inputs/coefficients/fokkerplanck1_pitch_C_coefficients_norotate_l5_d2_1_1.dat diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_4p1a_coefficients_l4_d3_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_l4_d3_1_1.dat similarity index 100% rename from testing/generated-inputs/coefficients/fokkerplanck1_4p1a_coefficients_l4_d3_1_1.dat rename to testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_l4_d3_1_1.dat diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_4p1a_coefficients_norotate_l4_d3_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_norotate_l4_d3_1_1.dat similarity index 100% rename from testing/generated-inputs/coefficients/fokkerplanck1_4p1a_coefficients_norotate_l4_d3_1_1.dat rename to testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_norotate_l4_d3_1_1.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t0.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t0.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t0.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t1.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t1.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t1.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t2.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t2.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t2.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t3.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t3.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t3.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t4.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_fg_l2_d2_t4.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_fg_l2_d2_t4.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t0.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t0.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t0.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t1.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t1.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t1.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t2.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t2.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t2.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t3.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t3.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t3.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t4.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p2_sg_l2_d2_t4.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_C_sg_l2_d2_t4.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t0.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t0.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t0.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t1.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t1.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t1.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t2.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t2.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t2.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t3.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t3.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t3.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t4.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_ad_sg_l4_d4_t4.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_ad_sg_l4_d4_t4.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t0.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t0.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t0.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t1.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t1.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t1.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t2.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t2.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t2.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t3.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t3.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t3.dat diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t4.dat similarity index 100% rename from testing/generated-inputs/time_advance/fokkerplanck1_4p1a_sg_l2_d2_t4.dat rename to testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_sg_l2_d2_t4.dat From 9d143e78e7dd225e3fd51f34227195177abc3419 Mon Sep 17 00:00:00 2001 From: Hugo Brunie Date: Thu, 21 Jan 2021 02:52:00 -0800 Subject: [PATCH 2/5] Adding fokkerplanck pitch E case 2. To add case we are using one more template value for PDE. TODO: add case2 proper gold generated tests for coefficients and time advance. --- src/coefficients_tests.cpp | 26 ++++++++-- src/pde.hpp | 14 +++-- src/pde/pde_fokkerplanck1_pitch_E.hpp | 19 ++++--- src/program_options.hpp | 52 +++++++++++++------ src/time_advance_tests.cpp | 31 +++++++++-- ..._pitch_E_case1_coefficients_l4_d3_1_1.dat} | 0 ...case1_coefficients_norotate_l4_d3_1_1.dat} | 0 7 files changed, 108 insertions(+), 34 deletions(-) rename testing/generated-inputs/coefficients/{fokkerplanck1_pitch_E_coefficients_l4_d3_1_1.dat => fokkerplanck1_pitch_E_case1_coefficients_l4_d3_1_1.dat} (100%) rename testing/generated-inputs/coefficients/{fokkerplanck1_pitch_E_coefficients_norotate_l4_d3_1_1.dat => fokkerplanck1_pitch_E_case1_coefficients_norotate_l4_d3_1_1.dat} (100%) diff --git a/src/coefficients_tests.cpp b/src/coefficients_tests.cpp index 7de2173cc..bfc046377 100644 --- a/src/coefficients_tests.cpp +++ b/src/coefficients_tests.cpp @@ -174,12 +174,30 @@ TEMPLATE_TEST_CASE("continuity 6 terms", "[coefficients]", double, float) } } -TEMPLATE_TEST_CASE("fokkerplanck1_pitch_E terms", "[coefficients]", double, - float) +TEMPLATE_TEST_CASE("fokkerplanck1_pitch_E case1 terms", "[coefficients]", + double, float) +{ + auto const pde_choice = PDE_opts::fokkerplanck_1d_pitch_E_case1; + auto const gold_path = "../testing/generated-inputs/coefficients/" + "fokkerplanck1_pitch_E_case1_coefficients"; + TestType const tol_factor = + std::is_same::value ? 1e-13 : 1e-5; + + SECTION("level 4, degree 3") + { + auto const levels = fk::vector{4}; + auto const degree = 3; + parser const test_parse(pde_choice, levels, degree); + test_coefficients(test_parse, gold_path, tol_factor); + } +} + +TEMPLATE_TEST_CASE("fokkerplanck1_pitch_E case2 terms", "[coefficients]", + double, float) { - auto const pde_choice = PDE_opts::fokkerplanck_1d_pitch_E; + auto const pde_choice = PDE_opts::fokkerplanck_1d_pitch_E_case2; auto const gold_path = "../testing/generated-inputs/coefficients/" - "fokkerplanck1_pitch_E_coefficients"; + "fokkerplanck1_pitch_E_case2_coefficients"; TestType const tol_factor = std::is_same::value ? 1e-13 : 1e-5; diff --git a/src/pde.hpp b/src/pde.hpp index a6048dd07..a757763b8 100644 --- a/src/pde.hpp +++ b/src/pde.hpp @@ -41,6 +41,7 @@ // --------------------------------------------------------------------------- template + std::unique_ptr> make_PDE(parser const &cli_input) { switch (cli_input.get_selected_pde()) @@ -53,8 +54,12 @@ std::unique_ptr> make_PDE(parser const &cli_input) return std::make_unique>(cli_input); case PDE_opts::continuity_6: return std::make_unique>(cli_input); - case PDE_opts::fokkerplanck_1d_pitch_E: - return std::make_unique>(cli_input); + case PDE_opts::fokkerplanck_1d_pitch_E_case1: + return std::make_unique< + PDE_fokkerplanck_1d_pitch_E>(cli_input); + case PDE_opts::fokkerplanck_1d_pitch_E_case2: + return std::make_unique< + PDE_fokkerplanck_1d_pitch_E>(cli_input); case PDE_opts::fokkerplanck_1d_pitch_C: return std::make_unique>(cli_input); case PDE_opts::fokkerplanck_1d_4p3: @@ -114,7 +119,10 @@ make_PDE(PDE_opts const pde_choice, int const level = parser::NO_USER_VALUE, case PDE_opts::continuity_6: return fk::vector(std::vector(6, level)); - case PDE_opts::fokkerplanck_1d_pitch_E: + case PDE_opts::fokkerplanck_1d_pitch_E_case1: + return fk::vector(std::vector(1, level)); + + case PDE_opts::fokkerplanck_1d_pitch_E_case2: return fk::vector(std::vector(1, level)); case PDE_opts::fokkerplanck_1d_pitch_C: diff --git a/src/pde/pde_fokkerplanck1_pitch_E.hpp b/src/pde/pde_fokkerplanck1_pitch_E.hpp index c3668d9c9..5de99894d 100644 --- a/src/pde/pde_fokkerplanck1_pitch_E.hpp +++ b/src/pde/pde_fokkerplanck1_pitch_E.hpp @@ -31,7 +31,7 @@ // q=df/fz with homogeneous Dirichlet BC // // --------------------------------------------------------------------------- -template +template class PDE_fokkerplanck_1d_pitch_E : public PDE

{ public: @@ -68,7 +68,8 @@ class PDE_fokkerplanck_1d_pitch_E : public PDE

// analytic solution static P phi(P const z, P const t) { return std::tanh(std::atanh(z) - t); } - static P f0(P const z) { return z * 0. + 1; } + static P f0_mod0(P const z) { return z * 0. + 1; } + static P f0_mod1(P const z) { return exp(-pow(z, 2) / pow(0.1, 2)); } static fk::vector

analytic_solution_dim0(fk::vector

const z, P const t = 0) @@ -76,11 +77,15 @@ class PDE_fokkerplanck_1d_pitch_E : public PDE

fk::vector

f(z.size()); for (int i = 0; i < z.size(); ++i) { - auto p = phi(z(i), t); - auto t1 = 1 - std::pow(p, 2); - auto t2 = 1 - std::pow(z(i), 2); - auto t3 = f0(p); - f(i) = t1 / t2 * t3; + P p = phi(z(i), t); + P t1 = 1 - std::pow(p, 2); + P t2 = 1 - std::pow(z(i), 2); + P t3 = 0.; + if constexpr (user_case == PDE_case_opts::mod1) + t3 = f0_mod1(p); + else + t3 = f0_mod0(p); + f(i) = t1 / t2 * t3; } return f; } diff --git a/src/program_options.hpp b/src/program_options.hpp index 22a4f49b7..e44fc3509 100644 --- a/src/program_options.hpp +++ b/src/program_options.hpp @@ -30,7 +30,8 @@ enum class PDE_opts continuity_2, continuity_3, continuity_6, - fokkerplanck_1d_pitch_E, + fokkerplanck_1d_pitch_E_case1, + fokkerplanck_1d_pitch_E_case2, fokkerplanck_1d_pitch_C, fokkerplanck_1d_4p3, fokkerplanck_1d_4p4, @@ -41,6 +42,15 @@ enum class PDE_opts // FIXME will need to add the user supplied PDE choice }; +enum class PDE_case_opts +{ + mod0, + mod1, + mod2, + mod_count + // FIXME will need to add the user supplied PDE cases choice +}; + class PDE_descriptor { public: @@ -70,10 +80,16 @@ static pde_map_t const pde_mapping = { PDE_opts::continuity_6)}, // the following are labelled according to figure number in the runaway // electron paper - {"fokkerplanck_1d_pitch_E", + {"fokkerplanck_1d_pitch_E_case1", PDE_descriptor( - "1D pitch angle collisional term: df/dt == d/dz ( (1-z^2) df/dz", - PDE_opts::fokkerplanck_1d_pitch_E)}, + "1D pitch angle collisional term: df/dt == d/dz ( (1-z^2) df/dz, f0 is" + " constant.", + PDE_opts::fokkerplanck_1d_pitch_E_case1)}, + {"fokkerplanck_1d_pitch_E_case2", + PDE_descriptor( + "1D pitch angle collisional term: df/dt == d/dz ( (1-z^2) df/dz, f0 is" + " gaussian.", + PDE_opts::fokkerplanck_1d_pitch_E_case2)}, {"fokkerplanck_1d_pitch_C", PDE_descriptor( "1D pitch angle collisional term: df/dt == d/dz ( (1-z^2) df/dz", @@ -111,18 +127,19 @@ class parser static auto constexpr NO_USER_VALUE_FP = std::numeric_limits::min(); static auto constexpr NO_USER_VALUE_STR = "none"; - static auto constexpr DEFAULT_CFL = 0.01; - static auto constexpr DEFAULT_ADAPT_THRESH = 1e-3; - static auto constexpr DEFAULT_MAX_LEVEL = 8; - static auto constexpr DEFAULT_TIME_STEPS = 10; - static auto constexpr DEFAULT_WRITE_FREQ = 0; - static auto constexpr DEFAULT_USE_IMPLICIT = false; - static auto constexpr DEFAULT_USE_FG = false; - static auto constexpr DEFAULT_DO_POISSON = false; - static auto constexpr DEFAULT_DO_ADAPT = false; - static auto constexpr DEFAULT_PDE_STR = "continuity_2"; - static auto constexpr DEFAULT_PDE_OPT = PDE_opts::continuity_2; - static auto constexpr DEFAULT_SOLVER = solve_opts::direct; + static auto constexpr DEFAULT_CFL = 0.01; + static auto constexpr DEFAULT_ADAPT_THRESH = 1e-3; + static auto constexpr DEFAULT_MAX_LEVEL = 8; + static auto constexpr DEFAULT_TIME_STEPS = 10; + static auto constexpr DEFAULT_WRITE_FREQ = 0; + static auto constexpr DEFAULT_USE_IMPLICIT = false; + static auto constexpr DEFAULT_USE_FG = false; + static auto constexpr DEFAULT_DO_POISSON = false; + static auto constexpr DEFAULT_DO_ADAPT = false; + static auto constexpr DEFAULT_PDE_STR = "continuity_2"; + static auto constexpr DEFAULT_PDE_OPT = PDE_opts::continuity_2; + static auto constexpr DEFAULT_SOLVER = solve_opts::direct; + static auto constexpr DEFAULT_PDE_SELECTED_CASE = 0; // construct from command line explicit parser(int argc, char **argv); @@ -185,7 +202,7 @@ class parser private: void print_available_pdes() { - auto const max_name_length = 25; + auto const max_name_length = 50; std::cerr << "available pdes (select using -p)" << "\n\n"; std::cerr << std::left << std::setw(max_name_length) << "Argument" @@ -250,6 +267,7 @@ class parser std::string pde_str = DEFAULT_PDE_STR; // pde to construct/evaluate PDE_opts pde_choice = DEFAULT_PDE_OPT; + // pde selected case (f0) // default std::string solver_str = NO_USER_VALUE_STR; diff --git a/src/time_advance_tests.cpp b/src/time_advance_tests.cpp index 2793fe545..d7d13cf75 100644 --- a/src/time_advance_tests.cpp +++ b/src/time_advance_tests.cpp @@ -213,14 +213,39 @@ TEST_CASE("adaptive time advance") time_advance_test(parse, gold_base, tol_factor); } - SECTION("fokkerplanck1_pitch_E explicit") + SECTION("fokkerplanck1_pitch_E case1 explicit") { auto const tol_factor = 1e-15; - std::string const pde_choice = "fokkerplanck_1d_pitch_E"; + std::string const pde_choice = "fokkerplanck_1d_pitch_E_case1"; auto const degree = 4; fk::vector const levels{4}; std::string const gold_base = "../testing/generated-inputs/time_advance/" - "fokkerplanck1_pitch_E_ad_sg_l4_d4_t"; + "fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t"; + + auto const full_grid = false; + auto const use_implicit = parser::DEFAULT_USE_IMPLICIT; + auto const do_adapt_levels = true; + auto const adapt_threshold = 1e-4; + + parser const parse(pde_choice, levels, degree, cfl, full_grid, + parser::DEFAULT_MAX_LEVEL, num_steps, use_implicit, + do_adapt_levels, adapt_threshold); + + // we do not gracefully handle coarsening below number of active ranks yet + if (get_num_ranks() == 1) + { + time_advance_test(parse, gold_base, tol_factor); + } + } + + SECTION("fokkerplanck1_pitch_E case2 explicit") + { + auto const tol_factor = 1e-15; + std::string const pde_choice = "fokkerplanck_1d_pitch_E_case2"; + auto const degree = 4; + fk::vector const levels{4}; + std::string const gold_base = "../testing/generated-inputs/time_advance/" + "fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t"; auto const full_grid = false; auto const use_implicit = parser::DEFAULT_USE_IMPLICIT; diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_l4_d3_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case1_coefficients_l4_d3_1_1.dat similarity index 100% rename from testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_l4_d3_1_1.dat rename to testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case1_coefficients_l4_d3_1_1.dat diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_norotate_l4_d3_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case1_coefficients_norotate_l4_d3_1_1.dat similarity index 100% rename from testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_coefficients_norotate_l4_d3_1_1.dat rename to testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case1_coefficients_norotate_l4_d3_1_1.dat From 8fbddb4f3aec280a7a2d820dc2942de11159264e Mon Sep 17 00:00:00 2001 From: Hugo Brunie Date: Thu, 21 Jan 2021 06:33:09 -0800 Subject: [PATCH 3/5] Use macro to wrap assert (macro). This fix the bug of not having real error root when assertion fails. --- src/basis.cpp | 20 +- src/batch.cpp | 98 +++--- src/batch.hpp | 2 +- src/batch_tests.cpp | 18 +- src/boundary_conditions.cpp | 18 +- src/coefficients.cpp | 8 +- src/distribution.cpp | 90 ++--- src/distribution.hpp | 34 +- src/elements.cpp | 68 ++-- src/elements.hpp | 10 +- src/fast_math.hpp | 24 +- src/kronmult.cpp | 22 +- src/lib_dispatch.cpp | 444 ++++++++++++------------- src/lib_dispatch_tests.cpp | 18 +- src/main.cpp | 4 +- src/matlab_utilities.cpp | 46 +-- src/pde/pde_base.hpp | 88 +++-- src/pde/pde_fokkerplanck2_complete.hpp | 2 +- src/permutations.cpp | 64 ++-- src/program_options.cpp | 4 +- src/program_options.hpp | 2 +- src/quadrature.cpp | 10 +- src/solver.cpp | 20 +- src/tensors.hpp | 213 ++++++------ src/time_advance.cpp | 12 +- src/tools.hpp | 30 +- src/tools_tests.cpp | 4 +- src/transformations.cpp | 20 +- src/transformations.hpp | 18 +- src/transformations_tests.cpp | 2 +- 30 files changed, 704 insertions(+), 709 deletions(-) diff --git a/src/basis.cpp b/src/basis.cpp index dc5a8024d..59769ca8c 100644 --- a/src/basis.cpp +++ b/src/basis.cpp @@ -16,7 +16,7 @@ template std::array, 6> generate_multi_wavelets(int const degree) { - tools::expect(degree > 0); + expect(degree > 0); // These are the function outputs // g0,g1,h0, and h1 are two-scale coefficients @@ -359,8 +359,8 @@ std::array, 6> generate_multi_wavelets(int const degree) template fk::matrix operator_two_scale(int const degree, int const num_levels) { - tools::expect(degree > 0); - tools::expect(num_levels > 1); + expect(degree > 0); + expect(num_levels > 1); int const max_level = fm::two_raised_to(num_levels); @@ -502,7 +502,7 @@ wavelet_transform::wavelet_transform(options const &program_opts, << '\n'; // copy to device if necessary - tools::expect(block_builder.size() == dense_blocks_.size()); + expect(block_builder.size() == dense_blocks_.size()); for (auto i = 0; i < static_cast(block_builder.size()); ++i) { if constexpr (resrc == resource::host) @@ -527,8 +527,8 @@ fk::vector wavelet_transform::apply( basis::side const transform_side, basis::transpose const transform_trans) const { - tools::expect(level >= 0); - tools::expect(level <= max_level); + expect(level >= 0); + expect(level <= max_level); auto const ncols = transform_side == basis::side::right ? coefficients.size() : 1; @@ -546,22 +546,22 @@ fk::matrix wavelet_transform::apply( basis::side const transform_side, basis::transpose const transform_trans) const { - tools::expect(level >= 0); + expect(level >= 0); if (level == 0) { return fk::matrix(coefficients); } - tools::expect(level <= max_level); + expect(level <= max_level); auto const op_size = fm::two_raised_to(level) * degree; if (transform_side == basis::side::right) { - tools::expect(coefficients.ncols() == op_size); + expect(coefficients.ncols() == op_size); } else { - tools::expect(coefficients.nrows() == op_size); + expect(coefficients.nrows() == op_size); } int const rows_y = diff --git a/src/batch.cpp b/src/batch.cpp index b25eff0ae..03d00eadd 100644 --- a/src/batch.cpp +++ b/src/batch.cpp @@ -18,10 +18,10 @@ batch::batch(int const num_entries, int const nrows, int const ncols, : num_entries_(num_entries), nrows_(nrows), ncols_(ncols), stride_(stride), do_trans_(do_trans), batch_{new P *[num_entries]()} { - tools::expect(num_entries > 0); - tools::expect(nrows > 0); - tools::expect(ncols > 0); - tools::expect(stride > 0); + expect(num_entries > 0); + expect(nrows > 0); + expect(ncols > 0); + expect(stride > 0); } template @@ -40,11 +40,11 @@ batch &batch::operator=(batch const &other) { return *this; } - tools::expect(num_entries() == other.num_entries()); - tools::expect(nrows() == other.nrows()); - tools::expect(ncols() == other.ncols()); - tools::expect(get_stride() == other.get_stride()); - tools::expect(get_trans() == other.get_trans()); + expect(num_entries() == other.num_entries()); + expect(nrows() == other.nrows()); + expect(ncols() == other.ncols()); + expect(get_stride() == other.get_stride()); + expect(get_trans() == other.get_trans()); std::memcpy(batch_, other.batch_, other.num_entries() * sizeof(P *)); return *this; } @@ -66,12 +66,12 @@ batch &batch::operator=(batch &&other) return *this; } - tools::expect(num_entries() == other.num_entries()); - tools::expect(nrows() == other.nrows()); - tools::expect(ncols() == other.ncols()); - tools::expect(get_stride() == other.get_stride()); + expect(num_entries() == other.num_entries()); + expect(nrows() == other.nrows()); + expect(ncols() == other.ncols()); + expect(get_stride() == other.get_stride()); - tools::expect(get_trans() == other.get_trans()); + expect(get_trans() == other.get_trans()); batch_ = other.batch_; other.batch_ = nullptr; return *this; @@ -121,8 +121,8 @@ bool batch::operator==(batch const &other) const template P *batch::operator()(int const position) const { - tools::expect(position >= 0); - tools::expect(position < num_entries()); + expect(position >= 0); + expect(position < num_entries()); return batch_[position]; } @@ -136,20 +136,20 @@ void batch::assign_entry(fk::matrix const &a, { // make sure this matrix is the // same dimensions as others in batch - tools::expect(a.nrows() == nrows()); - tools::expect(a.ncols() == ncols()); + expect(a.nrows() == nrows()); + expect(a.ncols() == ncols()); // if this is a batch of vectors, // we won't check the single column // matrix view a's stride if (get_stride() != 1) { - tools::expect(a.stride() == get_stride()); + expect(a.stride() == get_stride()); } // ensure position is valid - tools::expect(position >= 0); - tools::expect(position < num_entries()); + expect(position >= 0); + expect(position < num_entries()); batch_[position] = a.data(); } @@ -157,8 +157,8 @@ void batch::assign_entry(fk::matrix const &a, template void batch::assign_raw(P *const a, int const position) { - tools::expect(position >= 0); - tools::expect(position < num_entries()); + expect(position >= 0); + expect(position < num_entries()); batch_[position] = a; } @@ -220,14 +220,14 @@ void batched_gemm(batch const &a, batch const &b, batch const &c, P const alpha, P const beta) { // check cardinality of sets - tools::expect(a.num_entries() == b.num_entries()); - tools::expect(b.num_entries() == c.num_entries()); + expect(a.num_entries() == b.num_entries()); + expect(b.num_entries() == c.num_entries()); // not allowed by blas interface // can be removed if we decide // we need to consider the transpose // of C later - tools::expect(!c.get_trans()); + expect(!c.get_trans()); // check dimensions for gemm // @@ -239,9 +239,9 @@ void batched_gemm(batch const &a, batch const &b, int const rows_b = b.get_trans() ? b.ncols() : b.nrows(); int const cols_b = b.get_trans() ? b.nrows() : b.ncols(); - tools::expect(cols_a == rows_b); - tools::expect(c.nrows() == rows_a); - tools::expect(c.ncols() == cols_b); + expect(cols_a == rows_b); + expect(c.nrows() == rows_a); + expect(c.ncols() == cols_b); // setup blas args int m = rows_a; @@ -271,8 +271,8 @@ void batched_gemv(batch const &a, batch const &b, batch const &c, P const alpha, P const beta) { // check cardinality of sets - tools::expect(a.num_entries() == b.num_entries()); - tools::expect(b.num_entries() == c.num_entries()); + expect(a.num_entries() == b.num_entries()); + expect(b.num_entries() == c.num_entries()); int const num_entries = a.num_entries(); // our gemv will be set up for a column vector, @@ -280,12 +280,12 @@ void batched_gemv(batch const &a, batch const &b, // // we can remove either or both of these if // we want to support more flexible operations - tools::expect(!b.get_trans() && !c.get_trans()); + expect(!b.get_trans() && !c.get_trans()); // check dimensions for gemv - tools::expect((a.get_trans() ? a.nrows() : a.ncols()) == b.nrows()); - tools::expect(b.ncols() == 1); - tools::expect(c.ncols() == 1); + expect((a.get_trans() ? a.nrows() : a.ncols()) == b.nrows()); + expect(b.ncols() == 1); + expect(c.ncols() == 1); // setup blas args int m = a.nrows(); @@ -341,15 +341,15 @@ batch_chain::batch_chain( fk::vector &final_output) { /* validation */ - tools::expect(matrices.size() > 0); - tools::expect(workspace.size() == 2); + expect(matrices.size() > 0); + expect(workspace.size() == 2); /* ensure "x" is correct size - should be the product of all the matrices respective number of columns */ - tools::expect(x.size() == std::accumulate(matrices.begin(), matrices.end(), 1, - [](int const i, auto const &m) { - return i * m.ncols(); - })); + expect(x.size() == std::accumulate(matrices.begin(), matrices.end(), 1, + [](int const i, auto const &m) { + return i * m.ncols(); + })); /* these are used to index "workspace" - the input/output role alternates between workspace[ 0 ] and workspace[ 1 ] in this algorithm */ @@ -358,8 +358,8 @@ batch_chain::batch_chain( /* ensure the workspaces are big enough for the problem */ int const workspace_len = calculate_workspace_length(matrices, x.size()); - tools::expect(workspace[0].size() >= workspace_len); - tools::expect(workspace[1].size() >= workspace_len); + expect(workspace[0].size() >= workspace_len); + expect(workspace[1].size() >= workspace_len); /* The algorithm iterates over each matrix in "matrix" in reverse order, @@ -488,8 +488,8 @@ batch_chain::batch_chain( template void batch_chain::execute() const { - tools::expect(left_.size() == right_.size()); - tools::expect(right_.size() == product_.size()); + expect(left_.size() == right_.size()); + expect(right_.size() == product_.size()); for (int i = 0; i < static_cast(left_.size()); ++i) { @@ -535,13 +535,13 @@ void build_system_matrix(PDE

const &pde, elements::table const &elem_table, int const elem_size = static_cast(std::pow(degree, pde.num_dims)); int const A_size = elem_size * elem_table.size(); - tools::expect(A.ncols() == A_size && A.nrows() == A_size); + expect(A.ncols() == A_size && A.nrows() == A_size); using key_type = std::pair; using val_type = fk::matrix; std::map coef_cache; - tools::expect(A.ncols() == A_size && A.nrows() == A_size); + expect(A.ncols() == A_size && A.nrows() == A_size); // copy coefficients to host for subsequent use for (int k = 0; k < pde.num_terms; ++k) @@ -561,7 +561,7 @@ void build_system_matrix(PDE

const &pde, elements::table const &elem_table, // calculate from the level/cell indices for each // dimension fk::vector const coords = elem_table.get_coords(i); - tools::expect(coords.size() == pde.num_dims * 2); + expect(coords.size() == pde.num_dims * 2); fk::vector const elem_indices = linearize(coords); int const global_row = i * elem_size; @@ -578,7 +578,7 @@ void build_system_matrix(PDE

const &pde, elements::table const &elem_table, { // get linearized indices for this connected element fk::vector const coords_nD = elem_table.get_coords(j); - tools::expect(coords_nD.size() == pde.num_dims * 2); + expect(coords_nD.size() == pde.num_dims * 2); fk::vector const connected_indices = linearize(coords_nD); // calculate the col portion of the diff --git a/src/batch.hpp b/src/batch.hpp index 27947ba53..04a5cca32 100644 --- a/src/batch.hpp +++ b/src/batch.hpp @@ -91,7 +91,7 @@ inline int calculate_workspace_length( for (iter = matrices.rbegin(); iter != matrices.rend(); ++iter) { c_prod *= iter->ncols(); - tools::expect(c_prod > 0); + expect(c_prod > 0); r_prod *= iter->nrows(); int const size = x_size / c_prod * r_prod; greatest = std::max(greatest, size); diff --git a/src/batch_tests.cpp b/src/batch_tests.cpp index 0fe9c0f20..757b3d4e8 100644 --- a/src/batch_tests.cpp +++ b/src/batch_tests.cpp @@ -546,18 +546,18 @@ void test_batched_gemm(int const m, int const n, int const k, int const lda, bool const trans_a = false, bool const trans_b = false, P const alpha = 1.0, P const beta = 0.0) { - tools::expect(m > 0); - tools::expect(n > 0); - tools::expect(k > 0); + expect(m > 0); + expect(n > 0); + expect(k > 0); int const rows_a = trans_a ? k : m; int const cols_a = trans_a ? m : k; - tools::expect(lda >= rows_a); - tools::expect(ldc >= m); + expect(lda >= rows_a); + expect(ldc >= m); int const rows_b = trans_b ? n : k; int const cols_b = trans_b ? k : n; - tools::expect(ldb >= rows_b); + expect(ldb >= rows_b); std::vector>> const matrices = [=]() { @@ -760,9 +760,9 @@ void test_batched_gemv(int const m, int const n, int const lda, int const num_batch = 3, bool const trans_a = false, P const alpha = 1.0, P const beta = 0.0) { - tools::expect(m > 0); - tools::expect(n > 0); - tools::expect(lda >= m); + expect(m > 0); + expect(n > 0); + expect(lda >= m); int const rows_a = trans_a ? n : m; int const cols_a = trans_a ? m : n; diff --git a/src/boundary_conditions.cpp b/src/boundary_conditions.cpp index e73a0e9be..145fff0b2 100644 --- a/src/boundary_conditions.cpp +++ b/src/boundary_conditions.cpp @@ -20,9 +20,9 @@ std::array, 2> boundary_conditions::make_unscaled_bc_parts( basis::wavelet_transform const &transformer, int const start_element, int const stop_element, P const t_init) { - tools::expect(start_element >= 0); - tools::expect(stop_element < table.size()); - tools::expect(stop_element >= start_element); + expect(start_element >= 0); + expect(stop_element < table.size()); + expect(stop_element >= start_element); unscaled_bc_parts

left_bc_parts; unscaled_bc_parts

right_bc_parts; @@ -156,7 +156,7 @@ fk::vector

boundary_conditions::compute_left_boundary_condition( P const domain_min = dim.domain_min; P const domain_max = dim.domain_max; P const domain_extent = domain_max - domain_min; - tools::expect(domain_extent > 0); + expect(domain_extent > 0); int const level = dim.get_level(); int const degree = dim.get_degree(); @@ -177,7 +177,7 @@ fk::vector

boundary_conditions::compute_left_boundary_condition( /* If the above modification was not enough, the choice of g_function should be re-evaluated */ - tools::expect(std::isfinite(g)); + expect(std::isfinite(g)); } /* legendre() returns a 1D matrix - must be converted into a vector */ @@ -192,7 +192,7 @@ fk::vector

boundary_conditions::compute_left_boundary_condition( fk::vector destination_slice(bc, 0, degree - 1); - tools::expect(destination_slice.size() == legendre_polys_at_value.size()); + expect(destination_slice.size() == legendre_polys_at_value.size()); destination_slice = fk::vector

(legendre_polys_at_value); @@ -208,7 +208,7 @@ fk::vector

boundary_conditions::compute_right_boundary_condition( P const domain_max = dim.domain_max; P const domain_extent = domain_max - domain_min; - tools::expect(domain_extent > 0); + expect(domain_extent > 0); int const level = dim.get_level(); int const degree = dim.get_degree(); @@ -229,7 +229,7 @@ fk::vector

boundary_conditions::compute_right_boundary_condition( /* If the above modification was not enough, the choice of g_function should be re-evaluated */ - tools::expect(std::isfinite(g)); + expect(std::isfinite(g)); } fk::vector

legendre_polys_at_value = fk::vector

( @@ -257,7 +257,7 @@ std::vector> boundary_conditions::generate_partial_bcs( P const time, std::vector> const &partial_terms, int const p_index, fk::vector

&&trace_bc) { - tools::expect(d_index < static_cast(dimensions.size())); + expect(d_index < static_cast(dimensions.size())); std::vector> partial_bc_vecs; diff --git a/src/coefficients.cpp b/src/coefficients.cpp index ce89356ca..0d021b041 100644 --- a/src/coefficients.cpp +++ b/src/coefficients.cpp @@ -17,7 +17,7 @@ void generate_all_coefficients( PDE

&pde, basis::wavelet_transform const &transformer, P const time, bool const rotate) { - tools::expect(time >= 0.0); + expect(time >= 0.0); for (auto i = 0; i < pde.num_dims; ++i) { @@ -50,9 +50,9 @@ fk::matrix

generate_coefficients( basis::wavelet_transform const &transformer, P const time, bool const rotate) { - tools::expect(time >= 0.0); - tools::expect(transformer.degree == dim.get_degree()); - tools::expect(transformer.max_level >= dim.get_level()); + expect(time >= 0.0); + expect(transformer.degree == dim.get_degree()); + expect(transformer.max_level >= dim.get_level()); // setup jacobi of variable x and define coeff_mat auto const num_points = fm::two_raised_to(transformer.max_level); diff --git a/src/distribution.cpp b/src/distribution.cpp index c3edb58ca..d95889e96 100644 --- a/src/distribution.cpp +++ b/src/distribution.cpp @@ -15,7 +15,7 @@ struct distribution_handler void set_global_comm(MPI_Comm const &comm) { auto const status = MPI_Comm_dup(comm, &global_comm); - tools::expect(status == 0); + expect(status == 0); } MPI_Comm get_global_comm() const { return global_comm; } @@ -33,12 +33,12 @@ int get_local_rank() auto success = MPI_Comm_split_type(distro_handle.get_global_comm(), MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &local_comm); - tools::expect(success == 0); + expect(success == 0); int local_rank; success = MPI_Comm_rank(local_comm, &local_rank); - tools::expect(success == 0); + expect(success == 0); success = MPI_Comm_free(&local_comm); - tools::expect(success == 0); + expect(success == 0); return local_rank; }(); return rank; @@ -53,7 +53,7 @@ int get_rank() int my_rank; auto const status = MPI_Comm_rank(distro_handle.get_global_comm(), &my_rank); - tools::expect(status == 0); + expect(status == 0); return my_rank; }(); return rank; @@ -68,7 +68,7 @@ int get_num_ranks() int num_ranks; auto const status = MPI_Comm_size(distro_handle.get_global_comm(), &num_ranks); - tools::expect(status == 0); + expect(status == 0); return num_ranks; }(); return num_ranks; @@ -102,20 +102,20 @@ static void terminate_all_ranks(int signum) std::array initialize_distribution() { static bool init_done = false; - tools::expect(!init_done); + expect(!init_done); #ifdef ASGARD_USE_MPI signal(SIGABRT, terminate_all_ranks); auto status = MPI_Init(NULL, NULL); init_done = true; - tools::expect(status == 0); + expect(status == 0); int num_ranks; status = MPI_Comm_size(MPI_COMM_WORLD, &num_ranks); - tools::expect(status == 0); + expect(status == 0); int my_rank; status = MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); - tools::expect(status == 0); + expect(status == 0); auto const num_participating = num_effective_ranks(num_ranks); bool const participating = my_rank < num_participating; @@ -123,10 +123,10 @@ std::array initialize_distribution() MPI_Comm effective_communicator; auto success = MPI_Comm_split(MPI_COMM_WORLD, comm_color, my_rank, &effective_communicator); - tools::expect(success == 0); + expect(success == 0); status = MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); - tools::expect(status == 0); + expect(status == 0); if (effective_communicator != MPI_COMM_NULL) { @@ -145,7 +145,7 @@ void finalize_distribution() { #ifdef ASGARD_USE_MPI auto const status = MPI_Finalize(); - tools::expect(status == 0); + expect(status == 0); #endif } @@ -155,13 +155,13 @@ void finalize_distribution() element_subgrid get_subgrid(int const num_ranks, int const my_rank, elements::table const &table) { - tools::expect(num_ranks > 0); + expect(num_ranks > 0); - tools::expect(num_ranks % 2 == 0 || num_ranks == 1 || - std::sqrt(num_ranks) == std::floor(std::sqrt(num_ranks))); - tools::expect(my_rank >= 0); - tools::expect(my_rank < num_ranks); - tools::expect(table.size() >= num_ranks); + expect(num_ranks % 2 == 0 || num_ranks == 1 || + std::sqrt(num_ranks) == std::floor(std::sqrt(num_ranks))); + expect(my_rank >= 0); + expect(my_rank < num_ranks); + expect(table.size() >= num_ranks); if (num_ranks == 1) { @@ -197,8 +197,8 @@ element_subgrid get_subgrid(int const num_ranks, int const my_rank, // distribution plan is a mapping from rank -> assigned subgrid distribution_plan get_plan(int const num_ranks, elements::table const &table) { - tools::expect(num_ranks > 0); - tools::expect(table.size() > 0); + expect(num_ranks > 0); + expect(table.size() > 0); auto const num_splits = num_effective_ranks(num_ranks); distribution_plan plan; @@ -260,9 +260,9 @@ template void reduce_results(fk::vector

const &source, fk::vector

&dest, distribution_plan const &plan, int const my_rank) { - tools::expect(source.size() == dest.size()); - tools::expect(my_rank >= 0); - tools::expect(my_rank < static_cast(plan.size())); + expect(source.size() == dest.size()); + expect(my_rank >= 0); + expect(my_rank < static_cast(plan.size())); #ifdef ASGARD_USE_MPI if (plan.size() == 1) @@ -282,16 +282,16 @@ void reduce_results(fk::vector

const &source, fk::vector

&dest, auto success = MPI_Comm_split(global_communicator, my_row, my_col, &row_communicator); - tools::expect(success == 0); + expect(success == 0); MPI_Datatype const mpi_type = std::is_same::value ? MPI_DOUBLE : MPI_FLOAT; success = MPI_Allreduce((void *)source.data(), (void *)dest.data(), source.size(), mpi_type, MPI_SUM, row_communicator); - tools::expect(success == 0); + expect(success == 0); success = MPI_Comm_free(&row_communicator); - tools::expect(success == 0); + expect(success == 0); #else fm::copy(source, dest); @@ -338,7 +338,7 @@ std::vector> const static dependencies_to_messages( std::vector const &row_boundaries, std::vector const &column_boundaries) { - tools::expect(col_dependencies.size() == column_boundaries.size()); + expect(col_dependencies.size() == column_boundaries.size()); /* initialize a round robin selector for each row */ std::vector row_round_robin_wheels; @@ -413,7 +413,7 @@ generate_messages(distribution_plan const &plan) std::vector col_boundaries; auto const num_cols = get_num_subgrid_cols(plan.size()); - tools::expect(plan.size() % num_cols == 0); + expect(plan.size() % num_cols == 0); auto const num_rows = static_cast(plan.size()) / num_cols; for (int i = 0; i < num_rows; ++i) @@ -447,7 +447,7 @@ copy_to_input(fk::vector

const &source, fk::vector

&dest, index_mapper const &source_map, index_mapper const &dest_map, message const &message, int const segment_size) { - tools::expect(segment_size > 0); + expect(segment_size > 0); if (message.message_dir == message_direction::send) { auto const source_start = @@ -482,7 +482,7 @@ static void dispatch_message(fk::vector

const &source, fk::vector

&dest, int const segment_size) { #ifdef ASGARD_USE_MPI - tools::expect(segment_size > 0); + expect(segment_size > 0); MPI_Datatype const mpi_type = std::is_same::value ? MPI_DOUBLE : MPI_FLOAT; @@ -504,7 +504,7 @@ static void dispatch_message(fk::vector

const &source, fk::vector

&dest, auto const success = MPI_Send((void *)window.data(), window.size(), mpi_type, message.target, mpi_tag, communicator); - tools::expect(success == 0); + expect(success == 0); } else { @@ -519,7 +519,7 @@ static void dispatch_message(fk::vector

const &source, fk::vector

&dest, auto const success = MPI_Recv((void *)window.data(), window.size(), mpi_type, message.target, MPI_ANY_TAG, communicator, MPI_STATUS_IGNORE); - tools::expect(success == 0); + expect(success == 0); } #else @@ -528,7 +528,7 @@ static void dispatch_message(fk::vector

const &source, fk::vector

&dest, ignore(map); ignore(message); ignore(segment_size); - tools::expect(false); + expect(false); #endif } @@ -538,8 +538,8 @@ void exchange_results(fk::vector

const &source, fk::vector

&dest, int const segment_size, distribution_plan const &plan, int const my_rank) { - tools::expect(my_rank >= 0); - tools::expect(my_rank < static_cast(plan.size())); + expect(my_rank >= 0); + expect(my_rank < static_cast(plan.size())); #ifdef ASGARD_USE_MPI if (plan.size() == 1) @@ -590,17 +590,17 @@ gather_errors(P const root_mean_squared, P const relative) auto success = MPI_Comm_split_type(distro_handle.get_global_comm(), MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &local_comm); - tools::expect(success == 0); + expect(success == 0); MPI_Datatype const mpi_type = std::is_same::value ? MPI_DOUBLE : MPI_FLOAT; int local_rank; success = MPI_Comm_rank(local_comm, &local_rank); - tools::expect(success == 0); + expect(success == 0); int local_size; success = MPI_Comm_size(local_comm, &local_size); - tools::expect(success == 0); + expect(success == 0); fk::vector

error_vect(local_size * 2); @@ -608,7 +608,7 @@ gather_errors(P const root_mean_squared, P const relative) mpi_type, 0, local_comm); success = MPI_Comm_free(&local_comm); - tools::expect(success == 0); + expect(success == 0); if (local_rank == 0) { @@ -633,8 +633,8 @@ std::vector

gather_results(fk::vector

const &my_results, distribution_plan const &plan, int const my_rank, int const element_segment_size) { - tools::expect(my_rank >= 0); - tools::expect(my_rank < static_cast(plan.size())); + expect(my_rank >= 0); + expect(my_rank < static_cast(plan.size())); auto const own_results = [&my_results]() { std::vector

own_results(my_results.size()); @@ -680,7 +680,7 @@ gather_results(fk::vector

const &my_results, distribution_plan const &plan, MPI_Comm first_row_communicator; auto success = MPI_Comm_split(global_communicator, comm_color, my_rank, &first_row_communicator); - tools::expect(success == 0); + expect(success == 0); // gather values if (first_row_communicator != MPI_COMM_NULL) @@ -704,7 +704,7 @@ gather_results(fk::vector

const &my_results, distribution_plan const &plan, rank_displacements(i)), rank_lengths(i), mpi_type, i, MPI_ANY_TAG, first_row_communicator, MPI_STATUS_IGNORE); - tools::expect(success == 0); + expect(success == 0); } return results; @@ -715,7 +715,7 @@ gather_results(fk::vector

const &my_results, distribution_plan const &plan, success = MPI_Send((void *)my_results.data(), my_results.size(), mpi_type, 0, mpi_tag, first_row_communicator); - tools::expect(success == 0); + expect(success == 0); return own_results(); } } diff --git a/src/distribution.hpp b/src/distribution.hpp index 8247215ce..200fa377e 100644 --- a/src/distribution.hpp +++ b/src/distribution.hpp @@ -46,10 +46,10 @@ class element_subgrid : row_start(row_start), row_stop(row_stop), col_start(col_start), col_stop(col_stop) { - tools::expect(row_start >= 0); - tools::expect(row_stop >= row_start); - tools::expect(col_start >= 0); - tools::expect(col_stop >= col_start); + expect(row_start >= 0); + expect(row_stop >= row_start); + expect(col_start >= 0); + expect(col_stop >= col_start); }; element_subgrid(element_subgrid const &e) : row_start(e.row_start), row_stop(e.row_stop), col_start(e.col_start), @@ -71,30 +71,30 @@ class element_subgrid // translation from local/global x and y int to_global_row(int const local_row) const { - tools::expect(local_row >= 0); - tools::expect(local_row < nrows()); + expect(local_row >= 0); + expect(local_row < nrows()); return local_row + row_start; } int to_global_col(int const local_col) const { - tools::expect(local_col >= 0); - tools::expect(local_col < ncols()); + expect(local_col >= 0); + expect(local_col < ncols()); return local_col + col_start; } int to_local_row(int const global_row) const { - tools::expect(global_row >= 0); + expect(global_row >= 0); int const local = global_row - row_start; - tools::expect(local >= 0); - tools::expect(local < nrows()); + expect(local >= 0); + expect(local < nrows()); return local; }; int to_local_col(int const global_col) const { - tools::expect(global_col >= 0); + expect(global_col >= 0); int const local = global_col - col_start; - tools::expect(local >= 0); - tools::expect(local < ncols()); + expect(local >= 0); + expect(local < ncols()); return local; }; @@ -125,7 +125,7 @@ class element_subgrid // possible inline int get_num_subgrid_cols(int const num_ranks) { - tools::expect(num_ranks > 0); + expect(num_ranks > 0); int trial_factor = static_cast(std::floor(std::sqrt(num_ranks))); while (trial_factor > 0) { @@ -137,7 +137,7 @@ inline int get_num_subgrid_cols(int const num_ranks) trial_factor++; } // I believe this is mathematically impossible... - tools::expect(false); + expect(false); return 0; } @@ -259,7 +259,7 @@ gather_results(fk::vector

const &my_results, distribution_plan const &plan, template double get_MB(int64_t const num_elems) { - tools::expect(num_elems > 0); + expect(num_elems > 0); double const bytes = num_elems * sizeof(P); double const MB = bytes * 1e-6; return MB; diff --git a/src/elements.cpp b/src/elements.cpp index 11477988a..e3cfc85d9 100644 --- a/src/elements.cpp +++ b/src/elements.cpp @@ -30,8 +30,8 @@ static std::map const dim_to_max_level = { int64_t get_1d_index(int const level, int const cell) { - tools::expect(level >= 0); - tools::expect(cell >= 0); + expect(level >= 0); + expect(cell >= 0); if (level == 0) { @@ -42,7 +42,7 @@ int64_t get_1d_index(int const level, int const cell) std::array get_level_cell(int64_t const single_dim_id) { - tools::expect(single_dim_id >= 0); + expect(single_dim_id >= 0); if (single_dim_id == 0) { return {0, 0}; @@ -57,26 +57,26 @@ std::array get_level_cell(int64_t const single_dim_id) int64_t map_to_id(fk::vector const &coords, int const max_level, int const num_dims) { - tools::expect(max_level > 0); - tools::expect(num_dims > 0); - tools::expect(coords.size() == num_dims * 2); - tools::expect(max_level <= dim_to_max_level.at(num_dims)); + expect(max_level > 0); + expect(num_dims > 0); + expect(coords.size() == num_dims * 2); + expect(max_level <= dim_to_max_level.at(num_dims)); int64_t id = 0; int64_t stride = 1; for (auto i = 0; i < num_dims; ++i) { - tools::expect(coords(i) >= 0); - tools::expect(coords(i) <= max_level); - tools::expect(coords(i + num_dims) >= 0); + expect(coords(i) >= 0); + expect(coords(i) <= max_level); + expect(coords(i + num_dims) >= 0); id += get_1d_index(coords(i), coords(i + num_dims)) * stride; stride *= static_cast(std::pow(2, max_level)); } - tools::expect(id >= 0); - tools::expect(id <= static_cast(std::pow(2, max_level * num_dims))); + expect(id >= 0); + expect(id <= static_cast(std::pow(2, max_level * num_dims))); return id; } @@ -84,10 +84,10 @@ int64_t map_to_id(fk::vector const &coords, int const max_level, fk::vector map_to_coords(int64_t const id, int const max_level, int const num_dims) { - tools::expect(id >= 0); - tools::expect(max_level > 0); - tools::expect(num_dims > 0); - tools::expect(max_level <= dim_to_max_level.at(num_dims)); + expect(id >= 0); + expect(max_level > 0); + expect(num_dims > 0); + expect(max_level <= dim_to_max_level.at(num_dims)); auto const stride = static_cast(std::pow(2, max_level)); @@ -115,11 +115,11 @@ void table::remove_elements(std::vector const &indices) auto const new_active_ids = [&to_delete, &active_element_ids_ = active_element_ids_]() { // don't delete all the elements - tools::expect(active_element_ids_.size() > to_delete.size()); + expect(active_element_ids_.size() > to_delete.size()); std::vector new_active_ids(active_element_ids_.size() - to_delete.size()); auto count = 0; - tools::expect(active_element_ids_.size() < INT_MAX); + expect(active_element_ids_.size() < INT_MAX); for (auto i = 0; i < static_cast(active_element_ids_.size()); ++i) { if (to_delete.count(i) == 1) @@ -128,7 +128,7 @@ void table::remove_elements(std::vector const &indices) } new_active_ids[count++] = active_element_ids_[i]; } - tools::expect(count == static_cast(new_active_ids.size())); + expect(count == static_cast(new_active_ids.size())); return new_active_ids; }(); @@ -137,11 +137,11 @@ void table::remove_elements(std::vector const &indices) auto const coord_size = static_cast(get_coords(0).size()); auto const new_table_size = active_table_h.size() - coord_size * to_delete.size(); - tools::expect(new_table_size > 0); + expect(new_table_size > 0); auto new_active_table = fk::vector(new_table_size); int64_t dest_start = 0; - tools::expect(size() < INT_MAX); + expect(size() < INT_MAX); for (int64_t i = 0; i < size(); ++i) { if (to_delete.count(i) == 1) @@ -168,27 +168,27 @@ void table::remove_elements(std::vector const &indices) active_element_ids_ = new_active_ids; - tools::expect(active_element_ids_.size() == id_to_coords_.size()); - tools::expect(size() > 0); + expect(active_element_ids_.size() == id_to_coords_.size()); + expect(size() > 0); } int64_t table::add_elements(std::vector const &ids, int const max_level) { - tools::expect(max_level > 0); + expect(max_level > 0); std::unordered_set const child_ids(ids.begin(), ids.end()); auto active_table_h = active_table_d_.clone_onto_host(); - tools::expect(size() > 0); + expect(size() > 0); auto const coord_size = get_coords(0).size(); - tools::expect(coord_size % 2 == 0); + expect(coord_size % 2 == 0); auto const num_dims = coord_size / 2; int64_t added = 0; for (auto const id : ids) { - tools::expect(id >= 0); + expect(id >= 0); // already present in grid if (id_to_coords_.count(id) == 1) @@ -205,7 +205,7 @@ table::add_elements(std::vector const &ids, int const max_level) active_table_h.concat(coords); added++; } - tools::expect(active_element_ids_.size() == id_to_coords_.size()); + expect(active_element_ids_.size() == id_to_coords_.size()); active_table_d_.resize(active_table_h.size()) = active_table_h.clone_onto_device(); return added; @@ -215,8 +215,8 @@ std::list table::get_child_elements(int64_t const index, options const &opts) const { // make sure we're dealing with an active element - tools::expect(index >= 0); - tools::expect(index < size()); + expect(index >= 0); + expect(index < size()); auto const coords = get_coords(index); // all coordinates have 2 entries (lev, cell) per dimension @@ -251,7 +251,7 @@ template table::table(options const &opts, PDE

const &pde) { // key type is 64 bits; this limits number of unique element ids - tools::expect(opts.max_level <= dim_to_max_level.at(pde.num_dims)); + expect(opts.max_level <= dim_to_max_level.at(pde.num_dims)); auto const perm_table = [&pde, &opts]() { auto const dims = pde.get_dimensions(); @@ -294,7 +294,7 @@ table::table(options const &opts, PDE

const &pde) } } - tools::expect(active_element_ids_.size() == id_to_coords_.size()); + expect(active_element_ids_.size() == id_to_coords_.size()); active_table_d_.resize(dev_table_builder.size()) .transfer_from(dev_table_builder); } @@ -305,11 +305,11 @@ table::table(options const &opts, PDE

const &pde) // coordinate fk::matrix table::get_cell_index_set(fk::vector const &level_tuple) { - tools::expect(level_tuple.size() > 0); + expect(level_tuple.size() > 0); for (auto const level : level_tuple) { ignore(level); - tools::expect(level >= 0); + expect(level >= 0); } int const num_dims = level_tuple.size(); diff --git a/src/elements.hpp b/src/elements.hpp index 090928cc7..5fae97e5a 100644 --- a/src/elements.hpp +++ b/src/elements.hpp @@ -62,16 +62,16 @@ class table // get id of element given its 0,...,n index in active elements int64_t get_element_id(int64_t const index) const { - tools::expect(index >= 0); - tools::expect(index < static_cast(active_element_ids_.size())); + expect(index >= 0); + expect(index < static_cast(active_element_ids_.size())); return active_element_ids_[index]; } // lookup coords by index fk::vector const &get_coords(int64_t const index) const { - tools::expect(index >= 0); - tools::expect(index < size()); + expect(index >= 0); + expect(index < size()); return id_to_coords_.at(active_element_ids_[index]); } @@ -98,7 +98,7 @@ class table // returns the number of (active) elements in table int64_t size() const { - tools::expect(active_element_ids_.size() == id_to_coords_.size()); + expect(active_element_ids_.size() == id_to_coords_.size()); return active_element_ids_.size(); } diff --git a/src/fast_math.hpp b/src/fast_math.hpp index 28142626c..817ad72a4 100644 --- a/src/fast_math.hpp +++ b/src/fast_math.hpp @@ -12,7 +12,7 @@ template inline T two_raised_to(T const exponent) { static_assert(std::is_same_v || std::is_same_v); - tools::expect(exponent >= 0); + expect(exponent >= 0); return 1 << exponent; } @@ -90,7 +90,7 @@ fk::vector & axpy(fk::vector const &x, fk::vector &y, P const alpha = 1.0) { - tools::expect(x.size() == y.size()); + expect(x.size() == y.size()); int n = x.size(); int one = 1; P alpha_ = alpha; @@ -103,7 +103,7 @@ template fk::vector & copy(fk::vector const &x, fk::vector &y) { - tools::expect(y.size() >= x.size()); + expect(y.size() >= x.size()); int n = x.size(); int one = 1; lib_dispatch::copy(&n, x.data(), &one, y.data(), &one, resrc); @@ -132,8 +132,8 @@ gemv(fk::matrix const &A, fk::vector const &x, int const rows_A = trans_A ? A.ncols() : A.nrows(); int const cols_A = trans_A ? A.nrows() : A.ncols(); - tools::expect(rows_A == y.size()); - tools::expect(cols_A == x.size()); + expect(rows_A == y.size()); + expect(cols_A == x.size()); int lda = A.stride(); int one = 1; @@ -163,9 +163,9 @@ gemm(fk::matrix const &A, fk::matrix const &B, int const rows_B = trans_B ? B.ncols() : B.nrows(); int const cols_B = trans_B ? B.nrows() : B.ncols(); - tools::expect(C.nrows() == rows_A); - tools::expect(C.ncols() == cols_B); - tools::expect(cols_A == rows_B); + expect(C.nrows() == rows_A); + expect(C.ncols() == cols_B); + expect(cols_A == rows_B); int lda = A.stride(); int ldb = B.stride(); @@ -198,8 +198,8 @@ void gesv(fk::matrix const &A, fk::vector &B, int cols_B = 1; int rows_ipiv = ipiv.size(); - tools::expect(cols_A == rows_B); - tools::expect(rows_ipiv == rows_A); + expect(cols_A == rows_B); + expect(rows_ipiv == rows_A); int lda = A.stride(); int ldb = B.size(); @@ -251,8 +251,8 @@ void getrs(fk::matrix const &A, fk::vector &B, int cols_B = 1; int rows_ipiv = ipiv.size(); - tools::expect(cols_A == rows_B); - tools::expect(rows_ipiv == rows_A); + expect(cols_A == rows_B); + expect(rows_ipiv == rows_A); char trans = 'N'; int lda = A.stride(); diff --git a/src/kronmult.cpp b/src/kronmult.cpp index 3e1edc0a7..940b3cfce 100644 --- a/src/kronmult.cpp +++ b/src/kronmult.cpp @@ -47,7 +47,7 @@ inline int get_num_subgrids(PDE

const &pde, elements::table const &elem_table, element_subgrid const &grid, int const rank_size_MB) { - tools::expect(grid.size() > 0); + expect(grid.size() > 0); // determine total problem size auto const num_elems = grid.size(); @@ -56,13 +56,13 @@ get_num_subgrids(PDE

const &pde, elements::table const &elem_table, // determine size of assigned x and y vectors auto const elem_size = element_segment_size(pde); auto const num_x_elems = static_cast(grid.nrows()) * elem_size; - tools::expect(num_x_elems < INT_MAX); + expect(num_x_elems < INT_MAX); auto const num_y_elems = static_cast(grid.ncols()) * elem_size; - tools::expect(num_y_elems < INT_MAX); + expect(num_y_elems < INT_MAX); double const xy_space_MB = get_MB

(num_y_elems + num_x_elems); // make sure rank size is something reasonable - tools::expect(space_per_elem < (0.5 * rank_size_MB)); + expect(space_per_elem < (0.5 * rank_size_MB)); // size of workspaces, input, output double const problem_size_MB = space_per_elem * num_elems; @@ -82,7 +82,7 @@ get_num_subgrids(PDE

const &pde, elements::table const &elem_table, auto const remaining_rank_MB = rank_size_MB - coefficients_size_MB - table_size_MB - xy_space_MB; - tools::expect(remaining_rank_MB > space_per_elem * 4); + expect(remaining_rank_MB > space_per_elem * 4); // determine number of subgrids return static_cast(std::ceil(problem_size_MB / remaining_rank_MB)); @@ -94,7 +94,7 @@ inline std::vector decompose(PDE

const &pde, elements::table const &elem_table, element_subgrid const &my_subgrid, int const workspace_size_MB) { - tools::expect(workspace_size_MB > 0); + expect(workspace_size_MB > 0); // min number subgrids auto const num_subgrids = @@ -114,7 +114,7 @@ decompose(PDE

const &pde, elements::table const &elem_table, // square tile the assigned subgrid std::vector grids; auto const round_up = [](int const to_round, int const multiple) { - tools::expect(multiple); + expect(multiple); return ((to_round + multiple - 1) / multiple) * multiple; }; @@ -283,9 +283,9 @@ execute(PDE

const &pde, elements::table const &elem_table, auto const deg_to_dim = static_cast(std::pow(degree, pde.num_dims)); auto const output_size = my_subgrid.nrows() * deg_to_dim; - tools::expect(output_size == fx.size()); + expect(output_size == fx.size()); auto const input_size = my_subgrid.ncols() * deg_to_dim; - tools::expect(input_size == x.size()); + expect(input_size == x.size()); auto const &workspace = kronmult_workspace

::get_workspace(pde, elem_table, my_subgrid); @@ -318,7 +318,7 @@ execute(PDE

const &pde, elements::table const &elem_table, for (int j = 0; j < pde.num_dims; ++j) { builder(i * pde.num_dims + j) = pde.get_coefficients(i, j).data(); - tools::expect(pde.get_coefficients(i, j).nrows() == lda); + expect(pde.get_coefficients(i, j).nrows() == lda); } } return builder; @@ -364,7 +364,7 @@ execute(PDE

const &pde, elements::table const &elem_table, auto const deg_to_dim = static_cast(std::pow(degree, pde.num_dims)); auto const output_size = my_subgrid.nrows() * deg_to_dim; - tools::expect(output_size < INT_MAX); + expect(output_size < INT_MAX); fk::vector fx_dev(output_size); fk::vector const x_dev( x.clone_onto_device()); diff --git a/src/lib_dispatch.cpp b/src/lib_dispatch.cpp index fa5f11a38..674b40785 100644 --- a/src/lib_dispatch.cpp +++ b/src/lib_dispatch.cpp @@ -36,10 +36,10 @@ struct device_handler { #ifdef ASGARD_USE_CUDA auto success = cublasCreate(&handle); - tools::expect(success == CUBLAS_STATUS_SUCCESS); + expect(success == CUBLAS_STATUS_SUCCESS); success = cublasSetPointerMode(handle, CUBLAS_POINTER_MODE_HOST); - tools::expect(success == CUBLAS_STATUS_SUCCESS); + expect(success == CUBLAS_STATUS_SUCCESS); #endif } @@ -49,20 +49,20 @@ struct device_handler int num_devices; auto success = cudaGetDeviceCount(&num_devices); - tools::expect(success == cudaSuccess); - tools::expect(local_rank >= 0); - tools::expect(local_rank < num_devices); + expect(success == cudaSuccess); + expect(local_rank >= 0); + expect(local_rank < num_devices); if (handle) { auto const cublas_success = cublasDestroy(handle); - tools::expect(cublas_success == CUBLAS_STATUS_SUCCESS); + expect(cublas_success == CUBLAS_STATUS_SUCCESS); } success = cudaSetDevice(local_rank); - tools::expect(success == cudaSuccess); + expect(success == cudaSuccess); auto const cublas_success = cublasCreate(&handle); - tools::expect(cublas_success == CUBLAS_STATUS_SUCCESS); + expect(cublas_success == CUBLAS_STATUS_SUCCESS); #else ignore(local_rank); @@ -89,7 +89,7 @@ static device_handler device; void initialize_libraries(int const local_rank) { #ifdef ASGARD_USE_CUDA - tools::expect(local_rank >= 0); + expect(local_rank >= 0); device.set_device(local_rank); #else ignore(local_rank); @@ -115,10 +115,10 @@ namespace lib_dispatch template void rotg(P *a, P *b, P *c, P *s, resource const resrc) { - tools::expect(a && b && c && s); + expect(a && b && c && s); // function doesn't make sense outside of FP context - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); if (resrc == resource::device) { @@ -128,12 +128,12 @@ void rotg(P *a, P *b, P *c, P *s, resource const resrc) if constexpr (std::is_same::value) { auto const success = cublasDrotg(device.get_handle(), a, b, c, s); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSrotg(device.get_handle(), a, b, c, s); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -153,29 +153,29 @@ void rotg(P *a, P *b, P *c, P *s, resource const resrc) template P nrm2(int *n, P *x, int *incx, resource const resrc) { - tools::expect(x); - tools::expect(incx && *incx >= 0); - tools::expect(n && *n >= 0); + expect(x); + expect(incx && *incx >= 0); + expect(n && *n >= 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); P norm; // function instantiated for these two fp types if constexpr (std::is_same::value) { auto const success = cublasDnrm2(device.get_handle(), *n, x, *incx, &norm); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSnrm2(device.get_handle(), *n, x, *incx, &norm); - tools::expect(success == 0); + expect(success == 0); } return norm; #endif @@ -204,31 +204,31 @@ P nrm2(int *n, P *x, int *incx, resource const resrc) template void copy(int *n, P *x, int *incx, P *y, int *incy, resource const resrc) { - tools::expect(x); - tools::expect(y); - tools::expect(incx && *incx >= 0); - tools::expect(incy && *incy >= 0); - tools::expect(n && *n >= 0); + expect(x); + expect(y); + expect(incx && *incx >= 0); + expect(incy && *incy >= 0); + expect(n && *n >= 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); // function instantiated for these two fp types if constexpr (std::is_same::value) { auto const success = cublasDcopy(device.get_handle(), *n, x, *incx, y, *incy); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasScopy(device.get_handle(), *n, x, *incx, y, *incy); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -255,18 +255,18 @@ void copy(int *n, P *x, int *incx, P *y, int *incy, resource const resrc) template P dot(int *n, P *x, int *incx, P *y, int *incy, resource const resrc) { - tools::expect(x); - tools::expect(y); - tools::expect(incx && *incx >= 0); - tools::expect(incy && *incy >= 0); - tools::expect(n && *n >= 0); + expect(x); + expect(y); + expect(incx && *incx >= 0); + expect(incy && *incy >= 0); + expect(n && *n >= 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); P result = 0.; // instantiated for these two fp types @@ -274,13 +274,13 @@ P dot(int *n, P *x, int *incx, P *y, int *incy, resource const resrc) { auto const success = cublasDdot(device.get_handle(), *n, x, *incx, y, *incy, &result); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSdot(device.get_handle(), *n, x, *incx, y, *incy, &result); - tools::expect(success == 0); + expect(success == 0); } return result; #endif @@ -310,32 +310,32 @@ template void axpy(int *n, P *alpha, P *x, int *incx, P *y, int *incy, resource const resrc) { - tools::expect(alpha); - tools::expect(x); - tools::expect(y); - tools::expect(incx && *incx >= 0); - tools::expect(incy && *incy >= 0); - tools::expect(n && *n >= 0); + expect(alpha); + expect(x); + expect(y); + expect(incx && *incx >= 0); + expect(incy && *incy >= 0); + expect(n && *n >= 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); // instantiated for these two fp types if constexpr (std::is_same::value) { auto const success = cublasDaxpy(device.get_handle(), *n, alpha, x, *incx, y, *incy); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSaxpy(device.get_handle(), *n, alpha, x, *incx, y, *incy); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -362,30 +362,30 @@ void axpy(int *n, P *alpha, P *x, int *incx, P *y, int *incy, template void scal(int *n, P *alpha, P *x, int *incx, resource const resrc) { - tools::expect(alpha); - tools::expect(x); - tools::expect(n && *n >= 0); - tools::expect(incx && *incx >= 0); + expect(alpha); + expect(x); + expect(n && *n >= 0); + expect(incx && *incx >= 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); // instantiated for these two fp types if constexpr (std::is_same::value) { auto const success = cublasDscal(device.get_handle(), *n, alpha, x, *incx); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSscal(device.get_handle(), *n, alpha, x, *incx); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -418,12 +418,12 @@ basic_gemm(P const *A, bool const trans_A, int const lda, P *B, bool trans_B, int const ldb, P *C, int const ldc, int const m, int const k, int const n, P const alpha, P const beta) { - tools::expect(m > 0); - tools::expect(k > 0); - tools::expect(n > 0); - tools::expect(lda > 0); // FIXME Tyler says these could be more thorough - tools::expect(ldb > 0); - tools::expect(ldc > 0); + expect(m > 0); + expect(k > 0); + expect(n > 0); + expect(lda > 0); // FIXME Tyler says these could be more thorough + expect(ldb > 0); + expect(ldc > 0); for (auto i = 0; i < m; ++i) { @@ -446,11 +446,11 @@ static void basic_gemv(P const *A, bool const trans_A, int const lda, P const *x, int const incx, P *y, int const incy, int const m, int const n, P const alpha, P const beta) { - tools::expect(m > 0); - tools::expect(n > 0); - tools::expect(lda > 0); - tools::expect(incx > 0); - tools::expect(incy > 0); + expect(m > 0); + expect(n > 0); + expect(lda > 0); + expect(incx > 0); + expect(incy > 0); for (auto i = 0; i < m; ++i) { @@ -468,24 +468,24 @@ template void gemv(char const *trans, int *m, int *n, P *alpha, P *A, int *lda, P *x, int *incx, P *beta, P *y, int *incy, resource const resrc) { - tools::expect(alpha); - tools::expect(A); - tools::expect(x); - tools::expect(beta); - tools::expect(y); - tools::expect(m && *m >= 0); - tools::expect(n && *n >= 0); - tools::expect(lda && *lda >= 0); - tools::expect(incx && *incx >= 0); - tools::expect(incy && *incy >= 0); - tools::expect(trans && (*trans == 't' || *trans == 'n')); + expect(alpha); + expect(A); + expect(x); + expect(beta); + expect(y); + expect(m && *m >= 0); + expect(n && *n >= 0); + expect(lda && *lda >= 0); + expect(incx && *incx >= 0); + expect(incy && *incy >= 0); + expect(trans && (*trans == 't' || *trans == 'n')); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); // instantiated for these two fp types if constexpr (std::is_same::value) @@ -493,14 +493,14 @@ void gemv(char const *trans, int *m, int *n, P *alpha, P *A, int *lda, P *x, auto const success = cublasDgemv(device.get_handle(), cublas_trans(*trans), *m, *n, alpha, A, *lda, x, *incx, beta, y, *incy); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSgemv(device.get_handle(), cublas_trans(*trans), *m, *n, alpha, A, *lda, x, *incx, beta, y, *incy); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -530,26 +530,26 @@ void gemm(char const *transa, char const *transb, int *m, int *n, int *k, P *alpha, P *A, int *lda, P *B, int *ldb, P *beta, P *C, int *ldc, resource const resrc) { - tools::expect(alpha); - tools::expect(A); - tools::expect(lda && *lda >= 0); - tools::expect(B); - tools::expect(ldb && *ldb >= 0); - tools::expect(beta); - tools::expect(C); - tools::expect(ldc && *ldc >= 0); - tools::expect(m && *m >= 0); - tools::expect(n && *n >= 0); - tools::expect(k && *k >= 0); - tools::expect(transa && (*transa == 't' || *transa == 'n')); - tools::expect(transb && (*transb == 't' || *transb == 'n')); + expect(alpha); + expect(A); + expect(lda && *lda >= 0); + expect(B); + expect(ldb && *ldb >= 0); + expect(beta); + expect(C); + expect(ldc && *ldc >= 0); + expect(m && *m >= 0); + expect(n && *n >= 0); + expect(k && *k >= 0); + expect(transa && (*transa == 't' || *transa == 'n')); + expect(transb && (*transb == 't' || *transb == 'n')); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); // instantiated for these two fp types if constexpr (std::is_same::value) @@ -557,14 +557,14 @@ void gemm(char const *transa, char const *transb, int *m, int *n, int *k, auto const success = cublasDgemm( device.get_handle(), cublas_trans(*transa), cublas_trans(*transb), *m, *n, *k, alpha, A, *lda, B, *ldb, beta, C, *ldc); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSgemm( device.get_handle(), cublas_trans(*transa), cublas_trans(*transb), *m, *n, *k, alpha, A, *lda, B, *ldb, beta, C, *ldc); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -592,12 +592,12 @@ template void getrf(int *m, int *n, P *A, int *lda, int *ipiv, int *info, resource const resrc) { - tools::expect(A); - tools::expect(ipiv); - tools::expect(info); - tools::expect(lda && *lda >= 0); - tools::expect(m && *m >= 0); - tools::expect(n && *n >= 0); + expect(A); + expect(ipiv); + expect(info); + expect(lda && *lda >= 0); + expect(m && *m >= 0); + expect(n && *n >= 0); if (resrc == resource::device) { @@ -605,28 +605,28 @@ void getrf(int *m, int *n, P *A, int *lda, int *ipiv, int *info, #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); - tools::expect(*m == *n); + expect(std::is_floating_point_v

); + expect(*m == *n); ignore(m); P **A_d; auto stat = cudaMalloc((void **)&A_d, sizeof(P *)); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(A_d, &A, sizeof(P *), cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); // instantiated for these two fp types if constexpr (std::is_same::value) { auto const success = cublasDgetrfBatched(device.get_handle(), *n, A_d, *lda, ipiv, info, 1); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSgetrfBatched(device.get_handle(), *n, A_d, *lda, ipiv, info, 1); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -644,7 +644,7 @@ void getrf(int *m, int *n, P *A, int *lda, int *ipiv, int *info, else { // not instantiated; should never be reached std::cerr << "getrf not implemented for non-floating types" << '\n'; - tools::expect(false); + expect(false); } } @@ -652,13 +652,13 @@ template void getri(int *n, P *A, int *lda, int *ipiv, P *work, int *lwork, int *info, resource const resrc) { - tools::expect(A); - tools::expect(ipiv); - tools::expect(work); - tools::expect(lwork); - tools::expect(info); - tools::expect(lda && *lda >= 0); - tools::expect(n && *n >= 0); + expect(A); + expect(ipiv); + expect(work); + expect(lwork); + expect(info); + expect(lda && *lda >= 0); + expect(n && *n >= 0); if (resrc == resource::device) { @@ -666,35 +666,35 @@ void getri(int *n, P *A, int *lda, int *ipiv, P *work, int *lwork, int *info, #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); - tools::expect(*lwork == (*n) * (*n)); + expect(*lwork == (*n) * (*n)); ignore(lwork); P const **A_d; P **work_d; auto stat = cudaMalloc((void **)&A_d, sizeof(P *)); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMalloc((void **)&work_d, sizeof(P *)); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(A_d, &A, sizeof(P *), cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(work_d, &work, sizeof(P *), cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); // instantiated for these two fp types if constexpr (std::is_same::value) { auto const success = cublasDgetriBatched( device.get_handle(), *n, A_d, *lda, nullptr, work_d, *n, info, 1); - tools::expect(success == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { auto const success = cublasSgetriBatched( device.get_handle(), *n, A_d, *lda, nullptr, work_d, *n, info, 1); - tools::expect(success == 0); + expect(success == 0); } return; #endif @@ -712,7 +712,7 @@ void getri(int *n, P *A, int *lda, int *ipiv, P *work, int *lwork, int *info, else { // not instantiated; should never be reached std::cerr << "getri not implemented for non-floating types" << '\n'; - tools::expect(false); + expect(false); } } @@ -722,27 +722,27 @@ void batched_gemm(P **const &a, int *lda, char const *transa, P **const &b, int *n, int *k, P *alpha, P *beta, int *num_batch, resource const resrc) { - tools::expect(alpha); - tools::expect(a); - tools::expect(lda && *lda >= 0); - tools::expect(b); - tools::expect(ldb && *ldb >= 0); - tools::expect(beta); - tools::expect(c); - tools::expect(ldc && *ldc >= 0); - tools::expect(m && *m >= 0); - tools::expect(n && *n >= 0); - tools::expect(k && *k >= 0); - tools::expect(transa && (*transa == 't' || *transa == 'n')); - tools::expect(transb && (*transb == 't' || *transb == 'n')); - tools::expect(num_batch && *num_batch > 0); + expect(alpha); + expect(a); + expect(lda && *lda >= 0); + expect(b); + expect(ldb && *ldb >= 0); + expect(beta); + expect(c); + expect(ldc && *ldc >= 0); + expect(m && *m >= 0); + expect(n && *n >= 0); + expect(k && *k >= 0); + expect(transa && (*transa == 't' || *transa == 'n')); + expect(transb && (*transb == 't' || *transb == 'n')); + expect(num_batch && *num_batch > 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); P const **a_d; P const **b_d; @@ -750,17 +750,17 @@ void batched_gemm(P **const &a, int *lda, char const *transa, P **const &b, size_t const list_size = *num_batch * sizeof(P *); auto stat = cudaMalloc((void **)&a_d, list_size); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMalloc((void **)&b_d, list_size); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMalloc((void **)&c_d, list_size); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(a_d, a, list_size, cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(b_d, b, list_size, cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(c_d, c, list_size, cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); // instantiated for these two fp types if constexpr (std::is_same::value) @@ -769,8 +769,8 @@ void batched_gemm(P **const &a, int *lda, char const *transa, P **const &b, device.get_handle(), cublas_trans(*transa), cublas_trans(*transb), *m, *n, *k, alpha, a_d, *lda, b_d, *ldb, beta, c_d, *ldc, *num_batch); auto const cuda_stat = cudaDeviceSynchronize(); - tools::expect(cuda_stat == 0); - tools::expect(success == 0); + expect(cuda_stat == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { @@ -778,16 +778,16 @@ void batched_gemm(P **const &a, int *lda, char const *transa, P **const &b, device.get_handle(), cublas_trans(*transa), cublas_trans(*transb), *m, *n, *k, alpha, a_d, *lda, b_d, *ldb, beta, c_d, *ldc, *num_batch); auto const cuda_stat = cudaDeviceSynchronize(); - tools::expect(cuda_stat == 0); - tools::expect(success == 0); + expect(cuda_stat == 0); + expect(success == 0); } stat = cudaFree(a_d); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaFree(b_d); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaFree(c_d); - tools::expect(stat == 0); + expect(stat == 0); return; #endif @@ -813,24 +813,24 @@ void batched_gemv(P **const &a, int *lda, char const *trans, P **const &x, P **const &y, int *m, int *n, P *alpha, P *beta, int *num_batch, resource const resrc) { - tools::expect(alpha); - tools::expect(a); - tools::expect(lda && *lda >= 0); - tools::expect(x); - tools::expect(beta); - tools::expect(y); - tools::expect(m && *m >= 0); - tools::expect(n && *n >= 0); - - tools::expect(trans && (*trans == 't' || *trans == 'n')); - tools::expect(num_batch && *num_batch > 0); + expect(alpha); + expect(a); + expect(lda && *lda >= 0); + expect(x); + expect(beta); + expect(y); + expect(m && *m >= 0); + expect(n && *n >= 0); + + expect(trans && (*trans == 't' || *trans == 'n')); + expect(num_batch && *num_batch > 0); if (resrc == resource::device) { // device-specific specialization if needed #ifdef ASGARD_USE_CUDA // no non-fp blas on device - tools::expect(std::is_floating_point_v

); + expect(std::is_floating_point_v

); char const transb = 'n'; int gemm_m = *trans == 't' ? *n : *m; @@ -846,17 +846,17 @@ void batched_gemv(P **const &a, int *lda, char const *trans, P **const &x, size_t const list_size = *num_batch * sizeof(P *); auto stat = cudaMalloc((void **)&a_d, list_size); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMalloc((void **)&x_d, list_size); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMalloc((void **)&y_d, list_size); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(a_d, a, list_size, cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(x_d, x, list_size, cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaMemcpy(y_d, y, list_size, cudaMemcpyHostToDevice); - tools::expect(stat == 0); + expect(stat == 0); // instantiated for these two fp types if constexpr (std::is_same::value) @@ -866,8 +866,8 @@ void batched_gemv(P **const &a, int *lda, char const *trans, P **const &x, gemm_m, gemm_n, gemm_k, alpha, a_d, *lda, x_d, ldb, beta, y_d, ldc, *num_batch); auto const cuda_stat = cudaDeviceSynchronize(); - tools::expect(cuda_stat == 0); - tools::expect(success == 0); + expect(cuda_stat == 0); + expect(success == 0); } else if constexpr (std::is_same::value) { @@ -876,16 +876,16 @@ void batched_gemv(P **const &a, int *lda, char const *trans, P **const &x, gemm_m, gemm_n, gemm_k, alpha, a_d, *lda, x_d, ldb, beta, y_d, ldc, *num_batch); auto const cuda_stat = cudaDeviceSynchronize(); - tools::expect(cuda_stat == 0); - tools::expect(success == 0); + expect(cuda_stat == 0); + expect(success == 0); } stat = cudaFree(a_d); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaFree(x_d); - tools::expect(stat == 0); + expect(stat == 0); stat = cudaFree(y_d); - tools::expect(stat == 0); + expect(stat == 0); return; @@ -906,17 +906,17 @@ template void gesv(int *n, int *nrhs, P *A, int *lda, int *ipiv, P *b, int *ldb, int *info) { - tools::expect(n); - tools::expect(nrhs); - tools::expect(A); - tools::expect(lda); - tools::expect(ipiv); - tools::expect(info); - tools::expect(b); - tools::expect(ldb); - tools::expect(*ldb >= 1); - tools::expect(*lda >= 1); - tools::expect(*n >= 0); + expect(n); + expect(nrhs); + expect(A); + expect(lda); + expect(ipiv); + expect(info); + expect(b); + expect(ldb); + expect(*ldb >= 1); + expect(*lda >= 1); + expect(*n >= 0); if constexpr (std::is_same::value) { dgesv_(n, nrhs, A, lda, ipiv, b, ldb, info); @@ -928,7 +928,7 @@ void gesv(int *n, int *nrhs, P *A, int *lda, int *ipiv, P *b, int *ldb, else { // not instantiated; should never be reached std::cerr << "gesv not implemented for non-floating types" << '\n'; - tools::expect(false); + expect(false); } } @@ -936,18 +936,18 @@ template void getrs(char *trans, int *n, int *nrhs, P *A, int *lda, int *ipiv, P *b, int *ldb, int *info) { - tools::expect(trans); - tools::expect(n); - tools::expect(nrhs); - tools::expect(A); - tools::expect(lda); - tools::expect(ipiv); - tools::expect(info); - tools::expect(b); - tools::expect(ldb); - tools::expect(*ldb >= 1); - tools::expect(*lda >= 1); - tools::expect(*n >= 0); + expect(trans); + expect(n); + expect(nrhs); + expect(A); + expect(lda); + expect(ipiv); + expect(info); + expect(b); + expect(ldb); + expect(*ldb >= 1); + expect(*lda >= 1); + expect(*n >= 0); if constexpr (std::is_same::value) { dgetrs_(trans, n, nrhs, A, lda, ipiv, b, ldb, info); @@ -968,17 +968,17 @@ template void slate_gesv(int *n, int *nrhs, P *A, int *lda, int *ipiv, P *b, int *ldb, int *info) { - tools::expect(n); - tools::expect(nrhs); - tools::expect(A); - tools::expect(lda); - tools::expect(ipiv); - tools::expect(info); - tools::expect(b); - tools::expect(ldb); - tools::expect(*ldb >= 1); - tools::expect(*lda >= 1); - tools::expect(*n >= 0); + expect(n); + expect(nrhs); + expect(A); + expect(lda); + expect(ipiv); + expect(info); + expect(b); + expect(ldb); + expect(*ldb >= 1); + expect(*lda >= 1); + expect(*n >= 0); if constexpr (std::is_same::value) { slate_dgesv_(n, nrhs, A, lda, ipiv, b, ldb, info); @@ -998,18 +998,18 @@ template void slate_getrs(char *trans, int *n, int *nrhs, P *A, int *lda, int *ipiv, P *b, int *ldb, int *info) { - tools::expect(trans); - tools::expect(n); - tools::expect(nrhs); - tools::expect(A); - tools::expect(lda); - tools::expect(ipiv); - tools::expect(info); - tools::expect(b); - tools::expect(ldb); - tools::expect(*ldb >= 1); - tools::expect(*lda >= 1); - tools::expect(*n >= 0); + expect(trans); + expect(n); + expect(nrhs); + expect(A); + expect(lda); + expect(ipiv); + expect(info); + expect(b); + expect(ldb); + expect(*ldb >= 1); + expect(*lda >= 1); + expect(*n >= 0); if constexpr (std::is_same::value) { slate_dgetrs_(trans, n, nrhs, A, lda, ipiv, b, ldb, info); @@ -1021,7 +1021,7 @@ void slate_getrs(char *trans, int *n, int *nrhs, P *A, int *lda, int *ipiv, else { // not instantiated; should never be reached std::cerr << "getrs not implemented for non-floating types" << '\n'; - tools::expect(false); + expect(false); } } #endif diff --git a/src/lib_dispatch_tests.cpp b/src/lib_dispatch_tests.cpp index a9780575b..87ea0c9ea 100644 --- a/src/lib_dispatch_tests.cpp +++ b/src/lib_dispatch_tests.cpp @@ -841,18 +841,18 @@ void test_batched_gemm(int const m, int const n, int const k, int const lda, bool const trans_a = false, bool const trans_b = false, P const alpha = 1.0, P const beta = 0.0) { - tools::expect(m > 0); - tools::expect(n > 0); - tools::expect(k > 0); + expect(m > 0); + expect(n > 0); + expect(k > 0); int const rows_a = trans_a ? k : m; int const cols_a = trans_a ? m : k; - tools::expect(lda >= rows_a); - tools::expect(ldc >= m); + expect(lda >= rows_a); + expect(ldc >= m); int const rows_b = trans_b ? n : k; int const cols_b = trans_b ? k : n; - tools::expect(ldb >= rows_b); + expect(ldb >= rows_b); std::vector>> const matrices = [=]() { @@ -1059,9 +1059,9 @@ void test_batched_gemv(int const m, int const n, int const lda, bool const trans_a = false, P const alpha = 1.0, P const beta = 0.0) { - tools::expect(m > 0); - tools::expect(n > 0); - tools::expect(lda >= m); + expect(m > 0); + expect(n > 0); + expect(lda >= m); int const rows_a = trans_a ? n : m; int const cols_a = trans_a ? m : n; diff --git a/src/main.cpp b/src/main.cpp index 26e3bad19..2c5075fb9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -205,8 +205,8 @@ int main(int argc, char **argv) auto const relative_error = RMSE / inf_norm(analytic_solution) * 100; auto const [rmse_errors, relative_errors] = gather_errors(RMSE, relative_error); - tools::expect(rmse_errors.size() == relative_errors.size()); - for (auto i = 0; i < rmse_errors.size(); ++i) + expect(rmse_errors.size() == relative_errors.size()); + for (int i = 0; i < rmse_errors.size(); ++i) { node_out() << "Errors for local rank: " << i << '\n'; node_out() << "RMSE (numeric-analytic) [wavelet]: " << rmse_errors(i) diff --git a/src/matlab_utilities.cpp b/src/matlab_utilities.cpp index 6915d0918..f6c1a818b 100644 --- a/src/matlab_utilities.cpp +++ b/src/matlab_utilities.cpp @@ -41,7 +41,7 @@ template std::enable_if_t::value, fk::vector

> linspace(P const start, P const end, unsigned int const num_elems) { - tools::expect(num_elems > 1); // must have at least 2 elements + expect(num_elems > 1); // must have at least 2 elements // create output vector fk::vector

points(num_elems); @@ -131,7 +131,7 @@ template P polyval(fk::vector

const p, P const x) { int const num_terms = p.size(); - tools::expect(num_terms > 0); + expect(num_terms > 0); P y = static_cast

(p(0)); for (int i = 1; i < num_terms; ++i) @@ -147,8 +147,8 @@ fk::vector

polyval(fk::vector

const p, fk::vector

const x) { int const num_terms = p.size(); int const num_sols = x.size(); - tools::expect(num_terms > 0); - tools::expect(num_sols > 0); + expect(num_terms > 0); + expect(num_sols > 0); fk::vector

solutions(num_sols); for (int i = 0; i < num_sols; ++i) @@ -206,7 +206,7 @@ fk::vector read_vector_from_bin_file(std::string const &path) if (!infile) { std::cout << "ERROR: Unable to open file " << path << "\n"; - tools::expect(!infile.fail()); + expect(!infile.fail()); } std::streampos bytes; @@ -248,7 +248,7 @@ double read_scalar_from_txt_file(std::string const &path) if (!infile) { std::cout << "ERROR: Unable to open file " << path << "\n"; - tools::expect(!infile.fail()); + expect(!infile.fail()); } std::string tmp_str; @@ -259,9 +259,9 @@ double read_scalar_from_txt_file(std::string const &path) // third line. expect "# type: scalar" infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "type:"); + expect(tmp_str == "type:"); infile >> tmp_str; - tools::expect(tmp_str == "scalar"); + expect(tmp_str == "scalar"); double value; @@ -290,7 +290,7 @@ fk::vector read_vector_from_txt_file(std::string const &path) if (!infile) { std::cout << "ERROR: Unable to open file " << path << "\n"; - tools::expect(!infile.fail()); + expect(!infile.fail()); } std::string tmp_str; @@ -301,26 +301,26 @@ fk::vector read_vector_from_txt_file(std::string const &path) // third line. expect "# type: matrix" infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "type:"); + expect(tmp_str == "type:"); infile >> tmp_str; - tools::expect(tmp_str == "matrix"); + expect(tmp_str == "matrix"); // get the number of rows infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "rows:"); + expect(tmp_str == "rows:"); infile >> tmp_str; int rows = std::stoi(tmp_str); // get the number of columns infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "columns:"); + expect(tmp_str == "columns:"); infile >> tmp_str; int columns = std::stoi(tmp_str); // make sure we're working with a (either row or column) vector - tools::expect((rows == 1) || columns == 1); + expect((rows == 1) || columns == 1); int const num_elems = (rows >= columns) ? rows : columns; @@ -357,7 +357,7 @@ fk::matrix read_matrix_from_txt_file(std::string const &path) if (!infile) { std::cout << "ERROR: Unable to open file " << path << "\n"; - tools::expect(!infile.fail()); + expect(!infile.fail()); } std::string tmp_str; @@ -368,21 +368,21 @@ fk::matrix read_matrix_from_txt_file(std::string const &path) // third line. expect "# type: matrix" infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "type:"); + expect(tmp_str == "type:"); infile >> tmp_str; - tools::expect(tmp_str == "matrix"); + expect(tmp_str == "matrix"); // get the number of rows infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "rows:"); + expect(tmp_str == "rows:"); infile >> tmp_str; int rows = std::stoi(tmp_str); // get the number of columns infile >> tmp_str; // chomp the '#' infile >> tmp_str; - tools::expect(tmp_str == "columns:"); + expect(tmp_str == "columns:"); infile >> tmp_str; int columns = std::stoi(tmp_str); @@ -403,14 +403,14 @@ fk::matrix read_matrix_from_txt_file(std::string const &path) template fk::matrix

horz_matrix_concat(std::vector> const matrices) { - tools::expect(matrices.size() > 0); + expect(matrices.size() > 0); auto const [nrows, ncols] = [&]() { int col_accum = 0; int const nrows = matrices[0].nrows(); for (auto const &mat : matrices) { col_accum += mat.ncols(); - tools::expect(mat.nrows() == nrows); + expect(mat.nrows() == nrows); } return std::array{nrows, col_accum}; }(); @@ -437,7 +437,7 @@ fk::matrix

horz_matrix_concat(std::vector> const matrices) // fk::matrix meshgrid(int const start, int const length) { - tools::expect(length > 0); + expect(length > 0); fk::matrix mesh(length, length); fk::vector const row = [=]() { fk::vector row(length); @@ -454,7 +454,7 @@ fk::matrix meshgrid(int const start, int const length) template fk::matrix

reshape(fk::matrix mat, int const nrow, int const ncol) { - tools::expect(nrow * ncol == mat.size()); + expect(nrow * ncol == mat.size()); fk::vector

X(mat); fk::matrix

Xreshape(nrow, ncol); diff --git a/src/pde/pde_base.hpp b/src/pde/pde_base.hpp index 7e8ef3ba2..477125135 100644 --- a/src/pde/pde_base.hpp +++ b/src/pde/pde_base.hpp @@ -94,13 +94,13 @@ class dimension private: void set_level(int const level) { - tools::expect(level >= 0); + expect(level >= 0); level_ = level; } void set_degree(int const degree) { - tools::expect(degree > 0); + expect(degree > 0); degree_ = degree; } @@ -238,8 +238,8 @@ class term void set_partial_coefficients(fk::matrix

const &coeffs, int const pterm) { - tools::expect(pterm >= 0); - tools::expect(pterm < static_cast(partial_terms_.size())); + expect(pterm >= 0); + expect(pterm < static_cast(partial_terms_.size())); partial_terms_[pterm].set_coefficients(coeffs); } @@ -260,15 +260,15 @@ class term { auto const new_dof = adapted_dim.get_degree() * fm::two_raised_to(adapted_dim.get_level()); - tools::expect(coefficients_.nrows() == coefficients_.ncols()); + expect(coefficients_.nrows() == coefficients_.ncols()); auto new_coeffs = eye

(new_dof); for (auto const &pterm : partial_terms_) { auto const &partial_coeff = pterm.get_coefficients(); - tools::expect(partial_coeff.size() >= - new_dof); // make sure we built the partial terms to support - // new level/degree + expect(partial_coeff.size() > + new_dof); // make sure we built the partial terms to support + // new level/degree new_coeffs = new_coeffs * fk::matrix( partial_coeff, 0, new_dof - 1, 0, @@ -346,19 +346,18 @@ class PDE has_analytic_soln(has_analytic_soln), dimensions_(dimensions), terms_(terms) { - tools::expect(num_dims > 0); - tools::expect(num_sources >= 0); - tools::expect(num_terms > 0); + expect(num_dims > 0); + expect(num_sources >= 0); + expect(num_terms > 0); - tools::expect(dimensions.size() == static_cast(num_dims)); - tools::expect(terms.size() == static_cast(num_terms)); - tools::expect(sources.size() == static_cast(num_sources)); + expect(dimensions.size() == static_cast(num_dims)); + expect(terms.size() == static_cast(num_terms)); + expect(sources.size() == static_cast(num_sources)); // ensure analytic solution functions were provided if this flag is set if (has_analytic_soln) { - tools::expect(exact_vector_funcs.size() == - static_cast(num_dims)); + expect(exact_vector_funcs.size() == static_cast(num_dims)); } // modify for appropriate level/degree @@ -376,7 +375,7 @@ class PDE for (dimension

&d : dimensions_) { auto const num_levels = cli_input.get_starting_levels()(counter++); - tools::expect(num_levels > 1); + expect(num_levels > 1); d.set_level(num_levels); } } @@ -384,7 +383,7 @@ class PDE auto const cli_degree = cli_input.get_degree(); if (cli_degree != parser::NO_USER_VALUE) { - tools::expect(cli_degree > 0); + expect(cli_degree > 0); for (dimension

&d : dimensions_) { d.set_degree(cli_degree); @@ -396,15 +395,15 @@ class PDE // check all terms for (auto &term_list : terms_) { - tools::expect(term_list.size() == static_cast(num_dims)); + expect(term_list.size() == static_cast(num_dims)); for (auto &term_1D : term_list) { - tools::expect(term_1D.get_partial_terms().size() > 0); + expect(term_1D.get_partial_terms().size() > 0); auto const max_dof = fm::two_raised_to(static_cast(cli_input.get_max_level())) * degree; - tools::expect(max_dof < INT_MAX); + expect(max_dof < INT_MAX); term_1D.set_data(fk::vector

(std::vector

(max_dof, 1.0))); term_1D.set_coefficients(eye

(max_dof)); @@ -412,15 +411,14 @@ class PDE for (auto &p : term_1D.get_partial_terms()) { if (p.left_homo == homogeneity::homogeneous) - tools::expect(static_cast(p.left_bc_funcs.size()) == 0); + expect(static_cast(p.left_bc_funcs.size()) == 0); else if (p.left_homo == homogeneity::inhomogeneous) - tools::expect(static_cast(p.left_bc_funcs.size()) == num_dims); + expect(static_cast(p.left_bc_funcs.size()) == num_dims); if (p.right_homo == homogeneity::homogeneous) - tools::expect(static_cast(p.right_bc_funcs.size()) == 0); + expect(static_cast(p.right_bc_funcs.size()) == 0); else if (p.right_homo == homogeneity::inhomogeneous) - tools::expect(static_cast(p.right_bc_funcs.size()) == - num_dims); + expect(static_cast(p.right_bc_funcs.size()) == num_dims); } } } @@ -428,15 +426,15 @@ class PDE // check all dimensions for (auto const &d : dimensions_) { - tools::expect(d.get_degree() > 0); - tools::expect(d.get_level() > 1); - tools::expect(d.domain_max > d.domain_min); + expect(d.get_degree() > 0); + expect(d.get_level() > 1); + expect(d.domain_max > d.domain_min); } // check all sources for (auto const &s : sources) { - tools::expect(s.source_funcs.size() == static_cast(num_dims)); + expect(s.source_funcs.size() == static_cast(num_dims)); } // set the dt @@ -473,10 +471,10 @@ class PDE fk::matrix const & get_coefficients(int const term, int const dim) const { - tools::expect(term >= 0); - tools::expect(term < num_terms); - tools::expect(dim >= 0); - tools::expect(dim < num_dims); + expect(term >= 0); + expect(term < num_terms); + expect(dim >= 0); + expect(dim < num_dims); return terms_[term][dim].get_coefficients(); } @@ -485,20 +483,20 @@ class PDE void set_coefficients(fk::matrix

const &coeffs, int const term, int const dim) { - tools::expect(term >= 0); - tools::expect(term < num_terms); - tools::expect(dim >= 0); - tools::expect(dim < num_dims); + expect(term >= 0); + expect(term < num_terms); + expect(dim >= 0); + expect(dim < num_dims); terms_[term][dim].set_coefficients(coeffs); } void set_partial_coefficients(int const term, int const dim, int const pterm, fk::matrix

const &coeffs) { - tools::expect(term >= 0); - tools::expect(term < num_terms); - tools::expect(dim >= 0); - tools::expect(dim < num_dims); + expect(term >= 0); + expect(term < num_terms); + expect(dim >= 0); + expect(dim < num_dims); terms_[term][dim].set_partial_coefficients(coeffs, pterm); } @@ -513,8 +511,8 @@ class PDE void rechain_dimension(int const dim_index) { - tools::expect(dim_index >= 0); - tools::expect(dim_index < num_dims); + expect(dim_index >= 0); + expect(dim_index < num_dims); for (auto i = 0; i < num_terms; ++i) { terms_[i][dim_index].rechain_coefficients(dimensions_[dim_index]); @@ -525,7 +523,7 @@ class PDE void set_dt(P const dt) { - tools::expect(dt > 0.0); + expect(dt > 0.0); dt_ = dt; } diff --git a/src/pde/pde_fokkerplanck2_complete.hpp b/src/pde/pde_fokkerplanck2_complete.hpp index b8cd14ed4..beca70816 100644 --- a/src/pde/pde_fokkerplanck2_complete.hpp +++ b/src/pde/pde_fokkerplanck2_complete.hpp @@ -376,7 +376,7 @@ class PDE_fokkerplanck_2d_complete : public PDE

static P e1_g2(P const x, P const time = 0) { ignore(time); - tools::expect(x > 0); + expect(x > 0); return 1.0 / std::pow(x, 2); } static P e1_g3(P const x, P const time = 0) diff --git a/src/permutations.cpp b/src/permutations.cpp index dda6e51c3..fdc21e40a 100644 --- a/src/permutations.cpp +++ b/src/permutations.cpp @@ -18,8 +18,8 @@ namespace permutations // (where n == 'num_dims') whose non-negative elements' sum == 'limit' int count_equal(int const num_dims, int const limit) { - tools::expect(num_dims > 0); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(limit >= 0); if (num_dims == 1) { return 1; @@ -45,9 +45,9 @@ int count_equal(int const num_dims, int const limit) int count_equal_multi(fk::vector const &levels, int const num_dims, int const limit) { - tools::expect(num_dims > 0); - tools::expect(levels.size() == num_dims); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(levels.size() == num_dims); + expect(limit >= 0); if (num_dims == 1) { @@ -73,8 +73,8 @@ int count_equal_multi(fk::vector const &levels, int const num_dims, // (where n == 'num_dims') whose non-negative elements' sum <= 'limit' int count_lequal(int const num_dims, int const limit) { - tools::expect(num_dims > 0); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(limit >= 0); int count = 0; for (auto i = 0; i <= limit; ++i) @@ -89,9 +89,9 @@ int count_lequal(int const num_dims, int const limit) // this version handles the non-uniform level case int count_lequal_multi(fk::vector const &levels, int num_dims, int limit) { - tools::expect(num_dims > 0); - tools::expect(levels.size() == num_dims); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(levels.size() == num_dims); + expect(limit >= 0); auto count = 0; for (auto i = 0; i <= limit; ++i) @@ -107,8 +107,8 @@ int count_lequal_multi(fk::vector const &levels, int num_dims, int limit) // grid only) int count_max(int const num_dims, int const limit) { - tools::expect(num_dims > 0); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(limit >= 0); return static_cast(std::pow(limit + 1, num_dims)); } @@ -123,8 +123,8 @@ int count_max(int const num_dims, int const limit) fk::matrix get_equal(int const num_dims, int const limit, bool const order_by_n) { - tools::expect(num_dims > 0); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(limit >= 0); int const num_tuples = count_equal(num_dims, limit); fk::matrix result(num_tuples, num_dims); @@ -175,9 +175,9 @@ fk::matrix get_equal_multi(fk::vector const &levels, int const num_dims, int const limit, bool const last_index_decreasing) { - tools::expect(num_dims > 0); - tools::expect(levels.size() == num_dims); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(levels.size() == num_dims); + expect(limit >= 0); if (num_dims == 1) { @@ -230,8 +230,8 @@ fk::matrix get_equal_multi(fk::vector const &levels, fk::matrix get_lequal(int const num_dims, int const limit, bool const order_by_n) { - tools::expect(num_dims > 0); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(limit >= 0); int const num_tuples = count_lequal(num_dims, limit); fk::matrix result(num_tuples, num_dims); @@ -282,9 +282,9 @@ fk::matrix get_lequal_multi(fk::vector const &levels, int const num_dims, int const limit, bool const increasing_sum_order) { - tools::expect(num_dims > 0); - tools::expect(levels.size() == num_dims); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(levels.size() == num_dims); + expect(limit >= 0); auto const num_tuples = count_lequal_multi(levels, num_dims, limit); fk::matrix result(num_tuples, num_dims); @@ -313,8 +313,8 @@ fk::matrix get_lequal_multi(fk::vector const &levels, fk::matrix get_max(int const num_dims, int const limit, bool const last_index_decreasing) { - tools::expect(num_dims > 0); - tools::expect(limit >= 0); + expect(num_dims > 0); + expect(limit >= 0); int const num_tuples = count_max(num_dims, limit); fk::matrix result(num_tuples, num_dims); @@ -361,8 +361,8 @@ get_max(int const num_dims, int const limit, bool const last_index_decreasing) fk::matrix get_max_multi(fk::vector const &levels, int const num_dims, bool const last_index_decreasing) { - tools::expect(num_dims > 0); - tools::expect(levels.size() > 0); + expect(num_dims > 0); + expect(levels.size() > 0); auto const limit = levels(num_dims - 1); @@ -410,9 +410,9 @@ fk::matrix get_max_multi(fk::vector const &levels, int const num_dims, int count_leq_max_indices(list_set const &lists, int const num_dims, int const max_sum, int const max_val) { - tools::expect(lists.size() > 0); - tools::expect(num_dims > 0); - tools::expect(num_dims <= static_cast(lists.size())); + expect(lists.size() > 0); + expect(num_dims > 0); + expect(num_dims <= static_cast(lists.size())); // base case if (num_dims == 1) @@ -446,9 +446,9 @@ int count_leq_max_indices(list_set const &lists, int const num_dims, fk::matrix get_leq_max_indices(list_set const &lists, int const num_dims, int const max_sum, int const max_val) { - tools::expect(lists.size() > 0); - tools::expect(num_dims > 0); - tools::expect(num_dims <= static_cast(lists.size())); + expect(lists.size() > 0); + expect(num_dims > 0); + expect(num_dims <= static_cast(lists.size())); int const num_entries = count_leq_max_indices(lists, num_dims, max_sum, max_val); diff --git a/src/program_options.cpp b/src/program_options.cpp index 1480a17eb..e26e56c5f 100644 --- a/src/program_options.cpp +++ b/src/program_options.cpp @@ -275,8 +275,8 @@ bool options::should_output_realspace(int const i) const bool options::write_at_step(int const i, int const freq) const { - tools::expect(i >= 0); - tools::expect(freq >= 0); + expect(i >= 0); + expect(freq >= 0); if (freq == 0) { diff --git a/src/program_options.hpp b/src/program_options.hpp index e44fc3509..a214a29f4 100644 --- a/src/program_options.hpp +++ b/src/program_options.hpp @@ -210,7 +210,7 @@ class parser for (auto const &[pde_name, pde_enum_val] : pde_mapping) { ignore(pde_enum_val); - tools::expect(pde_name.size() <= max_name_length); + expect(pde_name.size() <= max_name_length); std::cerr << std::left << std::setw(max_name_length) << pde_name << pde_mapping.at(pde_name).info << '\n'; } diff --git a/src/quadrature.cpp b/src/quadrature.cpp index ac2055e6e..090734f5c 100644 --- a/src/quadrature.cpp +++ b/src/quadrature.cpp @@ -18,8 +18,8 @@ std::enable_if_t::value, std::array, 2>> legendre(fk::vector

const domain, int const degree, legendre_normalization const normalization) { - tools::expect(degree >= 0); - tools::expect(domain.size() > 0); + expect(degree >= 0); + expect(domain.size() > 0); // allocate and zero the output Legendre polynomials, their derivatives fk::matrix

legendre(domain.size(), std::max(1, degree)); @@ -101,7 +101,7 @@ legendre(fk::vector

const domain, int const degree, dscale = static_cast

(1.0) / std::sqrt(2.0); } - tools::expect(dscale > 0); + expect(dscale > 0); fk::vector

const legendre_sub = legendre.extract_submatrix(0, i, domain.size(), 1); @@ -159,8 +159,8 @@ std::array, 2> legendre_weights(int const degree, P const lower_bound, P const upper_bound, bool const use_degree_points) { - tools::expect(degree > 0); - tools::expect(lower_bound < upper_bound); + expect(degree > 0); + expect(lower_bound < upper_bound); auto const default_quad_number = [](int const degree) { static int constexpr minimum_quadrature = 10; diff --git a/src/solver.cpp b/src/solver.cpp index 806fa3186..8c6ac2682 100644 --- a/src/solver.cpp +++ b/src/solver.cpp @@ -10,26 +10,26 @@ P simple_gmres(fk::matrix

const &A, fk::vector

&x, fk::vector

const &b, fk::matrix

const &M, int const restart, int const max_iter, P const tolerance) { - tools::expect(tolerance >= std::numeric_limits

::epsilon()); - tools::expect(A.nrows() == A.ncols()); + expect(tolerance >= std::numeric_limits

::epsilon()); + expect(A.nrows() == A.ncols()); int const n = A.nrows(); - tools::expect(b.size() == n); - tools::expect(x.size() == n); + expect(b.size() == n); + expect(x.size() == n); bool const do_precond = M.size() > 0; std::vector precond_pivots(n); if (do_precond) { - tools::expect(M.ncols() == n); - tools::expect(M.nrows() == n); + expect(M.ncols() == n); + expect(M.nrows() == n); } fk::matrix

precond(M); bool precond_factored = false; - tools::expect(restart > 0); - tools::expect(restart <= n); - tools::expect(max_iter >= restart); - tools::expect(max_iter <= n); + expect(restart > 0); + expect(restart <= n); + expect(max_iter >= restart); + expect(max_iter <= n); P const norm_b = [&b]() { P const norm_b = fm::nrm2(b); diff --git a/src/tensors.hpp b/src/tensors.hpp index a1ce91c83..c3d84d636 100644 --- a/src/tensors.hpp +++ b/src/tensors.hpp @@ -150,13 +150,13 @@ class vector vector(vector const &); // cannot be templated per C++ spec 12.8 // instead of disabling w/ sfinae for const_view, - // static tools::expect added to definition + // static expect added to definition vector &operator=(vector const &); // move constructor/assignment (required to be same to same) vector(vector &&); - // as with copy assignment, static tools::expect added + // as with copy assignment, static expect added // to definition to prevent assignment into // const views vector &operator=(vector &&); @@ -644,13 +644,13 @@ allocate_device(P *&ptr, int const num_elems, bool const initialize = true) assert(success == cudaSuccess); if (num_elems > 0) { - tools::expect(ptr != nullptr); + expect(ptr != nullptr); } if (initialize) { success = cudaMemset((void *)ptr, 0, num_elems * sizeof(P)); - tools::expect(success == cudaSuccess); + expect(success == cudaSuccess); } #else @@ -673,8 +673,7 @@ inline void delete_device(P *const ptr) // the device runtime may be unloaded at process shut down // (when static storage duration destructors are called) // returning a cudartUnloading error code. - tools::expect((success == cudaSuccess) || - (success == cudaErrorCudartUnloading)); + expect((success == cudaSuccess) || (success == cudaErrorCudartUnloading)); #else delete[] ptr; #endif @@ -687,7 +686,7 @@ copy_on_device(P *const dest, P const *const source, int const num_elems) #ifdef ASGARD_USE_CUDA auto const success = cudaMemcpy(dest, source, num_elems * sizeof(P), cudaMemcpyDeviceToDevice); - tools::expect(success == cudaSuccess); + expect(success == cudaSuccess); #else std::copy(source, source + num_elems, dest); #endif @@ -700,7 +699,7 @@ copy_to_device(P *const dest, P const *const source, int const num_elems) #ifdef ASGARD_USE_CUDA auto const success = cudaMemcpy(dest, source, num_elems * sizeof(P), cudaMemcpyHostToDevice); - tools::expect(success == cudaSuccess); + expect(success == cudaSuccess); #else std::copy(source, source + num_elems, dest); #endif @@ -713,7 +712,7 @@ copy_to_host(P *const dest, P const *const source, int const num_elems) #ifdef ASGARD_USE_CUDA auto const success = cudaMemcpy(dest, source, num_elems * sizeof(P), cudaMemcpyDeviceToHost); - tools::expect(success == cudaSuccess); + expect(success == cudaSuccess); #else std::copy(source, source + num_elems, dest); #endif @@ -724,15 +723,15 @@ inline void copy_matrix_on_device(fk::matrix &dest, fk::matrix const &source) { - tools::expect(source.nrows() == dest.nrows()); - tools::expect(source.ncols() == dest.ncols()); + expect(source.nrows() == dest.nrows()); + expect(source.ncols() == dest.ncols()); #ifdef ASGARD_USE_CUDA auto const success = cudaMemcpy2D(dest.data(), dest.stride() * sizeof(P), source.data(), source.stride() * sizeof(P), source.nrows() * sizeof(P), source.ncols(), cudaMemcpyDeviceToDevice); - tools::expect(success == 0); + expect(success == 0); #else std::copy(source.begin(), source.end(), dest.begin()); #endif @@ -744,14 +743,14 @@ inline void copy_matrix_to_device(fk::matrix &dest, fk::matrix const &source) { - tools::expect(source.nrows() == dest.nrows()); - tools::expect(source.ncols() == dest.ncols()); + expect(source.nrows() == dest.nrows()); + expect(source.ncols() == dest.ncols()); #ifdef ASGARD_USE_CUDA auto const success = cudaMemcpy2D(dest.data(), dest.stride() * sizeof(P), source.data(), source.stride() * sizeof(P), source.nrows() * sizeof(P), source.ncols(), cudaMemcpyHostToDevice); - tools::expect(success == 0); + expect(success == 0); #else std::copy(source.begin(), source.end(), dest.begin()); #endif @@ -763,14 +762,14 @@ inline void copy_matrix_to_host(fk::matrix &dest, fk::matrix const &source) { - tools::expect(source.nrows() == dest.nrows()); - tools::expect(source.ncols() == dest.ncols()); + expect(source.nrows() == dest.nrows()); + expect(source.ncols() == dest.ncols()); #ifdef ASGARD_USE_CUDA auto const success = cudaMemcpy2D(dest.data(), dest.stride() * sizeof(P), source.data(), source.stride() * sizeof(P), source.nrows() * sizeof(P), source.ncols(), cudaMemcpyDeviceToHost); - tools::expect(success == 0); + expect(success == 0); #else std::copy(source.begin(), source.end(), dest.begin()); #endif @@ -807,7 +806,7 @@ template fk::vector::vector(int const size) : size_{size}, ref_count_{std::make_shared(0)} { - tools::expect(size >= 0); + expect(size >= 0); if constexpr (resrc == resource::host) { @@ -949,7 +948,7 @@ fk::vector::~vector() { if constexpr (mem == mem_type::owner) { - tools::expect(ref_count_.use_count() == 1); + expect(ref_count_.use_count() == 1); if constexpr (resrc == resource::host) { @@ -1006,7 +1005,7 @@ operator=(vector const &a) if (&a == this) return *this; - tools::expect(size() == a.size()); + expect(size() == a.size()); if constexpr (resrc == resource::host) { @@ -1031,7 +1030,7 @@ fk::vector::vector(vector &&a) { if constexpr (mem == mem_type::owner) { - tools::expect(a.ref_count_.use_count() == 1); + expect(a.ref_count_.use_count() == 1); } ref_count_ = std::make_shared(0); ref_count_.swap(a.ref_count_); @@ -1054,11 +1053,11 @@ operator=(vector &&a) if constexpr (mem == mem_type::owner) { - tools::expect(ref_count_.use_count() == 1); - tools::expect(a.ref_count_.use_count() == 1); + expect(ref_count_.use_count() == 1); + expect(a.ref_count_.use_count() == 1); } - tools::expect(size() == a.size()); + expect(size() == a.size()); size_ = a.size_; ref_count_ = std::make_shared(0); ref_count_.swap(a.ref_count_); @@ -1093,7 +1092,7 @@ template fk::vector &fk::vector:: operator=(vector const &a) { - tools::expect(size() == a.size()); + expect(size() == a.size()); size_ = a.size(); for (auto i = 0; i < a.size(); ++i) @@ -1128,7 +1127,7 @@ template fk::vector &fk::vector:: operator=(vector const &a) { - tools::expect(size() == a.size()); + expect(size() == a.size()); if constexpr (resrc == resource::host) { std::memcpy(data_, a.data(), size() * sizeof(P)); @@ -1159,7 +1158,7 @@ template fk::vector &fk::vector::transfer_from( fk::vector const &a) { - tools::expect(a.size() == size()); + expect(a.size() == size()); copy_to_device(data_, a.data(), a.size()); return *this; } @@ -1182,7 +1181,7 @@ template fk::vector &fk::vector::transfer_from( vector const &a) { - tools::expect(a.size() == size()); + expect(a.size() == size()); copy_to_host(data_, a.data(), a.size()); return *this; } @@ -1195,7 +1194,7 @@ template fk::vector &fk::vector:: operator=(std::vector

const &v) { - tools::expect(size() == static_cast(v.size())); + expect(size() == static_cast(v.size())); std::memcpy(data_, v.data(), v.size() * sizeof(P)); return *this; } @@ -1218,7 +1217,7 @@ template template P &fk::vector::operator()(int i) { - tools::expect(i < size_); + expect(i < size_); return data_[i]; } @@ -1226,7 +1225,7 @@ template template P fk::vector::operator()(int i) const { - tools::expect(i < size_); + expect(i < size_); return data_[i]; } @@ -1282,7 +1281,7 @@ template fk::vector

fk::vector:: operator+(vector const &right) const { - tools::expect(size() == right.size()); + expect(size() == right.size()); vector

ans(size()); for (auto i = 0; i < size(); ++i) ans(i) = (*this)(i) + right(i); @@ -1297,7 +1296,7 @@ template fk::vector

fk::vector:: operator-(vector const &right) const { - tools::expect(size() == right.size()); + expect(size() == right.size()); vector

ans(size()); for (auto i = 0; i < size(); ++i) ans(i) = (*this)(i)-right(i); @@ -1311,7 +1310,7 @@ template template P fk::vector::operator*(vector const &right) const { - tools::expect(size() == right.size()); + expect(size() == right.size()); int n = size(); int one = 1; vector const &X = (*this); @@ -1328,7 +1327,7 @@ fk::vector

fk::vector:: operator*(fk::matrix const &A) const { // check dimension compatibility - tools::expect(size() == A.nrows()); + expect(size() == A.nrows()); vector const &X = (*this); vector

Y(A.ncols()); @@ -1419,7 +1418,7 @@ void fk::vector::print(std::string const label) const else if constexpr (mem == mem_type::const_view) std::cout << label << "(const view)" << '\n'; else - tools::expect(false); // above cases should cover all implemented types + expect(false); // above cases should cover all implemented types if constexpr (std::is_floating_point

::value) { @@ -1464,7 +1463,7 @@ template fk::vector & fk::vector::resize(int const new_size) { - tools::expect(new_size >= 0); + expect(new_size >= 0); if (new_size == this->size()) return *this; P *old_data{data_}; @@ -1521,8 +1520,8 @@ fk::vector & fk::vector::set_subvector(int const index, fk::vector const sub_vector) { - tools::expect(index >= 0); - tools::expect((index + sub_vector.size()) <= this->size()); + expect(index >= 0); + expect((index + sub_vector.size()) <= this->size()); std::memcpy(&(*this)(index), sub_vector.data(), sub_vector.size() * sizeof(P)); return *this; @@ -1534,9 +1533,9 @@ template fk::vector

fk::vector::extract(int const start, int const stop) const { - tools::expect(start >= 0); - tools::expect(stop < this->size()); - tools::expect(stop >= start); + expect(start >= 0); + expect(stop < this->size()); + expect(stop >= start); int const sub_size = stop - start + 1; fk::vector

sub_vector(sub_size); @@ -1569,9 +1568,9 @@ fk::vector::vector(fk::vector const &vec, size_ = 0; if (vec.size() > 0) { - tools::expect(start_index >= 0); - tools::expect(stop_index < vec.size()); - tools::expect(stop_index >= start_index); + expect(start_index >= 0); + expect(stop_index < vec.size()); + expect(stop_index >= start_index); data_ = vec.data_ + start_index; size_ = stop_index - start_index + 1; @@ -1588,11 +1587,11 @@ fk::vector::vector(fk::matrix const &source, int const row_stop) : ref_count_(source_ref_count) { - tools::expect(column_index >= 0); - tools::expect(column_index < source.ncols()); - tools::expect(row_start >= 0); - tools::expect(row_start <= row_stop); - tools::expect(row_stop < source.nrows()); + expect(column_index >= 0); + expect(column_index < source.ncols()); + expect(row_start >= 0); + expect(row_start <= row_stop); + expect(row_stop < source.nrows()); data_ = nullptr; size_ = row_stop - row_start + 1; @@ -1626,8 +1625,8 @@ fk::matrix::matrix(int const m, int const n) std::make_shared(0)} { - tools::expect(m >= 0); - tools::expect(n >= 0); + expect(m >= 0); + expect(n >= 0); if constexpr (resrc == resource::host) { @@ -1733,7 +1732,7 @@ fk::matrix::~matrix() { if constexpr (mem == mem_type::owner) { - tools::expect(ref_count_.use_count() == 1); + expect(ref_count_.use_count() == 1); if constexpr (resrc == resource::host) { delete[] data_; @@ -1790,7 +1789,7 @@ operator=(matrix const &a) if (&a == this) return *this; - tools::expect((nrows() == a.nrows()) && (ncols() == a.ncols())); + expect((nrows() == a.nrows()) && (ncols() == a.ncols())); if constexpr (mem == mem_type::owner) { @@ -1838,8 +1837,8 @@ template fk::matrix &fk::matrix:: operator=(matrix const &a) { - tools::expect(nrows() == a.nrows()); - tools::expect(ncols() == a.ncols()); + expect(nrows() == a.nrows()); + expect(ncols() == a.ncols()); if constexpr (resrc == resource::host) { std::copy(a.begin(), a.end(), begin()); @@ -1878,7 +1877,7 @@ template fk::matrix &fk::matrix:: operator=(matrix const &a) { - tools::expect((nrows() == a.nrows()) && (ncols() == a.ncols())); + expect((nrows() == a.nrows()) && (ncols() == a.ncols())); nrows_ = a.nrows(); ncols_ = a.ncols(); @@ -1909,8 +1908,8 @@ template fk::matrix &fk::matrix::transfer_from( fk::matrix const &a) { - tools::expect(a.nrows() == nrows()); - tools::expect(a.ncols() == ncols()); + expect(a.nrows() == nrows()); + expect(a.ncols() == ncols()); copy_matrix_to_device(*this, a); @@ -1935,8 +1934,8 @@ template fk::matrix &fk::matrix::transfer_from( matrix const &a) { - tools::expect(a.nrows() == nrows()); - tools::expect(a.ncols() == ncols()); + expect(a.nrows() == nrows()); + expect(a.ncols() == ncols()); copy_matrix_to_host(*this, a); return *this; } @@ -1952,7 +1951,7 @@ fk::matrix::matrix(matrix &&a) { if constexpr (mem == mem_type::owner) { - tools::expect(a.ref_count_.use_count() == 1); + expect(a.ref_count_.use_count() == 1); } ref_count_ = std::make_shared(0); @@ -1976,13 +1975,13 @@ operator=(matrix &&a) if (&a == this) return *this; - tools::expect((nrows() == a.nrows()) && - (ncols() == a.ncols() && stride() == a.stride())); + expect((nrows() == a.nrows()) && + (ncols() == a.ncols() && stride() == a.stride())); // check for destination orphaning; see below if constexpr (mem == mem_type::owner) { - tools::expect(ref_count_.use_count() == 1 && a.ref_count_.use_count() == 1); + expect(ref_count_.use_count() == 1 && a.ref_count_.use_count() == 1); } ref_count_ = std::make_shared(0); ref_count_.swap(a.ref_count_); @@ -2002,7 +2001,7 @@ template fk::matrix &fk::matrix:: operator=(fk::vector const &v) { - tools::expect(nrows() * ncols() == v.size()); + expect(nrows() * ncols() == v.size()); for (auto j = 0; j < ncols(); ++j) for (auto i = 0; i < nrows(); ++i) @@ -2020,7 +2019,7 @@ template template P &fk::matrix::operator()(int const i, int const j) { - tools::expect(i < nrows() && j < ncols()); + expect(i < nrows() && j < ncols()); return *(data(i, j)); } @@ -2028,7 +2027,7 @@ template template P fk::matrix::operator()(int const i, int const j) const { - tools::expect(i < nrows() && j < ncols()); + expect(i < nrows() && j < ncols()); return *(data(i, j)); } @@ -2089,7 +2088,7 @@ template fk::matrix

fk::matrix:: operator+(matrix const &right) const { - tools::expect(nrows() == right.nrows() && ncols() == right.ncols()); + expect(nrows() == right.nrows() && ncols() == right.ncols()); matrix

ans(nrows(), ncols()); ans.nrows_ = nrows(); @@ -2110,7 +2109,7 @@ template fk::matrix

fk::matrix:: operator-(matrix const &right) const { - tools::expect(nrows() == right.nrows() && ncols() == right.ncols()); + expect(nrows() == right.nrows() && ncols() == right.ncols()); matrix

ans(nrows(), ncols()); ans.nrows_ = nrows(); @@ -2150,7 +2149,7 @@ fk::vector

fk::matrix:: operator*(fk::vector const &right) const { // check dimension compatibility - tools::expect(ncols() == right.size()); + expect(ncols() == right.size()); matrix const &A = (*this); vector

Y(A.nrows()); @@ -2176,7 +2175,7 @@ template fk::matrix

fk::matrix:: operator*(matrix const &B) const { - tools::expect(ncols() == B.nrows()); // k == k + expect(ncols() == B.nrows()); // k == k // just aliases for easier reading matrix const &A = (*this); @@ -2303,7 +2302,7 @@ template template fk::matrix &fk::matrix::invert() { - tools::expect(nrows() == ncols()); + expect(nrows() == ncols()); int *ipiv{new int[ncols()]}; int lwork{nrows() * ncols()}; @@ -2337,7 +2336,7 @@ template template P fk::matrix::determinant() const { - tools::expect(nrows() == ncols()); + expect(nrows() == ncols()); matrix temp(*this); // get temp copy to do LU int *ipiv{new int[ncols()]}; @@ -2370,8 +2369,8 @@ fk::matrix & fk::matrix::update_col(int const col_idx, fk::vector const &v) { - tools::expect(nrows() == static_cast(v.size())); - tools::expect(col_idx < ncols()); + expect(nrows() == static_cast(v.size())); + expect(col_idx < ncols()); int n{v.size()}; int one{1}; @@ -2391,8 +2390,8 @@ fk::matrix & fk::matrix::update_col(int const col_idx, std::vector

const &v) { - tools::expect(nrows() == static_cast(v.size())); - tools::expect(col_idx < ncols()); + expect(nrows() == static_cast(v.size())); + expect(col_idx < ncols()); int n{static_cast(v.size())}; int one{1}; @@ -2414,8 +2413,8 @@ fk::matrix & fk::matrix::update_row(int const row_idx, fk::vector const &v) { - tools::expect(ncols() == v.size()); - tools::expect(row_idx < nrows()); + expect(ncols() == v.size()); + expect(row_idx < nrows()); int n{v.size()}; int one{1}; @@ -2435,8 +2434,8 @@ fk::matrix & fk::matrix::update_row(int const row_idx, std::vector

const &v) { - tools::expect(ncols() == static_cast(v.size())); - tools::expect(row_idx < nrows()); + expect(ncols() == static_cast(v.size())); + expect(row_idx < nrows()); int n{static_cast(v.size())}; int one{1}; @@ -2456,12 +2455,12 @@ template fk::matrix & fk::matrix::clear_and_resize(int const rows, int const cols) { - tools::expect(ref_count_.use_count() == 1); + expect(ref_count_.use_count() == 1); - tools::expect(rows >= 0); - tools::expect(cols >= 0); + expect(rows >= 0); + expect(cols >= 0); if (rows == 0 || cols == 0) - tools::expect(cols == rows); + expect(cols == rows); if constexpr (resrc == resource::host) { @@ -2489,10 +2488,10 @@ fk::matrix & fk::matrix::set_submatrix(int const row_idx, int const col_idx, matrix const &submatrix) { - tools::expect(row_idx >= 0); - tools::expect(col_idx >= 0); - tools::expect(row_idx + submatrix.nrows() <= nrows()); - tools::expect(col_idx + submatrix.ncols() <= ncols()); + expect(row_idx >= 0); + expect(col_idx >= 0); + expect(row_idx + submatrix.nrows() <= nrows()); + expect(col_idx + submatrix.ncols() <= ncols()); matrix &matrix = *this; for (auto i = 0; i < submatrix.nrows(); ++i) @@ -2516,10 +2515,10 @@ fk::matrix::extract_submatrix(int const row_idx, int const num_rows, int const num_cols) const { - tools::expect(row_idx >= 0); - tools::expect(col_idx >= 0); - tools::expect(row_idx + num_rows <= nrows()); - tools::expect(col_idx + num_cols <= ncols()); + expect(row_idx >= 0); + expect(col_idx >= 0); + expect(row_idx + num_rows <= nrows()); + expect(col_idx + num_cols <= ncols()); matrix

submatrix(num_rows, num_cols); auto matrix = *this; @@ -2554,7 +2553,7 @@ void fk::matrix::print(std::string label) const std::cout << label << "(const view, " << "stride == " << std::to_string(stride()) << ")" << '\n'; else - tools::expect(false); // above cases cover all implemented mem types + expect(false); // above cases cover all implemented mem types for (auto i = 0; i < nrows(); ++i) { @@ -2628,11 +2627,11 @@ fk::matrix::matrix(fk::matrix const &owner, int const view_cols = stop_col - start_col + 1; if (owner.size() > 0) { - tools::expect(start_row >= 0); - tools::expect(start_col >= 0); - tools::expect(stop_col < owner.ncols()); - tools::expect(stop_row < owner.nrows()); - tools::expect(stop_row >= start_row); + expect(start_row >= 0); + expect(start_col >= 0); + expect(stop_col < owner.ncols()); + expect(stop_row < owner.nrows()); + expect(stop_row >= start_row); data_ = owner.data(start_row, start_col); nrows_ = view_rows; @@ -2651,12 +2650,12 @@ fk::matrix::matrix(fk::vector const &source, int const start_index) : ref_count_(source_ref_count) { - tools::expect(start_index >= 0); - tools::expect(num_rows > 0); - tools::expect(num_cols > 0); + expect(start_index >= 0); + expect(num_rows > 0); + expect(num_cols > 0); int const size = num_rows * num_cols; - tools::expect(start_index + size <= source.size()); + expect(start_index + size <= source.size()); data_ = nullptr; nrows_ = 0; @@ -2730,8 +2729,8 @@ template void debug_compare(fk::matrix const &left, fk::matrix const &right) { - tools::expect(left.nrows() == right.nrows()); - tools::expect(left.ncols() == right.ncols()); + expect(left.nrows() == right.nrows()); + expect(left.ncols() == right.ncols()); static std::string const red("\033[0;31m"); static std::string const reset("\033[0m"); diff --git a/src/time_advance.cpp b/src/time_advance.cpp index c5437bb64..a742646c1 100644 --- a/src/time_advance.cpp +++ b/src/time_advance.cpp @@ -126,10 +126,10 @@ explicit_advance(PDE

const &pde, auto const elem_size = element_segment_size(pde); auto const dt = pde.get_dt(); auto const col_size = elem_size * static_cast(grid.ncols()); - tools::expect(x_orig.size() == col_size); + expect(x_orig.size() == col_size); auto const row_size = elem_size * static_cast(grid.nrows()); - tools::expect(col_size < INT_MAX); - tools::expect(row_size < INT_MAX); + expect(col_size < INT_MAX); + expect(row_size < INT_MAX); // time advance working vectors // input vector for apply_A @@ -137,8 +137,8 @@ explicit_advance(PDE

const &pde, // a buffer for reducing across subgrid row fk::vector

reduced_fx(row_size); - tools::expect(time >= 0); - tools::expect(dt > 0); + expect(time >= 0); + expect(dt > 0); // see // https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods#Explicit_Runge%E2%80%93Kutta_methods @@ -250,7 +250,7 @@ implicit_advance(PDE

const &pde, fk::vector

const &x_orig, P const time, solve_opts const solver, bool const update_system) { - tools::expect(time >= 0); + expect(time >= 0); static fk::matrix A; static std::vector ipiv; diff --git a/src/tools.hpp b/src/tools.hpp index 710c5c156..3efc4c023 100644 --- a/src/tools.hpp +++ b/src/tools.hpp @@ -12,30 +12,29 @@ // funcs at a time, if we need this, just need to wrap map access with locks namespace tools { +#ifndef NDEBUG +#define expect(cond) assert(cond) +#else +#define expect(cond) ((void)(cond)) +#endif // simple layer over assert to prevent unused variable warnings when -// tools::expects disabled -inline void expect(bool const condition) -{ - auto const ignore = [](auto ignored) { (void)ignored; }; - ignore(condition); - assert(condition); -} +// expects disabled class simple_timer { public: std::string const start(std::string const &identifier) { - tools::expect(!identifier.empty()); - tools::expect(id_to_start_.count(identifier) == 0); + expect(!identifier.empty()); + expect(id_to_start_.count(identifier) == 0); id_to_start_[identifier] = std::chrono::high_resolution_clock::now(); return identifier; } void stop(std::string const &identifier, double const flops = -1) { - tools::expect(!identifier.empty()); - tools::expect(id_to_start_.count(identifier) == 1); + expect(!identifier.empty()); + expect(id_to_start_.count(identifier) == 1); auto const beg = id_to_start_[identifier]; auto const end = std::chrono::high_resolution_clock::now(); auto const dur = @@ -47,17 +46,16 @@ class simple_timer if (flops != -1) { - tools::expect(flops > 0); + expect(flops > 0); auto const gflops = flops / 1e9; - tools::expect(dur >= 0.0); + expect(dur >= 0.0); auto const gflops_per_sec = dur == 0.0 ? std::numeric_limits::infinity() : gflops / (static_cast(dur) * 1e-6); // to seconds insert(id_to_flops_, identifier, gflops_per_sec); - tools::expect(id_to_times_.count(identifier) == - id_to_flops_.count(identifier)); + expect(id_to_times_.count(identifier) == id_to_flops_.count(identifier)); } } @@ -67,7 +65,7 @@ class simple_timer // get times for some key, mostly for testing for now std::vector const &get_times(std::string const &id) { - tools::expect(id_to_times_.count(id) == 1); + expect(id_to_times_.count(id) == 1); return id_to_times_[id]; } diff --git a/src/tools_tests.cpp b/src/tools_tests.cpp index 9bb8017b8..d3a44c137 100644 --- a/src/tools_tests.cpp +++ b/src/tools_tests.cpp @@ -8,7 +8,7 @@ // for testing the timer double shuffle_random(int const num_items) { - tools::expect(num_items > 0); + expect(num_items > 0); std::random_device rd; std::mt19937 mersenne_engine(rd()); std::uniform_real_distribution dist(0.1, 1.0); @@ -34,7 +34,7 @@ TEST_CASE("test timer") timer.start(identifier); double const val = shuffle_random(items_to_gen); timer.stop(identifier); - tools::expect(val > 0.0); // to avoid comp. warnings + expect(val > 0.0); // to avoid comp. warnings } std::string const report = timer.report(); diff --git a/src/transformations.cpp b/src/transformations.cpp index a6d4e788e..e46d60e94 100644 --- a/src/transformations.cpp +++ b/src/transformations.cpp @@ -30,7 +30,7 @@ template fk::vector

kron_d(std::vector> const &operands, int const num_prods) { - tools::expect(num_prods > 0); + expect(num_prods > 0); if (num_prods == 1) { return operands[0]; @@ -68,8 +68,8 @@ fk::matrix

recursive_kron(std::vector> &kron_matrices, int const index) { - tools::expect(index >= 0); - tools::expect(index < static_cast(kron_matrices.size())); + expect(index >= 0); + expect(index < static_cast(kron_matrices.size())); if (index == (static_cast(kron_matrices.size()) - 1)) { @@ -135,7 +135,7 @@ void wavelet_to_realspace( std::array, 2> &workspace, fk::vector

&real_space) { - tools::expect(memory_limit_MB > 0); + expect(memory_limit_MB > 0); std::vector> chain; @@ -171,7 +171,7 @@ void wavelet_to_realspace( } /* compute the amount of needed memory */ - tools::expect(kron_matrix_MB(kron_matrices) <= memory_limit_MB); + expect(kron_matrix_MB(kron_matrices) <= memory_limit_MB); /* create a view of a section of the wave space vector */ fk::vector const x(wave_space, i * stride, @@ -204,17 +204,17 @@ combine_dimensions(int const degree, elements::table const &table, P const time_scale) { int const num_dims = vectors.size(); - tools::expect(num_dims > 0); - tools::expect(start_element >= 0); - tools::expect(stop_element >= start_element); - tools::expect(stop_element < table.size()); + expect(num_dims > 0); + expect(start_element >= 0); + expect(stop_element >= start_element); + expect(stop_element < table.size()); int64_t const vector_size = (stop_element - start_element + 1) * std::pow(degree, num_dims); // FIXME here we want to catch the 64-bit solution vector problem // and halt execution if we spill over. there is an open issue for this - tools::expect(vector_size < INT_MAX); + expect(vector_size < INT_MAX); fk::vector

combined(vector_size); for (int i = start_element; i <= stop_element; ++i) diff --git a/src/transformations.hpp b/src/transformations.hpp index 160c81c0b..22ad9fb14 100644 --- a/src/transformations.hpp +++ b/src/transformations.hpp @@ -56,10 +56,10 @@ fk::vector

forward_transform( P const domain_min = dim.domain_min; P const domain_max = dim.domain_max; - tools::expect(num_levels >= 0); - tools::expect(num_levels <= transformer.max_level); - tools::expect(degree > 0); - tools::expect(domain_max > domain_min); + expect(num_levels >= 0); + expect(num_levels <= transformer.max_level); + expect(degree > 0); + expect(domain_max > domain_min); // check to make sure the F function arg is a function type // that will accept a vector argument. we have a check for its @@ -106,7 +106,7 @@ fk::vector

forward_transform( // get the f(v) initial condition at the quadrature points. fk::vector

f_here = function(mapped_roots, t); // ensuring function returns vector of appropriate size - tools::expect(f_here.size() == weights.size()); + expect(f_here.size() == weights.size()); std::transform(f_here.begin(), f_here.end(), weights.begin(), f_here.begin(), std::multiplies

()); @@ -146,10 +146,10 @@ inline fk::vector

transform_and_combine_dimensions( int const start, int const stop, int const degree, P const time = 0.0, P const time_multiplier = 1.0) { - tools::expect(static_cast(v_functions.size()) == pde.num_dims); - tools::expect(start <= stop); - tools::expect(stop < table.size()); - tools::expect(degree > 0); + expect(static_cast(v_functions.size()) == pde.num_dims); + expect(start <= stop); + expect(stop < table.size()); + expect(degree > 0); std::vector> dimension_components; dimension_components.reserve(pde.num_dims); diff --git a/src/transformations_tests.cpp b/src/transformations_tests.cpp index fabe86555..7c1b9b681 100644 --- a/src/transformations_tests.cpp +++ b/src/transformations_tests.cpp @@ -185,7 +185,7 @@ void test_wavelet_to_realspace(PDE

const &pde, auto const wave_space_size = static_cast(table.size()) * std::pow(degree, pde.num_dims); - tools::expect(wave_space_size < INT_MAX); + expect(wave_space_size < INT_MAX); fk::vector

wave_space(wave_space_size); for (int i = 0; i < wave_space.size(); ++i) From 4cb215bf44b53ce2147ad5a9a146041f7cc7c9e1 Mon Sep 17 00:00:00 2001 From: Hugo Brunie Date: Thu, 28 Jan 2021 11:58:01 -0800 Subject: [PATCH 4/5] Fix fokkerplanck 1d case2 tests. --- src/time_advance_tests.cpp | 35 +++- ...1_pitch_E_case2_coefficients_l4_d3_1_1.dat | 53 +++++++ ..._case2_coefficients_norotate_l4_d3_1_1.dat | 53 +++++++ ...erplanck1_pitch_E_case1_ad_sg_l4_d4_t0.dat | 13 ++ ...erplanck1_pitch_E_case1_ad_sg_l4_d4_t1.dat | 13 ++ ...erplanck1_pitch_E_case1_ad_sg_l4_d4_t2.dat | 13 ++ ...erplanck1_pitch_E_case1_ad_sg_l4_d4_t3.dat | 13 ++ ...erplanck1_pitch_E_case1_ad_sg_l4_d4_t4.dat | 13 ++ ...okkerplanck1_pitch_E_case1_sg_l2_d2_t0.dat | 13 ++ ...okkerplanck1_pitch_E_case1_sg_l2_d2_t1.dat | 13 ++ ...okkerplanck1_pitch_E_case1_sg_l2_d2_t2.dat | 13 ++ ...okkerplanck1_pitch_E_case1_sg_l2_d2_t3.dat | 13 ++ ...okkerplanck1_pitch_E_case1_sg_l2_d2_t4.dat | 13 ++ ...erplanck1_pitch_E_case2_ad_sg_l4_d4_t0.dat | 149 ++++++++++++++++++ ...erplanck1_pitch_E_case2_ad_sg_l4_d4_t1.dat | 149 ++++++++++++++++++ ...erplanck1_pitch_E_case2_ad_sg_l4_d4_t2.dat | 149 ++++++++++++++++++ ...erplanck1_pitch_E_case2_ad_sg_l4_d4_t3.dat | 149 ++++++++++++++++++ ...erplanck1_pitch_E_case2_ad_sg_l4_d4_t4.dat | 149 ++++++++++++++++++ ...okkerplanck1_pitch_E_case2_sg_l2_d2_t0.dat | 13 ++ ...okkerplanck1_pitch_E_case2_sg_l2_d2_t1.dat | 13 ++ ...okkerplanck1_pitch_E_case2_sg_l2_d2_t2.dat | 13 ++ ...okkerplanck1_pitch_E_case2_sg_l2_d2_t3.dat | 13 ++ ...okkerplanck1_pitch_E_case2_sg_l2_d2_t4.dat | 13 ++ 23 files changed, 1076 insertions(+), 5 deletions(-) create mode 100644 testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_l4_d3_1_1.dat create mode 100644 testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_norotate_l4_d3_1_1.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t0.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t1.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t2.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t3.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t4.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t0.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t1.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t2.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t3.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t4.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t0.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t1.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t2.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t3.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t4.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t0.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t1.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t2.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t3.dat create mode 100644 testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t4.dat diff --git a/src/time_advance_tests.cpp b/src/time_advance_tests.cpp index d7d13cf75..659ad7605 100644 --- a/src/time_advance_tests.cpp +++ b/src/time_advance_tests.cpp @@ -604,21 +604,46 @@ TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_4p3", "[time_advance]", } } -TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_pitch_E", "[time_advance]", - float, double) +TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_pitch_E_case1", + "[time_advance]", float, double) +{ + std::string const pde_choice = "fokkerplanck_1d_pitch_E_case1"; + TestType const cfl = 0.01; + TestType const tol_factor = + std::is_same::value ? 1e-15 : 1e-5; + auto const num_dims = 1; + + SECTION("fokkerplanck_1d_pitch_E_case1, level 2, degree 2, sparse grid") + { + int const degree = 2; + int const level = 2; + std::string const gold_base = "../testing/generated-inputs/time_advance/" + "fokkerplanck1_pitch_E_case1_sg_l2_d2_t"; + + auto const full_grid = false; + parser const parse( + pde_choice, fk::vector(std::vector(num_dims, level)), degree, + cfl, full_grid, parser::DEFAULT_MAX_LEVEL, num_steps); + + time_advance_test(parse, gold_base, tol_factor); + } +} + +TEMPLATE_TEST_CASE("time advance - fokkerplanck_1d_pitch_E_case2", + "[time_advance]", float, double) { - std::string const pde_choice = "fokkerplanck_1d_pitch_E"; + std::string const pde_choice = "fokkerplanck_1d_pitch_E_case2"; TestType const cfl = 0.01; TestType const tol_factor = std::is_same::value ? 1e-15 : 1e-5; auto const num_dims = 1; - SECTION("fokkerplanck_1d_pitch_E, level 2, degree 2, sparse grid") + SECTION("fokkerplanck_1d_pitch_E_case2, level 2, degree 2, sparse grid") { int const degree = 2; int const level = 2; std::string const gold_base = "../testing/generated-inputs/time_advance/" - "fokkerplanck1_pitch_E_sg_l2_d2_t"; + "fokkerplanck1_pitch_E_case2_sg_l2_d2_t"; auto const full_grid = false; parser const parse( diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_l4_d3_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_l4_d3_1_1.dat new file mode 100644 index 000000000..3076ce0f1 --- /dev/null +++ b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_l4_d3_1_1.dat @@ -0,0 +1,53 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 48 +# columns: 48 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +1.154700538379227 -2.775557561562891e-17 -0.5163977794943118 -6.446232436729815e-15 1.242408953494589e-14 -5.88418203051333e-15 5.114832168917616e-15 1.06512021424976e-14 -5.606626274357041e-15 -2.733924198139448e-15 3.601285936127852e-15 -4.590078317434632e-15 2.964208739575369e-15 5.152128723651117e-15 -2.622901895676932e-15 9.399165473711335e-15 1.190237144954587e-14 -8.659739592076221e-15 1.639747365667077e-15 5.505578631881392e-15 -5.412337245047638e-15 -1.668370303020694e-15 1.654926196081874e-15 -2.747801985947262e-15 1.843197903333982e-15 2.086004979862111e-15 -1.001802807376606e-15 5.657041675377616e-15 5.619203019557872e-15 -4.461708780212348e-15 2.522613194722023e-15 5.002942504717112e-15 -3.799044412389208e-15 1.662006036268204e-14 1.556968529797809e-14 -1.009956007713697e-14 2.329191527150609e-15 5.185413730346422e-15 -3.899658373995862e-15 5.79403061987116e-15 6.923281392623437e-15 -4.191091917959966e-15 1.243525681732249e-15 2.65672900345848e-15 -2.22738494315422e-15 -4.950467119568813e-16 3.317658647805644e-16 -8.222589276130066e-16 +-4.996003610813204e-16 1.549193338482931 2.220446049250313e-16 -0.7499999999999816 -1.457167719820518e-16 0.6708203932499289 -0.06629126073623029 -1.273980920757367e-14 0.05929270612816261 -0.06629126073624428 1.315614284180811e-14 0.05929270612815063 -0.005859375000004618 -1.281613704051665e-14 0.005240784322271319 -0.005859374999996712 -2.161465451067102e-15 0.005240784322270542 -0.005859374999995779 1.024180740216707e-14 0.005240784322259801 -0.005859375000003636 4.753142324176451e-15 0.005240784322259162 -0.0005179004745059063 -6.307454558651671e-15 0.0004632242666299871 -0.0005179004745118603 -1.288227337303827e-14 0.0004632242666351288 -0.0005179004745040111 -5.121771062821523e-15 0.0004632242666312916 -0.0005179004745007135 5.134781488891349e-16 0.0004632242666259972 -0.0005179004744978993 3.791238156747312e-15 0.0004632242666235808 -0.0005179004744899625 1.214306433183765e-14 0.0004632242666184963 -0.0005179004744990754 6.884250114413959e-15 0.000463224266620349 -0.0005179004745028601 1.030425744730223e-15 0.0004632242666234888 +2.997602166487923e-15 -6.661338147750939e-15 1.499999999999958 -4.999999999999852 2.711088342345092 -4.472135954999464 7.336232854810229 5.477225575051426 -3.399448484680918 -0.265165042944956 2.53408405370692e-14 0.237170824512638 0.02343749999999344 1.046732145404405e-14 -0.02096313728906563 10.02343749999975 7.745966692414473 -4.493099092288502 -0.02343749999999201 -4.773959005888173e-15 0.02096313728908128 -0.0234375000000052 1.078824529709976e-14 0.02096313728905497 0.002071601898011633 9.547918011776346e-15 -0.00185289706651004 0.00207160189800427 2.524022657546254e-15 -0.001852897066509367 0.002071601897994786 -1.535924165629865e-14 -0.001852897066496023 14.14420722562861 10.95445115010283 -6.32640821740307 -0.002071601898014751 -1.936645288580507e-14 0.00185289706652822 -0.002071601898004782 -1.93942084614207e-15 0.001852897066511497 -0.002071601898002508 9.0951551845464e-15 0.001852897066499909 -0.002071601898009558 3.266484305264328e-15 0.001852897066500658 +-1.110223024625157e-15 -2.786659791809143e-14 1.665334536937735e-16 -1.871941950666847 -1.040834085586084e-15 -5.484827557301315 -0.2567449488305489 -2.273181642920008e-14 0.2296396633859303 -0.2567449488305436 2.167710455580618e-14 0.2296396633859336 -0.02269326179417586 -7.719519468096792e-15 0.02029747040120111 -0.02269326179420202 6.38378239159465e-15 0.0202974704011939 -0.02269326179417606 -9.048317650695026e-15 0.02029747040121954 -0.02269326179418885 9.988537774674455e-15 0.02029747040119406 -0.002005819912742061 -8.397796347203723e-15 0.001794059870206938 -0.002005819912733058 1.615027556134407e-15 0.001794059870204243 -0.002005819912726594 1.741662369880714e-14 0.001794059870191649 -0.002005819912755697 6.640521466039218e-15 0.001794059870191878 -0.002005819912744878 -2.239874952181253e-14 0.001794059870226516 -0.002005819912738363 -5.388051116383963e-15 0.001794059870212736 -0.002005819912734797 7.768091725424142e-15 0.001794059870199424 -0.002005819912740852 2.957703526540456e-15 0.001794059870198709 +2.969846590872294e-15 -5.88418203051333e-15 -1.341640786499845 -4.472135954999464 5.196152422706522 -3.999999999999912 6.324555320336611 4.898979485566136 -2.828427124746109 4.662936703425657e-15 -5.606626274357041e-15 8.597506387375553e-15 -5.146057191485198e-15 -8.61116733474887e-15 4.718447854656915e-15 8.944271909998957 6.928203230275215 -3.999999999999889 -3.141584214993998e-15 -9.619909036029384e-15 9.658940314238862e-15 1.934650356583134e-15 -1.887379141862766e-15 4.024558464266192e-15 -2.697928686012929e-15 -3.62904151174348e-15 2.008809785181143e-15 -9.491105817938106e-15 -1.054798609567698e-14 7.164407955784213e-15 -3.458062829142516e-15 -7.779367428017991e-15 5.710709682915649e-15 12.64911064067324 9.797958971132312 -5.656854249492233 -4.515810468619375e-15 -8.922767039121204e-15 6.654399253847032e-15 -1.018120050072513e-14 -1.107230626629097e-14 8.999745393367675e-15 -1.737976082494264e-15 -3.994200803436598e-15 4.326400349086157e-15 8.181389593575616e-16 -6.42715047849407e-16 1.465841337200402e-15 +1.77635683940025e-15 -5.218048215738236e-15 0.1325825214724824 -0.5303300858898976 0.513489897661075 6.550315845288424e-15 -10.49999999999972 1.355544171172552 -6.708203932499213 0 0 0 10.73918423927043 8.215838362577163 -4.862001902508763 -7.20365033333779 -5.477225575051428 3.280863072424645 0 0 0 0 0 0 0.01171874999999355 1.092638620640157e-14 -0.01048156864453567 15.01171874999966 11.61895003862175 -6.718685501143711 -0.01171874999998405 -1.304512053934559e-14 0.01048156864456268 -10.01171874999979 -7.745966692414485 4.482617523643979 0 0 0 0 0 0 0 0 0 0 0 0 +-7.771561172376096e-16 -6.550315845288424e-15 2.164934898019055e-14 -3.286260152890463e-14 2.753353101070388e-14 1.287858708565182e-14 -4.808954321540661 -1.999999999999892 -7.938566201357207 0 0 0 -0.1283724744152825 -3.441691376337985e-14 0.1148198316929776 -5.605598049466703 -4.242640687119027 2.564309574476067 0 0 0 0 0 0 -0.01134663089708355 -7.749009767188397e-15 0.01014873520060255 -0.01134663089711619 3.552713678800501e-15 0.01014873520059636 -0.01134663089707717 -1.992850329202156e-14 0.01014873520063519 -7.757313323311618 -5.999999999999616 3.474250350338191 0 0 0 0 0 0 0 0 0 0 0 0 +5.10702591327572e-15 -9.686695889854491e-15 -0.1185854122563048 0.4743416490252615 -0.4592793267718507 6.550315845288424e-15 -4.472135954999484 9.52627944162861 -6.999999999999853 0 0 0 9.486832980504937 7.34846922834923 -4.242640687119176 3.162277660168305 2.449489742783053 -1.414213562373037 0 0 0 0 0 0 -6.599755464353763e-15 -9.658940314238862e-15 5.453970608471082e-15 13.41640786499847 10.39230484541285 -5.999999999999851 -1.265806036376826e-14 -2.141602867267167e-14 1.856848008685574e-14 4.472135954999469 3.464101615137588 -1.999999999999928 0 0 0 0 0 0 0 0 0 0 0 0 +9.992007221626409e-16 7.216449660063518e-15 0.1325825214724683 7.601397897755169 0.5134898976610808 6.324555320336608 -4.999999999999862 -3.872983346207237 2.236067977499722 -9.499999999999732 5.228527517379787 -4.472135954999487 0 0 0 -7.071067811865291 -5.477225575051415 3.162277660168286 10.73918423927044 8.215838362577111 -4.862001902508788 -0.1325825214724858 3.774758283725532e-14 0.1185854122563325 0 0 0 0 0 0 0 0 0 -9.999999999999755 -7.745966692414498 4.472135954999454 0.01171874999998129 1.096345236817342e-14 -0.01048156864457039 15.01171874999966 11.61895003862173 -6.718685501143705 -0.01171874999999275 -2.581268532253489e-15 0.01048156864455882 -0.01171875000000576 1.114060761502576e-14 0.01048156864452484 +1.110223024625157e-15 -1.343369859796439e-14 -2.103872631664672e-14 -5.477225575051433 -2.864375403532904e-14 -4.89897948556613 3.872983346207237 2.999999999999803 -1.732050807568791 -0.9359709753334239 -0.9999999999999103 -9.670617008925994 0 0 0 5.477225575051414 4.242640687119014 -2.449489742783059 -0.1283724744152966 1.465494392505207e-14 0.1148198316930003 -0.1283724744152804 3.591571484662381e-14 0.1148198316929809 0 0 0 0 0 0 0 0 0 7.745966692414495 5.999999999999625 -3.464101615137591 -0.01134663089707378 -3.33066907387547e-15 0.01014873520063325 -0.01134663089712236 1.509903313490213e-14 0.01014873520059062 -0.01134663089708606 -5.10702591327572e-15 0.01014873520062981 -0.01134663089709652 9.951241219940954e-15 0.01014873520059476 +5.717648576819556e-15 -6.661338147750939e-16 -0.1185854122563169 -3.636619309193541 -0.4592793267718466 -2.828427124746107 2.236067977499721 1.732050807568792 -0.9999999999999666 -6.708203932499216 7.794228634059819 -5.999999999999877 0 0 0 3.162277660168288 2.449489742783061 -1.414213562373049 9.486832980504943 7.348469228349225 -4.242640687119161 4.602221381766469e-15 -4.052314039881821e-15 1.13242748511766e-14 0 0 0 0 0 0 0 0 0 4.472135954999456 3.464101615137594 -1.999999999999938 -1.111784275753536e-14 -2.284110400818662e-14 2.176037128265307e-14 13.41640786499847 10.39230484541285 -5.999999999999846 -3.336957446475886e-15 -1.25732757538799e-14 1.440514374451141e-14 1.818207043258191e-15 -1.474514954580286e-15 4.40619762898109e-15 +5.551115123125783e-16 -1.998401444325282e-15 0.01171875000000544 -0.04687500000000605 0.04538652358837336 3.441691376337985e-15 -0.2651650429449512 0.256744948830539 8.326672684688674e-15 0 0 0 -13.24999999999968 0.6777720855862777 -7.826237921249102 0 0 0 0 0 0 0 0 0 12.44065993150054 9.585144756340046 -5.593278611422697 -10.67289297853423 -8.215838362577177 4.802709196380661 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +-1.998401444325282e-15 0 6.994405055138486e-15 -1.681987882307112e-14 1.598721155460225e-14 3.497202527569243e-15 -4.929390229335695e-14 4.485301019485632e-14 1.187938636348917e-14 0 0 0 -6.277460506977584 -2.999999999999844 -9.16543552338517 0 0 0 0 0 0 0 0 0 -0.06418623720764829 -3.957945082788683e-14 0.05740991584649979 -8.280024599784802 -6.363961030678571 3.731644530021142 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +3.108624468950438e-15 -7.549516567451064e-15 -0.01048156864452038 0.04192627457811315 -0.04059494080239079 5.564992910933597e-15 0.2371708245126429 -0.229639663385941 1.043609643147647e-14 0 0 0 -4.472135954999502 11.69134295108968 -8.499999999999842 0 0 0 0 0 0 0 0 0 11.06797181058912 8.57321409974079 -4.949747468305716 4.743416490252466 3.67423461417459 -2.121320343559566 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +4.440892098500626e-16 1.554312234475219e-15 0.01171874999999356 -0.04687499999998646 0.04538652358835638 -3.996802888650564e-15 10.87176676074289 0.2567449488305522 9.486832980504945 0 0 0 -7.499999999999815 -5.809475019310874 3.354101966249591 -27.74999999999932 6.487247104897145 -13.41640786499847 0 0 0 0 0 0 0 0 0 -10.60660171779797 -8.215838362577147 4.743416490252443 26.58279555523119 20.53959590644288 -11.91783393175935 -14.20842688446691 -10.95445115010287 6.383848026464841 0 0 0 0 0 0 0 0 0 0 0 0 +0 -7.549516567451064e-15 1.287858708565182e-14 1.210143096841421e-14 -1.598721155460225e-14 1.332267629550188e-14 -8.215838362577106 2.220446049250313e-14 -7.348469228349213 0 0 0 5.809475019310873 4.49999999999972 -2.598076211353195 -8.213952180081208 -5.49999999999967 -22.15581658015148 0 0 0 0 0 0 0 0 0 8.215838362577147 6.363961030678541 -3.6742346141746 -0.06418623720768192 -1.343369859796439e-14 0.05740991584655349 -11.01863738731053 -8.485281374238065 4.956389401412716 0 0 0 0 0 0 0 0 0 0 0 0 +5.329070518200751e-15 -8.326672684688674e-15 -0.01048156864452876 0.04192627457814146 -0.04059494080241755 2.664535259100376e-15 -4.980587314765103 -0.2296396633859588 -4.242640687119156 0 0 0 3.354101966249591 2.598076211353195 -1.499999999999953 -12.29837387624861 22.9496732002872 -16.99999999999968 0 0 0 0 0 0 0 0 0 4.743416490252444 3.674234614174601 -2.121320343559579 23.71708245126241 18.37117307087312 -10.60660171779795 6.324555320336623 4.898979485566119 -2.828427124746077 0 0 0 0 0 0 0 0 0 0 0 0 +-1.332267629550188e-15 9.325873406851315e-15 0.01171874999999822 10.04687499999974 0.04538652358838147 8.944271909998953 -7.071067811865292 -5.477225575051414 3.162277660168288 -7.336232854810242 5.733970523881956 3.162277660168304 0 0 0 -9.999999999999755 -7.745966692414497 4.472135954999454 -27.24999999999933 8.423738778000772 -12.29837387624861 0 0 0 0 0 0 0 0 0 0 0 0 -14.14213562373062 -10.95445115010286 6.32455532033659 26.5827955552312 20.53959590644286 -11.91783393175936 -10.67289297853424 -8.215838362577129 4.802709196380683 0 0 0 0 0 0 +-1.332267629550188e-15 -1.4210854715202e-14 -5.329070518200751e-15 -7.745966692414464 1.448841047135829e-14 -6.92820323027521 5.477225575051415 4.242640687119013 -2.449489742783061 5.477225575051434 -4.242640687119033 -2.449489742783041 0 0 0 7.745966692414497 5.999999999999628 -3.464101615137593 -6.27746050697758 -4.999999999999683 -23.02184198393588 0 0 0 0 0 0 0 0 0 0 0 0 10.95445115010286 8.485281374238054 -4.898979485566135 -0.0641862372076884 9.880984919163893e-15 0.05740991584656796 -8.280024599784811 -6.363961030678531 3.731644530021169 0 0 0 0 0 0 +5.773159728050814e-15 -5.551115123125783e-15 -0.01048156864453897 -4.514062229577563 -0.04059494080238957 -3.999999999999883 3.162277660168287 2.44948974278306 -1.414213562373049 3.399448484680958 -2.679129406169026 -1.414213562373042 0 0 0 4.472135954999454 3.464101615137593 -1.999999999999938 -13.41640786499848 22.0836477965028 -16.49999999999969 0 0 0 0 0 0 0 0 0 0 0 0 6.324555320336591 4.898979485566135 -2.828427124746106 23.71708245126241 18.37117307087311 -10.60660171779794 4.743416490252473 3.674234614174585 -2.121320343559553 0 0 0 0 0 0 +-3.33066907387547e-16 3.774758283725532e-15 0.01171875000000666 0.046874999999995 0.04538652358835948 -6.217248937900877e-15 0 0 0 10.87176676074289 0.2567449488305433 9.486832980504934 0 0 0 0 0 0 -7.499999999999815 -5.809475019310874 3.354101966249591 -11.74999999999971 6.487247104897148 -4.472135954999509 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -10.60660171779797 -8.215838362577147 4.743416490252443 12.44065993150056 9.585144756339973 -5.593278611422733 -0.06629126073624764 4.254929741875912e-14 0.05929270612817852 +2.220446049250313e-15 -3.552713678800501e-15 -1.48769885299771e-14 -1.704192342799615e-14 -1.376676550535194e-14 1.021405182655144e-14 0 0 0 -8.215838362577173 -4.618527782440651e-14 -7.348469228349222 0 0 0 0 0 0 5.809475019310873 4.49999999999972 -2.598076211353195 -0.4679854876667102 -1.499999999999875 -11.76351173473837 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.215838362577147 6.363961030678541 -3.6742346141746 -0.06418623720766789 3.319566843629218e-14 0.05740991584653009 -0.06418623720764333 3.960720640350246e-14 0.05740991584650475 +2.997602166487923e-15 1.665334536937735e-15 -0.01048156864453309 -0.0419262745781237 -0.04059494080239814 3.164135620181696e-15 0 0 0 -4.980587314765073 -0.2296396633859372 -4.242640687119175 0 0 0 0 0 0 3.354101966249591 2.598076211353195 -1.499999999999953 -7.826237921249104 9.093266739736483 -6.999999999999864 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.743416490252444 3.674234614174601 -2.121320343559579 11.06797181058913 8.573214099740783 -4.949747468305697 4.69936589642117e-15 -4.107825191113079e-15 1.203204202937513e-14 +3.05311331771918e-16 -9.436895709313831e-16 0.001035800949006904 -0.004143203796019068 0.004011639825480917 1.332267629550188e-15 -0.02343750000000666 0.02269326179418912 3.663735981263017e-15 0 0 0 -0.132582521472473 0.1283724744152659 8.881784197001252e-15 0 0 0 0 0 0 0 0 0 -14.62499999999969 0.3388860427931397 -8.38525491562406 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +-9.436895709313831e-16 8.881784197001252e-16 1.221245327087672e-15 -4.662936703425657e-15 4.635181127810029e-15 6.071532165918825e-16 -1.687538997430238e-14 1.565414464721471e-14 2.886579864025407e-15 0 0 0 -5.484501741648273e-14 5.062616992290714e-14 1.021405182655144e-14 0 0 0 0 0 0 0 0 0 -7.011713599696058 -3.499999999999829 -9.778870184399166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +2.55351295663786e-15 -4.440892098500626e-15 -0.0009264485332463046 0.003705794133002094 -0.003588119740399326 3.219646771412954e-15 0.02096313728905264 -0.0202974704011919 6.106226635438361e-15 0 0 0 0.1185854122563341 -0.114819831692986 1.199040866595169e-14 0 0 0 0 0 0 0 0 0 -4.47213595499952 12.77387470582023 -9.249999999999856 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +6.661338147750939e-16 2.220446049250313e-16 0.001035800949001464 -0.00414320379600841 0.004011639825472701 -1.110223024625157e-15 -0.02343749999998224 0.02269326179416753 -3.996802888650564e-15 0 0 0 12.50695119223677 0.1283724744152748 11.06797181058914 0 0 0 0 0 0 0 0 0 -8.74999999999981 -6.777720855862705 3.913118960624534 -36.87499999999921 7.116606898655842 -17.88854381999801 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +-1.110223024625157e-15 -1.998401444325282e-15 8.770761894538737e-15 -1.126876369994534e-14 9.325873406851315e-15 5.495603971894525e-15 7.771561172376096e-15 -1.243449787580175e-14 1.643130076445232e-14 0 0 0 -9.585144756339965 4.352074256530614e-14 -8.573214099740776 0 0 0 0 0 0 0 0 0 6.777720855862705 5.249999999999689 -3.031088913245402 -11.85294278245513 -7.74999999999957 -28.39841636576428 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +6.217248937900877e-15 -7.549516567451064e-15 -0.0009264485332449168 0.003705794133009366 -0.003588119740405904 3.802513859341161e-15 0.0209631372890885 -0.02029747040122654 1.942890293094024e-15 0 0 0 -5.65257131755089 -0.1148198316930125 -4.949747468305691 0 0 0 0 0 0 0 0 0 3.913118960624534 3.031088913245402 -1.74999999999995 -15.09345884812334 30.52739548340098 -22.49999999999963 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +-1.332267629550188e-15 6.661338147750939e-15 0.001035800948992249 -0.004143203796010297 0.004011639825475921 -7.993605777301127e-15 15.02343749999965 0.02269326179420972 13.41640786499847 0 0 0 -10.60660171779797 -8.215838362577147 4.743416490252444 -10.73918423927044 8.344210836992406 4.743416490252472 0 0 0 0 0 0 0 0 0 -14.99999999999967 -11.61895003862178 6.7082039324992 -51.62499999999888 11.95783608141491 -24.03773075812234 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +4.440892098500626e-16 -7.549516567451064e-15 1.376676550535194e-14 3.108624468950438e-15 -7.993605777301127e-15 1.321165399303936e-14 -11.61895003862172 2.842170943040401e-14 -10.39230484541284 0 0 0 8.215838362577149 6.363961030678542 -3.674234614174601 8.215838362577125 -6.363961030678526 -3.674234614174569 0 0 0 0 0 0 0 0 0 11.61895003862178 8.999999999999467 -5.196152422706405 -14.75768029211057 -10.49999999999939 -40.95578472063842 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +8.881784197001252e-15 -1.032507412901396e-14 -0.0009264485332505235 0.003705794133024964 -0.003588119740418616 1.665334536937735e-15 -6.729167069788234 -0.02029747040118712 -5.999999999999832 0 0 0 4.743416490252443 3.6742346141746 -2.121320343559579 4.862001902508847 -3.789054445867651 -2.121320343559558 0 0 0 0 0 0 0 0 0 6.708203932499201 5.196152422706405 -2.999999999999915 -22.36067977499752 42.21873843449072 -31.24999999999949 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +3.108624468950438e-15 1.554312234475219e-15 0.001035800948997245 -0.004143203796022066 0.004011639825485441 -1.154631945610163e-14 0.02343749999997602 0.02269326179415465 -1.199040866595169e-14 0 0 0 0 0 0 26.64908681596739 0.128372474415281 23.71708245126241 0 0 0 0 0 0 0 0 0 0 0 0 -18.74999999999959 -14.52368754827723 8.385254915623999 -58.87499999999872 14.86257359107038 -26.83281572999705 0 0 0 0 0 0 0 0 0 0 0 0 +-8.881784197001252e-16 -5.995204332975845e-15 4.440892098500626e-15 2.76445533131664e-14 -3.007316617953393e-14 1.110223024625157e-14 -2.531308496145357e-14 -1.4210854715202e-14 3.019806626980426e-14 0 0 0 0 0 0 -20.53959590644286 1.77635683940025e-14 -18.3711730708731 0 0 0 0 0 0 0 0 0 0 0 0 14.52368754827722 11.24999999999933 -6.495190528383004 -15.72592612866238 -11.74999999999931 -47.4509752490216 0 0 0 0 0 0 0 0 0 0 0 0 +1.021405182655144e-14 -6.439293542825908e-15 -0.0009264485332605155 0.003705794133025686 -0.003588119740415813 -8.215650382226158e-15 -0.0209631372891006 -0.02029747040123819 1.84297022087776e-14 0 0 0 0 0 0 -11.97712663788753 -0.114819831693044 -10.60660171779793 0 0 0 0 0 0 0 0 0 0 0 0 8.385254915624001 6.495190528383004 -3.749999999999893 -26.2737987356221 47.84790355908953 -35.49999999999942 0 0 0 0 0 0 0 0 0 0 0 0 +8.881784197001252e-16 1.681987882307112e-14 0.001035800948999022 14.14627882752662 0.004011639825490576 12.64911064067325 -9.999999999999755 -7.745966692414496 4.472135954999456 -10.02343749999978 7.768659954208696 4.472135954999469 0 0 0 -14.14213562373062 -10.95445115010286 6.324555320336591 -14.27471814520309 11.08282362451812 6.324555320336621 0 0 0 0 0 0 0 0 0 0 0 0 -19.99999999999956 -15.49193338482904 8.944271909998935 -58.62499999999873 15.83081942762219 -26.27379873562212 0 0 0 0 0 0 0 0 0 +8.881784197001252e-16 -1.638966740102887e-14 -3.108624468950438e-15 -10.95445115010282 1.509903313490213e-14 -9.797958971132308 7.745966692414498 5.999999999999625 -3.464101615137594 7.745966692414477 -5.99999999999961 -3.464101615137583 0 0 0 10.95445115010286 8.485281374238054 -4.898979485566135 10.95445115010288 -8.485281374238072 -4.898979485566104 0 0 0 0 0 0 0 0 0 0 0 0 15.49193338482904 11.99999999999929 -6.928203230275205 -14.75768029211056 -11.49999999999931 -47.88398795091378 0 0 0 0 0 0 0 0 0 +8.659739592076221e-15 -7.757683384568281e-15 -0.0009264485332618477 -6.328261114469569 -0.003588119740383089 -5.656854249492218 4.472135954999454 3.464101615137592 -1.999999999999938 4.49309909228851 -3.484399085538791 -1.999999999999926 0 0 0 6.324555320336591 4.898979485566134 -2.828427124746105 6.44314073259301 -5.013799317259195 -2.828427124746089 0 0 0 0 0 0 0 0 0 0 0 0 8.944271909998934 6.928203230275205 -3.999999999999886 -26.83281572999703 47.41489085719731 -35.24999999999942 0 0 0 0 0 0 0 0 0 +4.440892098500626e-16 2.664535259100376e-15 0.001035800949005683 0.004143203796001638 0.00401163982546221 -3.996802888650564e-15 0 0 0 -0.02343749999997957 0.02269326179416442 -1.4210854715202e-14 0 0 0 0 0 0 26.64908681596739 0.1283724744152774 23.71708245126241 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -18.74999999999959 -14.52368754827723 8.385254915623999 -50.8749999999989 14.86257359107037 -22.36067977499754 0 0 0 0 0 0 +8.881784197001252e-16 -5.10702591327572e-15 -7.105427357601002e-15 1.63202784619898e-14 1.859623566247137e-14 9.769962616701378e-15 0 0 0 2.797762022055394e-14 -3.197442310920451e-14 2.509104035652854e-14 0 0 0 0 0 0 -20.53959590644289 -1.598721155460225e-14 -18.3711730708731 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14.52368754827722 11.24999999999933 -6.495190528383004 -11.85294278245512 -9.749999999999405 -42.25482282631502 0 0 0 0 0 0 +9.769962616701378e-15 2.220446049250313e-15 -0.0009264485332625139 -0.003705794133009754 -0.003588119740399048 1.332267629550188e-14 0 0 0 0.02096313728909083 -0.02029747040123109 1.77635683940025e-15 0 0 0 0 0 0 -11.97712663788751 -0.1148198316930342 -10.60660171779794 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.385254915624001 6.495190528383004 -3.749999999999893 -24.03773075812233 40.91970032881414 -30.49999999999951 0 0 0 0 0 0 +0 5.329070518200751e-15 0.001035800949014898 0.004143203796011186 0.004011639825472368 -1.06581410364015e-14 0 0 0 15.02343749999964 0.02269326179420439 13.41640786499847 0 0 0 0 0 0 -10.60660171779797 -8.215838362577147 4.743416490252444 -10.73918423927044 8.344210836992408 4.743416490252461 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -14.99999999999967 -11.61895003862178 6.7082039324992 -35.62499999999923 11.95783608141492 -15.09345884812335 0 0 0 +8.881784197001252e-16 -6.217248937900877e-15 -1.454392162258955e-14 -4.440892098500626e-15 -1.110223024625157e-15 1.243449787580175e-14 0 0 0 -11.61895003862174 1.06581410364015e-14 -10.39230484541284 0 0 0 0 0 0 8.215838362577149 6.363961030678542 -3.674234614174601 8.215838362577188 -6.363961030678587 -3.674234614174581 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11.61895003862178 8.999999999999467 -5.196152422706405 -7.01171359969605 -6.499999999999587 -30.56347987522528 0 0 0 +5.995204332975845e-15 2.331468351712829e-15 -0.0009264485332601824 -0.003705794133019413 -0.003588119740409068 7.993605777301127e-15 0 0 0 -6.729167069788243 -0.02029747040119823 -5.999999999999841 0 0 0 0 0 0 4.743416490252443 3.6742346141746 -2.121320343559579 4.862001902508819 -3.789054445867623 -2.121320343559573 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.708203932499201 5.196152422706405 -2.999999999999915 -17.88854381999801 28.36233197393997 -21.24999999999966 0 0 0 +6.661338147750939e-16 2.664535259100376e-15 0.001035800949010124 0.004143203796020789 0.004011639825481805 -3.33066907387547e-15 0 0 0 0.02343749999999556 0.02269326179417597 -8.326672684688674e-15 0 0 0 0 0 0 0 0 0 12.50695119223677 0.1283724744152694 11.06797181058912 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -8.74999999999981 -6.777720855862705 3.913118960624534 -12.87499999999972 7.116606898655846 -4.472135954999525 +1.554312234475219e-15 4.440892098500626e-16 -4.996003610813204e-15 -1.071365218763276e-14 -9.880984919163893e-15 3.219646771412954e-15 0 0 0 -1.665334536937735e-14 -1.354472090042691e-14 1.121325254871408e-14 0 0 0 0 0 0 0 0 0 -9.58514475634006 -5.062616992290714e-14 -8.573214099740785 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.777720855862705 5.249999999999689 -3.031088913245402 -0.2339927438333531 -1.749999999999858 -12.80995909764457 +1.998401444325282e-15 1.77635683940025e-15 -0.0009264485332524108 -0.003705794133011697 -0.003588119740407514 2.498001805406602e-16 0 0 0 -0.02096313728906229 -0.02029747040119889 3.941291737419306e-15 0 0 0 0 0 0 0 0 0 -5.652571317550851 -0.1148198316929809 -4.949747468305719 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.913118960624534 3.031088913245402 -1.74999999999995 -8.385254915624062 9.74278579257483 -7.499999999999873 diff --git a/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_norotate_l4_d3_1_1.dat b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_norotate_l4_d3_1_1.dat new file mode 100644 index 000000000..04291141a --- /dev/null +++ b/testing/generated-inputs/coefficients/fokkerplanck1_pitch_E_case2_coefficients_norotate_l4_d3_1_1.dat @@ -0,0 +1,53 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 48 +# columns: 48 +-1.9921875 -3.450569968203622 -4.454666673925361 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0.004510548978034379 -3.984374999999997 -7.717726188848747 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +5.329070518200751e-15 0.006051536478409503 -5.976562500000002 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +1.9921875 3.450569968203622 4.454666673925361 -3.968749999999999 -6.87407664253898 -8.874394785702288 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +-3.450569968203622 -5.976562499999999 -7.715709010022588 3.455080517181656 -9.9296875 -15.37291983408686 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +4.454666673925361 7.715709010022588 9.960937499999998 -4.454666673925363 7.72176054650097 -15.89062500000001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 3.968749999999999 6.87407664253898 8.874394785702288 -5.929687499999998 -10.27052002300607 -13.25918433533078 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 -6.874076642538981 -11.90625 -15.37090265526068 6.878587191517008 -15.82812499999999 -22.96759811454047 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 8.874394785702288 15.37090265526068 19.84375 -8.874394785702275 15.37695419173904 -25.72656249999999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 5.929687499999998 10.27052002300607 13.25918433533078 -7.874999999999999 -13.63990010960491 -17.60903532281084 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 -10.27052002300608 -17.7890625 -22.96558093571429 10.27503057198409 -21.67968749999999 -30.5017610302096 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 13.25918433533078 22.96558093571429 29.6484375 -13.25918433533078 22.97163247219259 -35.48437499999999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 7.874999999999999 13.63990010960491 17.60903532281084 -9.804687499999998 -16.98221690233547 -21.92394774814246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -13.63990010960491 -23.62499999999999 -30.4997438513834 13.64441065858291 -27.48437499999999 -37.97540858109424 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 17.60903532281084 30.4997438513834 39.37499999999999 -17.60903532281083 30.50579538786166 -45.16406249999998 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 9.804687499999998 16.98221690233547 21.92394774814246 -11.71875 -20.29747040119778 -26.20392161132566 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 -16.98221690233547 -29.41406249999999 -37.97339140226803 16.98672745131346 -33.24218749999999 -45.38854076719439 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 21.92394774814247 37.97339140226803 49.02343749999999 -21.92394774814246 37.97944293874622 -54.76562500000001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11.71875 20.29747040119778 26.20392161132566 -13.6171875 -23.58566060619182 -30.44895691236041 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -20.29747040119778 -35.15624999999999 -45.38652358836816 20.30198095017577 -38.95312499999999 -52.74115758851003 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26.20392161132566 45.38652358836816 58.59374999999999 -26.20392161132565 45.39257512484632 -64.28906249999999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13.6171875 23.58566060619182 30.44895691236041 -15.5 -26.84678751731759 -34.65905365124674 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -23.58566060619182 -40.85156249999999 -52.7391404096838 23.59017115516981 -44.61718749999999 -60.03325904504121 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30.44895691236041 52.7391404096838 68.08593749999999 -30.4489569123604 52.74519194616195 -73.734375 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15.5 26.84678751731759 34.65905365124674 -17.3671875 -30.08085113457511 -38.83421182798462 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -26.84678751731759 -46.49999999999999 -60.03124186621496 26.85129806629558 -50.23437499999999 -67.26484513678788 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 34.65905365124673 60.03124186621495 77.49999999999999 -34.65905365124674 60.03729340269304 -83.10156249999999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17.3671875 30.08085113457511 38.83421182798462 -19.21875 -33.28785145796436 -42.97443144257408 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -30.08085113457511 -52.10156249999999 -67.26282795796162 30.08536168355307 -55.80468749999999 -74.43591586375007 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 38.83421182798462 67.26282795796162 86.83593749999999 -38.83421182798462 67.26887949443963 -92.39062499999999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 19.21875 33.28785145796436 42.97443144257408 -21.0546875 -36.46778848748534 -47.07971249501509 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -33.28785145796436 -57.65624999999999 -74.43389868492379 33.29236200694233 -61.32812499999999 -81.54647122592775 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 42.97443144257407 74.43389868492378 96.09374999999999 -42.97443144257409 74.43995022140179 -101.6015625 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 21.0546875 36.46778848748534 47.07971249501509 -22.875 -39.62066222313806 -51.15005498530768 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -36.46778848748534 -63.16406249999999 -81.54445404710145 36.47229903646329 -66.80468749999999 -88.59651122332096 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47.07971249501509 81.54445404710147 105.2734375 -47.07971249501509 81.55050558357941 -110.734375 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.875 39.62066222313806 51.15005498530768 -24.6796875 -42.74647266492251 -55.18545891345183 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -39.62066222313806 -68.62499999999999 -88.59449404449465 39.625172772116 -72.23437499999999 -95.58603585592965 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51.15005498530768 88.59449404449465 114.375 -51.15005498530769 88.60054558097256 -119.7890625 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.6796875 42.74647266492251 55.18545891345183 -26.46875 -45.84521981283871 -59.18592427944755 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -42.74647266492252 -74.03906249999999 -95.58401867710334 42.75098321390046 -77.61718749999999 -102.5150451237539 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55.18545891345183 95.58401867710334 123.3984375 -55.18545891345182 95.59007021358126 -128.765625 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26.46875 45.84521981283871 59.18592427944755 -28.24218749999999 -48.91690366688664 -63.15145108329483 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -45.84521981283871 -79.40624999999999 -102.5130279449276 45.84973036181663 -82.953125 -109.3835390267936 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59.18592427944755 102.5130279449275 132.34375 -59.18592427944755 102.5190794814054 -137.6640625 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28.24218749999999 48.91690366688664 63.15145108329483 -29.99999999999999 -51.96152422706631 -67.08203932499367 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -48.91690366688665 -84.7265625 -109.3815218479673 48.92141421586457 -88.24218749999999 -116.1915175650488 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 63.15145108329484 109.3815218479673 141.2109375 -63.15145108329482 109.3875733844451 -146.484375 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t0.dat new file mode 100644 index 000000000..23a5a2c06 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t0.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5ce0b4d10cd8ad0d4f665011571398caa8b7d3d1 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +1.414213562373093 +0.002041241027060633 +1.976423537604412e-06 +1.670382759906186e-09 +9.855373231740114e-16 +9.733237937377714e-16 +9.953021833842214e-16 +9.865232301417002e-16 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t1.dat new file mode 100644 index 000000000..d7357c09e --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t1.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5ce0b4d10cd8ad0d4f665011571398caa8b7d3d1 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +1.414213562373093 +0.004082479502571349 +7.905683856550809e-06 +1.336304473054458e-08 +9.135883309072302e-12 +2.025137840638742e-14 +-1.594618623078514e-11 +-6.740860660434073e-15 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t2.dat new file mode 100644 index 000000000..d3c12d40e --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t2.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5ce0b4d10cd8ad0d4f665011571398caa8b7d3d1 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +1.414213562373093 +0.006123712874994571 +1.778775448695545e-05 +4.510018694011361e-08 +4.176044338208758e-11 +1.165954622226789e-13 +-7.290026413870292e-11 +-4.541890303734372e-14 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t3.dat new file mode 100644 index 000000000..4643e88c5 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t3.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5ce0b4d10cd8ad0d4f665011571398caa8b7d3d1 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +1.414213562373093 +0.008164938592815505 +3.162259131252932e-05 +1.069038912210505e-07 +1.135342546591953e-10 +3.477700642774887e-13 +-1.981988380174734e-10 +-1.382911972404805e-13 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t4.dat new file mode 100644 index 000000000..2fd5ef4a9 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_ad_sg_l4_d4_t4.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5ce0b4d10cd8ad0d4f665011571398caa8b7d3d1 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +1.414213562373093 +0.01020615410455353 +4.941013257081277e-05 +2.08796075468906e-07 +2.401166848458696e-10 +7.715389004370626e-13 +-4.191791213094816e-10 +-3.086010257639334e-13 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t0.dat new file mode 100644 index 000000000..885845811 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t0.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash aaec71a692d4b986a1c1618d4589a40968233168 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +5.367553283859954e-06 +2.734374996538206e-08 +5.457764263439895e-06 +2.73437499679269e-08 +3.061862178478602e-05 +8.562621175895776e-08 +1.41421356237309 +0.008164938699039021 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t1.dat new file mode 100644 index 000000000..b578c68d5 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t1.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash aaec71a692d4b986a1c1618d4589a40968233168 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +2.128982837251483e-05 +2.130649939812226e-07 +2.201570131133579e-05 +2.163607376389876e-07 +0.0001224704773838433 +6.815562852864749e-07 +1.41421356237309 +0.01632971473897856 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t2.dat new file mode 100644 index 000000000..e9f95d74c --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t2.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash aaec71a692d4b986a1c1618d4589a40968233168 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +4.74964673096694e-05 +7.068858961599212e-07 +4.995510594847497e-05 +7.253128285694284e-07 +0.0002755452996047867 +2.29279452384573e-06 +1.41421356237309 +0.02449416547580405 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t3.dat new file mode 100644 index 000000000..709e2c97a --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t3.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash aaec71a692d4b986a1c1618d4589a40968233168 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +8.371754109304371e-05 +1.649355420222245e-06 +8.95641089180372e-05 +1.709059588549026e-06 +0.0004898260374217819 +5.418678785634019e-06 +1.41421356237309 +0.03265812829321963 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t4.dat new file mode 100644 index 000000000..932296f9e --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case1_sg_l2_d2_t4.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash aaec71a692d4b986a1c1618d4589a40968233168 +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +0.0001296837510716017 +3.17217274623329e-06 +0.0001411374493846003 +3.319434382451696e-06 +0.0007652889073323811 +1.055301356192567e-05 +1.41421356237309 +0.04082144061633836 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t0.dat new file mode 100644 index 000000000..bf88977d2 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t0.dat @@ -0,0 +1,149 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 144 +# columns: 1 +2.756208736642233e-05 +1.755852287101041e-05 +-3.497535876461787e-05 +-1.132549260027526e-05 +-0.006186338885590969 +-0.001911231228218668 +0.01224583023307797 +0.001571145014085031 +-0.006288954388483419 +0.001711925013855724 +0.0126245284164832 +-0.001429686957675133 +3.066097966410449e-05 +-1.942035248578319e-05 +-3.916504125308e-05 +1.259132128880833e-05 +-0.009086744308259617 +-0.01481024776543643 +-0.005153994173800401 +0.008272315218536221 +-0.01052043852270412 +0.01598772888707519 +-0.003419965117879465 +-0.00916886951954944 +0.03694177640129082 +0.02188052719519528 +-0.05513339623051867 +-0.01746492410334381 +0.03603012375373815 +-0.02081447679147049 +-0.05540379747397672 +0.01713561891833646 +-0.1530728179304367 +-0.001329853168802239 +-0.2357688248406901 +-0.003558183067463886 +0.1253314137315488 +0.000269993579573449 +-0.1380222648577996 +-0.0006033210697105925 +7.346030089660985e-06 +2.951213541334766e-06 +-1.161104713508066e-05 +-1.986893536995052e-06 +6.813293756125509e-05 +-2.49215462403944e-05 +-0.0001353676056486961 +1.76321050734809e-05 +-0.0001722758586532754 +0.0001857509416794153 +0.0003431179487722518 +-0.0001355939064767087 +-0.0001260783959302641 +-0.0001964878700688409 +0.0002575276195715464 +0.0001428716400273352 +6.137237929455756e-05 +2.920538263068861e-05 +-0.0001237876388396689 +-2.048974741122298e-05 +7.851469106554998e-06 +-2.657359335187392e-06 +-1.274084428393686e-05 +2.398924220004293e-06 +4.345359757504574e-06 +6.112864271660828e-07 +-7.77580178597914e-06 +-2.341519477043191e-07 +-3.479926518291861e-06 +-1.989088519284714e-06 +5.546818719416527e-06 +1.453588124737817e-06 +-2.640090446475687e-05 +-9.696690888701086e-07 +4.682360412033337e-05 +-6.184950178320927e-07 +2.328801289465518e-05 +5.384362595669875e-06 +-4.090520919345785e-05 +-3.536897607421106e-06 +2.580401661822355e-05 +-4.924740782011578e-06 +-4.54655123542352e-05 +3.657971776982853e-06 +-2.644473990874235e-05 +-1.54356004626597e-06 +4.667267918347619e-05 +-7.419639414777243e-08 +-3.867802278763724e-06 +1.555949121164949e-06 +6.971813022399149e-06 +-1.626189319074916e-06 +4.611980995057931e-06 +-2.125039312231421e-08 +-8.142022277434113e-06 +2.915433829060731e-07 +1.682794183107901e-06 +2.802598002322956e-07 +-2.944627933287195e-06 +-3.87551869422106e-08 +1.751296572553063e-06 +1.115499726975923e-07 +-3.115851227001421e-06 +1.036335061973268e-07 +3.987349298998051e-10 +-3.083020704058871e-10 +-2.751361809394857e-10 +1.766731856597341e-10 +-1.929192364138926e-09 +1.524334064115283e-09 +1.370252897812088e-09 +-8.664923537159802e-10 +1.115331087634627e-15 +9.635222130061475e-16 +7.283364553452025e-16 +1.001466362515011e-15 +-1.904993242711341e-10 +1.588278704501467e-10 +1.259388513618637e-10 +-7.396675108770752e-11 +-4.517730756060656e-07 +2.916270621434602e-07 +4.049709933697555e-07 +-3.055541066427816e-07 +-3.560394136077327e-07 +1.528740682006163e-07 +2.696427401966215e-07 +-2.562635114346919e-07 +2.423127323083111e-07 +-2.765769995700588e-07 +-2.964893825155993e-07 +1.413268190730577e-07 +1.915201934422151e-07 +-1.234198240813065e-07 +-1.817146206313224e-07 +1.339760160938901e-07 +-5.074886852002881e-07 +3.962244259051228e-07 +5.040545687560193e-07 +-3.335974686605994e-07 +-4.240762171904132e-07 +2.153247311680702e-07 +3.383396126032845e-07 +-2.978074187335917e-07 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t1.dat new file mode 100644 index 000000000..3f1029177 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t1.dat @@ -0,0 +1,149 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 144 +# columns: 1 +2.61603582514842e-05 +1.672027548764736e-05 +-3.305980113180552e-05 +-1.075152387670291e-05 +-0.006126038351410647 +-0.00200261535992263 +0.01204079938168162 +0.001635616997728207 +-0.006330897807773101 +0.001604362294661164 +0.01279710099345189 +-0.00135235191121893 +3.241285284171519e-05 +-2.049677037297224e-05 +-4.148413465841942e-05 +1.329598692148508e-05 +-0.008381292362049075 +-0.01422325204228168 +-0.005980806556314422 +0.007831982562178352 +-0.01124733659316827 +0.01657672781483258 +-0.002513037194008669 +-0.009624422357019668 +0.03735090477789912 +0.02237413140782371 +-0.05496356420885044 +-0.01760865839064189 +0.03552712373247306 +-0.02024178240253831 +-0.05550342087251621 +0.01694971400946622 +-0.1530092405940495 +-0.002658430793963777 +-0.235730838127155 +-0.0071149056088708 +0.1253314137315488 +0.0005399863279469825 +-0.1380203333289884 +-0.001206630992305791 +7.163318863933629e-06 +3.002026877049401e-06 +-1.112624696544152e-05 +-1.949102396703476e-06 +7.12257919835814e-05 +-2.284864457947211e-05 +-0.0001405582934616945 +1.619708191360634e-05 +-0.0001945888325526595 +0.0001801541075203301 +0.0003843086216420528 +-0.0001316702790943457 +-0.00010206574709142 +-0.0002011857078457213 +0.000213028030663253 +0.0001464044190751664 +5.734939118710026e-05 +3.142878807413062e-05 +-0.0001171475265944492 +-2.20543454660226e-05 +8.166787302119511e-06 +-2.54097773801797e-06 +-1.344839579265412e-05 +2.717362500530897e-06 +4.273084856605291e-06 +7.29953650339573e-07 +-7.638388029010789e-06 +-2.77838577424361e-07 +-3.177492613915696e-06 +-2.055566547241873e-06 +4.772281984117161e-06 +1.48397155694413e-06 +-2.634196402212303e-05 +-1.652009995728228e-06 +4.713457656416966e-05 +-6.087469906823956e-07 +2.174126808858453e-05 +5.664458845417186e-06 +-3.851403274163644e-05 +-3.531038521733342e-06 +2.718056558704785e-05 +-4.746039005057053e-06 +-4.781675482469093e-05 +3.53212703673136e-06 +-2.624945710962282e-05 +-2.299608258305222e-06 +4.670374651012618e-05 +-5.498315065613833e-08 +-4.263002005794769e-06 +1.5511351562379e-06 +7.939719251480721e-06 +-1.800962577708023e-06 +4.646655050428155e-06 +1.098054308495786e-07 +-8.311978293668758e-06 +3.225946122300163e-07 +1.67842378739601e-06 +2.853579750695446e-07 +-2.915280818719917e-06 +-3.967015392282433e-08 +1.778452110351617e-06 +1.197649554449849e-07 +-3.234994835975148e-06 +8.30569873251606e-08 +4.001568306059583e-10 +-3.094425977985441e-10 +-2.760610311864728e-10 +1.773322954424359e-10 +3.774296584622344e-09 +-2.89140144459941e-09 +-2.595560080544727e-09 +1.709523022445615e-09 +1.114275444436097e-15 +9.635176925980333e-16 +7.301871461615236e-16 +1.001465542490163e-15 +-1.28794764100817e-10 +1.074131781282117e-10 +8.508303206743634e-11 +-5.006713438215335e-11 +-6.452663435913337e-07 +4.609113324911029e-07 +6.131570146578443e-07 +-4.31064790375688e-07 +-7.160194645809345e-07 +4.742497547773867e-07 +6.59258517818609e-07 +-4.869500824343352e-07 +-2.633774114845742e-08 +-3.097283328115995e-08 +-3.784358992790384e-09 +-2.823169357287574e-08 +2.74182993208975e-07 +-2.01959324181001e-07 +-2.649515348772518e-07 +1.794446657214816e-07 +-5.073419963180926e-07 +3.943766699802004e-07 +5.028298242487638e-07 +-3.339506056062101e-07 +-7.442798832226384e-07 +4.970760835174608e-07 +6.840345073325609e-07 +-5.047228999979263e-07 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t2.dat new file mode 100644 index 000000000..239c234be --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t2.dat @@ -0,0 +1,149 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 144 +# columns: 1 +2.480681191864212e-05 +1.590387893820379e-05 +-3.122754571731178e-05 +-1.019685645213465e-05 +-0.006059978321762796 +-0.002088541567823247 +0.01182602336674259 +0.001695869311563505 +-0.006366352990680886 +0.001491650045488764 +0.01295773074070959 +-0.001270656972465936 +3.42635066690911e-05 +-2.163390609862079e-05 +-4.393369786983311e-05 +1.403780078382321e-05 +-0.00768425871365516 +-0.0136383621404883 +-0.006780693159852524 +0.007397347414134428 +-0.01198003141790096 +0.01716502542339233 +-0.001579729750043733 +-0.01008425177101703 +0.03772927950772749 +0.02284167453657507 +-0.05477130752361825 +-0.01773869218464503 +0.0349923802962601 +-0.01964249785407803 +-0.05557870331467505 +0.01674942646262525 +-0.1529033137487832 +-0.003984427356212656 +-0.2356675432853522 +-0.01066868042525899 +0.1253314137315488 +0.0008099774139316924 +-0.1380171141409754 +-0.001809918620999147 +6.9708523622796e-06 +3.033385006376909e-06 +-1.064491882311937e-05 +-1.909394679132851e-06 +7.417668824437716e-05 +-2.089117461825717e-05 +-0.0001453776499250216 +1.477127782574437e-05 +-0.0002163053062768819 +0.000174476057961884 +0.0004242927036838289 +-0.0001274611881543066 +-7.748937461217435e-05 +-0.0002055500724871622 +0.0001674692153313199 +0.000149668089370877 +5.2974261780588e-05 +3.372236739670559e-05 +-0.0001099616916186259 +-2.371042582129949e-05 +8.468160035432205e-06 +-2.496559389487906e-06 +-1.421090222643134e-05 +2.984593481976207e-06 +4.28472393896713e-06 +7.495366166454128e-07 +-7.548460132676093e-06 +-2.850436203216883e-07 +-2.832325417180135e-06 +-2.109757096181716e-06 +3.962753967450319e-06 +1.500446738274998e-06 +-2.622920795396791e-05 +-2.054098363016064e-06 +4.738289833172284e-05 +-3.924092231095305e-07 +2.008238131641381e-05 +5.838058790535475e-06 +-3.601979391693519e-05 +-3.69618601307938e-06 +2.853987762776597e-05 +-4.549510707618466e-06 +-5.010370057941078e-05 +3.389403453810816e-06 +-2.589886798278853e-05 +-2.822906863265523e-06 +4.659518194074e-05 +2.114945906042624e-07 +-4.740593178943985e-06 +1.641186181055307e-06 +9.032635345234798e-06 +-1.944757174216267e-06 +4.67825635430928e-06 +1.829692639232525e-07 +-8.488629606783009e-06 +3.101559543772216e-07 +1.703051540236682e-06 +2.440038439470974e-07 +-2.931375211866831e-06 +-1.697297211820226e-08 +1.805591367952377e-06 +1.436174747943495e-07 +-3.326714831123736e-06 +4.217755337376733e-08 +4.011232840825199e-10 +-3.102292102262394e-10 +-2.766740023288618e-10 +1.777884818838602e-10 +4.401944955955771e-09 +-3.378293887219114e-09 +-3.046791174393306e-09 +2.002738246243462e-09 +1.113223351116872e-15 +9.635131398187657e-16 +7.32024419816506e-16 +1.001464655687467e-15 +-1.5915400940433e-10 +1.327512215478719e-10 +1.051065601845156e-10 +-6.189052699675482e-11 +-7.360627811142823e-07 +5.443710787575512e-07 +7.132391024575682e-07 +-4.889555455511688e-07 +-8.509128787347003e-07 +5.999824754118105e-07 +8.083181042076594e-07 +-5.72004180453749e-07 +-8.681858428892771e-08 +2.779853741647482e-08 +6.369527256177386e-08 +-6.518008139660133e-08 +3.20864831394021e-07 +-2.370827610780481e-07 +-3.107518662948148e-07 +2.10453825610666e-07 +-5.264403058403141e-07 +4.098857515722414e-07 +5.222977080087536e-07 +-3.464030130857194e-07 +-8.899937741555043e-07 +6.32268583975957e-07 +8.456772110165014e-07 +-5.972377982106631e-07 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t3.dat new file mode 100644 index 000000000..2311fdef8 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t3.dat @@ -0,0 +1,149 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 144 +# columns: 1 +2.350199841649514e-05 +1.51105973964826e-05 +-2.947707313862308e-05 +-9.661825743993318e-06 +-0.005988377307866781 +-0.002169018066201891 +0.01160206756127879 +0.001751874361278707 +-0.006395157097706119 +0.0013738021540929 +0.0131058747512653 +-0.001184700444651773 +3.621350689880654e-05 +-2.282652871435025e-05 +-4.651771967900722e-05 +1.482100962828088e-05 +-0.006996230410858425 +-0.01305620012673912 +-0.007553597334447926 +0.00696874622661181 +-0.01271781703674531 +0.01775190268481903 +-0.0006202570238471417 +-0.01054794269322465 +0.03807721238815896 +0.02328334662643236 +-0.05455713583680217 +-0.01785521940111845 +0.0344257062006861 +-0.01901654493455408 +-0.0556291945603298 +0.01653460783884808 +-0.1527550897969121 +-0.005306550234537289 +-0.2355789645210835 +-0.01421803210955476 +0.1253314137315488 +0.001079966006358992 +-0.1380126073331126 +-0.002413172809613734 +6.770847245385484e-06 +3.047751697082342e-06 +-1.016854044797871e-05 +-1.867417289751799e-06 +7.696499311055729e-05 +-1.902485307602341e-05 +-0.0001498134092268193 +1.336732104589595e-05 +-0.000237381805648404 +0.0001686408543963892 +0.0004629868445449829 +-0.0001230359285474935 +-5.241538047895781e-05 +-0.0002095795541853557 +0.0001209482654892729 +0.0001526608971781252 +4.830293772854802e-05 +3.605216279530903e-05 +-0.0001022507131525165 +-2.542687541777687e-05 +8.764705842884218e-06 +-2.50311100837204e-06 +-1.502295318388319e-05 +3.206973430480008e-06 +4.330616278733498e-06 +7.346064261633393e-07 +-7.486877640658885e-06 +-2.549186380962351e-07 +-2.467288921324874e-06 +-2.134392721210558e-06 +3.13922782081493e-06 +1.49971500881468e-06 +-2.611320226435582e-05 +-2.365768752097638e-06 +4.752017567839775e-05 +-6.475074742983799e-08 +1.845191908600547e-05 +5.907579851014468e-06 +-3.345077278069663e-05 +-3.950562518942374e-06 +2.986796188280163e-05 +-4.326390038791356e-06 +-5.231080050666541e-05 +3.231929903037043e-06 +-2.551473590387339e-05 +-3.234297945491235e-06 +4.632873879927709e-05 +6.25084151159963e-07 +-5.231964489385216e-06 +1.720062561347774e-06 +1.018659628412295e-05 +-2.044234838090033e-06 +4.710818999454128e-06 +2.357342091800108e-07 +-8.656967581241159e-06 +2.68640638186727e-07 +1.684298338652155e-06 +2.37728053026257e-07 +-2.936148994187206e-06 +-1.53472252006991e-08 +1.827771874770902e-06 +1.872560837834332e-07 +-3.374833248859119e-06 +-7.06411274695742e-09 +4.01643143082521e-10 +-3.106687546790173e-10 +-2.769812013711459e-10 +1.780456597833661e-10 +2.463074328004256e-09 +-1.879778649240056e-09 +-1.718051681665431e-09 +1.138661858601589e-09 +1.112179387141172e-15 +9.635085669129078e-16 +7.338492299332728e-16 +1.001463747312874e-15 +-1.940883936305204e-10 +1.619269804244091e-10 +1.281339270029917e-10 +-7.548362923826294e-11 +-7.674458486380878e-07 +5.767286919400876e-07 +7.499140317546063e-07 +-5.080942988196474e-07 +-8.839762275269596e-07 +6.355024069544878e-07 +8.474494497558125e-07 +-5.915493801563413e-07 +-8.338098730785442e-08 +2.77658433811139e-08 +6.133901810177452e-08 +-6.189844389351303e-08 +3.680486446065969e-07 +-2.727074073484274e-07 +-3.572994723907499e-07 +2.418919036351309e-07 +-5.476762239735062e-07 +4.275867252436851e-07 +5.444732402035311e-07 +-3.603054618927018e-07 +-9.338495870251284e-07 +6.794003507922407e-07 +8.981142734754905e-07 +-6.23428994615154e-07 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t4.dat new file mode 100644 index 000000000..062246c88 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_ad_sg_l4_d4_t4.dat @@ -0,0 +1,149 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 144 +# columns: 1 +2.224618293340396e-05 +1.434144252759932e-05 +-2.780666490717171e-05 +-9.146635622661691e-06 +-0.005911457956976778 +-0.002244060710275745 +0.01136950194648037 +0.001803623309600477 +-0.006417146291132689 +0.001250875835630243 +0.01324099849599581 +-0.001094555775991016 +3.826507432375059e-05 +-2.407345307173574e-05 +-4.92416677852295e-05 +1.564851454385608e-05 +-0.00631777355044209 +-0.01247737271237314 +-0.008299490729221787 +0.006546498076836745 +-0.01345996283959532 +0.01833661907682318 +0.0003651313191311074 +-0.01101506435704648 +0.03839503588056908 +0.0236993566313633 +-0.05432156734908928 +-0.0179584412638333 +0.03382694329004615 +-0.01836387126157711 +-0.05565445956668692 +0.01630512049677905 +-0.1525646420730514 +-0.00662351496800621 +-0.2354651357094129 +-0.01776149293674828 +0.1253314137315488 +0.001349951274090777 +-0.1380068129604913 +-0.003016382412886281 +6.565170245637174e-06 +3.047236841762091e-06 +-9.698468278139272e-06 +-1.822947729252595e-06 +7.957381102911293e-05 +-1.723236245866194e-05 +-0.0001538588086966128 +1.199477339489224e-05 +-0.0002577821711512843 +0.000162626185371199 +0.000500325078810673 +-0.0001184232250164888 +-2.688672093380591e-05 +-0.0002132651756245053 +7.354774863079454e-05 +0.0001553790637450924 +4.335709558056096e-05 +3.840914707460272e-05 +-9.401806780732554e-05 +-2.718168459741464e-05 +9.065621842759686e-06 +-2.545882021699896e-06 +-1.588093322903385e-05 +3.39077908780774e-06 +4.371474021169214e-06 +7.14836646733869e-07 +-7.439937993110771e-06 +-2.032089533753089e-07 +-2.096854297424285e-06 +-2.124997124147431e-06 +2.318519712662569e-06 +1.477067613051277e-06 +-2.600414471109506e-05 +-2.668750036030082e-06 +4.751343802600182e-05 +3.154847697256478e-07 +1.690702954374487e-05 +5.914809555280668e-06 +-3.081770715983171e-05 +-4.217686786898254e-06 +3.116134122009453e-05 +-4.078483008022604e-06 +-5.443211002355535e-05 +3.067249646907978e-06 +-2.515499455124263e-05 +-3.599220983949411e-06 +4.589116922446147e-05 +1.1016773999289e-06 +-5.716925313642516e-06 +1.758729781732711e-06 +1.136679689185466e-05 +-2.087671119261752e-06 +4.743012438145622e-06 +2.88005958406191e-07 +-8.804717284105131e-06 +2.064859212592718e-07 +1.608141789979299e-06 +2.766534997031843e-07 +-2.881024254337516e-06 +-6.64109734777025e-08 +1.851548101616077e-06 +2.313677944404026e-07 +-3.384599576270173e-06 +-4.971983939908073e-08 +4.017259539489777e-10 +-3.107686178659442e-10 +-2.769892097530095e-10 +1.781080537905634e-10 +-3.776613329780884e-10 +3.152773989876396e-10 +2.395641305272315e-10 +-1.354213878317463e-10 +1.111143786722505e-15 +9.635039775526388e-16 +7.35662863105567e-16 +1.001462844667831e-15 +-1.944205518337827e-10 +1.622751427784961e-10 +1.282652452708378e-10 +-7.563833444962848e-11 +-7.687618825128741e-07 +5.821662816891545e-07 +7.538260376352659e-07 +-5.078617284111246e-07 +-8.788913181568254e-07 +6.357178421599027e-07 +8.443848653688432e-07 +-5.868589813550686e-07 +-6.979566327353848e-08 +1.717969913038241e-08 +4.720085962951709e-08 +-5.256235928515987e-08 +4.169387150625173e-07 +-3.10035981523584e-07 +-4.053496808830236e-07 +2.740682289422417e-07 +-5.674264975057499e-07 +4.446756808701462e-07 +5.657091895038234e-07 +-3.732416849331695e-07 +-9.285916893734839e-07 +6.818766625790105e-07 +8.962840570649453e-07 +-6.179964949905716e-07 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t0.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t0.dat new file mode 100644 index 000000000..a1d1ec374 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t0.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +0.1168748916418945 +0.05836185255343701 +0.1207197879199593 +-0.05532831057752801 +-0.1925509638273807 +-0.006334234258172602 +0.1253313438903165 +0.00109999695443589 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t1.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t1.dat new file mode 100644 index 000000000..2a50d8b2a --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t1.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +0.1149044241108874 +0.05808039857160729 +0.1223295762772874 +-0.05198524874796995 +-0.1924483431878547 +-0.01249023209023374 +0.1253313438903165 +0.002199928906717105 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t2.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t2.dat new file mode 100644 index 000000000..11b61e6fe --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t2.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +0.1129472756172172 +0.05777937741944458 +0.1236930875467798 +-0.04860341175419054 +-0.1922792148090441 +-0.01847051486835991 +0.1253313438903165 +0.003299731955507621 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t3.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t3.dat new file mode 100644 index 000000000..3f4a506de --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t3.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +0.11100396437766 +0.05745966438050083 +0.1248159576896253 +-0.04519210947170434 +-0.1920451153194681 +-0.02427760389654312 +0.1253313438903165 +0.004399343350992554 diff --git a/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t4.dat b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t4.dat new file mode 100644 index 000000000..963fda891 --- /dev/null +++ b/testing/generated-inputs/time_advance/fokkerplanck1_pitch_E_case2_sg_l2_d2_t4.dat @@ -0,0 +1,13 @@ +# Created from matlab git hash 5b113ba64dceadce746223be59f9d5572723f7db +# name: foo +# type: matrix +# rows: 8 +# columns: 1 +0.1090749824060101 +0.05712211215411938 +0.1257038624445272 +-0.04176021735899683 +-0.191747560898483 +-0.02991401919794937 +0.1253313438903165 +0.005498701436351021 From c091accdbcae13d6d656bbeb34186d0081eb18b2 Mon Sep 17 00:00:00 2001 From: Hugo Brunie Date: Sun, 31 Jan 2021 23:16:09 -0800 Subject: [PATCH 5/5] Requested changes to PR. Remove obsolete comment. Enum instead of int. static expect -> static assert brackets for one line if/else. --- src/pde.hpp | 4 ++-- src/pde/pde_fokkerplanck1_pitch_E.hpp | 16 ++++++++++------ src/program_options.hpp | 11 +++++------ src/tensors.hpp | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/pde.hpp b/src/pde.hpp index a757763b8..943cc3285 100644 --- a/src/pde.hpp +++ b/src/pde.hpp @@ -56,10 +56,10 @@ std::unique_ptr> make_PDE(parser const &cli_input) return std::make_unique>(cli_input); case PDE_opts::fokkerplanck_1d_pitch_E_case1: return std::make_unique< - PDE_fokkerplanck_1d_pitch_E>(cli_input); + PDE_fokkerplanck_1d_pitch_E>(cli_input); case PDE_opts::fokkerplanck_1d_pitch_E_case2: return std::make_unique< - PDE_fokkerplanck_1d_pitch_E>(cli_input); + PDE_fokkerplanck_1d_pitch_E>(cli_input); case PDE_opts::fokkerplanck_1d_pitch_C: return std::make_unique>(cli_input); case PDE_opts::fokkerplanck_1d_4p3: diff --git a/src/pde/pde_fokkerplanck1_pitch_E.hpp b/src/pde/pde_fokkerplanck1_pitch_E.hpp index 5de99894d..377968a5a 100644 --- a/src/pde/pde_fokkerplanck1_pitch_E.hpp +++ b/src/pde/pde_fokkerplanck1_pitch_E.hpp @@ -31,7 +31,7 @@ // q=df/fz with homogeneous Dirichlet BC // // --------------------------------------------------------------------------- -template +template class PDE_fokkerplanck_1d_pitch_E : public PDE

{ public: @@ -68,8 +68,8 @@ class PDE_fokkerplanck_1d_pitch_E : public PDE

// analytic solution static P phi(P const z, P const t) { return std::tanh(std::atanh(z) - t); } - static P f0_mod0(P const z) { return z * 0. + 1; } - static P f0_mod1(P const z) { return exp(-pow(z, 2) / pow(0.1, 2)); } + static P f0_case0(P const z) { return z * 0. + 1; } + static P f0_case1(P const z) { return exp(-pow(z, 2) / pow(0.1, 2)); } static fk::vector

analytic_solution_dim0(fk::vector

const z, P const t = 0) @@ -81,10 +81,14 @@ class PDE_fokkerplanck_1d_pitch_E : public PDE

P t1 = 1 - std::pow(p, 2); P t2 = 1 - std::pow(z(i), 2); P t3 = 0.; - if constexpr (user_case == PDE_case_opts::mod1) - t3 = f0_mod1(p); + if constexpr (user_case == PDE_case_opts::case1) + { + t3 = f0_case1(p); + } else - t3 = f0_mod0(p); + { + t3 = f0_case0(p); + } f(i) = t1 / t2 * t3; } return f; diff --git a/src/program_options.hpp b/src/program_options.hpp index a214a29f4..366adab27 100644 --- a/src/program_options.hpp +++ b/src/program_options.hpp @@ -44,10 +44,10 @@ enum class PDE_opts enum class PDE_case_opts { - mod0, - mod1, - mod2, - mod_count + case0, + case1, + case2, + case_count // FIXME will need to add the user supplied PDE cases choice }; @@ -139,7 +139,7 @@ class parser static auto constexpr DEFAULT_PDE_STR = "continuity_2"; static auto constexpr DEFAULT_PDE_OPT = PDE_opts::continuity_2; static auto constexpr DEFAULT_SOLVER = solve_opts::direct; - static auto constexpr DEFAULT_PDE_SELECTED_CASE = 0; + static auto constexpr DEFAULT_PDE_SELECTED_CASE = PDE_case_opts::case0; // construct from command line explicit parser(int argc, char **argv); @@ -267,7 +267,6 @@ class parser std::string pde_str = DEFAULT_PDE_STR; // pde to construct/evaluate PDE_opts pde_choice = DEFAULT_PDE_OPT; - // pde selected case (f0) // default std::string solver_str = NO_USER_VALUE_STR; diff --git a/src/tensors.hpp b/src/tensors.hpp index c3d84d636..7dd9d8641 100644 --- a/src/tensors.hpp +++ b/src/tensors.hpp @@ -150,13 +150,13 @@ class vector vector(vector const &); // cannot be templated per C++ spec 12.8 // instead of disabling w/ sfinae for const_view, - // static expect added to definition + // static assert added to definition vector &operator=(vector const &); // move constructor/assignment (required to be same to same) vector(vector &&); - // as with copy assignment, static expect added + // as with copy assignment, static assert added // to definition to prevent assignment into // const views vector &operator=(vector &&);