diff options
Diffstat (limited to 'Source/Evolve/WarpXEvolve.cpp')
-rw-r--r-- | Source/Evolve/WarpXEvolve.cpp | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp index c3c297b56..86bcc7fb7 100644 --- a/Source/Evolve/WarpXEvolve.cpp +++ b/Source/Evolve/WarpXEvolve.cpp @@ -83,10 +83,7 @@ WarpX::Evolve (int numsteps) if (verbose) { amrex::Print() << "\nSTEP " << step+1 << " starts ...\n"; } - if (warpx_py_beforestep) { - WARPX_PROFILE("warpx_py_beforestep"); - warpx_py_beforestep(); - } + ExecutePythonCallback("beforestep"); amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(0); if (cost) { @@ -168,10 +165,7 @@ WarpX::Evolve (int numsteps) // Main PIC operation: // gather fields, push particles, deposit sources, update fields - if (warpx_py_particleinjection) { - WARPX_PROFILE("warpx_py_particleinjection"); - warpx_py_particleinjection(); - } + ExecutePythonCallback("particleinjection"); // Electrostatic case: only gather fields and push particles, // deposition and calculation of fields done further below if (do_electrostatic != ElectrostaticSolverAlgo::None) @@ -307,10 +301,7 @@ WarpX::Evolve (int numsteps) } if( do_electrostatic != ElectrostaticSolverAlgo::None ) { - if (warpx_py_beforeEsolve) { - WARPX_PROFILE("warpx_py_beforeEsolve"); - warpx_py_beforeEsolve(); - } + ExecutePythonCallback("beforeEsolve"); // Electrostatic solver: // For each species: deposit charge and add the associated space-charge // E and B field to the grid ; this is done at the end of the PIC @@ -319,18 +310,12 @@ WarpX::Evolve (int numsteps) // and so that the fields are at the correct time in the output. bool const reset_fields = true; ComputeSpaceChargeField( reset_fields ); - if (warpx_py_afterEsolve) { - WARPX_PROFILE("warpx_py_afterEsolve"); - warpx_py_afterEsolve(); - } + ExecutePythonCallback("afterEsolve"); } - // warpx_py_afterstep runs with the updated global time. It is included + // afterstep callback runs with the updated global time. It is included // in the evolve timing. - if (warpx_py_afterstep) { - WARPX_PROFILE("warpx_py_afterstep"); - warpx_py_afterstep(); - } + ExecutePythonCallback("afterstep"); /// reduced diags if (reduced_diags->m_plot_rd != 0) @@ -387,20 +372,13 @@ WarpX::OneStep_nosub (Real cur_time) // from p^{n-1/2} to p^{n+1/2} // Deposit current j^{n+1/2} // Deposit charge density rho^{n} - if (warpx_py_particlescraper) { - WARPX_PROFILE("warpx_py_particlescraper"); - warpx_py_particlescraper(); - } - if (warpx_py_beforedeposition) { - WARPX_PROFILE("warpx_py_beforedeposition"); - warpx_py_beforedeposition(); - } + + ExecutePythonCallback("particlescraper"); + ExecutePythonCallback("beforedeposition"); + PushParticlesandDepose(cur_time); - if (warpx_py_afterdeposition) { - WARPX_PROFILE("warpx_py_afterdeposition"); - warpx_py_afterdeposition(); - } + ExecutePythonCallback("afterdeposition"); // Synchronize J and rho SyncCurrent(); @@ -422,10 +400,7 @@ WarpX::OneStep_nosub (Real cur_time) if (do_pml && pml_has_particles) CopyJPML(); if (do_pml && do_pml_j_damping) DampJPML(); - if (warpx_py_beforeEsolve) { - WARPX_PROFILE("warpx_py_beforeEsolve"); - warpx_py_beforeEsolve(); - } + ExecutePythonCallback("beforeEsolve"); // Push E and B from {n} to {n+1} // (And update guard cells immediately afterwards) @@ -507,10 +482,7 @@ WarpX::OneStep_nosub (Real cur_time) FillBoundaryB(guard_cells.ng_alloc_EB); } // !PSATD - if (warpx_py_afterEsolve) { - WARPX_PROFILE("warpx_py_afterEsolve"); - warpx_py_afterEsolve(); - } + ExecutePythonCallback("afterEsolve"); } void |