diff options
42 files changed, 147 insertions, 149 deletions
diff --git a/Examples/Modules/qed/breit_wheeler/inputs_3d b/Examples/Modules/qed/breit_wheeler/inputs_3d index 34d0ce1dc..73a8d4f77 100644 --- a/Examples/Modules/qed/breit_wheeler/inputs_3d +++ b/Examples/Modules/qed/breit_wheeler/inputs_3d @@ -100,7 +100,7 @@ p4.qed_breit_wheeler_pos_product_species = pos4 ### PRODUCT SPECIES ### ele1.species_type = "electron" ele1.injection_style = nuniformpercell -ele1.num_particles_per_cell_each_dim = 0 0 +ele1.num_particles_per_cell_each_dim = 0 0 0 ele1.profile = constant ele1.density = 0.0 ele1.momentum_distribution_type = "gaussian" @@ -110,7 +110,7 @@ ele1.qed_quantum_sync_phot_product_species = dummy_phot ele2.species_type = "electron" ele2.injection_style = nuniformpercell -ele2.num_particles_per_cell_each_dim = 0 0 +ele2.num_particles_per_cell_each_dim = 0 0 0 ele2.profile = constant ele2.density = 0.0 ele2.momentum_distribution_type = "gaussian" @@ -120,7 +120,7 @@ ele2.qed_quantum_sync_phot_product_species = dummy_phot ele3.species_type = "electron" ele3.injection_style = nuniformpercell -ele3.num_particles_per_cell_each_dim = 0 0 +ele3.num_particles_per_cell_each_dim = 0 0 0 ele3.profile = constant ele3.density = 0.0 ele3.momentum_distribution_type = "gaussian" @@ -130,7 +130,7 @@ ele3.qed_quantum_sync_phot_product_species = dummy_phot ele4.species_type = "electron" ele4.injection_style = nuniformpercell -ele4.num_particles_per_cell_each_dim = 0 0 +ele4.num_particles_per_cell_each_dim = 0 0 0 ele4.profile = constant ele4.density = 0.0 ele4.momentum_distribution_type = "gaussian" @@ -140,7 +140,7 @@ ele4.qed_quantum_sync_phot_product_species = dummy_phot pos1.species_type = "positron" pos1.injection_style = nuniformpercell -pos1.num_particles_per_cell_each_dim = 0 0 +pos1.num_particles_per_cell_each_dim = 0 0 0 pos1.profile = constant pos1.density = 0.0 pos1.momentum_distribution_type = "gaussian" @@ -150,7 +150,7 @@ pos1.qed_quantum_sync_phot_product_species = dummy_phot pos2.species_type = "positron" pos2.injection_style = nuniformpercell -pos2.num_particles_per_cell_each_dim = 0 0 +pos2.num_particles_per_cell_each_dim = 0 0 0 pos2.profile = constant pos2.density = 0.0 pos2.momentum_distribution_type = "gaussian" @@ -160,7 +160,7 @@ pos2.qed_quantum_sync_phot_product_species = dummy_phot pos3.species_type = "positron" pos3.injection_style = nuniformpercell -pos3.num_particles_per_cell_each_dim = 0 0 +pos3.num_particles_per_cell_each_dim = 0 0 0 pos3.profile = constant pos3.density = 0.0 pos3.momentum_distribution_type = "gaussian" @@ -170,7 +170,7 @@ pos3.qed_quantum_sync_phot_product_species = dummy_phot pos4.species_type = "positron" pos4.injection_style = nuniformpercell -pos4.num_particles_per_cell_each_dim = 0 0 +pos4.num_particles_per_cell_each_dim = 0 0 0 pos4.profile = constant pos4.density = 0.0 pos4.momentum_distribution_type = "gaussian" @@ -180,7 +180,7 @@ pos4.qed_quantum_sync_phot_product_species = dummy_phot dummy_phot.species_type = "photon" dummy_phot.injection_style = nuniformpercell -dummy_phot.num_particles_per_cell_each_dim = 0 0 +dummy_phot.num_particles_per_cell_each_dim = 0 0 0 dummy_phot.profile = constant dummy_phot.density = 0.0 dummy_phot.momentum_distribution_type = "gaussian" diff --git a/Examples/Modules/qed/quantum_synchrotron/inputs_3d b/Examples/Modules/qed/quantum_synchrotron/inputs_3d index 5198a66b4..8b1ff7e89 100644 --- a/Examples/Modules/qed/quantum_synchrotron/inputs_3d +++ b/Examples/Modules/qed/quantum_synchrotron/inputs_3d @@ -96,7 +96,7 @@ p4.qed_quantum_sync_phot_product_species = qsp_4 ### PRODUCT SPECIES ### qsp_1.species_type = "photon" qsp_1.injection_style = nuniformpercell -qsp_1.num_particles_per_cell_each_dim = 0 0 +qsp_1.num_particles_per_cell_each_dim = 0 0 0 qsp_1.profile = constant qsp_1.density = 0.0 qsp_1.momentum_distribution_type = "gaussian" @@ -106,7 +106,7 @@ qsp_1.qed_breit_wheeler_pos_product_species = dummy_pos qsp_2.species_type = "photon" qsp_2.injection_style = nuniformpercell -qsp_2.num_particles_per_cell_each_dim = 0 0 +qsp_2.num_particles_per_cell_each_dim = 0 0 0 qsp_2.profile = constant qsp_2.density = 0.0 qsp_2.momentum_distribution_type = "gaussian" @@ -116,7 +116,7 @@ qsp_2.qed_breit_wheeler_pos_product_species = dummy_pos qsp_3.species_type = "photon" qsp_3.injection_style = nuniformpercell -qsp_3.num_particles_per_cell_each_dim = 0 0 +qsp_3.num_particles_per_cell_each_dim = 0 0 0 qsp_3.profile = constant qsp_3.density = 0.0 qsp_3.momentum_distribution_type = "gaussian" @@ -126,7 +126,7 @@ qsp_3.qed_breit_wheeler_pos_product_species = dummy_pos qsp_4.species_type = "photon" qsp_4.injection_style = nuniformpercell -qsp_4.num_particles_per_cell_each_dim = 0 0 +qsp_4.num_particles_per_cell_each_dim = 0 0 0 qsp_4.profile = constant qsp_4.density = 0.0 qsp_4.momentum_distribution_type = "gaussian" @@ -138,14 +138,14 @@ qsp_4.qed_breit_wheeler_pos_product_species = dummy_pos dummy_ele.species_type = "electron" dummy_ele.injection_style = nuniformpercell -dummy_ele.num_particles_per_cell_each_dim = 0 0 +dummy_ele.num_particles_per_cell_each_dim = 0 0 0 dummy_ele.profile = constant dummy_ele.density = 0.0 dummy_ele.momentum_distribution_type = "gaussian" dummy_pos.species_type = "positron" dummy_pos.injection_style = nuniformpercell -dummy_pos.num_particles_per_cell_each_dim = 0 0 +dummy_pos.num_particles_per_cell_each_dim = 0 0 0 dummy_pos.profile = constant dummy_pos.density = 0.0 dummy_pos.momentum_distribution_type = "gaussian" diff --git a/Examples/Modules/qed/schwinger/inputs_3d_schwinger b/Examples/Modules/qed/schwinger/inputs_3d_schwinger index 1f532eceb..c8f70992f 100644 --- a/Examples/Modules/qed/schwinger/inputs_3d_schwinger +++ b/Examples/Modules/qed/schwinger/inputs_3d_schwinger @@ -49,8 +49,8 @@ ele_schwinger.species_type = "electron" pos_schwinger.species_type = "positron" ele_schwinger.injection_style = "NUniformPerCell" pos_schwinger.injection_style = "NUniformPerCell" -ele_schwinger.num_particles_per_cell_each_dim = 0 0 -pos_schwinger.num_particles_per_cell_each_dim = 0 0 +ele_schwinger.num_particles_per_cell_each_dim = 0 0 0 +pos_schwinger.num_particles_per_cell_each_dim = 0 0 0 ele_schwinger.profile = "constant" pos_schwinger.profile = "constant" ele_schwinger.density = 0 diff --git a/Examples/Tests/galilean/inputs_rz b/Examples/Tests/galilean/inputs_rz index 92f84a3ab..69a44dfc1 100644 --- a/Examples/Tests/galilean/inputs_rz +++ b/Examples/Tests/galilean/inputs_rz @@ -44,7 +44,7 @@ psatd.noz = 16 electrons.charge = -q_e electrons.mass = m_e electrons.injection_style = "NUniformPerCell" -electrons.num_particles_per_cell_each_dim = 2 2 +electrons.num_particles_per_cell_each_dim = 2 2 1 electrons.profile = constant electrons.density = 282197938148984.7 electrons.momentum_distribution_type = "gaussian" @@ -59,7 +59,7 @@ electrons.uz_th = 0.0001 ions.charge = q_e ions.mass = m_p ions.injection_style = "NUniformPerCell" -ions.num_particles_per_cell_each_dim = 2 2 +ions.num_particles_per_cell_each_dim = 2 2 1 ions.profile = constant ions.density = 282197938148984.7 ions.momentum_distribution_type = "gaussian" diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 93e74d9d6..50233f2c8 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -506,9 +506,9 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& /*g int ngFFt_z = do_nodal ? noz_fft : noz_fft/2; ParmParse pp_psatd("psatd"); - pp_psatd.query("nx_guard", ngFFt_x); - pp_psatd.query("ny_guard", ngFFt_y); - pp_psatd.query("nz_guard", ngFFt_z); + queryWithParser(pp_psatd, "nx_guard", ngFFt_x); + queryWithParser(pp_psatd, "ny_guard", ngFFt_y); + queryWithParser(pp_psatd, "nz_guard", ngFFt_z); #if (AMREX_SPACEDIM == 3) IntVect ngFFT = IntVect(ngFFt_x, ngFFt_y, ngFFt_z); @@ -599,8 +599,8 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& /*g const RealVect dx{AMREX_D_DECL(geom->CellSize(0), geom->CellSize(1), geom->CellSize(2))}; // Get the cell-centered box, with guard cells BoxArray realspace_ba = ba; // Copy box - Array<Real,3> const v_galilean_zero = {0., 0., 0.}; - Array<Real,3> const v_comoving_zero = {0., 0., 0.}; + amrex::Vector<amrex::Real> const v_galilean_zero = {0., 0., 0.}; + amrex::Vector<amrex::Real> const v_comoving_zero = {0., 0., 0.}; realspace_ba.enclosedCells().grow(nge); // cell-centered + guard cells spectral_solver_fp = std::make_unique<SpectralSolver>(lev, realspace_ba, dm, nox_fft, noy_fft, noz_fft, do_nodal, WarpX::fill_guards, v_galilean_zero, @@ -707,8 +707,8 @@ PML::PML (const int lev, const BoxArray& grid_ba, const DistributionMapping& /*g const RealVect cdx{AMREX_D_DECL(cgeom->CellSize(0), cgeom->CellSize(1), cgeom->CellSize(2))}; // Get the cell-centered box, with guard cells BoxArray realspace_cba = cba; // Copy box - Array<Real,3> const v_galilean_zero = {0., 0., 0.}; - Array<Real,3> const v_comoving_zero = {0., 0., 0.}; + amrex::Vector<amrex::Real> const v_galilean_zero = {0., 0., 0.}; + amrex::Vector<amrex::Real> const v_comoving_zero = {0., 0., 0.}; realspace_cba.enclosedCells().grow(nge); // cell-centered + guard cells spectral_solver_cp = std::make_unique<SpectralSolver>(lev, realspace_cba, cdm, nox_fft, noy_fft, noz_fft, do_nodal, WarpX::fill_guards, v_galilean_zero, diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index 53a1fc09a..fadd97b0f 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -131,7 +131,7 @@ BTDiagnostics::ReadParameters () pp_diag_name.query("do_back_transformed_particles", m_do_back_transformed_particles); AMREX_ALWAYS_ASSERT(m_do_back_transformed_fields or m_do_back_transformed_particles); - pp_diag_name.get("num_snapshots_lab", m_num_snapshots_lab); + getWithParser(pp_diag_name, "num_snapshots_lab", m_num_snapshots_lab); m_num_buffers = m_num_snapshots_lab; // Read either dz_snapshots_lab or dt_snapshots_lab @@ -144,7 +144,7 @@ BTDiagnostics::ReadParameters () AMREX_ALWAYS_ASSERT_WITH_MESSAGE(snapshot_interval_is_specified, "For back-transformed diagnostics, user should specify either dz_snapshots_lab or dt_snapshots_lab"); - if (pp_diag_name.query("buffer_size", m_buffer_size)) { + if (queryWithParser(pp_diag_name, "buffer_size", m_buffer_size)) { if(m_max_box_size < m_buffer_size) m_max_box_size = m_buffer_size; } diff --git a/Source/Diagnostics/BackTransformedDiagnostic.cpp b/Source/Diagnostics/BackTransformedDiagnostic.cpp index 541e1190e..171687942 100644 --- a/Source/Diagnostics/BackTransformedDiagnostic.cpp +++ b/Source/Diagnostics/BackTransformedDiagnostic.cpp @@ -598,7 +598,7 @@ BackTransformedDiagnostic (Real zmin_lab, Real zmax_lab, Real v_window_lab, ParmParse pp_warpx("warpx"); bool do_user_fields; do_user_fields = pp_warpx.queryarr("back_transformed_diag_fields", user_fields_to_dump); - if (pp_warpx.query("buffer_size", m_num_buffer_)) { + if (queryWithParser(pp_warpx, "buffer_size", m_num_buffer_)) { if (m_max_box_size_ < m_num_buffer_) m_max_box_size_ = m_num_buffer_; } // If user specifies fields to dump, overwrite ncomp_to_dump, diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp index cb4ffcd02..a6d85185c 100644 --- a/Source/Diagnostics/Diagnostics.cpp +++ b/Source/Diagnostics/Diagnostics.cpp @@ -48,7 +48,7 @@ Diagnostics::BaseReadParameters () amrex::ParmParse pp_diag_name(m_diag_name); m_file_prefix = "diags/" + m_diag_name; pp_diag_name.query("file_prefix", m_file_prefix); - pp_diag_name.query("file_min_digits", m_file_min_digits); + queryWithParser(pp_diag_name, "file_min_digits", m_file_min_digits); pp_diag_name.query("format", m_format); pp_diag_name.query("dump_last_timestep", m_dump_last_timestep); @@ -124,7 +124,7 @@ Diagnostics::BaseReadParameters () // Initialize cr_ratio with default value of 1 for each dimension. amrex::Vector<int> cr_ratio(AMREX_SPACEDIM, 1); // Read user-defined coarsening ratio for the output MultiFab. - bool cr_specified = pp_diag_name.queryarr("coarsening_ratio", cr_ratio); + bool cr_specified = queryArrWithParser(pp_diag_name, "coarsening_ratio", cr_ratio, 0, AMREX_SPACEDIM); if (cr_specified) { for (int idim =0; idim < AMREX_SPACEDIM; ++idim) { m_crse_ratio[idim] = cr_ratio[idim]; diff --git a/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp b/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp index 29461ae1f..eb00b6c09 100644 --- a/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp +++ b/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp @@ -15,8 +15,8 @@ using namespace amrex; ParticleDiag::ParticleDiag(std::string diag_name, std::string name, WarpXParticleContainer* pc) : m_diag_name(diag_name), m_name(name), m_pc(pc) { - ParmParse pp(diag_name + "." + name); - if (!pp.queryarr("variables", variables)){ + ParmParse pp_diag_name_species_name(diag_name + "." + name); + if (!pp_diag_name_species_name.queryarr("variables", variables)){ variables = {"ux", "uy", "uz", "w"}; } @@ -72,14 +72,17 @@ ParticleDiag::ParticleDiag(std::string diag_name, std::string name, WarpXParticl #endif // build filter functors - m_do_random_filter = queryWithParser(pp, "random_fraction", m_random_fraction); - m_do_uniform_filter = pp.query("uniform_stride", m_uniform_stride); + m_do_random_filter = queryWithParser(pp_diag_name_species_name, "random_fraction", + m_random_fraction); + m_do_uniform_filter = queryWithParser(pp_diag_name_species_name, "uniform_stride", + m_uniform_stride); std::string buf; - m_do_parser_filter = pp.query("plot_filter_function(t,x,y,z,ux,uy,uz)", buf); + m_do_parser_filter = pp_diag_name_species_name.query("plot_filter_function(t,x,y,z,ux,uy,uz)", + buf); if (m_do_parser_filter) { std::string function_string = ""; - Store_parserString(pp,"plot_filter_function(t,x,y,z,ux,uy,uz)", + Store_parserString(pp_diag_name_species_name,"plot_filter_function(t,x,y,z,ux,uy,uz)", function_string); m_particle_filter_parser = std::make_unique<amrex::Parser>( makeParser(function_string,{"t","x","y","z","ux","uy","uz"})); diff --git a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp index d683fce85..c30d5820f 100644 --- a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp +++ b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp @@ -394,7 +394,7 @@ void ParticleExtrema::ComputeDiags (int step) const int nox = WarpX::nox; const bool galerkin_interpolation = WarpX::galerkin_interpolation; const amrex::IntVect ngE = warpx.getngE(); - const amrex::Array<amrex::Real,3> v_galilean = myspc.get_v_galilean(); + amrex::Vector<amrex::Real> v_galilean = myspc.get_v_galilean(); const auto& time_of_last_gal_shift = warpx.time_of_last_gal_shift; // loop over refinement levels diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp index 20a2ec8f7..e9a26ab37 100644 --- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp +++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp @@ -60,7 +60,7 @@ ParticleHistogram::ParticleHistogram (std::string rd_name) pp_rd_name.get("species",selected_species_name); // read bin parameters - pp_rd_name.get("bin_number",m_bin_num); + getWithParser(pp_rd_name, "bin_number",m_bin_num); getWithParser(pp_rd_name, "bin_max", m_bin_max); getWithParser(pp_rd_name, "bin_min", m_bin_min); m_bin_size = (m_bin_max - m_bin_min) / m_bin_num; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H index 40dfeef38..cc9e7e4fc 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H @@ -34,7 +34,7 @@ class ComovingPsatdAlgorithm : public SpectralBaseAlgorithm const int norder_z, const bool nodal, const amrex::IntVect& fill_guards, - const amrex::Array<amrex::Real,3>& v_comoving, + const amrex::Vector<amrex::Real>& v_comoving, const amrex::Real dt, const bool update_with_rho); @@ -95,7 +95,7 @@ class ComovingPsatdAlgorithm : public SpectralBaseAlgorithm KVectorComponent kz_vec; // Additional member variables - amrex::Array<amrex::Real,3> m_v_comoving; + amrex::Vector<amrex::Real> m_v_comoving; amrex::Real m_dt; }; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp index f80ee7749..ba9613d3b 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp @@ -26,7 +26,7 @@ ComovingPsatdAlgorithm::ComovingPsatdAlgorithm (const SpectralKSpace& spectral_k const int norder_x, const int norder_y, const int norder_z, const bool nodal, const amrex::IntVect& fill_guards, - const amrex::Array<amrex::Real, 3>& v_comoving, + const amrex::Vector<amrex::Real>& v_comoving, const amrex::Real dt, const bool update_with_rho) // Members initialization diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H index 8ac6a1d58..0907cf37f 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H @@ -21,7 +21,7 @@ class GalileanPsatdAlgorithmRZ : public SpectralBaseAlgorithmRZ const SpectralFieldIndex& spectral_index, int const n_rz_azimuthal_modes, int const norder_z, bool const nodal, - const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Vector<amrex::Real>& v_galilean, amrex::Real const dt_step, bool const update_with_rho); // Redefine functions from base class @@ -65,7 +65,7 @@ class GalileanPsatdAlgorithmRZ : public SpectralBaseAlgorithmRZ bool coefficients_initialized; // Note that dt and v_galilean are saved to use in InitializeSpectralCoefficients amrex::Real const m_dt; - amrex::Array<amrex::Real,3> m_v_galilean; + amrex::Vector<amrex::Real> m_v_galilean; bool m_update_with_rho; SpectralRealCoefficients C_coef, S_ck_coef; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp index 79fee3c2e..4fa68b681 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp @@ -20,7 +20,7 @@ GalileanPsatdAlgorithmRZ::GalileanPsatdAlgorithmRZ (SpectralKSpaceRZ const & spe const SpectralFieldIndex& spectral_index, int const n_rz_azimuthal_modes, int const norder_z, bool const nodal, - const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Vector<amrex::Real>& v_galilean, amrex::Real const dt, bool const update_with_rho) // Initialize members of base class diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H index 1df77f6f3..d0dce0fef 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H @@ -54,7 +54,7 @@ class PsatdAlgorithm : public SpectralBaseAlgorithm const int norder_z, const bool nodal, const amrex::IntVect& fill_guards, - const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Vector<amrex::Real>& v_galilean, const amrex::Real dt, const bool update_with_rho, const bool time_averaging, @@ -162,7 +162,7 @@ class PsatdAlgorithm : public SpectralBaseAlgorithm KVectorComponent modified_kz_vec_centered; // Other member variables - amrex::Array<amrex::Real,3> m_v_galilean; + amrex::Vector<amrex::Real> m_v_galilean; amrex::Real m_dt; bool m_update_with_rho; bool m_time_averaging; diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp index a605835e5..b3a4ec885 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp @@ -35,7 +35,7 @@ PsatdAlgorithm::PsatdAlgorithm( const int norder_z, const bool nodal, const amrex::IntVect& fill_guards, - const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Vector<amrex::Real>& v_galilean, const amrex::Real dt, const bool update_with_rho, const bool time_averaging, diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H index 50b9978f4..b2a33c323 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H @@ -72,8 +72,8 @@ class SpectralSolver const int norder_x, const int norder_y, const int norder_z, const bool nodal, const amrex::IntVect& fill_guards, - const amrex::Array<amrex::Real,3>& v_galilean, - const amrex::Array<amrex::Real,3>& v_comoving, + const amrex::Vector<amrex::Real>& v_galilean, + const amrex::Vector<amrex::Real>& v_comoving, const amrex::RealVect dx, const amrex::Real dt, const bool pml, diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp index 8dd6b2bd9..a6b2f0aa4 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -24,8 +24,8 @@ SpectralSolver::SpectralSolver( const int norder_x, const int norder_y, const int norder_z, const bool nodal, const amrex::IntVect& fill_guards, - const amrex::Array<amrex::Real,3>& v_galilean, - const amrex::Array<amrex::Real,3>& v_comoving, + const amrex::Vector<amrex::Real>& v_galilean, + const amrex::Vector<amrex::Real>& v_comoving, const amrex::RealVect dx, const amrex::Real dt, const bool pml, const bool periodic_single_box, const bool update_with_rho, diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H index e08d5741c..52f422799 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H +++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H @@ -32,7 +32,7 @@ class SpectralSolverRZ amrex::DistributionMapping const & dm, int const n_rz_azimuthal_modes, int const norder_z, bool const nodal, - const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Vector<amrex::Real>& v_galilean, amrex::RealVect const dx, amrex::Real const dt, bool const update_with_rho, const bool fft_do_time_averaging, diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp index 12c2dabf2..b47dfa4ad 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp @@ -30,7 +30,7 @@ SpectralSolverRZ::SpectralSolverRZ (const int lev, amrex::DistributionMapping const & dm, int const n_rz_azimuthal_modes, int const norder_z, bool const nodal, - const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Vector<amrex::Real>& v_galilean, amrex::RealVect const dx, amrex::Real const dt, bool const update_with_rho, const bool fft_do_time_averaging, diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index dfe959bb2..aa02c94f5 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -205,7 +205,7 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) // so that inj_pos->getPositionUnitBox calls // InjectorPosition[Random or Regular].getPositionUnitBox. else if (injection_style == "nrandompercell") { - pp_species_name.query("num_particles_per_cell", num_particles_per_cell); + queryWithParser(pp_species_name, "num_particles_per_cell", num_particles_per_cell); #if WARPX_DIM_RZ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( num_particles_per_cell>=2*WarpX::n_rz_azimuthal_modes, @@ -229,7 +229,7 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) "of particles should be at least two times n_rz_azimuthal_modes " "(Please visit PR#765 for more information.)"); #endif - pp_species_name.get("surface_flux_pos", surface_flux_pos); + getWithParser(pp_species_name, "surface_flux_pos", surface_flux_pos); std::string flux_normal_axis_string; pp_species_name.get("flux_normal_axis", flux_normal_axis_string); flux_normal_axis = -1; @@ -274,10 +274,15 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name) } else if (injection_style == "nuniformpercell") { // Note that for RZ, three numbers are expected, r, theta, and z. // For 2D, only two are expected. The third is overwritten with 1. - num_particles_per_cell_each_dim.assign(3, 1); - pp_species_name.getarr("num_particles_per_cell_each_dim", num_particles_per_cell_each_dim); #if WARPX_DIM_XZ - num_particles_per_cell_each_dim[2] = 1; + constexpr int num_required_ppc_each_dim = 2; +#else + constexpr int num_required_ppc_each_dim = 3; +#endif + getArrWithParser(pp_species_name, "num_particles_per_cell_each_dim", + num_particles_per_cell_each_dim, 0, num_required_ppc_each_dim); +#if WARPX_DIM_XZ + num_particles_per_cell_each_dim.push_back(1); #endif #if WARPX_DIM_RZ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp index 63d7beea2..d43d9305f 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp @@ -7,6 +7,7 @@ #include "Laser/LaserProfiles.H" #include "Utils/WarpX_Complex.H" +#include "Utils/WarpXUtil.H" #include <AMReX.H> #include <AMReX_Extension.H> @@ -39,7 +40,7 @@ WarpXLaserProfiles::FieldFunctionLaserProfile::init ( symbols.erase("t"); // after removing variables, we are left with constants for (auto it = symbols.begin(); it != symbols.end(); ) { Real v; - if (ppc.query(it->c_str(), v)) { + if (queryWithParser(ppc, it->c_str(), v)) { m_parser.setConstant(*it, v); it = symbols.erase(it); } else { diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp index 127470314..b9b31ec7e 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp @@ -60,7 +60,7 @@ WarpXLaserProfiles::FromTXYEFileLaserProfile::init ( //Set time_chunk_size m_params.time_chunk_size = m_params.nt; int temp = 1; - if(ppl.query("time_chunk_size", temp)){ + if(queryWithParser(ppl ,"time_chunk_size", temp)){ m_params.time_chunk_size = min( temp, m_params.time_chunk_size); } @@ -69,7 +69,7 @@ WarpXLaserProfiles::FromTXYEFileLaserProfile::init ( } //Reads the (optional) delay - ppl.query("delay", m_params.t_delay); + queryWithParser(ppl, "delay", m_params.t_delay); //Allocate memory for E_data Vector const int data_size = m_params.time_chunk_size* diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H index 4568db45a..51abaef41 100644 --- a/Source/Parallelization/GuardCellManager.H +++ b/Source/Parallelization/GuardCellManager.H @@ -50,8 +50,8 @@ public: const int nci_corr_stencil, const int maxwell_solver_id, const int max_level, - const amrex::Array<amrex::Real,3> v_galilean, - const amrex::Array<amrex::Real,3> v_comoving, + const amrex::Vector<amrex::Real> v_galilean, + const amrex::Vector<amrex::Real> v_comoving, const bool safe_guard_cells, const int do_electrostatic); diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp index 8dd44f706..6e3b46645 100644 --- a/Source/Parallelization/GuardCellManager.cpp +++ b/Source/Parallelization/GuardCellManager.cpp @@ -17,6 +17,7 @@ #include "Filter/NCIGodfreyFilter.H" #include "Utils/WarpXAlgorithmSelection.H" #include "Utils/WarpXConst.H" +#include "Utils/WarpXUtil.H" #include <AMReX_Config.H> #include <AMReX_INT.H> @@ -42,8 +43,8 @@ guardCellManager::Init ( const int nci_corr_stencil, const int maxwell_solver_id, const int max_level, - const amrex::Array<amrex::Real,3> v_galilean, - const amrex::Array<amrex::Real,3> v_comoving, + const amrex::Vector<amrex::Real> v_galilean, + const amrex::Vector<amrex::Real> v_comoving, const bool safe_guard_cells, const int do_electrostatic) { @@ -164,9 +165,9 @@ guardCellManager::Init ( int ngFFt_z = (do_nodal || galilean) ? noz_fft : noz_fft / 2; ParmParse pp_psatd("psatd"); - pp_psatd.query("nx_guard", ngFFt_x); - pp_psatd.query("ny_guard", ngFFt_y); - pp_psatd.query("nz_guard", ngFFt_z); + queryWithParser(pp_psatd, "nx_guard", ngFFt_x); + queryWithParser(pp_psatd, "ny_guard", ngFFt_y); + queryWithParser(pp_psatd, "nz_guard", ngFFt_z); #if (AMREX_SPACEDIM == 3) IntVect ngFFT = IntVect(ngFFt_x, ngFFt_y, ngFFt_z); diff --git a/Source/Particles/Collision/BackgroundMCCCollision.cpp b/Source/Particles/Collision/BackgroundMCCCollision.cpp index 5de6ab587..23c79d021 100644 --- a/Source/Particles/Collision/BackgroundMCCCollision.cpp +++ b/Source/Particles/Collision/BackgroundMCCCollision.cpp @@ -25,29 +25,29 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_species_names.size() == 1, "Background MCC must have exactly one species."); - amrex::ParmParse pp(collision_name); + amrex::ParmParse pp_collision_name(collision_name); - pp.query("background_density", m_background_density); - pp.query("background_temperature", m_background_temperature); + queryWithParser(pp_collision_name, "background_density", m_background_density); + queryWithParser(pp_collision_name, "background_temperature", m_background_temperature); // if the neutral mass is specified use it, but if ionization is // included the mass of the secondary species of that interaction // will be used. If no neutral mass is specified and ionization is not // included the mass of the colliding species will be used m_background_mass = -1; - pp.query("background_mass", m_background_mass); + queryWithParser(pp_collision_name, "background_mass", m_background_mass); // query for a list of collision processes // these could be elastic, excitation, charge_exchange, back, etc. amrex::Vector<std::string> scattering_process_names; - pp.queryarr("scattering_processes", scattering_process_names); + pp_collision_name.queryarr("scattering_processes", scattering_process_names); // create a vector of MCCProcess objects from each scattering // process name for (auto scattering_process : scattering_process_names) { std::string kw_cross_section = scattering_process + "_cross_section"; std::string cross_section_file; - pp.query(kw_cross_section.c_str(), cross_section_file); + pp_collision_name.query(kw_cross_section.c_str(), cross_section_file); amrex::Real energy = 0.0; // if the scattering process is excitation or ionization get the @@ -55,7 +55,7 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name if (scattering_process.find("excitation") != std::string::npos || scattering_process.find("ionization") != std::string::npos) { std::string kw_energy = scattering_process + "_energy"; - pp.get(kw_energy.c_str(), energy); + getWithParser(pp_collision_name, kw_energy.c_str(), energy); } MCCProcess process(scattering_process, cross_section_file, energy); @@ -74,7 +74,7 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name ionization_flag = true; std::string secondary_species; - pp.get("ionization_species", secondary_species); + pp_collision_name.get("ionization_species", secondary_species); m_species_names.push_back(secondary_species); m_ionization_processes.push_back(std::move(process)); diff --git a/Source/Particles/Collision/CollisionBase.cpp b/Source/Particles/Collision/CollisionBase.cpp index 067a8c7e9..470408de0 100644 --- a/Source/Particles/Collision/CollisionBase.cpp +++ b/Source/Particles/Collision/CollisionBase.cpp @@ -6,6 +6,8 @@ */ #include "CollisionBase.H" +#include "Utils/WarpXUtil.H" + #include <AMReX_ParmParse.H> CollisionBase::CollisionBase (std::string collision_name) @@ -17,7 +19,7 @@ CollisionBase::CollisionBase (std::string collision_name) // number of time steps between collisions m_ndt = 1; - pp_collision_name.query("ndt", m_ndt); + queryWithParser(pp_collision_name, "ndt", m_ndt); } diff --git a/Source/Particles/ElementaryProcess/Ionization.H b/Source/Particles/ElementaryProcess/Ionization.H index c970fb4f9..88ea55a43 100644 --- a/Source/Particles/ElementaryProcess/Ionization.H +++ b/Source/Particles/ElementaryProcess/Ionization.H @@ -71,7 +71,7 @@ struct IonizationFilterFunc amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - amrex::Array<amrex::Real,3> v_galilean, + amrex::Vector<amrex::Real> v_galilean, const amrex::Real* const AMREX_RESTRICT a_ionization_energies, const amrex::Real* const AMREX_RESTRICT a_adk_prefactor, const amrex::Real* const AMREX_RESTRICT a_adk_exp_prefactor, diff --git a/Source/Particles/ElementaryProcess/Ionization.cpp b/Source/Particles/ElementaryProcess/Ionization.cpp index 4e361e8e5..8f57b6115 100644 --- a/Source/Particles/ElementaryProcess/Ionization.cpp +++ b/Source/Particles/ElementaryProcess/Ionization.cpp @@ -24,7 +24,7 @@ IonizationFilterFunc::IonizationFilterFunc (const WarpXParIter& a_pti, int lev, amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - amrex::Array<amrex::Real,3> v_galilean, + amrex::Vector<amrex::Real> v_galilean, const amrex::Real* const AMREX_RESTRICT a_ionization_energies, const amrex::Real* const AMREX_RESTRICT a_adk_prefactor, const amrex::Real* const AMREX_RESTRICT a_adk_exp_prefactor, diff --git a/Source/Particles/ElementaryProcess/QEDPairGeneration.H b/Source/Particles/ElementaryProcess/QEDPairGeneration.H index 2303d0bde..29e4eb134 100644 --- a/Source/Particles/ElementaryProcess/QEDPairGeneration.H +++ b/Source/Particles/ElementaryProcess/QEDPairGeneration.H @@ -94,7 +94,7 @@ public: amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - amrex::Array<amrex::Real,3> v_galilean, + amrex::Vector<amrex::Real> v_galilean, int a_offset = 0); /** diff --git a/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp b/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp index 344fd973a..b97c9fe8d 100644 --- a/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp +++ b/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp @@ -26,7 +26,7 @@ PairGenerationTransformFunc (BreitWheelerGeneratePairs const generate_functor, amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - amrex::Array<amrex::Real,3> v_galilean, + amrex::Vector<amrex::Real> v_galilean, int a_offset) : m_generate_functor(generate_functor) { diff --git a/Source/Particles/ElementaryProcess/QEDPhotonEmission.H b/Source/Particles/ElementaryProcess/QEDPhotonEmission.H index a311f2cf4..3d922216d 100644 --- a/Source/Particles/ElementaryProcess/QEDPhotonEmission.H +++ b/Source/Particles/ElementaryProcess/QEDPhotonEmission.H @@ -108,7 +108,7 @@ public: amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - amrex::Array<amrex::Real,3> v_galilean, + amrex::Vector<amrex::Real> v_galilean, int a_offset = 0); /** diff --git a/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp b/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp index 3feec1ec7..464ea0aec 100644 --- a/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp +++ b/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp @@ -27,7 +27,7 @@ PhotonEmissionTransformFunc (QuantumSynchrotronGetOpticalDepth opt_depth_functor amrex::FArrayBox const& bxfab, amrex::FArrayBox const& byfab, amrex::FArrayBox const& bzfab, - amrex::Array<amrex::Real,3> v_galilean, + amrex::Vector<amrex::Real> v_galilean, int a_offset) :m_opt_depth_functor{opt_depth_functor}, m_opt_depth_runtime_comp{opt_depth_runtime_comp}, diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index f7e990c34..ea8e58ee7 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -371,7 +371,8 @@ MultiParticleContainer::ReadParameters () #if (AMREX_SPACEDIM == 2) getWithParser(pp_qed_schwinger, "y_size",m_qed_schwinger_y_size); #endif - pp_qed_schwinger.query("threshold_poisson_gaussian", m_qed_schwinger_threshold_poisson_gaussian); + queryWithParser(pp_qed_schwinger, "threshold_poisson_gaussian", + m_qed_schwinger_threshold_poisson_gaussian); queryWithParser(pp_qed_schwinger, "xmin", m_qed_schwinger_xmin); queryWithParser(pp_qed_schwinger, "xmax", m_qed_schwinger_xmax); #if (AMREX_SPACEDIM == 3) @@ -1139,7 +1140,7 @@ MultiParticleContainer::QuantumSyncGenerateTable () getWithParser(pp_qed_qs, "tab_dndt_chi_max", ctrl.dndt_params.chi_part_max); //How many points should be used for chi in the table - pp_qed_qs.get("tab_dndt_how_many", ctrl.dndt_params.chi_part_how_many); + getWithParser(pp_qed_qs, "tab_dndt_how_many", ctrl.dndt_params.chi_part_how_many); //------ //--- sub-table 2 (2D) @@ -1156,7 +1157,7 @@ MultiParticleContainer::QuantumSyncGenerateTable () getWithParser(pp_qed_qs, "tab_em_chi_max", ctrl.phot_em_params.chi_part_max); //How many points should be used for chi in the table - pp_qed_qs.get("tab_em_chi_how_many", ctrl.phot_em_params.chi_part_how_many); + getWithParser(pp_qed_qs, "tab_em_chi_how_many", ctrl.phot_em_params.chi_part_how_many); //The other axis of the table is the ratio between the quantum //parameter of the emitted photon and the quantum parameter of the @@ -1165,7 +1166,7 @@ MultiParticleContainer::QuantumSyncGenerateTable () //This parameter is the number of different points to consider for the second //axis - pp_qed_qs.get("tab_em_frac_how_many", ctrl.phot_em_params.frac_how_many); + getWithParser(pp_qed_qs, "tab_em_frac_how_many", ctrl.phot_em_params.frac_how_many); //==================== m_shr_p_qs_engine->compute_lookup_tables(ctrl, qs_minimum_chi_part); @@ -1220,7 +1221,7 @@ MultiParticleContainer::BreitWheelerGenerateTable () getWithParser(pp_qed_bw, "tab_dndt_chi_max", ctrl.dndt_params.chi_phot_max); //How many points should be used for chi in the table - pp_qed_bw.get("tab_dndt_how_many", ctrl.dndt_params.chi_phot_how_many); + getWithParser(pp_qed_bw, "tab_dndt_how_many", ctrl.dndt_params.chi_phot_how_many); //------ //--- sub-table 2 (2D) @@ -1237,12 +1238,12 @@ MultiParticleContainer::BreitWheelerGenerateTable () getWithParser(pp_qed_bw, "tab_pair_chi_max", ctrl.pair_prod_params.chi_phot_max); //How many points should be used for chi in the table - pp_qed_bw.get("tab_pair_chi_how_many", ctrl.pair_prod_params.chi_phot_how_many); + getWithParser(pp_qed_bw, "tab_pair_chi_how_many", ctrl.pair_prod_params.chi_phot_how_many); //The other axis of the table is the fraction of the initial energy //'taken away' by the most energetic particle of the pair. //This parameter is the number of different fractions to consider - pp_qed_bw.get("tab_pair_frac_how_many", ctrl.pair_prod_params.frac_how_many); + getWithParser(pp_qed_bw, "tab_pair_frac_how_many", ctrl.pair_prod_params.frac_how_many); //==================== m_shr_p_bw_engine->compute_lookup_tables(ctrl, bw_minimum_chi_part); diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 0369c6e54..d6238528f 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -233,7 +233,7 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp pp_species_name.query("do_continuous_injection", do_continuous_injection); pp_species_name.query("initialize_self_fields", initialize_self_fields); queryWithParser(pp_species_name, "self_fields_required_precision", self_fields_required_precision); - pp_species_name.query("self_fields_max_iters", self_fields_max_iters); + queryWithParser(pp_species_name, "self_fields_max_iters", self_fields_max_iters); pp_species_name.query("self_fields_verbosity", self_fields_verbosity); // Whether to plot back-transformed (lab-frame) diagnostics // for this species. @@ -312,7 +312,7 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp if (use_default_v_galilean) { m_v_galilean[2] = -std::sqrt(1._rt - 1._rt / (WarpX::gamma_boost * WarpX::gamma_boost)); } else { - pp_psatd.query("v_galilean", m_v_galilean); + queryArrWithParser(pp_psatd, "v_galilean", m_v_galilean, 0, 3); } // Scale the Galilean velocity by the speed of light for (int i=0; i<3; i++) m_v_galilean[i] *= PhysConst::c; @@ -2521,7 +2521,7 @@ PhysicalParticleContainer::InitIonizationModule () "charge != q_e for ionizable species: overriding user value and setting charge = q_e."); charge = PhysConst::q_e; } - pp_species_name.query("ionization_initial_level", ionization_initial_level); + queryWithParser(pp_species_name, "ionization_initial_level", ionization_initial_level); pp_species_name.get("ionization_product_species", ionization_product_name); pp_species_name.get("physical_element", physical_element); // Add runtime integer component for ionization level diff --git a/Source/Particles/Resampling/LevelingThinning.cpp b/Source/Particles/Resampling/LevelingThinning.cpp index 8d2516a0f..33ad87630 100644 --- a/Source/Particles/Resampling/LevelingThinning.cpp +++ b/Source/Particles/Resampling/LevelingThinning.cpp @@ -40,7 +40,7 @@ LevelingThinning::LevelingThinning (const std::string species_name) " It is possible that no particle will be removed during resampling"); } - pp_species_name.query("resampling_algorithm_min_ppc", m_min_ppc); + queryWithParser(pp_species_name, "resampling_algorithm_min_ppc", m_min_ppc); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_min_ppc >= 1, "Resampling min_ppc should be greater than or equal to 1"); } diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index 9c7d8a462..de8e198c0 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -353,7 +353,7 @@ public: */ std::string getSpeciesTypeName () const {return species::get_name(physical_species);} - amrex::Array<amrex::Real,3> get_v_galilean () {return m_v_galilean;} + amrex::Vector<amrex::Real> get_v_galilean () {return m_v_galilean;} /** * \brief Virtual method to resample the species. Overriden by PhysicalParticleContainer only. @@ -372,7 +372,7 @@ public: void defineAllParticleTiles () noexcept; protected: - amrex::Array<amrex::Real,3> m_v_galilean = {{0}}; + amrex::Vector<amrex::Real> m_v_galilean{amrex::Vector<amrex::Real>(3, amrex::Real(0.))}; std::map<std::string, int> particle_comps; std::map<std::string, int> particle_icomps; std::map<std::string, int> particle_runtime_comps; diff --git a/Source/Utils/WarpXUtil.H b/Source/Utils/WarpXUtil.H index 745d8eb0c..66b0287ed 100644 --- a/Source/Utils/WarpXUtil.H +++ b/Source/Utils/WarpXUtil.H @@ -10,6 +10,7 @@ #include <AMReX_Extension.H> #include <AMReX_GpuQualifiers.H> +#include <AMReX_ParmParse.H> #include <AMReX_Parser.H> #include <AMReX_REAL.H> #include <AMReX_Utility.H> @@ -257,16 +258,20 @@ amrex::ParserExecutor<N> compileParser (amrex::Parser const* parser) * \param[in] a_pp amrex::ParmParse object * \param[in] str name of the parameter to read * \param[out] val where the value queried and parsed is stored, either a scalar or vector - * \param[in] start_ix start index in the list of inputs values (optional with arrays) - * \param[in] num_val number of input values to use (optional with arrays) + * \param[in] start_ix start index in the list of inputs values (optional with arrays, default is + * amrex::ParmParse::FIRST for starting with the first input value) + * \param[in] num_val number of input values to use (optional with arrays, default is + * amrex::ParmParse::LAST for reading until the last input value) */ int queryWithParser (const amrex::ParmParse& a_pp, char const * const str, float& val); int queryWithParser (const amrex::ParmParse& a_pp, char const * const str, double& val); int queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val, - const int start_ix, const int num_val); + const int start_ix = amrex::ParmParse::FIRST, + const int num_val = amrex::ParmParse::LAST); int queryWithParser (const amrex::ParmParse& a_pp, char const * const str, int& val); int queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val, - const int start_ix, const int num_val); + const int start_ix = amrex::ParmParse::FIRST, + const int num_val = amrex::ParmParse::LAST); /** * \brief Similar to amrex::ParmParse::get, but also supports math expressions for the value. @@ -279,18 +284,20 @@ int queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, st * \param[in] a_pp amrex::ParmParse object * \param[in] str name of the parameter to read * \param[out] val where the value queried and parsed is stored - * \param[in] start_ix start index in the list of inputs values (optional with arrays) - * \param[in] num_val number of input values to use (optional with arrays) + * \param[in] start_ix start index in the list of inputs values (optional with arrays, default is + * amrex::ParmParse::FIRST for starting with the first input value) + * \param[in] num_val number of input values to use (optional with arrays, default is + * amrex::ParmParse::LAST for reading until the last input value) */ void getWithParser (const amrex::ParmParse& a_pp, char const * const str, float& val); void getWithParser (const amrex::ParmParse& a_pp, char const * const str, double& val); -void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val); void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val, - const int start_ix, const int num_val); + const int start_ix = amrex::ParmParse::FIRST, + const int num_val = amrex::ParmParse::LAST); void getWithParser (const amrex::ParmParse& a_pp, char const * const str, int& val); -void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val); void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val, - const int start_ix, const int num_val); + const int start_ix = amrex::ParmParse::FIRST, + const int num_val = amrex::ParmParse::LAST); namespace WarpXUtilMsg{ diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index d92f75b9e..64b30a9b1 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -455,20 +455,6 @@ queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::v } void -getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val) -{ - // Create parser objects and apply them to the values provided by the user. - std::vector<std::string> tmp_str_arr; - a_pp.getarr(str, tmp_str_arr); - - int const n = static_cast<int>(tmp_str_arr.size()); - val.resize(n); - for (int i=0 ; i < n ; i++) { - val[i] = parseStringtoReal(tmp_str_arr[i]); - } -} - -void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<amrex::Real>& val, const int start_ix, const int num_val) { @@ -511,15 +497,6 @@ int queryArrWithParser (const amrex::ParmParse& a_pp, char const * const str, st return result; } -void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val) { - std::vector<amrex::Real> rval; - getArrWithParser(a_pp, str, rval); - val.resize(rval.size()); - for (unsigned long i = 0 ; i < val.size() ; i++) { - val[i] = safeCastToInt(std::round(rval[i]), str); - } -} - void getArrWithParser (const amrex::ParmParse& a_pp, char const * const str, std::vector<int>& val, const int start_ix, const int num_val) { std::vector<amrex::Real> rval; @@ -564,7 +541,7 @@ void CheckGriddingForRZSpectral () ParmParse pp_amr("amr"); pp_amr.get("max_level",max_level); - pp_amr.getarr("n_cell",n_cell,0,AMREX_SPACEDIM); + pp_amr.getarr("n_cell", n_cell, 0, AMREX_SPACEDIM); Vector<int> blocking_factor_x(max_level+1); Vector<int> max_grid_size_x(max_level+1); @@ -596,8 +573,8 @@ void CheckGriddingForRZSpectral () // Get the longitudinal blocking factor in case it was set by the user. // If not set, use the default value of 8. Vector<int> bf; - pp_amr.queryarr("blocking_factor",bf); - pp_amr.queryarr("blocking_factor_y",bf); + pp_amr.queryarr("blocking_factor", bf); + pp_amr.queryarr("blocking_factor_y", bf); bf.resize(std::max(static_cast<int>(bf.size()),1),8); // Modify the default or any user input, making sure that the blocking factor @@ -611,8 +588,8 @@ void CheckGriddingForRZSpectral () // Get the longitudinal max grid size in case it was set by the user. // If not set, use the default value of 128. Vector<int> mg; - pp_amr.queryarr("max_grid_size",mg); - pp_amr.queryarr("max_grid_size_y",mg); + pp_amr.queryarr("max_grid_size", mg); + pp_amr.queryarr("max_grid_size_y", mg); mg.resize(std::max(static_cast<int>(mg.size()),1),128); // Modify the default or any user input, making sure that the max grid size diff --git a/Source/WarpX.H b/Source/WarpX.H index 942accc4c..64ae90c14 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -325,10 +325,10 @@ public: amrex::Vector< std::unique_ptr<NCIGodfreyFilter> > nci_godfrey_filter_bxbyez; amrex::Real time_of_last_gal_shift = 0; - amrex::Array<amrex::Real,3> m_v_galilean = {{0}}; + amrex::Vector<amrex::Real> m_v_galilean{amrex::Vector<amrex::Real>(3, amrex::Real(0.))}; amrex::Array<amrex::Real,3> m_galilean_shift = {{0}}; - amrex::Array<amrex::Real,3> m_v_comoving = {{0.}}; + amrex::Vector<amrex::Real> m_v_comoving{amrex::Vector<amrex::Real>(3, amrex::Real(0.))}; static int num_mirrors; amrex::Vector<amrex::Real> mirror_z; @@ -561,7 +561,7 @@ public: /* /brief This computes the lower of the problem domain, taking into account any shift when using the Galilean algorithm. */ - std::array<amrex::Real,3> LowerCornerWithGalilean (const amrex::Box& bx, const amrex::Array<amrex::Real,3>& v_galilean, int lev); + std::array<amrex::Real,3> LowerCornerWithGalilean (const amrex::Box& bx, const amrex::Vector<amrex::Real>& v_galilean, int lev); static amrex::IntVect RefRatio (int lev); diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 7f5d9e62e..782d81623 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -473,7 +473,7 @@ WarpX::ReadParameters () pp_warpx.query("do_multi_J", do_multi_J); if (do_multi_J) { - pp_warpx.get("do_multi_J_n_depositions", do_multi_J_n_depositions); + getWithParser(pp_warpx, "do_multi_J_n_depositions", do_multi_J_n_depositions); } pp_warpx.query("use_hybrid_QED", use_hybrid_QED); pp_warpx.query("safe_guard_cells", safe_guard_cells); @@ -488,7 +488,7 @@ WarpX::ReadParameters () pp_warpx.query("do_device_synchronize_before_profile", do_device_synchronize_before_profile); - // pp.query returns 1 if argument zmax_plasma_to_compute_max_step is + // queryWithParser returns 1 if argument zmax_plasma_to_compute_max_step is // specified by the user, 0 otherwise. do_compute_max_step_from_zmax = queryWithParser(pp_warpx, "zmax_plasma_to_compute_max_step", @@ -522,7 +522,7 @@ WarpX::ReadParameters () moving_window_x = geom[0].ProbLo(moving_window_dir); - pp_warpx.get("moving_window_v", moving_window_v); + getWithParser(pp_warpx, "moving_window_v", moving_window_v); moving_window_v *= PhysConst::c; } @@ -627,22 +627,22 @@ WarpX::ReadParameters () } #endif - pp_warpx.query("num_mirrors", num_mirrors); + queryWithParser(pp_warpx, "num_mirrors", num_mirrors); if (num_mirrors>0){ mirror_z.resize(num_mirrors); getArrWithParser(pp_warpx, "mirror_z", mirror_z, 0, num_mirrors); mirror_z_width.resize(num_mirrors); getArrWithParser(pp_warpx, "mirror_z_width", mirror_z_width, 0, num_mirrors); mirror_z_npoints.resize(num_mirrors); - pp_warpx.getarr("mirror_z_npoints", mirror_z_npoints, 0, num_mirrors); + getArrWithParser(pp_warpx, "mirror_z_npoints", mirror_z_npoints, 0, num_mirrors); } pp_warpx.query("serialize_ics", serialize_ics); pp_warpx.query("refine_plasma", refine_plasma); pp_warpx.query("do_dive_cleaning", do_dive_cleaning); pp_warpx.query("do_divb_cleaning", do_divb_cleaning); - pp_warpx.query("n_field_gather_buffer", n_field_gather_buffer); - pp_warpx.query("n_current_deposition_buffer", n_current_deposition_buffer); + queryWithParser(pp_warpx, "n_field_gather_buffer", n_field_gather_buffer); + queryWithParser(pp_warpx, "n_current_deposition_buffer", n_current_deposition_buffer); amrex::Real quantum_xi_tmp; int quantum_xi_is_specified = queryWithParser(pp_warpx, "quantum_xi", quantum_xi_tmp); @@ -912,7 +912,8 @@ WarpX::ReadParameters () sort_intervals = IntervalsParser(sort_intervals_string_vec); Vector<int> vect_sort_bin_size(AMREX_SPACEDIM,1); - bool sort_bin_size_is_specified = pp_warpx.queryarr("sort_bin_size", vect_sort_bin_size); + bool sort_bin_size_is_specified = queryArrWithParser(pp_warpx, "sort_bin_size", + vect_sort_bin_size, 0, AMREX_SPACEDIM); if (sort_bin_size_is_specified){ for (int i=0; i<AMREX_SPACEDIM; i++) sort_bin_size[i] = vect_sort_bin_size[i]; @@ -1028,7 +1029,7 @@ WarpX::ReadParameters () if (use_default_v_galilean) { m_v_galilean[2] = -std::sqrt(1._rt - 1._rt / (gamma_boost * gamma_boost)); } else { - pp_psatd.query("v_galilean", m_v_galilean); + queryArrWithParser(pp_psatd, "v_galilean", m_v_galilean, 0, 3); } // Check whether the default comoving velocity should be used @@ -1040,7 +1041,7 @@ WarpX::ReadParameters () } else { - pp_psatd.query("v_comoving", m_v_comoving); + queryArrWithParser(pp_psatd, "v_comoving", m_v_comoving, 0, 3); } // Galilean and comoving algorithms should not be used together @@ -2005,7 +2006,7 @@ WarpX::UpperCorner(const Box& bx, int lev) } std::array<Real,3> -WarpX::LowerCornerWithGalilean (const Box& bx, const amrex::Array<amrex::Real,3>& v_galilean, int lev) +WarpX::LowerCornerWithGalilean (const Box& bx, const amrex::Vector<amrex::Real>& v_galilean, int lev) { amrex::Real cur_time = gett_new(lev); amrex::Real time_shift = (cur_time - time_of_last_gal_shift); |