diff --git a/pgens/accretion/pgen.hpp b/pgens/accretion/pgen.hpp index 864140df..54a60735 100644 --- a/pgens/accretion/pgen.hpp +++ b/pgens/accretion/pgen.hpp @@ -43,7 +43,8 @@ namespace user { TWO * metric.spin() * g_00); } - Inline auto bx1(const coord_t& x_Ph) const -> real_t { // at ( i , j + HALF ) + Inline auto bx1(const coord_t& x_Ph) const + -> real_t { // at ( i , j + HALF ) coord_t xi { ZERO }, x0m { ZERO }, x0p { ZERO }; metric.template convert(x_Ph, xi); @@ -61,7 +62,8 @@ namespace user { } } - Inline auto bx2(const coord_t& x_Ph) const -> real_t { // at ( i + HALF , j ) + Inline auto bx2(const coord_t& x_Ph) const + -> real_t { // at ( i + HALF , j ) coord_t xi { ZERO }, x0m { ZERO }, x0p { ZERO }; metric.template convert(x_Ph, xi); @@ -174,7 +176,7 @@ namespace user { return false; } - Inline auto operator()(const coord_t& x_Ph) const -> real_t override { + Inline auto operator()(const coord_t& x_Ph) const -> real_t { auto fill = true; for (auto d = 0u; d < M::Dim; ++d) { fill &= x_Ph[d] > x_min[d] and x_Ph[d] < x_max[d] and sigma_crit(x_Ph); diff --git a/pgens/reconnection/pgen.hpp b/pgens/reconnection/pgen.hpp index e92de584..8e8804b2 100644 --- a/pgens/reconnection/pgen.hpp +++ b/pgens/reconnection/pgen.hpp @@ -28,7 +28,7 @@ namespace user { , center_x { center_x } , cs_y { cs_y } {} - Inline auto operator()(const coord_t& x_Ph) const -> real_t override { + Inline auto operator()(const coord_t& x_Ph) const -> real_t { return ONE / SQR(math::cosh((x_Ph[1] - cs_y) / cs_width)) * (ONE - math::exp(-SQR((x_Ph[0] - center_x) / cs_width))); } diff --git a/src/archetypes/energy_dist.h b/src/archetypes/energy_dist.h index 24a3731d..bcb88fbc 100644 --- a/src/archetypes/energy_dist.h +++ b/src/archetypes/energy_dist.h @@ -40,17 +40,6 @@ namespace arch { EnergyDistribution(const M& metric) : metric { metric } {} - // Takes the physical coordinate of the particle and returns - // the velocity in tetrad basis - // last argument -- is the species index (1, ..., nspec) - Inline virtual void operator()(const coord_t&, - vec_t& v, - spidx_t = 0) const { - v[0] = ZERO; - v[1] = ZERO; - v[2] = ZERO; - } - protected: const M metric; }; @@ -61,7 +50,8 @@ namespace arch { Inline void operator()(const coord_t&, vec_t& v, - spidx_t = 0) const override { + spidx_t = 0) const { + v[0] = ZERO; v[1] = ZERO; v[2] = ZERO; @@ -85,7 +75,7 @@ namespace arch { Inline void operator()(const coord_t&, vec_t& v, - spidx_t = 0) const override { + spidx_t = 0) const { auto rand_gen = pool.get_state(); auto rand_X1 = Random(rand_gen); auto rand_gam = ONE; @@ -241,7 +231,7 @@ namespace arch { Inline void operator()(const coord_t&, vec_t& v, - spidx_t sp = 0) const override { + spidx_t sp = 0) const { SampleFromMaxwellian(v, pool, temperature, @@ -293,7 +283,7 @@ namespace arch { Inline void operator()(const coord_t&, vec_t& v, - spidx_t sp = 0) const override { + spidx_t sp = 0) const { SampleFromMaxwellian( v, pool, @@ -367,7 +357,7 @@ namespace arch { Inline void operator()(const coord_t& x_Code, vec_t& v, - spidx_t = 0) const override { + spidx_t = 0) const { if (cmp::AlmostZero(temperature)) { v[0] = ZERO; v[1] = ZERO; diff --git a/src/archetypes/spatial_dist.h b/src/archetypes/spatial_dist.h index 225c66eb..eabb9ea7 100644 --- a/src/archetypes/spatial_dist.h +++ b/src/archetypes/spatial_dist.h @@ -32,10 +32,6 @@ namespace arch { SpatialDistribution(const M& metric) : metric { metric } {} - Inline virtual auto operator()(const coord_t&) const -> real_t { - return ONE; - } - protected: const M metric; }; @@ -44,7 +40,7 @@ namespace arch { struct Uniform : public SpatialDistribution { Uniform(const M& metric) : SpatialDistribution { metric } {} - Inline auto operator()(const coord_t&) const -> real_t override { + Inline auto operator()(const coord_t&) const -> real_t { return ONE; } }; @@ -69,7 +65,7 @@ namespace arch { , target_density { target_density } , target_max_density { target_max_density } {} - Inline auto operator()(const coord_t& x_Ph) const -> real_t override { + Inline auto operator()(const coord_t& x_Ph) const -> real_t { coord_t x_Cd { ZERO }; metric.template convert(x_Ph, x_Cd); real_t dens { ZERO }; diff --git a/src/archetypes/tests/spatial_dist.cpp b/src/archetypes/tests/spatial_dist.cpp index 232ab1eb..c27f2085 100644 --- a/src/archetypes/tests/spatial_dist.cpp +++ b/src/archetypes/tests/spatial_dist.cpp @@ -76,7 +76,7 @@ struct RadialDist : public SpatialDistribution { RadialDist(const M& metric) : SpatialDistribution { metric } {} - Inline auto operator()(const coord_t& x_Code) const -> real_t override { + auto operator()(const coord_t& x_Code) const -> real_t { coord_t x_Sph { ZERO }; metric.template convert(x_Code, x_Sph); auto r { ZERO }; @@ -123,4 +123,4 @@ auto main(int argc, char* argv[]) -> int { } Kokkos::finalize(); return 0; -} \ No newline at end of file +} diff --git a/src/global/utils/error.h b/src/global/utils/error.h index 5f378bf1..df23bce6 100644 --- a/src/global/utils/error.h +++ b/src/global/utils/error.h @@ -101,12 +101,12 @@ namespace raise { const char* func, int line, const char* msg) { - printf("\n%s:%d @ %s\nError: %s", file, line, func, msg); + Kokkos::printf("\n%s:%d @ %s\nError: %s", file, line, func, msg); Kokkos::abort("kernel error"); } Inline void KernelNotImplementedError(const char* file, const char* func, int line) { - printf("\n%s:%d @ %s\n", file, line, func); + Kokkos::printf("\n%s:%d @ %s\n", file, line, func); Kokkos::abort("kernel not implemented"); } diff --git a/src/kernels/tests/ampere_mink.cpp b/src/kernels/tests/ampere_mink.cpp index 80af88fa..ab4de813 100644 --- a/src/kernels/tests/ampere_mink.cpp +++ b/src/kernels/tests/ampere_mink.cpp @@ -25,7 +25,7 @@ void errorIf(bool condition, const std::string& message) { Inline auto equal(real_t a, real_t b, const char* msg, real_t acc) -> bool { if (not(math::abs(a - b) < acc)) { - printf("%.12e != %.12e [%.12e] %s\n", a, b, math::abs(a - b), msg); + Kokkos::printf("%.12e != %.12e [%.12e] %s\n", a, b, math::abs(a - b), msg); return false; } return true; diff --git a/src/kernels/tests/deposit.cpp b/src/kernels/tests/deposit.cpp index c9acafae..0afb7d95 100644 --- a/src/kernels/tests/deposit.cpp +++ b/src/kernels/tests/deposit.cpp @@ -32,8 +32,8 @@ const real_t eps = std::is_same_v ? (real_t)(1e-6) Inline auto equal(real_t a, real_t b, const char* msg, real_t eps) -> bool { if ((a - b) >= eps * math::max(math::fabs(a), math::fabs(b))) { - printf("%.12e != %.12e %s\n", a, b, msg); - printf("%.12e >= %.12e %s\n", + Kokkos::printf("%.12e != %.12e %s\n", a, b, msg); + Kokkos::printf("%.12e >= %.12e %s\n", a - b, eps * math::max(math::fabs(a), math::fabs(b)), msg); diff --git a/src/kernels/tests/faraday_mink.cpp b/src/kernels/tests/faraday_mink.cpp index 74c2b9b1..ce9f4c50 100644 --- a/src/kernels/tests/faraday_mink.cpp +++ b/src/kernels/tests/faraday_mink.cpp @@ -25,7 +25,7 @@ void errorIf(bool condition, const std::string& message) { Inline auto equal(real_t a, real_t b, const char* msg, real_t acc) -> bool { if (not(math::abs(a - b) < acc)) { - printf("%.12e != %.12e [%.12e] %s\n", a, b, math::abs(a - b), msg); + Kokkos::printf("%.12e != %.12e [%.12e] %s\n", a, b, math::abs(a - b), msg); return false; } return true; diff --git a/src/kernels/tests/flds_bc.cpp b/src/kernels/tests/flds_bc.cpp index 5de006d1..bb27fff6 100644 --- a/src/kernels/tests/flds_bc.cpp +++ b/src/kernels/tests/flds_bc.cpp @@ -48,7 +48,7 @@ struct DummyFieldsBCs { Inline auto equal(real_t a, real_t b, const char* msg, real_t acc) -> bool { if (not(math::abs(a - b) < acc)) { - printf("%.12e != %.12e [%.12e] %s\n", a, b, math::abs(a - b), msg); + Kokkos::printf("%.12e != %.12e [%.12e] %s\n", a, b, math::abs(a - b), msg); return false; } return true; @@ -118,19 +118,19 @@ void testFldsBCs(const std::vector& res) { FOUR * math::abs(x + HALF - xg_edge) / dx_abs); const auto factor2 = math::tanh(FOUR * math::abs(x - xg_edge) / dx_abs); if (not cmp::AlmostEqual(flds(i1, em::ex1), TWO * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, em::ex1), TWO * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, em::ex1), TWO * (ONE - factor1)); raise::KernelError(HERE, "incorrect ex1"); } if (not cmp::AlmostEqual(flds(i1, em::ex2), THREE * (ONE - factor2))) { - printf("%f != %f\n", flds(i1, em::ex2), THREE * (ONE - factor2)); + Kokkos::printf("%f != %f\n", flds(i1, em::ex2), THREE * (ONE - factor2)); raise::KernelError(HERE, "incorrect ex2"); } if (not cmp::AlmostEqual(flds(i1, em::bx2), FOUR * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, em::bx2), FOUR * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, em::bx2), FOUR * (ONE - factor1)); raise::KernelError(HERE, "incorrect bx2"); } if (not cmp::AlmostEqual(flds(i1, em::bx3), FIVE * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, em::bx3), FIVE * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, em::bx3), FIVE * (ONE - factor1)); raise::KernelError(HERE, "incorrect bx3"); } }); @@ -145,19 +145,19 @@ void testFldsBCs(const std::vector& res) { FOUR * math::abs(x + HALF - xg_edge) / dx_abs); const auto factor2 = math::tanh(FOUR * math::abs(x - xg_edge) / dx_abs); if (not cmp::AlmostEqual(flds(i1, i2, em::ex1), TWO * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, i2, em::ex1), TWO * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, i2, em::ex1), TWO * (ONE - factor1)); raise::KernelError(HERE, "incorrect ex1"); } if (not cmp::AlmostEqual(flds(i1, i2, em::ex2), THREE * (ONE - factor2))) { - printf("%f != %f\n", flds(i1, i2, em::ex2), THREE * (ONE - factor2)); + Kokkos::printf("%f != %f\n", flds(i1, i2, em::ex2), THREE * (ONE - factor2)); raise::KernelError(HERE, "incorrect ex2"); } if (not cmp::AlmostEqual(flds(i1, i2, em::bx2), FOUR * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, i2, em::bx2), FOUR * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, i2, em::bx2), FOUR * (ONE - factor1)); raise::KernelError(HERE, "incorrect bx2"); } if (not cmp::AlmostEqual(flds(i1, i2, em::bx3), FIVE * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, i2, em::bx3), FIVE * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, i2, em::bx3), FIVE * (ONE - factor1)); raise::KernelError(HERE, "incorrect bx3"); } }); @@ -173,22 +173,22 @@ void testFldsBCs(const std::vector& res) { FOUR * math::abs(x + HALF - xg_edge) / dx_abs); const auto factor2 = math::tanh(FOUR * math::abs(x - xg_edge) / dx_abs); if (not cmp::AlmostEqual(flds(i1, i2, i3, em::ex1), TWO * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, i2, i3, em::ex1), TWO * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, i2, i3, em::ex1), TWO * (ONE - factor1)); raise::KernelError(HERE, "incorrect ex1"); } if (not cmp::AlmostEqual(flds(i1, i2, i3, em::ex2), THREE * (ONE - factor2))) { - printf("%f != %f\n", flds(i1, i2, i3, em::ex2), THREE * (ONE - factor2)); + Kokkos::printf("%f != %f\n", flds(i1, i2, i3, em::ex2), THREE * (ONE - factor2)); raise::KernelError(HERE, "incorrect ex2"); } if (not cmp::AlmostEqual(flds(i1, i2, i3, em::bx2), FOUR * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, i2, i3, em::bx2), FOUR * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, i2, i3, em::bx2), FOUR * (ONE - factor1)); raise::KernelError(HERE, "incorrect bx2"); } if (not cmp::AlmostEqual(flds(i1, i2, i3, em::bx3), FIVE * (ONE - factor1))) { - printf("%f != %f\n", flds(i1, i2, i3, em::bx3), FIVE * (ONE - factor1)); + Kokkos::printf("%f != %f\n", flds(i1, i2, i3, em::bx3), FIVE * (ONE - factor1)); raise::KernelError(HERE, "incorrect bx3"); } }); diff --git a/src/kernels/tests/prtl_bc.cpp b/src/kernels/tests/prtl_bc.cpp index 6e49f8ba..f7f8be43 100644 --- a/src/kernels/tests/prtl_bc.cpp +++ b/src/kernels/tests/prtl_bc.cpp @@ -29,7 +29,7 @@ void errorIf(bool condition, const std::string& message = "") { Inline auto equal(real_t a, real_t b, const std::string& msg) -> bool { if (not(math::abs(a - b) < 1e-4)) { - printf("%.12e != %.12e %s\n", a, b, msg.c_str()); + Kokkos::printf("%.12e != %.12e %s\n", a, b, msg.c_str()); return false; } return true; diff --git a/src/metrics/tests/coord_trans.cpp b/src/metrics/tests/coord_trans.cpp index 67dcdda5..f2bd7e46 100644 --- a/src/metrics/tests/coord_trans.cpp +++ b/src/metrics/tests/coord_trans.cpp @@ -33,7 +33,7 @@ Inline auto equal(const coord_t& a, const auto eps = epsilon * acc; for (auto d { 0u }; d < D; ++d) { if (not cmp::AlmostEqual(a[d], b[d], eps)) { - printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); + Kokkos::printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); return false; } } diff --git a/src/metrics/tests/ks-qks.cpp b/src/metrics/tests/ks-qks.cpp index fce9004d..98be577e 100644 --- a/src/metrics/tests/ks-qks.cpp +++ b/src/metrics/tests/ks-qks.cpp @@ -27,7 +27,7 @@ Inline auto equal(const vec_t& a, const auto eps = epsilon * acc; for (auto d { 0u }; d < D; ++d) { if (not cmp::AlmostEqual(a[d], b[d], eps)) { - printf("%s: %.12e : %.12e\n", msg, a[d], b[d]); + Kokkos::printf("%s: %.12e : %.12e\n", msg, a[d], b[d]); return false; } } @@ -138,7 +138,7 @@ void testMetric(const std::vector& res, vec_t h_ij_expect { h_11_expect, h_22_expect, h_33_expect }; if (not equal(h_ij_predict, h_ij_expect, "h_ij", acc)) { - printf("h_ij: %.12e %.12e %.12e : %.12e %.12e %.12e\n", + Kokkos::printf("h_ij: %.12e %.12e %.12e : %.12e %.12e %.12e\n", h_ij_predict[0], h_ij_predict[1], h_ij_predict[2], @@ -148,11 +148,11 @@ void testMetric(const std::vector& res, Kokkos::abort("h_ij"); } if (not equal(h_13_predict, { h_13_expect }, "h_13", acc)) { - printf("h_13: %.12e : %.12e\n", h_13_predict[0], h_13_expect); + Kokkos::printf("h_13: %.12e : %.12e\n", h_13_predict[0], h_13_expect); Kokkos::abort("h_13"); } if (not equal(hij_predict, hij_expect, "hij", acc)) { - printf("hij: %.12e %.12e %.12e : %.12e %.12e %.12e\n", + Kokkos::printf("hij: %.12e %.12e %.12e : %.12e %.12e %.12e\n", hij_predict[0], hij_predict[1], hij_predict[2], @@ -162,7 +162,7 @@ void testMetric(const std::vector& res, Kokkos::abort("hij"); } if (not equal(h13_predict, { h13_expect }, "h13", acc)) { - printf("h13: %.12e : %.12e\n", h13_predict[0], h13_expect); + Kokkos::printf("h13: %.12e : %.12e\n", h13_predict[0], h13_expect); Kokkos::abort("h13"); } }); diff --git a/src/metrics/tests/minkowski.cpp b/src/metrics/tests/minkowski.cpp index 6073b810..4c7d7791 100644 --- a/src/metrics/tests/minkowski.cpp +++ b/src/metrics/tests/minkowski.cpp @@ -23,7 +23,7 @@ Inline auto equal(const coord_t& a, const coord_t& b, real_t acc = ONE) -> bool { for (auto d { 0u }; d < D; ++d) { if (not cmp::AlmostEqual(a[d], b[d], epsilon * acc)) { - printf("%d : %.12f != %.12f\n", d, a[d], b[d]); + Kokkos::printf("%d : %.12f != %.12f\n", d, a[d], b[d]); return false; } } diff --git a/src/metrics/tests/sph-qsph.cpp b/src/metrics/tests/sph-qsph.cpp index 2ad802c2..12c37bf6 100644 --- a/src/metrics/tests/sph-qsph.cpp +++ b/src/metrics/tests/sph-qsph.cpp @@ -27,7 +27,7 @@ Inline auto equal(const vec_t& a, const auto eps = epsilon * acc; for (auto d { 0u }; d < D; ++d) { if (not cmp::AlmostEqual(a[d], b[d], eps)) { - printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); + Kokkos::printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); return false; } } diff --git a/src/metrics/tests/sr-cart-sph.cpp b/src/metrics/tests/sr-cart-sph.cpp index b3e4e163..6ca6a52d 100644 --- a/src/metrics/tests/sr-cart-sph.cpp +++ b/src/metrics/tests/sr-cart-sph.cpp @@ -30,7 +30,7 @@ Inline auto equal(const coord_t& a, const auto eps = epsilon * acc; for (auto d { 0u }; d < D; ++d) { if (not cmp::AlmostEqual(a[d], b[d], eps)) { - printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); + Kokkos::printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); return false; } } diff --git a/src/metrics/tests/vec_trans.cpp b/src/metrics/tests/vec_trans.cpp index af7c0881..e9a03aa5 100644 --- a/src/metrics/tests/vec_trans.cpp +++ b/src/metrics/tests/vec_trans.cpp @@ -33,7 +33,7 @@ Inline auto equal(const vec_t& a, const auto eps = epsilon * acc; for (auto d { 0u }; d < D; ++d) { if (not cmp::AlmostEqual(a[d], b[d], eps)) { - printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); + Kokkos::printf("%d : %.12e != %.12e %s\n", d, a[d], b[d], msg); return false; } } diff --git a/src/output/tests/writer-mpi.cpp b/src/output/tests/writer-mpi.cpp index 0770b8f8..72a8f87e 100644 --- a/src/output/tests/writer-mpi.cpp +++ b/src/output/tests/writer-mpi.cpp @@ -158,7 +158,7 @@ auto main(int argc, char* argv[]) -> int { if (not cmp::AlmostEqual( field_read(i1), field(i1 * dwn1 + first_cell + i1min, cntr))) { - printf("\n:::::::::::::::\nfield_read(%ld) = %f != " + Kokkos::printf("\n:::::::::::::::\nfield_read(%ld) = %f != " "field(%ld, %d) = %f\n:::::::::::::::\n", i1, field_read(i1), diff --git a/src/output/tests/writer-nompi.cpp b/src/output/tests/writer-nompi.cpp index 70024d96..6e0c3085 100644 --- a/src/output/tests/writer-nompi.cpp +++ b/src/output/tests/writer-nompi.cpp @@ -179,7 +179,7 @@ auto main(int argc, char* argv[]) -> int { i2 * dwn2 + i2min, i3 * dwn3 + i3min, cntr))) { - printf("\n:::::::::::::::\nfield_read(%ld, %ld, %ld) = %f != " + Kokkos::printf("\n:::::::::::::::\nfield_read(%ld, %ld, %ld) = %f != " "field(%ld, %ld, %ld, %d) = %f\n:::::::::::::::\n", i1, i2,