From 3b20f5dfb3911243052df4f03907ff49e8e1c5a9 Mon Sep 17 00:00:00 2001 From: haykh Date: Thu, 9 Apr 2026 14:09:16 -0400 Subject: [PATCH 01/56] empty From b764c9171e65592d7e0ebdefc658f56a42f9d8ae Mon Sep 17 00:00:00 2001 From: haykh Date: Thu, 16 Apr 2026 17:07:29 -0400 Subject: [PATCH 02/56] rm benchmark mode --- .gitignore | 1 + CMakeLists.txt | 75 +++++++++++++++++++---------------------- benchmark/benchmark.cpp | 17 ---------- cmake/benchmark.cmake | 18 ---------- 4 files changed, 36 insertions(+), 75 deletions(-) delete mode 100644 benchmark/benchmark.cpp delete mode 100644 cmake/benchmark.cmake diff --git a/.gitignore b/.gitignore index 62248c605..0513b4da9 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ temp*/ logs/ *.log *.bak +temp* # Trash files .trash/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 985eebc53..144ae522e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,35 +28,35 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/defaults.cmake) # defaults set(DEBUG - ${default_debug} - CACHE BOOL "Debug mode") + ${default_debug} + CACHE BOOL "Debug mode") set(precision - ${default_precision} - CACHE STRING "Precision") + ${default_precision} + CACHE STRING "Precision") set(deposit - ${default_deposit} - CACHE STRING "Deposit") + ${default_deposit} + CACHE STRING "Deposit") set(shape_order - ${default_shape_order} - CACHE STRING "Shape function") + ${default_shape_order} + CACHE STRING "Shape function") set(pgen - ${default_pgen} - CACHE STRING "Problem generator") + ${default_pgen} + CACHE STRING "Problem generator") set(output - ${default_output} - CACHE BOOL "Enable output") + ${default_output} + CACHE BOOL "Enable output") set(mpi - ${default_mpi} - CACHE BOOL "Use MPI") + ${default_mpi} + CACHE BOOL "Use MPI") set(gpu_aware_mpi - ${default_gpu_aware_mpi} - CACHE BOOL "Enable GPU-aware MPI") + ${default_gpu_aware_mpi} + CACHE BOOL "Enable GPU-aware MPI") # -------------------------- Compilation settings -------------------------- # set(CMAKE_CXX_STANDARD 20) @@ -65,42 +65,42 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if(${DEBUG} STREQUAL "OFF") set(CMAKE_BUILD_TYPE - Release - CACHE STRING "CMake build type") + Release + CACHE STRING "CMake build type") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG -O3") else() set(CMAKE_BUILD_TYPE - Debug - CACHE STRING "CMake build type") + Debug + CACHE STRING "CMake build type") set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -DDEBUG -Wall -Wextra -Wno-unknown-pragmas") + "${CMAKE_CXX_FLAGS} -DDEBUG -Wall -Wextra -Wno-unknown-pragmas") endif() # options set(precisions - "single" "double" - CACHE STRING "Precisions") + "single" "double" + CACHE STRING "Precisions") set(deposits - "zigzag" "esirkepov" - CACHE STRING "Deposits") + "zigzag" "esirkepov" + CACHE STRING "Deposits") if(${deposit} STREQUAL "zigzag") set(shape_order - ${default_shape_order} - CACHE STRING "Shape functions") + ${default_shape_order} + CACHE STRING "Shape functions") endif() set(shape_orders - "1;2;3;4;5;6;7;8;9;10;11" - CACHE STRING "Shape orders") + "1;2;3;4;5;6;7;8;9;10;11" + CACHE STRING "Shape orders") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake) # ------------------------- Third-Party Tests ------------------------------ # set(BUILD_TESTING - OFF - CACHE BOOL "Build tests") + OFF + CACHE BOOL "Build tests") # ------------------------ Third-party dependencies ------------------------ # include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies.cmake) @@ -129,8 +129,8 @@ else() endif() if(("${Kokkos_DEVICES}" MATCHES "CUDA") - OR ("${Kokkos_DEVICES}" MATCHES "HIP") - OR ("${Kokkos_DEVICES}" MATCHES "SYCL")) + OR ("${Kokkos_DEVICES}" MATCHES "HIP") + OR ("${Kokkos_DEVICES}" MATCHES "SYCL")) set(DEVICE_ENABLED ON) else() set(DEVICE_ENABLED OFF) @@ -148,8 +148,8 @@ if(${mpi}) endif() else() set(gpu_aware_mpi - OFF - CACHE BOOL "Use explicit copy when using MPI + GPU") + OFF + CACHE BOOL "Use explicit copy when using MPI + GPU") endif() endif() @@ -186,9 +186,4 @@ if(TESTS) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests.cmake) endif() -if(BENCHMARK) - # ------------------------------ Benchmark --------------------------------- # - include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/benchmark.cmake) -endif() - include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/report.cmake) diff --git a/benchmark/benchmark.cpp b/benchmark/benchmark.cpp deleted file mode 100644 index 98306c92b..000000000 --- a/benchmark/benchmark.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "global.h" - -#include -#include - -auto main(int argc, char* argv[]) -> int { - ntt::GlobalInitialize(argc, argv); - try { - // ... - } catch (const std::exception& e) { - std::cerr << "Error: " << e.what() << std::endl; - GlobalFinalize(); - return 1; - } - GlobalFinalize(); - return 0; -} diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake deleted file mode 100644 index af0d334ea..000000000 --- a/cmake/benchmark.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# cmake-lint: disable=C0103 - -set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) - -set(exec benchmark.xc) -set(src ${CMAKE_CURRENT_SOURCE_DIR}/benchmark/benchmark.cpp) - -add_executable(${exec} ${src}) - -set(libs ntt_global ntt_metrics ntt_kernels ntt_archetypes ntt_framework) -if(${output}) - list(APPEND libs ntt_output) -endif() -add_dependencies(${exec} ${libs}) -if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") - list(APPEND libs stdc++fs) -endif() -target_link_libraries(${exec} PRIVATE ${libs}) From bfa7a63db711a4f6081fb80d6b6138e3544508b8 Mon Sep 17 00:00:00 2001 From: haykh Date: Thu, 16 Apr 2026 17:12:17 -0400 Subject: [PATCH 03/56] better enums --- minimal/CMakeLists.txt | 4 +- pgens/accretion/pgen.hpp | 17 +- pgens/examples/atmosphere/pgen.hpp | 8 +- pgens/examples/custom_emission/pgen.hpp | 8 +- .../custom_energy_distribution/pgen.hpp | 8 +- .../examples/custom_particle_update/pgen.hpp | 28 +- .../custom_spatial_distribution/pgen.hpp | 8 +- pgens/examples/external_fields/pgen.hpp | 16 +- .../match_fix_field_boundaries/pgen.hpp | 8 +- pgens/examples/replenish_injector/pgen.hpp | 8 +- pgens/examples/tutorial_cartesian_sr/pgen.hpp | 16 +- pgens/magnetosphere/pgen.hpp | 8 +- pgens/pgen.hpp | 8 +- pgens/piston_shock/pgen.hpp | 8 +- pgens/reconnection/pgen.hpp | 10 +- pgens/shock/pgen.hpp | 12 +- pgens/streaming/pgen.hpp | 8 +- pgens/turbulence/pgen.hpp | 8 +- pgens/wald/pgen.hpp | 24 +- src/archetypes/energy_dist.h | 16 +- src/archetypes/field_setter.h | 2 +- src/archetypes/particle_injector.h | 24 +- src/archetypes/piston.h | 12 +- src/archetypes/problem_generator.h | 2 +- src/archetypes/spatial_dist.h | 8 +- src/archetypes/tests/energy_dist.cpp | 4 +- src/archetypes/tests/pgen.cpp | 19 +- src/archetypes/tests/powerlaw.cpp | 6 +- src/archetypes/tests/spatial_dist.cpp | 6 +- src/archetypes/traits.h | 33 +- src/archetypes/utils.h | 8 +- src/engines/engine.hpp | 13 +- src/engines/grpic.hpp | 5 +- src/engines/reporter.h | 4 +- src/engines/srpic/fields_bcs.h | 8 +- src/engines/srpic/fieldsolvers.h | 6 +- src/engines/srpic/particles_bcs.h | 2 +- src/engines/srpic/srpic.hpp | 2 - src/engines/srpic/utils.h | 18 +- src/engines/traits.h | 56 ---- src/entity.cpp | 18 +- src/framework/CMakeLists.txt | 2 +- src/framework/containers/fields.cpp | 12 +- src/framework/containers/fields.h | 2 +- src/framework/containers/fields_io.cpp | 6 +- src/framework/containers/particles.cpp | 20 +- src/framework/containers/particles.h | 4 +- src/framework/containers/particles_comm.cpp | 18 +- src/framework/containers/particles_io.cpp | 55 ++-- src/framework/containers/particles_sort.cpp | 28 +- src/framework/domain/domain.h | 11 +- src/framework/domain/grid.cpp | 8 +- src/framework/domain/mesh.h | 5 +- src/framework/domain/metadomain.cpp | 18 +- src/framework/domain/metadomain.h | 2 +- src/framework/domain/metadomain_chckpt.cpp | 6 +- src/framework/domain/metadomain_comm.cpp | 28 +- src/framework/domain/metadomain_io.cpp | 12 +- src/framework/domain/metadomain_sort.cpp | 2 +- src/framework/domain/metadomain_stats.cpp | 37 ++- src/framework/parameters/grid.cpp | 18 +- src/framework/parameters/grid.h | 12 +- src/framework/parameters/parameters.cpp | 2 +- src/framework/parameters/particles.cpp | 26 +- src/framework/simulation.h | 2 - src/framework/specialization_registry.h | 2 +- src/framework/tests/fields.cpp | 12 +- src/framework/tests/parameters.cpp | 2 +- src/framework/tests/particles.cpp | 128 ++++---- src/framework/tests/particles_sort.cpp | 4 +- src/global/CMakeLists.txt | 3 +- src/global/arch/directions.h | 4 +- src/global/arch/kokkos_aliases.cpp | 36 +-- src/global/arch/kokkos_aliases.h | 4 +- src/global/arch/mpi_tags.h | 9 +- src/global/enums.h | 179 +++++------ src/global/tests/param_container.cpp | 4 +- src/global/utils/cargs.cpp | 4 +- src/global/utils/cargs.h | 3 +- src/global/utils/colors.h | 3 +- src/global/utils/comparators.h | 16 +- src/global/utils/diag.cpp | 5 +- src/global/utils/formatting.h | 10 +- src/global/utils/param_container.cpp | 26 +- src/global/utils/progressbar.cpp | 5 +- src/global/utils/progressbar.h | 5 +- src/global/utils/timer.cpp | 5 +- src/global/utils/tools.h | 32 +- src/kernels/comm.hpp | 8 +- src/kernels/currents_deposit.hpp | 2 +- src/kernels/digital_filter.hpp | 8 +- src/kernels/divergences.hpp | 6 +- src/kernels/emission/emission.hpp | 2 +- src/kernels/fields_bcs.hpp | 4 +- src/kernels/fieldsetter.hpp | 2 +- src/kernels/injectors.hpp | 28 +- src/kernels/particle_moments.hpp | 12 +- src/kernels/particle_pusher_gr.hpp | 4 +- src/kernels/particle_pusher_sr.hpp | 58 ++-- src/kernels/prtls_to_phys.hpp | 10 +- src/kernels/reduced_stats.hpp | 6 +- src/kernels/tests/custom_emission.cpp | 28 +- src/kernels/tests/custom_prtl_update.cpp | 287 ++++++++++++------ src/kernels/tests/deposit.cpp | 6 +- src/kernels/tests/digital_filter.cpp | 2 +- src/kernels/tests/ext_force.cpp | 24 +- src/kernels/tests/fields_to_phys.cpp | 2 +- src/kernels/tests/gca_pusher.cpp | 30 +- src/kernels/tests/particle_moments.cpp | 6 +- src/kernels/tests/prtl_bc.cpp | 4 +- src/kernels/tests/pusher.cpp | 55 ++-- src/kernels/tests/reduced_stats.cpp | 4 +- src/metrics/kerr_schild.h | 8 +- src/metrics/kerr_schild_0.h | 4 +- src/metrics/minkowski.h | 8 +- src/metrics/qkerr_schild.h | 8 +- src/metrics/qspherical.h | 8 +- src/metrics/spherical.h | 8 +- src/metrics/tests/minkowski.cpp | 3 +- src/metrics/traits.h | 2 +- src/output/CMakeLists.txt | 2 +- src/output/checkpoint.h | 3 +- src/output/tests/writer-mpi.cpp | 2 +- src/output/tests/writer-nompi.cpp | 2 +- src/output/utils/interpret_prompt.h | 4 +- src/output/writer.cpp | 5 +- 126 files changed, 1015 insertions(+), 974 deletions(-) delete mode 100644 src/engines/traits.h diff --git a/minimal/CMakeLists.txt b/minimal/CMakeLists.txt index c77775223..6a43c0dbd 100644 --- a/minimal/CMakeLists.txt +++ b/minimal/CMakeLists.txt @@ -84,7 +84,7 @@ endif() if("ADIOS2_NOMPI" IN_LIST MODES) set(libs "") - if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") + if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") list(APPEND libs stdc++fs) endif() set(exec adios2-nompi.xc) @@ -101,7 +101,7 @@ endif() if("ADIOS2_MPI" IN_LIST MODES) set(libs "") - if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") + if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") list(APPEND libs stdc++fs) endif() set(exec adios2-mpi.xc) diff --git a/pgens/accretion/pgen.hpp b/pgens/accretion/pgen.hpp index d79408588..648590e30 100644 --- a/pgens/accretion/pgen.hpp +++ b/pgens/accretion/pgen.hpp @@ -13,7 +13,6 @@ #include "archetypes/spatial_dist.h" #include "archetypes/traits.h" #include "framework/domain/metadomain.h" - #include "kernels/particle_moments.hpp" namespace user { @@ -43,8 +42,7 @@ 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); @@ -62,8 +60,7 @@ 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); @@ -101,7 +98,7 @@ namespace user { const real_t m_eps; }; - template + template struct PointDistribution : public arch::SpatialDistribution { PointDistribution(const std::vector& xi_min, const std::vector& xi_max, @@ -196,19 +193,19 @@ namespace user { const M metric; }; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { arch::traits::pgen::compatible_with::value + Metric::Kerr_Schild_0> {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class diff --git a/pgens/examples/atmosphere/pgen.hpp b/pgens/examples/atmosphere/pgen.hpp index 65cb7b68e..a5fffc3fd 100644 --- a/pgens/examples/atmosphere/pgen.hpp +++ b/pgens/examples/atmosphere/pgen.hpp @@ -11,17 +11,17 @@ namespace user { using namespace ntt; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; diff --git a/pgens/examples/custom_emission/pgen.hpp b/pgens/examples/custom_emission/pgen.hpp index e1d200bab..3c678400c 100644 --- a/pgens/examples/custom_emission/pgen.hpp +++ b/pgens/examples/custom_emission/pgen.hpp @@ -157,16 +157,16 @@ namespace user { } }; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; diff --git a/pgens/examples/custom_energy_distribution/pgen.hpp b/pgens/examples/custom_energy_distribution/pgen.hpp index e4fc1232b..de1635177 100644 --- a/pgens/examples/custom_energy_distribution/pgen.hpp +++ b/pgens/examples/custom_energy_distribution/pgen.hpp @@ -55,17 +55,17 @@ namespace user { const real_t drift_amplitude; }; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; diff --git a/pgens/examples/custom_particle_update/pgen.hpp b/pgens/examples/custom_particle_update/pgen.hpp index 9d7113d42..4bcbdc43a 100644 --- a/pgens/examples/custom_particle_update/pgen.hpp +++ b/pgens/examples/custom_particle_update/pgen.hpp @@ -33,18 +33,18 @@ namespace user { using namespace ntt; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class @@ -67,11 +67,11 @@ namespace user { inline void InitPrtls(Domain& local_domain) { const auto empty = std::vector {}; const auto x1_e = params.template get>("setup.x1_e", - empty); + empty); const auto x2_e = params.template get>("setup.x2_e", - empty); + empty); const auto x3_e = params.template get>("setup.x3_e", - empty); + empty); const auto phi_e = params.template get>("setup.phi_e", empty); const auto ux1_e = params.template get>("setup.ux1_e", @@ -82,11 +82,11 @@ namespace user { empty); const auto x1_i = params.template get>("setup.x1_i", - empty); + empty); const auto x2_i = params.template get>("setup.x2_i", - empty); + empty); const auto x3_i = params.template get>("setup.x3_i", - empty); + empty); const auto phi_i = params.template get>("setup.phi_i", empty); const auto ux1_i = params.template get>("setup.ux1_i", @@ -109,7 +109,7 @@ namespace user { { "ux2", ux2_i }, { "ux3", ux3_i } }; - if constexpr (M::CoordType == Coord::Cart or D == Dim::_3D) { + if constexpr (M::CoordType == Coord::Cartesian or D == Dim::_3D) { data_e["x3"] = x3_e; data_i["x3"] = x3_i; } else if constexpr (D == Dim::_2D) { @@ -154,7 +154,8 @@ namespace user { const int delta_i1_to_wall = pusher.i1_prev(p); const prtldx_t delta_dx1_to_wall = pusher.dx1_prev(p); const real_t dx_to_wall = i_di_to_Xi(delta_i1_to_wall, delta_dx1_to_wall); - const real_t dt_to_wall = dx_to_wall / + const real_t dt_to_wall = + dx_to_wall / pusher.metric.template transform<1, Idx::XYZ, Idx::U>(x_dummy, beta_x_p); @@ -189,7 +190,8 @@ namespace user { const int delta_i1_to_wall = pusher.ni1 - 1 - pusher.i1_prev(p); const prtldx_t delta_dx1_to_wall = ONE - pusher.dx1_prev(p); const real_t dx_to_wall = i_di_to_Xi(delta_i1_to_wall, delta_dx1_to_wall); - const real_t dt_to_wall = dx_to_wall / + const real_t dt_to_wall = + dx_to_wall / pusher.metric.template transform<1, Idx::XYZ, Idx::U>(x_dummy, beta_x_p); diff --git a/pgens/examples/custom_spatial_distribution/pgen.hpp b/pgens/examples/custom_spatial_distribution/pgen.hpp index 0ba434e54..9ec5a7c84 100644 --- a/pgens/examples/custom_spatial_distribution/pgen.hpp +++ b/pgens/examples/custom_spatial_distribution/pgen.hpp @@ -32,17 +32,17 @@ namespace user { } }; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; diff --git a/pgens/examples/external_fields/pgen.hpp b/pgens/examples/external_fields/pgen.hpp index 9f7eca314..3e8dda38a 100644 --- a/pgens/examples/external_fields/pgen.hpp +++ b/pgens/examples/external_fields/pgen.hpp @@ -52,16 +52,16 @@ namespace user { const spidx_t sp; }; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; @@ -79,10 +79,10 @@ namespace user { * * @note apply_external_fields is true for species other than 1 (i.e., 2 and 3 in this case) */ - inline auto ExternalFields(simtime_t time, - spidx_t sp, - const Domain& domain) const - -> std::pair> { + inline auto ExternalFields( + simtime_t time, + spidx_t sp, + const Domain& domain) const -> std::pair> { // apply only to species 2 and 3 return { sp != 1u, diff --git a/pgens/examples/match_fix_field_boundaries/pgen.hpp b/pgens/examples/match_fix_field_boundaries/pgen.hpp index 473d17bb3..38c07e0c4 100644 --- a/pgens/examples/match_fix_field_boundaries/pgen.hpp +++ b/pgens/examples/match_fix_field_boundaries/pgen.hpp @@ -26,16 +26,16 @@ namespace user { } }; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; diff --git a/pgens/examples/replenish_injector/pgen.hpp b/pgens/examples/replenish_injector/pgen.hpp index 8c196140f..f50f623d3 100644 --- a/pgens/examples/replenish_injector/pgen.hpp +++ b/pgens/examples/replenish_injector/pgen.hpp @@ -39,17 +39,17 @@ namespace user { } }; - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; using arch::ProblemGenerator::D; diff --git a/pgens/examples/tutorial_cartesian_sr/pgen.hpp b/pgens/examples/tutorial_cartesian_sr/pgen.hpp index f312fbd5d..6a3885885 100644 --- a/pgens/examples/tutorial_cartesian_sr/pgen.hpp +++ b/pgens/examples/tutorial_cartesian_sr/pgen.hpp @@ -94,27 +94,27 @@ namespace user { } template <> - Inline auto DipoleField::radius(const coord_t& x) const - -> real_t { + Inline auto DipoleField::radius( + const coord_t& x) const -> real_t { return math::sqrt(SQR(x[0]) + SQR(x[1])); } template <> - Inline auto DipoleField::radius(const coord_t& x) const - -> real_t { + Inline auto DipoleField::radius( + const coord_t& x) const -> real_t { return math::sqrt(SQR(x[0]) + SQR(x[1]) + SQR(x[2])); } - template + template struct PGen : public arch::ProblemGenerator { static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // DipoleField init_flds; diff --git a/pgens/magnetosphere/pgen.hpp b/pgens/magnetosphere/pgen.hpp index 706c35018..fb0b0067e 100644 --- a/pgens/magnetosphere/pgen.hpp +++ b/pgens/magnetosphere/pgen.hpp @@ -84,17 +84,17 @@ namespace user { const real_t time, Omega; }; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class diff --git a/pgens/pgen.hpp b/pgens/pgen.hpp index d2d091ebf..4a6de91a8 100644 --- a/pgens/pgen.hpp +++ b/pgens/pgen.hpp @@ -15,11 +15,11 @@ namespace user { using namespace ntt; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { arch::traits::pgen::compatible_with::value + Metric::Kerr_Schild_0> {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class diff --git a/pgens/piston_shock/pgen.hpp b/pgens/piston_shock/pgen.hpp index 745f751d2..0cc366e92 100644 --- a/pgens/piston_shock/pgen.hpp +++ b/pgens/piston_shock/pgen.hpp @@ -20,18 +20,18 @@ namespace user { using namespace ntt; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class diff --git a/pgens/reconnection/pgen.hpp b/pgens/reconnection/pgen.hpp index 4711aec22..38fab3a3f 100644 --- a/pgens/reconnection/pgen.hpp +++ b/pgens/reconnection/pgen.hpp @@ -19,7 +19,7 @@ namespace user { using namespace ntt; - template + template struct CurrentLayer : public arch::SpatialDistribution { CurrentLayer(const M& metric, real_t cs_width, real_t center_x, real_t cs_y) : arch::SpatialDistribution { metric } @@ -137,17 +137,17 @@ namespace user { }; // constant particle density for particle boundaries - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class diff --git a/pgens/shock/pgen.hpp b/pgens/shock/pgen.hpp index b8289c9a3..ae21d08e0 100644 --- a/pgens/shock/pgen.hpp +++ b/pgens/shock/pgen.hpp @@ -66,17 +66,17 @@ namespace user { const real_t Btheta, Bphi, Vx, Bmag; }; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class @@ -121,8 +121,8 @@ namespace user { return init_flds; } - auto FixFieldsConst(const bc_in&, const em& comp) const - -> std::pair { + auto FixFieldsConst(const bc_in&, + const em& comp) const -> std::pair { if (comp == em::ex1) { return { init_flds.ex1({ ZERO }), true }; } else if (comp == em::ex2) { diff --git a/pgens/streaming/pgen.hpp b/pgens/streaming/pgen.hpp index 9c87d7d97..ae2e7ced3 100644 --- a/pgens/streaming/pgen.hpp +++ b/pgens/streaming/pgen.hpp @@ -50,16 +50,16 @@ namespace user { const real_t Btheta, Bphi, Bmag; }; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines = - arch::traits::pgen::compatible_with::value; + arch::traits::pgen::compatible_with {}; static constexpr auto metrics = - arch::traits::pgen::compatible_with::value; + arch::traits::pgen::compatible_with {}; static constexpr auto dimensions = - arch::traits::pgen::compatible_with::value; + arch::traits::pgen::compatible_with {}; // for easy access to variables in the child class using arch::ProblemGenerator::D; diff --git a/pgens/turbulence/pgen.hpp b/pgens/turbulence/pgen.hpp index 17093d86a..5ae8c032f 100644 --- a/pgens/turbulence/pgen.hpp +++ b/pgens/turbulence/pgen.hpp @@ -289,16 +289,16 @@ namespace user { array_t A0; }; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines = - arch::traits::pgen::compatible_with::value; + arch::traits::pgen::compatible_with {}; static constexpr auto metrics = - arch::traits::pgen::compatible_with::value; + arch::traits::pgen::compatible_with {}; static constexpr auto dimensions = - arch::traits::pgen::compatible_with::value; + arch::traits::pgen::compatible_with {}; // for easy access to variables in the child class using arch::ProblemGenerator::D; diff --git a/pgens/wald/pgen.hpp b/pgens/wald/pgen.hpp index 292f6f7fe..a9fec61e3 100644 --- a/pgens/wald/pgen.hpp +++ b/pgens/wald/pgen.hpp @@ -59,8 +59,7 @@ 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); @@ -78,8 +77,7 @@ 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); @@ -96,8 +94,8 @@ namespace user { } } - Inline auto bx3(const coord_t& x_Ph) const - -> real_t { // at ( i + HALF , j + HALF ) + Inline auto bx3( + const coord_t& x_Ph) const -> real_t { // at ( i + HALF , j + HALF ) if (field_geometry == InitFieldGeometry::Wald) { coord_t xi { ZERO }, x0m { ZERO }, x0p { ZERO }; metric.template convert(x_Ph, xi); @@ -117,8 +115,7 @@ namespace user { } } - Inline auto dx1(const coord_t& x_Ph) const - -> real_t { // at ( i + HALF , j ) + Inline auto dx1(const coord_t& x_Ph) const -> real_t { // at ( i + HALF , j ) if (field_geometry == InitFieldGeometry::Wald) { coord_t xi { ZERO }, x0m { ZERO }, x0p { ZERO }; metric.template convert(x_Ph, xi); @@ -156,8 +153,7 @@ namespace user { } } - Inline auto dx2(const coord_t& x_Ph) const - -> real_t { // at ( i , j + HALF ) + Inline auto dx2(const coord_t& x_Ph) const -> real_t { // at ( i , j + HALF ) if (field_geometry == InitFieldGeometry::Wald) { coord_t xi { ZERO }, x0m { ZERO }, x0p { ZERO }; metric.template convert(x_Ph, xi); @@ -228,19 +224,19 @@ namespace user { InitFieldGeometry field_geometry; }; - template + template struct PGen : public arch::ProblemGenerator { // compatibility traits for the problem generator static constexpr auto engines { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; static constexpr auto metrics { arch::traits::pgen::compatible_with::value + Metric::Kerr_Schild_0> {} }; static constexpr auto dimensions { - arch::traits::pgen::compatible_with::value + arch::traits::pgen::compatible_with {} }; // for easy access to variables in the child class diff --git a/src/archetypes/energy_dist.h b/src/archetypes/energy_dist.h index a493d7d85..329851b61 100644 --- a/src/archetypes/energy_dist.h +++ b/src/archetypes/energy_dist.h @@ -34,7 +34,7 @@ namespace arch { using namespace ntt; - template + template requires metric::traits::HasD struct EnergyDistribution { static constexpr auto D = M::Dim; @@ -45,7 +45,7 @@ namespace arch { const M metric; }; - template + template struct Cold : public EnergyDistribution { Cold(const M& metric) : EnergyDistribution { metric } {} @@ -57,7 +57,7 @@ namespace arch { } }; - template + template struct Powerlaw : public EnergyDistribution { using EnergyDistribution::metric; @@ -161,7 +161,7 @@ namespace arch { pool.free_state(rand_gen); } - template + template Inline void SampleFromMaxwellian(vec_t& v, const random_number_pool_t& pool, real_t temperature, @@ -200,7 +200,7 @@ namespace arch { } } - template + template struct Maxwellian : public EnergyDistribution { using EnergyDistribution::metric; @@ -217,7 +217,7 @@ namespace arch { raise::ErrorIf(temperature < ZERO, "Maxwellian: Temperature must be non-negative", HERE); - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { drift_4vel = NORM(drift_four_vel[0], drift_four_vel[1], drift_four_vel[2]); if (cmp::AlmostZero_host(drift_4vel)) { drift_dir = 0; @@ -244,7 +244,7 @@ namespace arch { "Maxwellian: Incorrect drift direction", HERE); raise::ErrorIf( - drift_dir != 0 and (M::CoordType != Coord::Cart), + drift_dir != 0 and (M::CoordType != Coord::Cartesian), "Maxwellian: Boosting is only supported in Cartesian coordinates", HERE); } @@ -259,7 +259,7 @@ namespace arch { JuttnerSinge(v, temperature, pool); } // @note: boost only when using cartesian coordinates - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { if (drift_dir != 0) { // Boost an isotropic Maxwellian with a drift velocity using // flipping method https://arxiv.org/pdf/1504.03910.pdf diff --git a/src/archetypes/field_setter.h b/src/archetypes/field_setter.h index a9e45d2d6..a5b5c137e 100644 --- a/src/archetypes/field_setter.h +++ b/src/archetypes/field_setter.h @@ -34,7 +34,7 @@ namespace arch { using namespace ntt; - template + template requires metric::traits::HasD && (((S == SimEngine::SRPIC) && metric::traits::HasConvert && metric::traits::HasTransform_i) || diff --git a/src/archetypes/particle_injector.h b/src/archetypes/particle_injector.h index 322eb9516..b53bb8edd 100644 --- a/src/archetypes/particle_injector.h +++ b/src/archetypes/particle_injector.h @@ -53,7 +53,7 @@ namespace arch { * - array_t: minimum coordinates of the region in computational coords * - array_t: maximum coordinates of the region in computational coords */ - template + template requires metric::traits::HasD && metric::traits::HasConvert auto DeduceRegion(const Domain& domain, const boundaries_t& box) -> std::tuple, array_t> { @@ -108,7 +108,7 @@ namespace arch { * - array_t: minimum coordinates of the region in computational coords * - array_t: maximum coordinates of the region in computational coords */ - template + template requires metric::traits::HasD auto ComputeNumInject(const SimulationParams& params, const Domain& domain, @@ -139,7 +139,7 @@ namespace arch { return { true, nparticles, xi_min, xi_max }; } - template + template struct AtmosphereDensityProfile { const real_t nmax, height, xsurf, ds; @@ -159,7 +159,7 @@ namespace arch { if (xi < xsurf - ds or xi >= xsurf) { return ZERO; } else { - if constexpr (C == Coord::Cart) { + if constexpr (C == Coord::Cartesian) { return nmax * math::exp(-(xsurf - xi) / height); } else { raise::KernelError( @@ -173,7 +173,7 @@ namespace arch { if (xi < xsurf or xi >= xsurf + ds) { return ZERO; } else { - if constexpr (C == Coord::Cart) { + if constexpr (C == Coord::Cartesian) { return nmax * math::exp(-(xi - xsurf) / height); } else { return nmax * math::exp(-(xsurf / height) * (ONE - (xsurf / xi))); @@ -200,7 +200,7 @@ namespace arch { * @tparam ED1 Energy distribution type for species 1 * @tparam ED2 Energy distribution type for species 2 */ - template + template requires metric::traits::HasD && traits::energydist::IsValid && traits::energydist::IsValid inline void InjectUniform(const SimulationParams& params, @@ -210,10 +210,10 @@ namespace arch { real_t number_density, bool use_weights = false, const boundaries_t& box = {}) { - raise::ErrorIf((M::CoordType != Coord::Cart) && (not use_weights), + raise::ErrorIf((M::CoordType != Coord::Cartesian) && (not use_weights), "Weights must be used for non-Cartesian coordinates", HERE); - raise::ErrorIf((M::CoordType == Coord::Cart) && use_weights, + raise::ErrorIf((M::CoordType == Coord::Cartesian) && use_weights, "Weights should not be used for Cartesian coordinates", HERE); raise::ErrorIf(params.template get("particles.use_weights") != use_weights, @@ -276,7 +276,7 @@ namespace arch { * @param data Map containing all the coordinates/velocities of particles to inject * @param use_weights Boolean toggle to use weights or not */ - template + template inline void InjectGlobally(const Metadomain& global_domain, Domain& local_domain, spidx_t spidx, @@ -313,7 +313,7 @@ namespace arch { * @tparam ED2 Energy distribution type for species 2 * @tparam SD Spatial distribution type */ - template + template requires metric::traits::HasD && traits::energydist::IsValid && traits::energydist::IsValid && traits::spatialdist::IsValid inline void InjectNonUniform(const SimulationParams& params, @@ -324,10 +324,10 @@ namespace arch { real_t number_density, bool use_weights = false, const boundaries_t& box = {}) { - raise::ErrorIf((M::CoordType != Coord::Cart) && (not use_weights), + raise::ErrorIf((M::CoordType != Coord::Cartesian) && (not use_weights), "Weights must be used for non-Cartesian coordinates", HERE); - raise::ErrorIf((M::CoordType == Coord::Cart) && use_weights, + raise::ErrorIf((M::CoordType == Coord::Cartesian) && use_weights, "Weights should not be used for Cartesian coordinates", HERE); raise::ErrorIf( diff --git a/src/archetypes/piston.h b/src/archetypes/piston.h index 171d1728d..bbec8e31b 100644 --- a/src/archetypes/piston.h +++ b/src/archetypes/piston.h @@ -51,7 +51,7 @@ namespace arch { * global coordinates * @param piston_v Velocity of piston at current timestep */ - template + template Inline void PistonUpdate(const index_t p, const PusherKernel& pusher, const real_t piston_position, @@ -113,8 +113,8 @@ namespace arch { piston_v) * dt_to_piston; - i_w_coll += static_cast(dx_w_coll >= ONE) - - static_cast(dx_w_coll < ZERO); + i_w_coll += static_cast(dx_w_coll >= ONE) - + static_cast(dx_w_coll < ZERO); dx_w_coll -= (dx_w_coll >= ONE); dx_w_coll += (dx_w_coll < ZERO); @@ -125,8 +125,8 @@ namespace arch { remaining_dt_inv_energy + dx_w_coll; - pusher.i1(p) += static_cast(pusher.dx1(p) >= ONE) - - static_cast(pusher.dx1(p) < ZERO); + pusher.i1(p) += static_cast(pusher.dx1(p) >= ONE) - + static_cast(pusher.dx1(p) < ZERO); pusher.dx1(p) -= (pusher.dx1(p) >= ONE); pusher.dx1(p) += (pusher.dx1(p) < ZERO); } @@ -140,7 +140,7 @@ namespace arch { * @param piston_v Velocity of piston at current timestep * @param is_left Is piston on the left side of the box or right side of the box */ - template + template Inline bool CrossesPiston(const index_t p, const PusherKernel& pusher, const real_t piston_position, diff --git a/src/archetypes/problem_generator.h b/src/archetypes/problem_generator.h index fc22428e6..559a9230c 100644 --- a/src/archetypes/problem_generator.h +++ b/src/archetypes/problem_generator.h @@ -30,7 +30,7 @@ namespace arch { using namespace ntt; - template + template requires metric::traits::HasD and metric::traits::HasCoordType struct ProblemGenerator { static constexpr Dimension D { M::Dim }; diff --git a/src/archetypes/spatial_dist.h b/src/archetypes/spatial_dist.h index bf8abe9cd..180d8839b 100644 --- a/src/archetypes/spatial_dist.h +++ b/src/archetypes/spatial_dist.h @@ -28,7 +28,7 @@ namespace arch { using namespace ntt; - template + template requires metric::traits::HasD struct SpatialDistribution { static constexpr auto D = M::Dim; @@ -39,7 +39,7 @@ namespace arch { const M metric; }; - template + template struct Uniform : public SpatialDistribution { Uniform(const M& metric) : SpatialDistribution { metric } {} @@ -48,7 +48,7 @@ namespace arch { } }; - template + template struct Replenish : public SpatialDistribution { using SpatialDistribution::metric; const ndfield_t density; @@ -95,7 +95,7 @@ namespace arch { } }; - template + template struct ReplenishUniform : public SpatialDistribution { using SpatialDistribution::metric; const ndfield_t density; diff --git a/src/archetypes/tests/energy_dist.cpp b/src/archetypes/tests/energy_dist.cpp index 0d3fc8023..f2863a0a6 100644 --- a/src/archetypes/tests/energy_dist.cpp +++ b/src/archetypes/tests/energy_dist.cpp @@ -41,14 +41,14 @@ struct Caller { EnrgDist dist; }; -template +template void testEnergyDist(const std::vector& res, const boundaries_t& ext, const std::map& params = {}) { raise::ErrorIf(res.size() != M::Dim, "res.size() != M::Dim", HERE); boundaries_t extent; - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { extent = ext; } else { if constexpr (M::Dim == Dim::_2D) { diff --git a/src/archetypes/tests/pgen.cpp b/src/archetypes/tests/pgen.cpp index 3eba67611..a5b1156c7 100644 --- a/src/archetypes/tests/pgen.cpp +++ b/src/archetypes/tests/pgen.cpp @@ -44,7 +44,7 @@ struct ExtCurrent { } }; -template +template struct CustomPgen : public arch::ProblemGenerator { CustomPgen(const SimulationParams& params = {}) : arch::ProblemGenerator { params } {} @@ -79,8 +79,9 @@ struct CustomPgen : public arch::ProblemGenerator { return { true, ExtForce {} }; } - auto FixFieldsConst(simtime_t, const bc_in&, ntt::em) const - -> std::pair { + auto FixFieldsConst(simtime_t, + const bc_in&, + ntt::em) const -> std::pair { return { ZERO, false }; } @@ -93,8 +94,10 @@ struct CustomPgen : public arch::ProblemGenerator { simtime_t, const Domain&) {} - auto CustomStat(const std::string&, timestep_t, simtime_t, const Domain&) - -> real_t { + auto CustomStat(const std::string&, + timestep_t, + simtime_t, + const Domain&) -> real_t { return ZERO; } }; @@ -162,16 +165,16 @@ auto main(int argc, char* argv[]) -> int { }; auto [apply_extfields, ext_fields] = custom_pgen.ExternalFields(ZERO, 0, domain); - if constexpr (not ::traits::external::HasFx1) { + if constexpr (not::traits::external::HasFx1) { throw std::runtime_error("CustomPgen's ext_fields should have fx1"); } - if constexpr (not ::traits::external::HasEx1) { + if constexpr (not::traits::external::HasEx1) { throw std::runtime_error("CustomPgen's ext_fields should have ex1"); } if constexpr (::traits::external::HasBx1) { throw std::runtime_error("CustomPgen's ext_fields should not have bx1"); } - if constexpr (not ::traits::external::HasBx3) { + if constexpr (not::traits::external::HasBx3) { throw std::runtime_error("CustomPgen's ext_current should have bx3"); } diff --git a/src/archetypes/tests/powerlaw.cpp b/src/archetypes/tests/powerlaw.cpp index 3cb76763f..79333ceb1 100644 --- a/src/archetypes/tests/powerlaw.cpp +++ b/src/archetypes/tests/powerlaw.cpp @@ -20,7 +20,7 @@ using namespace ntt; using namespace metric; using namespace arch; -template +template struct Caller { static constexpr auto D = M::Dim; @@ -62,14 +62,14 @@ struct Caller { EnrgDist dist; }; -template +template void testEnergyDist(const std::vector& res, const boundaries_t& ext, const std::map& params = {}) { raise::ErrorIf(res.size() != M::Dim, "res.size() != M::Dim", HERE); boundaries_t extent; - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { extent = ext; } else { if constexpr (M::Dim == Dim::_2D) { diff --git a/src/archetypes/tests/spatial_dist.cpp b/src/archetypes/tests/spatial_dist.cpp index 51f1703a9..d69390b7e 100644 --- a/src/archetypes/tests/spatial_dist.cpp +++ b/src/archetypes/tests/spatial_dist.cpp @@ -20,7 +20,7 @@ using namespace arch; template struct Caller { - static_assert(M::CoordType == Coord::Cart, + static_assert(M::CoordType == Coord::Cartesian, "Caller only available in Cartesian coordinates"); static_assert(M::Dim != Dim::_1D, "1D Caller not available"); @@ -66,10 +66,10 @@ struct Caller { const M metric; }; -template +template struct RadialDist : public SpatialDistribution { using SpatialDistribution::metric; - static_assert(M::CoordType == Coord::Cart, + static_assert(M::CoordType == Coord::Cartesian, "RadialDist only available in Cartesian coordinates"); static_assert(M::Dim != Dim::_1D, "1D RadialDist not available"); diff --git a/src/archetypes/traits.h b/src/archetypes/traits.h index 45ba642b6..a6f833f3b 100644 --- a/src/archetypes/traits.h +++ b/src/archetypes/traits.h @@ -56,18 +56,27 @@ namespace arch { namespace pgen { // checking compat for the problem generator + engine - template - struct check_compatibility { - template - static constexpr bool value(std::integer_sequence) { - return ((Is == N) || ...); - } - }; - - template - struct compatible_with { - static constexpr auto value = std::integer_sequence {}; - }; + template + struct compatible_with {}; + + // free function — deduces Is... from the tag, checks if N is among them + template + constexpr bool is_compatible(compatible_with) { + return ((N == Is) || ...); + } + + // template + // struct check_compatibility { + // template + // static constexpr bool value(std::integer_sequence) { + // return ((Is == N) || ...); + // } + // }; + + // template + // struct compatible_with { + // static constexpr auto value = std::integer_sequence {}; + // }; template concept HasD = requires { diff --git a/src/archetypes/utils.h b/src/archetypes/utils.h index 3518ab4c0..9328a3687 100644 --- a/src/archetypes/utils.h +++ b/src/archetypes/utils.h @@ -41,7 +41,7 @@ namespace arch { * @tparam S Simulation engine type * @tparam M Metric type */ - template + template inline void InjectUniformMaxwellians( const SimulationParams& params, Domain& domain, @@ -91,7 +91,7 @@ namespace arch { * @tparam S Simulation engine type * @tparam M Metric type */ - template + template inline void InjectUniformMaxwellian( const SimulationParams& params, Domain& domain, @@ -129,7 +129,7 @@ namespace arch { * @tparam F Field ID for the moment to compute (e.g. FldsID::N, FldsID::T, etc.) * @tparam N Last dimension of the buffer (e.g. 3 or 6) */ - template + template requires metric::traits::HasD inline void ComputeMomentWithSpecies( const SimulationParams& params, @@ -177,7 +177,7 @@ namespace arch { Kokkos::Experimental::contribute(buffer, scatter_buff); } - template + template requires ::metric::traits::HasD inline void UpdateEMFields(const SimulationParams& params, Domain& domain, diff --git a/src/engines/engine.hpp b/src/engines/engine.hpp index 0d0948e79..79b09d8ae 100644 --- a/src/engines/engine.hpp +++ b/src/engines/engine.hpp @@ -24,7 +24,6 @@ #include "archetypes/field_setter.h" #include "archetypes/traits.h" #include "engines/reporter.h" -#include "engines/traits.h" #include "framework/containers/species.h" #include "framework/domain/domain.h" #include "framework/domain/metadomain.h" @@ -57,8 +56,7 @@ namespace ntt { - template - requires traits::engine::IsCompatibleWithEngine + template class Engine { protected: @@ -128,8 +126,7 @@ namespace ntt { } }; - template - requires traits::engine::IsCompatibleWithEngine + template void Engine::init() { m_metadomain.InitStatsWriter(m_params, is_resuming); #if defined(OUTPUT_ENABLED) @@ -177,8 +174,7 @@ namespace ntt { print_report(); } - template - requires traits::engine::IsCompatibleWithEngine + template void Engine::print_report() const { const auto colored_stdout = m_params.template get( "diagnostics.colored_stdout"); @@ -237,8 +233,7 @@ namespace ntt { } } - template - requires traits::engine::IsCompatibleWithEngine + template void Engine::run() { init(); diff --git a/src/engines/grpic.hpp b/src/engines/grpic.hpp index 7952153ba..399988380 100644 --- a/src/engines/grpic.hpp +++ b/src/engines/grpic.hpp @@ -66,7 +66,6 @@ namespace ntt { }; template - requires traits::engine::IsCompatibleWithGRPICEngine class GRPICEngine : public Engine { using base_t = Engine; using pgen_t = user::PGen; @@ -680,7 +679,7 @@ namespace ntt { /** * open boundaries */ - raise::ErrorIf(M::CoordType == Coord::Cart, + raise::ErrorIf(M::CoordType == Coord::Cartesian, "Invalid coordinate type for horizon BCs", HERE); raise::ErrorIf(direction.get_dim() != in::x1, @@ -715,7 +714,7 @@ namespace ntt { /** * axis boundaries */ - raise::ErrorIf(M::CoordType == Coord::Cart, + raise::ErrorIf(M::CoordType == Coord::Cartesian, "Invalid coordinate type for axis BCs", HERE); raise::ErrorIf(direction.get_dim() != in::x2, diff --git a/src/engines/reporter.h b/src/engines/reporter.h index 9cbcf3a3d..cb17e3f42 100644 --- a/src/engines/reporter.h +++ b/src/engines/reporter.h @@ -23,8 +23,8 @@ namespace ntt { unsigned int) -> std::string; template - inline auto ReportPgenConfig(const PG& pgen, const std::string& pgen_name) - -> std::string { + inline auto ReportPgenConfig(const PG& pgen, + const std::string& pgen_name) -> std::string { std::string report = ""; report += "\n"; reporter::AddCategory(report, 4, "Problem generator"); diff --git a/src/engines/srpic/fields_bcs.h b/src/engines/srpic/fields_bcs.h index a02909cdf..ed1e3cba8 100644 --- a/src/engines/srpic/fields_bcs.h +++ b/src/engines/srpic/fields_bcs.h @@ -193,7 +193,7 @@ namespace ntt { /** * axis boundaries */ - if constexpr (M::CoordType != Coord::Cart) { + if constexpr (M::CoordType != Coord::Cartesian) { raise::ErrorIf(direction.get_dim() != in::x2, "Invalid axis direction, should be x2", HERE); @@ -237,7 +237,7 @@ namespace ntt { */ const auto sign = direction.get_sign(); const auto dim = direction.get_dim(); - raise::ErrorIf(dim != in::x1 and M::CoordType != Coord::Cart, + raise::ErrorIf(dim != in::x1 and M::CoordType != Coord::Cartesian, "Fixed BCs only implemented for x1 in " "non-cartesian coordinates", HERE); @@ -273,7 +273,7 @@ namespace ntt { comps.push_back(em::bx2); comps.push_back(em::bx3); } - raise::ErrorIf(M::CoordType != Coord::Cart and dim != in::x1, + raise::ErrorIf(M::CoordType != Coord::Cartesian and dim != in::x1, "FixedFields cannot be used for non-cartesian metric", HERE); for (const auto& comp : comps) { @@ -344,7 +344,7 @@ namespace ntt { /** * perfect conductor field boundaries */ - if constexpr (M::CoordType != Coord::Cart) { + if constexpr (M::CoordType != Coord::Cartesian) { (void)direction; (void)domain; (void)tags; diff --git a/src/engines/srpic/fieldsolvers.h b/src/engines/srpic/fieldsolvers.h index bc68cee3a..2b28358a0 100644 --- a/src/engines/srpic/fieldsolvers.h +++ b/src/engines/srpic/fieldsolvers.h @@ -32,7 +32,7 @@ namespace ntt { params.template get( "algorithms.timestep.correction") * dt; - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { // minkowski case const auto dx = math::sqrt(domain.mesh.metric.template h_<1, 1>({})); const auto deltax = params.template get( @@ -98,7 +98,7 @@ namespace ntt { "algorithms.timestep.correction") * dt; auto range = RangeWithAxisBCs(domain); - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { // minkowski case const auto dx = math::sqrt(domain.mesh.metric.template h_<1, 1>({})); real_t coeff1, coeff2; @@ -137,7 +137,7 @@ namespace ntt { const auto q0 = params.template get("scales.q0"); const auto n0 = params.template get("scales.n0"); const auto B0 = params.template get("scales.B0"); - if constexpr (M::CoordType == Coord::Cart) { + if constexpr (M::CoordType == Coord::Cartesian) { // minkowski case const auto V0 = params.template get("scales.V0"); const auto ppc0 = params.template get("particles.ppc0"); diff --git a/src/engines/srpic/particles_bcs.h b/src/engines/srpic/particles_bcs.h index 5d444385f..360dfe5d1 100644 --- a/src/engines/srpic/particles_bcs.h +++ b/src/engines/srpic/particles_bcs.h @@ -49,7 +49,7 @@ namespace ntt { Kokkos::deep_copy(domain.fields.bckp, ZERO); auto scatter_bckp = Kokkos::Experimental::create_scatter_view( domain.fields.bckp); - const auto use_weights = M::CoordType != Coord::Cart; + const auto use_weights = M::CoordType != Coord::Cartesian; const auto ni2 = domain.mesh.n_active(in::x2); const auto inv_n0 = ONE / params.template get("scales.n0"); diff --git a/src/engines/srpic/srpic.hpp b/src/engines/srpic/srpic.hpp index 246f7f056..c73f7bba4 100644 --- a/src/engines/srpic/srpic.hpp +++ b/src/engines/srpic/srpic.hpp @@ -24,7 +24,6 @@ #include "engines/srpic/fieldsolvers.h" #include "engines/srpic/particle_pusher.h" #include "engines/srpic/particles_bcs.h" -#include "engines/traits.h" #include "framework/domain/domain.h" #include "framework/parameters/parameters.h" @@ -38,7 +37,6 @@ namespace ntt { template - requires traits::engine::IsCompatibleWithSRPICEngine class SRPICEngine : public Engine { using base_t = Engine; diff --git a/src/engines/srpic/utils.h b/src/engines/srpic/utils.h index 9779e55e4..be0ff25f1 100644 --- a/src/engines/srpic/utils.h +++ b/src/engines/srpic/utils.h @@ -38,18 +38,18 @@ namespace ntt { */ template requires metric::traits::HasD && metric::traits::HasConvert - auto GetAtmosphereExtent(dir::direction_t direction, - const M& global_metric, - const Grid& global_grid, - const SimulationParams& params) - -> std::tuple { + auto GetAtmosphereExtent( + dir::direction_t direction, + const M& global_metric, + const Grid& global_grid, + const SimulationParams& params) -> std::tuple { const auto sign = direction.get_sign(); const auto dim = direction.get_dim(); const auto min_buff = params.template get( "algorithms.current_filters") + 2; const auto buffer_ncells = min_buff > 5 ? min_buff : 5; - if (M::CoordType != Coord::Cart and (dim != in::x1 or sign > 0)) { + if (M::CoordType != Coord::Cartesian and (dim != in::x1 or sign > 0)) { raise::Error("For non-cartesian coordinates atmosphere BCs is " "possible only in -x1 (@ rmin)", HERE); @@ -94,10 +94,10 @@ namespace ntt { } template - auto RangeWithAxisBCs(const Domain& domain) - -> range_t { + auto RangeWithAxisBCs( + const Domain& domain) -> range_t { auto range = domain.mesh.rangeActiveCells(); - if constexpr (M::CoordType != Coord::Cart) { + if constexpr (M::CoordType != Coord::Cartesian) { /** * @brief taking one extra cell in the x2 direction if AXIS BCs */ diff --git a/src/engines/traits.h b/src/engines/traits.h deleted file mode 100644 index 4050049b5..000000000 --- a/src/engines/traits.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file engine/traits.h - * @brief Defines a set of traits to check if an engine class satisfies certain - * conditions - * @implements - * - ntt::traits::engine::HasRun<> - checks if an engine has a run() method - * - ntt::traits::engine::IsCompatibleWithEngine<> - checks if a metric and - * pgen are compatible with a given simulation engine - * - ntt::traits::engine::IsCompatibleWithSRPICEngine<> - checks if a metric - * and pgen are compatible with the SRPIC engine - * - ntt::traits::engine::IsCompatibleWithGRPICEngine<> - checks if a metric - * and pgen are compatible with the GRPIC engine - * @namespaces: - * - ntt::traits::engine:: - */ -#ifndef ENGINES_TRAITS_H -#define ENGINES_TRAITS_H - -#include "metrics/traits.h" - -#include "archetypes/traits.h" - -#include - -namespace ntt { - namespace traits { - namespace engine { - - template class PG> - concept IsCompatibleWithEngine = - metric::traits::HasD and - arch::traits::pgen::check_compatibility::value(PG::engines) and - arch::traits::pgen::check_compatibility::value( - PG::metrics) and - arch::traits::pgen::check_compatibility::value(PG::dimensions); - - template class PG> - concept IsCompatibleWithSRPICEngine = - IsCompatibleWithEngine && - metric::traits::HasH_ij && metric::traits::HasConvert_i && - metric::traits::HasSqrtH_ij; - - template class PG> - concept IsCompatibleWithGRPICEngine = - IsCompatibleWithEngine; - - template - concept HasRun = requires(E& engine) { - { engine.run() } -> std::same_as; - }; - - } // namespace engine - } // namespace traits -} // namespace ntt - -#endif // ENGINES_TRAITS_H diff --git a/src/entity.cpp b/src/entity.cpp index 9afb37cb2..0fb67b681 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -14,7 +14,7 @@ #include namespace ntt { - template + template struct EngineSelector; template <> @@ -30,24 +30,22 @@ namespace ntt { }; } // namespace ntt -template class M, Dimension D> +template class M, Dimension D> static constexpr bool should_compile { - arch::traits::pgen::check_compatibility::value(user::PGen>::engines) && - arch::traits::pgen::check_compatibility::MetricType>::value( - user::PGen>::metrics) && - arch::traits::pgen::check_compatibility::value(user::PGen>::dimensions) + arch::traits::pgen::is_compatible(user::PGen>::engines) and + arch::traits::pgen::is_compatible::MetricType>(user::PGen>::metrics) and + arch::traits::pgen::is_compatible(user::PGen>::dimensions) }; -template class M, Dimension D> +template class M, Dimension D> void dispatch_engine(ntt::Simulation& sim) { if constexpr (S == SimEngine::SRPIC) { sim.run::template type, M, D>(); } else if constexpr (S == SimEngine::GRPIC) { sim.run::template type, M, D>(); } else { - static_assert( - ::traits::always_false>::value, - "Unsupported engine"); + static_assert(::traits::always_false>::value, + "Unsupported engine"); } } diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index df2bf4c69..371b4be02 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -74,7 +74,7 @@ add_library(ntt_framework ${SOURCES}) set(libs ntt_global ntt_metrics ntt_kernels ntt_output) add_dependencies(ntt_framework ${libs}) target_link_libraries(ntt_framework PUBLIC ${libs}) -if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") +if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") target_link_libraries(ntt_framework PRIVATE stdc++fs) endif() diff --git a/src/framework/containers/fields.cpp b/src/framework/containers/fields.cpp index 7202ff282..aca2f4a1f 100644 --- a/src/framework/containers/fields.cpp +++ b/src/framework/containers/fields.cpp @@ -7,7 +7,7 @@ namespace ntt { - template + template Fields::Fields(const std::vector& res) { ncells_t nx1, nx2, nx3; nx1 = res[0] + 2 * N_GHOSTS; @@ -46,10 +46,10 @@ namespace ntt { } } - template struct Fields; - template struct Fields; - template struct Fields; - template struct Fields; - template struct Fields; + template struct Fields; + template struct Fields; + template struct Fields; + template struct Fields; + template struct Fields; } // namespace ntt diff --git a/src/framework/containers/fields.h b/src/framework/containers/fields.h index 4acabf7b4..48120879d 100644 --- a/src/framework/containers/fields.h +++ b/src/framework/containers/fields.h @@ -34,7 +34,7 @@ namespace ntt { * @tparam D Dimension * @tparam S Simulation engine */ - template + template struct Fields { /* SRPIC & GRPIC -------------------------------------------------------- */ /** diff --git a/src/framework/containers/fields_io.cpp b/src/framework/containers/fields_io.cpp index 8c7029a7e..8e1a2c5ff 100644 --- a/src/framework/containers/fields_io.cpp +++ b/src/framework/containers/fields_io.cpp @@ -17,7 +17,7 @@ namespace ntt { - template + template void Fields::CheckpointDeclare( adios2::IO& io, const std::vector& local_shape, @@ -45,7 +45,7 @@ namespace ntt { } } - template + template void Fields::CheckpointRead(adios2::IO& io, adios2::Engine& reader, const adios2::Box& range) { @@ -64,7 +64,7 @@ namespace ntt { } } - template + template void Fields::CheckpointWrite(adios2::IO& io, adios2::Engine& writer) const { logger::Checkpoint("Writing fields checkpoint", HERE); diff --git a/src/framework/containers/particles.cpp b/src/framework/containers/particles.cpp index 7682718a3..ae61eb0bc 100644 --- a/src/framework/containers/particles.cpp +++ b/src/framework/containers/particles.cpp @@ -15,7 +15,7 @@ namespace ntt { - template + template Particles::Particles(spidx_t index, const std::string& label, float m, @@ -79,12 +79,12 @@ namespace ntt { pld_i = array_t { label + "_pld_i", maxnpart, npld_i }; } - if ((D == Dim::_2D) && (C != Coord::Cart)) { + if ((D == Dim::_2D) && (C != Coord::Cartesian)) { phi = array_t { label + "_phi", maxnpart }; } } - template + template auto Particles::PusherKernelArrays() -> kernel::sr::PusherArrays { kernel::sr::PusherArrays pusher_arrays {}; pusher_arrays.sp = index(); @@ -109,12 +109,12 @@ namespace ntt { return pusher_arrays; } - template struct Particles; - template struct Particles; - template struct Particles; - template struct Particles; - template struct Particles; - template struct Particles; - template struct Particles; + template struct Particles; + template struct Particles; + template struct Particles; + template struct Particles; + template struct Particles; + template struct Particles; + template struct Particles; } // namespace ntt diff --git a/src/framework/containers/particles.h b/src/framework/containers/particles.h index c3ee1c1b5..9dcdd1ac7 100644 --- a/src/framework/containers/particles.h +++ b/src/framework/containers/particles.h @@ -43,7 +43,7 @@ namespace ntt { * @tparam D The dimension of the simulation * @tparam S The simulation engine being used */ - template + template struct Particles : public ParticleSpecies { private: // Number of currently active (used) particles @@ -298,7 +298,7 @@ namespace ntt { #if defined(OUTPUT_ENABLED) void OutputDeclare(adios2::IO&) const; - template + template void OutputWrite(adios2::IO&, adios2::Engine&, npart_t, diff --git a/src/framework/containers/particles_comm.cpp b/src/framework/containers/particles_comm.cpp index 1cf17efef..652561ae7 100644 --- a/src/framework/containers/particles_comm.cpp +++ b/src/framework/containers/particles_comm.cpp @@ -161,7 +161,7 @@ namespace ntt { } } // namespace prtls - template + template void Particles::Communicate(const dir::dirs_t& dirs_to_comm, const array_t& shifts_in_x1, const array_t& shifts_in_x2, @@ -224,7 +224,7 @@ namespace ntt { // number of arrays of each type to send/recv const unsigned short NREALS = 4 + static_cast( - D == Dim::_2D and C != Coord::Cart); + D == Dim::_2D and C != Coord::Cartesian); const unsigned short NINTS = 2 * static_cast(D); const unsigned short NPRTLDX = 2 * static_cast(D); const unsigned short NPLDS_R = npld_r(); @@ -381,13 +381,13 @@ namespace ntt { const dir::map_t&, \ const dir::map_t&); - PARTICLES_COMM(Dim::_1D, Coord::Cart) - PARTICLES_COMM(Dim::_2D, Coord::Cart) - PARTICLES_COMM(Dim::_3D, Coord::Cart) - PARTICLES_COMM(Dim::_2D, Coord::Sph) - PARTICLES_COMM(Dim::_2D, Coord::Qsph) - PARTICLES_COMM(Dim::_3D, Coord::Sph) - PARTICLES_COMM(Dim::_3D, Coord::Qsph) + PARTICLES_COMM(Dim::_1D, Coord::Cartesian) + PARTICLES_COMM(Dim::_2D, Coord::Cartesian) + PARTICLES_COMM(Dim::_3D, Coord::Cartesian) + PARTICLES_COMM(Dim::_2D, Coord::Spherical) + PARTICLES_COMM(Dim::_2D, Coord::Qspherical) + PARTICLES_COMM(Dim::_3D, Coord::Spherical) + PARTICLES_COMM(Dim::_3D, Coord::Qspherical) #undef PARTICLES_COMM } // namespace ntt diff --git a/src/framework/containers/particles_io.cpp b/src/framework/containers/particles_io.cpp index fb72ccc5f..72bd7cc2f 100644 --- a/src/framework/containers/particles_io.cpp +++ b/src/framework/containers/particles_io.cpp @@ -22,10 +22,11 @@ namespace ntt { /* * * * * * * * * * Output * * * * * * * * */ - template + template void Particles::OutputDeclare(adios2::IO& io) const { - const auto n_addition_coords = ((D == Dim::_2D) and (C != Coord::Cart)) ? 1 - : 0; + const auto n_addition_coords = ((D == Dim::_2D) and (C != Coord::Cartesian)) + ? 1 + : 0; for (auto d { 0u }; d < D + n_addition_coords; ++d) { io.DefineVariable(fmt::format("pX%d_%d", d + 1, index()), { adios2::UnknownDim }, @@ -77,8 +78,8 @@ namespace ntt { } } - template - template + template + template void Particles::OutputWrite(adios2::IO& io, adios2::Engine& writer, npart_t prtl_stride, @@ -154,7 +155,7 @@ namespace ntt { if constexpr (D == Dim::_2D or D == Dim::_3D) { buff_x2 = array_t { "x2", nout }; } - if constexpr (D == Dim::_3D or ((D == Dim::_2D) and (C != Coord::Cart))) { + if constexpr (D == Dim::_3D or ((D == Dim::_2D) and (C != Coord::Cartesian))) { buff_x3 = array_t { "x3", nout }; } array_t buff_pldr; @@ -250,7 +251,7 @@ namespace ntt { nout_total, nout_offset); } - if constexpr (D == Dim::_3D or ((D == Dim::_2D) and (C != Coord::Cart))) { + if constexpr (D == Dim::_3D or ((D == Dim::_2D) and (C != Coord::Cartesian))) { out::Write1DArray(io, writer, fmt::format("pX3_%d", index()), @@ -341,7 +342,7 @@ namespace ntt { * Checkpoints * * * * * * * * */ - template + template void Particles::CheckpointDeclare(adios2::IO& io) const { logger::Checkpoint( fmt::format("Declaring particle checkpoint for species #%d", index()), @@ -374,7 +375,7 @@ namespace ntt { { adios2::UnknownDim }); } - if constexpr (D == Dim::_2D and C != ntt::Coord::Cart) { + if constexpr (D == Dim::_2D and C != ntt::Coord::Cartesian) { io.DefineVariable(fmt::format("s%d_phi", index()), { adios2::UnknownDim }, { adios2::UnknownDim }, @@ -410,7 +411,7 @@ namespace ntt { } } - template + template void Particles::CheckpointRead(adios2::IO& io, adios2::Engine& reader, std::size_t domains_total, @@ -536,7 +537,7 @@ namespace ntt { npart_offset); } - if constexpr (D == Dim::_2D and C != Coord::Cart) { + if constexpr (D == Dim::_2D and C != Coord::Cartesian) { out::Read1DArray(io, reader, fmt::format("s%d_phi", index()), @@ -597,7 +598,7 @@ namespace ntt { } } - template + template void Particles::CheckpointWrite(adios2::IO& io, adios2::Engine& writer, std::size_t domains_total, @@ -735,7 +736,7 @@ namespace ntt { npart_offset); } - if constexpr (D == Dim::_2D and C != Coord::Cart) { + if constexpr (D == Dim::_2D and C != Coord::Cartesian) { out::Write1DArray(io, writer, fmt::format("s%d_phi", index()), @@ -806,13 +807,13 @@ namespace ntt { #define PARTICLES_OUTPUT_DECLARE(D, C) \ template void Particles::OutputDeclare(adios2::IO&) const; - PARTICLES_OUTPUT_DECLARE(Dim::_1D, Coord::Cart) - PARTICLES_OUTPUT_DECLARE(Dim::_2D, Coord::Cart) - PARTICLES_OUTPUT_DECLARE(Dim::_3D, Coord::Cart) - PARTICLES_OUTPUT_DECLARE(Dim::_2D, Coord::Sph) - PARTICLES_OUTPUT_DECLARE(Dim::_2D, Coord::Qsph) - PARTICLES_OUTPUT_DECLARE(Dim::_3D, Coord::Sph) - PARTICLES_OUTPUT_DECLARE(Dim::_3D, Coord::Qsph) + PARTICLES_OUTPUT_DECLARE(Dim::_1D, Coord::Cartesian) + PARTICLES_OUTPUT_DECLARE(Dim::_2D, Coord::Cartesian) + PARTICLES_OUTPUT_DECLARE(Dim::_3D, Coord::Cartesian) + PARTICLES_OUTPUT_DECLARE(Dim::_2D, Coord::Spherical) + PARTICLES_OUTPUT_DECLARE(Dim::_2D, Coord::Qspherical) + PARTICLES_OUTPUT_DECLARE(Dim::_3D, Coord::Spherical) + PARTICLES_OUTPUT_DECLARE(Dim::_3D, Coord::Qspherical) #undef PARTICLES_OUTPUT_DECLARE #define PARTICLES_OUTPUT_WRITE(S, M, D) \ @@ -838,13 +839,13 @@ namespace ntt { std::size_t, \ std::size_t) const; - PARTICLES_CHECKPOINTS(Dim::_1D, Coord::Cart) - PARTICLES_CHECKPOINTS(Dim::_2D, Coord::Cart) - PARTICLES_CHECKPOINTS(Dim::_3D, Coord::Cart) - PARTICLES_CHECKPOINTS(Dim::_2D, Coord::Sph) - PARTICLES_CHECKPOINTS(Dim::_2D, Coord::Qsph) - PARTICLES_CHECKPOINTS(Dim::_3D, Coord::Sph) - PARTICLES_CHECKPOINTS(Dim::_3D, Coord::Qsph) + PARTICLES_CHECKPOINTS(Dim::_1D, Coord::Cartesian) + PARTICLES_CHECKPOINTS(Dim::_2D, Coord::Cartesian) + PARTICLES_CHECKPOINTS(Dim::_3D, Coord::Cartesian) + PARTICLES_CHECKPOINTS(Dim::_2D, Coord::Spherical) + PARTICLES_CHECKPOINTS(Dim::_2D, Coord::Qspherical) + PARTICLES_CHECKPOINTS(Dim::_3D, Coord::Spherical) + PARTICLES_CHECKPOINTS(Dim::_3D, Coord::Qspherical) #undef PARTICLES_CHECKPOINTS } // namespace ntt diff --git a/src/framework/containers/particles_sort.cpp b/src/framework/containers/particles_sort.cpp index 2fd0e6011..932a8223a 100644 --- a/src/framework/containers/particles_sort.cpp +++ b/src/framework/containers/particles_sort.cpp @@ -16,7 +16,7 @@ namespace ntt { - template + template auto Particles::NpartsPerTagAndOffsets() const -> std::pair, array_t> { auto this_tag = tag; @@ -88,7 +88,7 @@ namespace ntt { buffer); } - template + template void Particles::RemoveDead() { npart_t n_alive = 0, n_dead = 0; auto& this_tag = tag; @@ -153,7 +153,7 @@ namespace ntt { RemoveDeadInArray(ux3, indices_alive); RemoveDeadInArray(weight, indices_alive); - if constexpr (D == Dim::_2D && C != Coord::Cart) { + if constexpr (D == Dim::_2D && C != Coord::Cartesian) { RemoveDeadInArray(phi, indices_alive); } @@ -181,7 +181,7 @@ namespace ntt { m_is_sorted = true; } - template + template void Particles::SortSpatially(const Grid& grid) { const auto nx2 = grid.n_active(in::x2); const auto nx3 = grid.n_active(in::x3); @@ -225,7 +225,7 @@ namespace ntt { sorter.sort(Kokkos::subview(ux3, slice)); sorter.sort(Kokkos::subview(weight, slice)); sorter.sort(Kokkos::subview(tag, slice)); - if constexpr (D == Dim::_2D and C != Coord::Cart) { + if constexpr (D == Dim::_2D and C != Coord::Cartesian) { sorter.sort(Kokkos::subview(phi, slice)); } for (auto pldr { 0u }; pldr < npld_r(); ++pldr) { @@ -237,18 +237,18 @@ namespace ntt { } #define PARTICLES_SORT(D, C) \ - template auto Particles::NpartsPerTagAndOffsets() const \ - -> std::pair, array_t>; \ + template auto Particles::NpartsPerTagAndOffsets() \ + const -> std::pair, array_t>; \ template void Particles::RemoveDead(); \ template void Particles::SortSpatially(const Grid&); - PARTICLES_SORT(Dim::_1D, Coord::Cart) - PARTICLES_SORT(Dim::_2D, Coord::Cart) - PARTICLES_SORT(Dim::_3D, Coord::Cart) - PARTICLES_SORT(Dim::_2D, Coord::Sph) - PARTICLES_SORT(Dim::_2D, Coord::Qsph) - PARTICLES_SORT(Dim::_3D, Coord::Sph) - PARTICLES_SORT(Dim::_3D, Coord::Qsph) + PARTICLES_SORT(Dim::_1D, Coord::Cartesian) + PARTICLES_SORT(Dim::_2D, Coord::Cartesian) + PARTICLES_SORT(Dim::_3D, Coord::Cartesian) + PARTICLES_SORT(Dim::_2D, Coord::Spherical) + PARTICLES_SORT(Dim::_2D, Coord::Qspherical) + PARTICLES_SORT(Dim::_3D, Coord::Spherical) + PARTICLES_SORT(Dim::_3D, Coord::Qspherical) #undef PARTICLES_SORT } // namespace ntt diff --git a/src/framework/domain/domain.h b/src/framework/domain/domain.h index 06ffd302d..ba2beca08 100644 --- a/src/framework/domain/domain.h +++ b/src/framework/domain/domain.h @@ -62,7 +62,7 @@ namespace ntt { - template + template requires metric::traits::HasD struct Domain { static constexpr Dimension D { M::Dim }; @@ -158,8 +158,7 @@ namespace ntt { } /* setters -------------------------------------------------------------- */ - auto set_neighbor_idx(const dir::direction_t& dir, unsigned int idx) - -> void { + auto set_neighbor_idx(const dir::direction_t& dir, unsigned int idx) -> void { m_neighbor_idx[dir] = idx; } @@ -240,9 +239,9 @@ namespace ntt { std::optional m_random_number_pool; }; - template - inline auto operator<<(std::ostream& os, const Domain& domain) - -> std::ostream& { + template + inline auto operator<<(std::ostream& os, + const Domain& domain) -> std::ostream& { os << "Domain #" << domain.index(); #if defined(MPI_ENABLED) os << " [MPI rank: " << domain.mpi_rank() << "]"; diff --git a/src/framework/domain/grid.cpp b/src/framework/domain/grid.cpp index 1e223cbc5..f1574833e 100644 --- a/src/framework/domain/grid.cpp +++ b/src/framework/domain/grid.cpp @@ -85,8 +85,8 @@ namespace ntt { } template - auto Grid::rangeCellsOnHost(const box_region_t& region) const - -> range_h_t { + auto Grid::rangeCellsOnHost( + const box_region_t& region) const -> range_h_t { tuple_t imin, imax; for (auto i { 0u }; i < D; i++) { switch (region[i]) { @@ -162,8 +162,8 @@ namespace ntt { } template - auto Grid::rangeCells(const tuple_t, D>& ranges) const - -> range_t { + auto Grid::rangeCells( + const tuple_t, D>& ranges) const -> range_t { tuple_t imin, imax; for (auto i { 0u }; i < D; i++) { raise::ErrorIf((ranges[i][0] < -(int)N_GHOSTS) || diff --git a/src/framework/domain/mesh.h b/src/framework/domain/mesh.h index adff231f4..ff678c3b4 100644 --- a/src/framework/domain/mesh.h +++ b/src/framework/domain/mesh.h @@ -123,8 +123,9 @@ namespace ntt { * @note indices are already shifted by N_GHOSTS (i.e. they start at N_GHOSTS not 0) */ [[nodiscard]] - auto ExtentToRange(boundaries_t box, boundaries_t incl_ghosts) const - -> boundaries_t { + auto ExtentToRange( + boundaries_t box, + boundaries_t incl_ghosts) const -> boundaries_t { raise::ErrorIf(box.size() != M::Dim, "Invalid box dimension", HERE); raise::ErrorIf(incl_ghosts.size() != M::Dim, "Invalid incl_ghosts dimension", diff --git a/src/framework/domain/metadomain.cpp b/src/framework/domain/metadomain.cpp index e31015c24..6a9028667 100644 --- a/src/framework/domain/metadomain.cpp +++ b/src/framework/domain/metadomain.cpp @@ -25,7 +25,7 @@ namespace ntt { - template + template requires IsCompatibleWithMetadomain Metadomain::Metadomain(unsigned int global_ndomains, const std::vector& global_decomposition, @@ -57,7 +57,7 @@ namespace ntt { metricCompatibilityCheck(); } - template + template requires IsCompatibleWithMetadomain void Metadomain::initialValidityCheck() const { // ensure everything has the correct shape @@ -95,7 +95,7 @@ namespace ntt { #endif // MPI_ENABLED } - template + template requires IsCompatibleWithMetadomain void Metadomain::createEmptyDomains() { /* decompose and compute cell & domain offsets ------------------------ */ @@ -191,7 +191,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain void Metadomain::redefineNeighbors() { for (unsigned int idx { 0 }; idx < g_ndomains; ++idx) { @@ -232,7 +232,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain void Metadomain::redefineBoundaries() { for (unsigned int idx { 0 }; idx < g_ndomains; ++idx) { @@ -322,7 +322,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain void Metadomain::finalValidityCheck() const { for (unsigned int idx { 0 }; idx < g_ndomains; ++idx) { @@ -368,7 +368,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain void Metadomain::metricCompatibilityCheck() const { const auto epsilon = std::numeric_limits::epsilon() * @@ -403,7 +403,7 @@ namespace ntt { #endif } - template + template requires IsCompatibleWithMetadomain void Metadomain::setFldsBC(const bc_in& dir, const FldsBC& new_bcs) { if (dir == bc_in::Mx1) { @@ -472,7 +472,7 @@ namespace ntt { redefineBoundaries(); } - template + template requires IsCompatibleWithMetadomain void Metadomain::setPrtlBC(const bc_in& dir, const PrtlBC& new_bcs) { if (dir == bc_in::Mx1) { diff --git a/src/framework/domain/metadomain.h b/src/framework/domain/metadomain.h index d04433fcf..86c4f7c9e 100644 --- a/src/framework/domain/metadomain.h +++ b/src/framework/domain/metadomain.h @@ -57,7 +57,7 @@ namespace ntt { metric::traits::HasConvert && metric::traits::HasTotVolume; - template + template requires IsCompatibleWithMetadomain struct Metadomain { static constexpr Dimension D { M::Dim }; diff --git a/src/framework/domain/metadomain_chckpt.cpp b/src/framework/domain/metadomain_chckpt.cpp index bd6b87cfd..e9d17ca1b 100644 --- a/src/framework/domain/metadomain_chckpt.cpp +++ b/src/framework/domain/metadomain_chckpt.cpp @@ -12,7 +12,7 @@ namespace ntt { - template + template requires IsCompatibleWithMetadomain void Metadomain::InitCheckpointWriter(adios2::ADIOS* ptr_adios, const SimulationParams& params) { @@ -63,7 +63,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain auto Metadomain::WriteCheckpoint(const SimulationParams& params, timestep_t current_step, @@ -110,7 +110,7 @@ namespace ntt { return true; } - template + template requires IsCompatibleWithMetadomain void Metadomain::ContinueFromCheckpoint(adios2::ADIOS* ptr_adios, const SimulationParams& params) { diff --git a/src/framework/domain/metadomain_comm.cpp b/src/framework/domain/metadomain_comm.cpp index 45bf61013..6c5cb0c5c 100644 --- a/src/framework/domain/metadomain_comm.cpp +++ b/src/framework/domain/metadomain_comm.cpp @@ -27,11 +27,11 @@ namespace ntt { using address_t = std::pair; using comm_params_t = std::pair>; - template - auto GetSendRecvRanks(const Metadomain* const metadomain, - Domain& domain, - dir::direction_t direction) - -> std::pair { + template + auto GetSendRecvRanks( + const Metadomain* const metadomain, + Domain& domain, + dir::direction_t direction) -> std::pair { const Domain* send_to_nghbr_ptr = nullptr; const Domain* recv_from_nghbr_ptr = nullptr; // set pointers to the correct send/recv domains @@ -110,12 +110,12 @@ namespace ntt { }; } - template - auto GetSendRecvParams(const Metadomain* const metadomain, - Domain& domain, - dir::direction_t direction, - bool synchronize) - -> std::pair { + template + auto GetSendRecvParams( + const Metadomain* const metadomain, + Domain& domain, + dir::direction_t direction, + bool synchronize) -> std::pair { const auto [send_indrank, recv_indrank] = GetSendRecvRanks(metadomain, domain, direction); const auto [send_ind, send_rank] = send_indrank; @@ -196,7 +196,7 @@ namespace ntt { }; } - template + template requires IsCompatibleWithMetadomain void Metadomain::CommunicateFields(Domain& domain, CommTags tags) const { @@ -414,7 +414,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain void Metadomain::SynchronizeFields(Domain& domain, CommTags tags, @@ -571,7 +571,7 @@ namespace ntt { } } - template + template requires IsCompatibleWithMetadomain void Metadomain::CommunicateParticles(Domain& domain) const { #if defined(MPI_ENABLED) diff --git a/src/framework/domain/metadomain_io.cpp b/src/framework/domain/metadomain_io.cpp index b9f351a0f..4fee7c10f 100644 --- a/src/framework/domain/metadomain_io.cpp +++ b/src/framework/domain/metadomain_io.cpp @@ -29,7 +29,7 @@ namespace ntt { - template + template requires IsCompatibleWithMetadomain void Metadomain::InitWriter(adios2::ADIOS* ptr_adios, const SimulationParams& params) { @@ -104,7 +104,7 @@ namespace ntt { g_writer.writeAttrs(params); } - template + template void ComputeMoments(const SimulationParams& params, const Mesh& mesh, const std::vector>& prtl_species, @@ -180,7 +180,7 @@ namespace ntt { } } - template + template void ComputeVectorPotential(ndfield_t& buffer, ndfield_t& EM, unsigned short buff_idx, @@ -244,7 +244,7 @@ namespace ntt { } #if defined(MPI_ENABLED) && defined(OUTPUT_ENABLED) - template + template void ExtractVectorPotential(ndfield_t& buffer, array_t& aphi_r, unsigned short buff_idx, @@ -257,7 +257,7 @@ namespace ntt { }); } - template + template requires IsCompatibleWithMetadomain void Metadomain::CommunicateVectorPotential(unsigned short buff_idx) { if constexpr (M::Dim == Dim::_2D) { @@ -312,7 +312,7 @@ namespace ntt { } #endif - template + template requires IsCompatibleWithMetadomain auto Metadomain::Write( const SimulationParams& params, diff --git a/src/framework/domain/metadomain_sort.cpp b/src/framework/domain/metadomain_sort.cpp index c529ca738..03b53b8f3 100644 --- a/src/framework/domain/metadomain_sort.cpp +++ b/src/framework/domain/metadomain_sort.cpp @@ -8,7 +8,7 @@ namespace ntt { - template + template requires IsCompatibleWithMetadomain void Metadomain::SortParticles(simtime_t, timestep_t step, diff --git a/src/framework/domain/metadomain_stats.cpp b/src/framework/domain/metadomain_stats.cpp index 21176a836..73ed1ae70 100644 --- a/src/framework/domain/metadomain_stats.cpp +++ b/src/framework/domain/metadomain_stats.cpp @@ -21,7 +21,7 @@ namespace ntt { - template + template requires IsCompatibleWithMetadomain void Metadomain::InitStatsWriter(const SimulationParams& params, bool is_resuming) { @@ -62,7 +62,7 @@ namespace ntt { } } - template + template auto ComputeMoments(const SimulationParams& params, const Mesh& mesh, const M& global_metric, @@ -119,7 +119,7 @@ namespace ntt { } } - template + template auto ReduceFields(Domain* domain, const M& global_metric, const std::vector& components) -> real_t { @@ -181,7 +181,7 @@ namespace ntt { return buffer / global_metric.totVolume(); } - template + template requires IsCompatibleWithMetadomain auto Metadomain::WriteStats( const SimulationParams& params, @@ -189,8 +189,8 @@ namespace ntt { timestep_t finished_step, simtime_t current_time, simtime_t finished_time, - std::function&)> CustomStat) - -> bool { + std::function&)> + CustomStat) -> bool { if (not(params.template get("output.stats.enable") and g_stats_writer.shouldWrite(finished_step, finished_time))) { return false; @@ -272,7 +272,7 @@ namespace ntt { } } else { raise::Error("StatsID not implemented for particular SimEngine: " + - std::to_string(static_cast(S)), + std::string(S.to_string()), HERE); } } @@ -280,18 +280,17 @@ namespace ntt { return true; } -#define METADOMAIN_STATS(S, M, D) \ - template void Metadomain>::InitStatsWriter(const SimulationParams&, \ - bool); \ - template auto Metadomain>::WriteStats( \ - const SimulationParams&, \ - timestep_t, \ - timestep_t, \ - simtime_t, \ - simtime_t, \ - std::function< \ - real_t(const std::string&, timestep_t, simtime_t, const Domain>&)>) \ - -> bool; +#define METADOMAIN_STATS(S, M, D) \ + template void Metadomain>::InitStatsWriter(const SimulationParams&, \ + bool); \ + template auto Metadomain>::WriteStats( \ + const SimulationParams&, \ + timestep_t, \ + timestep_t, \ + simtime_t, \ + simtime_t, \ + std::function< \ + real_t(const std::string&, timestep_t, simtime_t, const Domain>&)>) -> bool; NTT_FOREACH_SPECIALIZATION(METADOMAIN_STATS) diff --git a/src/framework/parameters/grid.cpp b/src/framework/parameters/grid.cpp index 9e5d39df5..8d5a84925 100644 --- a/src/framework/parameters/grid.cpp +++ b/src/framework/parameters/grid.cpp @@ -27,10 +27,10 @@ namespace ntt { namespace params { template - auto get_dx0_V0(const std::vector& resolution, - const boundaries_t& extent, - const std::map& params) - -> std::pair { + auto get_dx0_V0( + const std::vector& resolution, + const boundaries_t& extent, + const std::map& params) -> std::pair { const auto metric = M(resolution, extent, params); const auto dx0 = metric.dxMin(); coord_t x_corner { ZERO }; @@ -112,7 +112,7 @@ namespace ntt { } std::vector> flds_bc_enum; std::vector> prtl_bc_enum; - if (coord_enum == Coord::Cart) { + if (coord_enum == Coord::Cartesian) { raise::ErrorIf(flds_bc.size() != (std::size_t)dim, "invalid `grid.boundaries.fields`", HERE); @@ -243,7 +243,7 @@ namespace ntt { const boundaries_t& extent_pairwise, const toml::value& toml_data) { if (needs_match_boundaries) { - if (coord_enum == Coord::Cart) { + if (coord_enum == Coord::Cartesian) { auto min_extent = std::numeric_limits::max(); for (const auto& e : extent_pairwise) { min_extent = std::min(min_extent, e.second - e.first); @@ -296,7 +296,7 @@ namespace ntt { } if (needs_absorb_boundaries) { - if (coord_enum == Coord::Cart) { + if (coord_enum == Coord::Cartesian) { auto min_extent = std::numeric_limits::max(); for (const auto& e : extent_pairwise) { min_extent = std::min(min_extent, e.second - e.first); @@ -461,7 +461,7 @@ namespace ntt { extent.erase(extent.begin() + (std::size_t)(dim), extent.end()); } raise::ErrorIf(extent[0].size() != 2, "invalid `grid.extent[0]`", HERE); - if (coord_enum != Coord::Cart) { + if (coord_enum != Coord::Cartesian) { raise::ErrorIf(extent.size() > 1, "invalid `grid.extent` for non-cartesian geometry", HERE); @@ -479,7 +479,7 @@ namespace ntt { } /* metric parameters ------------------------------------------------------ */ - if (coord_enum == Coord::Qsph) { + if (coord_enum == Coord::Qspherical) { metric_params_short_["r0"] = metric_params["qsph_r0"]; metric_params_short_["h"] = metric_params["qsph_h"]; } diff --git a/src/framework/parameters/grid.h b/src/framework/parameters/grid.h index 978b7f329..81aa4998c 100644 --- a/src/framework/parameters/grid.h +++ b/src/framework/parameters/grid.h @@ -75,12 +75,12 @@ namespace ntt { void setParams(SimulationParams*) const; }; - auto GetBoundaryConditions(SimulationParams* params, - const SimEngine&, - Dimension, - const Coord&, - const toml::value&) - -> std::tuple, boundaries_t>; + auto GetBoundaryConditions( + SimulationParams* params, + const SimEngine&, + Dimension, + const Coord&, + const toml::value&) -> std::tuple, boundaries_t>; } // namespace params } // namespace ntt diff --git a/src/framework/parameters/parameters.cpp b/src/framework/parameters/parameters.cpp index 085e6bc39..f882be390 100644 --- a/src/framework/parameters/parameters.cpp +++ b/src/framework/parameters/parameters.cpp @@ -237,7 +237,7 @@ namespace ntt { extra_params.setParams(extra_extra_flags, this); // @TODO: disabling stats for non-Cartesian - if (coord_enum != Coord::Cart) { + if (coord_enum != Coord::Cartesian) { set("output.stats.enable", false); } } diff --git a/src/framework/parameters/particles.cpp b/src/framework/parameters/particles.cpp index afc795a9a..93ee6d639 100644 --- a/src/framework/parameters/particles.cpp +++ b/src/framework/parameters/particles.cpp @@ -21,8 +21,8 @@ namespace ntt { /* * Auxiliary functions */ - auto getRadiativeDragFlags(const std::string& radiative_drag_str) - -> RadiativeDragFlags { + auto getRadiativeDragFlags( + const std::string& radiative_drag_str) -> RadiativeDragFlags { if (fmt::toLower(radiative_drag_str) == "none") { return RadiativeDrag::NONE; } else { @@ -46,8 +46,8 @@ namespace ntt { } } - auto getPusherFlags(const std::string& particle_pusher_str) - -> ParticlePusherFlags { + auto getPusherFlags( + const std::string& particle_pusher_str) -> ParticlePusherFlags { if (fmt::toLower(particle_pusher_str) == "none") { return ParticlePusher::NONE; } else { @@ -78,8 +78,8 @@ namespace ntt { } } - auto getEmissionPolicyFlag(const std::string& emission_policy_str) - -> EmissionTypeFlag { + auto getEmissionPolicyFlag( + const std::string& emission_policy_str) -> EmissionTypeFlag { if (fmt::toLower(emission_policy_str) == "none") { return EmissionType::NONE; } else if (fmt::toLower(emission_policy_str) == "synchrotron") { @@ -96,13 +96,13 @@ namespace ntt { } } - auto GetParticleSpecies(SimulationParams* params, - const SimEngine& engine_enum, - spidx_t idx, - const toml::value& sp, - timestep_t global_clearing_interval, - timestep_t global_spatial_sorting_interval) - -> ParticleSpecies { + auto GetParticleSpecies( + SimulationParams* params, + const SimEngine& engine_enum, + spidx_t idx, + const toml::value& sp, + timestep_t global_clearing_interval, + timestep_t global_spatial_sorting_interval) -> ParticleSpecies { const auto label = toml::find_or(sp, "label", "s" + std::to_string(idx)); diff --git a/src/framework/simulation.h b/src/framework/simulation.h index 7387d62dd..44f4efe19 100644 --- a/src/framework/simulation.h +++ b/src/framework/simulation.h @@ -18,7 +18,6 @@ #include "utils/error.h" -#include "engines/traits.h" #include "framework/parameters/parameters.h" #include @@ -37,7 +36,6 @@ namespace ntt { ~Simulation(); template