aboutsummaryrefslogtreecommitdiff
path: root/Source/Evolve/WarpXEvolve.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-07-26 20:55:34 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-26 18:55:34 +0000
commit766d71146a8314a48db88f29b0e0548d1d9c5397 (patch)
tree630ae577a1856ae0f5fb2e236a4e85b9346566d2 /Source/Evolve/WarpXEvolve.cpp
parent4783ad60809fc5fdff164a4ed0cacca4b3fffa70 (diff)
downloadWarpX-766d71146a8314a48db88f29b0e0548d1d9c5397.tar.gz
WarpX-766d71146a8314a48db88f29b0e0548d1d9c5397.tar.zst
WarpX-766d71146a8314a48db88f29b0e0548d1d9c5397.zip
Initialize variables at declaration if it improves readability (#4117)
* init some variables at declaration * make code more readable * avoid lossy function result cast * Update Source/Initialization/WarpXInitData.cpp Co-authored-by: Weiqun Zhang <WeiqunZhang@lbl.gov> * replace with equality * Revert "replace with equality" This reverts commit e3164f9e053d345b153d770ae107a7f68c4bb260. * Update Source/Diagnostics/ComputeDiagFunctors/ParticleReductionFunctor.cpp Co-authored-by: Weiqun Zhang <WeiqunZhang@lbl.gov> --------- Co-authored-by: Weiqun Zhang <WeiqunZhang@lbl.gov>
Diffstat (limited to 'Source/Evolve/WarpXEvolve.cpp')
-rw-r--r--Source/Evolve/WarpXEvolve.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp
index 6ae20e446..a97c87122 100644
--- a/Source/Evolve/WarpXEvolve.cpp
+++ b/Source/Evolve/WarpXEvolve.cpp
@@ -65,12 +65,8 @@ WarpX::Evolve (int numsteps)
Real cur_time = t_new[0];
- int numsteps_max;
- if (numsteps < 0) { // Note that the default argument is numsteps = -1
- numsteps_max = max_step;
- } else {
- numsteps_max = istep[0] + numsteps;
- }
+ // Note that the default argument is numsteps = -1
+ const int numsteps_max = (numsteps < 0)?(max_step):(istep[0] + numsteps);
bool early_params_checked = false; // check typos in inputs after step 1
bool exit_loop_due_to_interrupt_signal = false;