diff --git a/src/include/psc.hxx b/src/include/psc.hxx index c96ba36c4..de7e386be 100644 --- a/src/include/psc.hxx +++ b/src/include/psc.hxx @@ -484,11 +484,6 @@ struct Psc prof_stop(pr_collision); } - // === particle injection - prof_start(pr_inject_prts); - inject_particles(); - prof_stop(pr_inject_prts); - if (checks_.continuity.should_do_check(timestep)) { mpi_printf(comm, "***** Checking continuity...\n"); prof_start(pr_checks); @@ -503,6 +498,11 @@ struct Psc prof_stop(pr_push_prts); // state is now: x^{n+3/2}, p^{n+1}, E^{n+1/2}, B^{n+1/2}, j^{n+1} + // === particle injection + prof_start(pr_inject_prts); + inject_particles_(mprts_, mflds_); + prof_stop(pr_inject_prts); + // === field propagation B^{n+1/2} -> B^{n+1} mpi_printf(comm, "***** Pushing B...\n"); prof_start(pr_push_flds); @@ -591,11 +591,6 @@ struct Psc #endif } - // ---------------------------------------------------------------------- - // inject_particles - - void inject_particles() { return this->inject_particles_(grid(), mprts_); } - private: // ---------------------------------------------------------------------- // print_profiling @@ -753,8 +748,8 @@ protected: class InjectParticlesNone { public: - template - void operator()(const Grid_t& grid, Mparticles& mprts) + template + void operator()(Mparticles& mprts, MfieldsState& mflds) {} }; diff --git a/src/psc_2d_shock.cxx b/src/psc_2d_shock.cxx index 58eaeef73..e5dc8485a 100644 --- a/src/psc_2d_shock.cxx +++ b/src/psc_2d_shock.cxx @@ -548,7 +548,9 @@ void run() double inject_fac = (g.inject_interval * grid.dt / inject_tau) / (1. + g.inject_interval * grid.dt / inject_tau); - auto lf_inject_heat = [&](const Grid_t& grid, Mparticles& mprts) { + auto lf_inject_heat = [&](Mparticles& mprts, MfieldsState& mflds) { + const Grid_t& grid = mprts.grid(); + static int pr_inject, pr_heating; if (!pr_inject) { pr_inject = prof_register("inject", 1., 0, 0); diff --git a/src/psc_flatfoil_yz.cxx b/src/psc_flatfoil_yz.cxx index 1f2469e9d..37c92ce9e 100644 --- a/src/psc_flatfoil_yz.cxx +++ b/src/psc_flatfoil_yz.cxx @@ -617,7 +617,9 @@ void run() double inject_fac = (g.inject_interval * grid.dt / inject_tau) / (1. + g.inject_interval * grid.dt / inject_tau); - auto lf_inject_heat = [&](const Grid_t& grid, Mparticles& mprts) { + auto lf_inject_heat = [&](Mparticles& mprts, MfieldsState& mflds) { + const Grid_t& grid = mprts.grid(); + static int pr_inject, pr_heating; if (!pr_inject) { pr_inject = prof_register("inject", 1., 0, 0);