diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp index a572eaa2ed3..26e7a025ff2 100644 --- a/Source/Diagnostics/WarpXIO.cpp +++ b/Source/Diagnostics/WarpXIO.cpp @@ -339,18 +339,18 @@ WarpX::InitFromCheckpoint () if (lev > 0) { - VisMF::Read(*m_fields.get("Efield_fp", Direction{0}, lev), + VisMF::Read(*m_fields.get("Efield_cp", Direction{0}, lev), amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Ex_cp")); - VisMF::Read(*m_fields.get("Efield_fp", Direction{1}, lev), + VisMF::Read(*m_fields.get("Efield_cp", Direction{1}, lev), amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Ey_cp")); - VisMF::Read(*m_fields.get("Efield_fp", Direction{2}, lev), + VisMF::Read(*m_fields.get("Efield_cp", Direction{2}, lev), amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Ez_cp")); - VisMF::Read(*m_fields.get("Bfield_fp", Direction{0}, lev), + VisMF::Read(*m_fields.get("Bfield_cp", Direction{0}, lev), amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Bx_cp")); - VisMF::Read(*m_fields.get("Bfield_fp", Direction{1}, lev), + VisMF::Read(*m_fields.get("Bfield_cp", Direction{1}, lev), amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "By_cp")); - VisMF::Read(*m_fields.get("Bfield_fp", Direction{2}, lev), + VisMF::Read(*m_fields.get("Bfield_cp", Direction{2}, lev), amrex::MultiFabFileFullPrefix(lev, restart_chkfile, level_prefix, "Bz_cp")); if (WarpX::fft_do_time_averaging) diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp index 7e9f62c589b..d80ca9db15e 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp @@ -64,7 +64,7 @@ void FiniteDifferenceSolver::EvolveE ( fields.get_alldirs("current_fp", lev) : fields.get_alldirs("current_cp", lev); amrex::MultiFab* Ffield = nullptr; - if (fields.has("F_fp", Direction{0}, lev)) { + if (fields.has("F_fp", lev)) { Ffield = patch_type == PatchType::fine ? fields.get("F_fp", lev) : fields.get("F_cp", lev); } diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp index ac5bf34a1ff..f8505d91d44 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp @@ -539,7 +539,7 @@ void HybridPICModel::FillElectronPressureMF ( void HybridPICModel::BfieldEvolveRK ( ablastr::fields::MultiLevelVectorField const& Bfield, - ablastr::fields::MultiLevelVectorField const&Efield, + ablastr::fields::MultiLevelVectorField const& Efield, ablastr::fields::MultiLevelVectorField const& Jfield, ablastr::fields::MultiLevelScalarField const& rhofield, ablastr::fields::MultiLevelVectorField const& edge_lengths, diff --git a/Source/FieldSolver/WarpXPushFieldsHybridPIC.cpp b/Source/FieldSolver/WarpXPushFieldsHybridPIC.cpp index ea5517f31aa..a8d70d8d792 100644 --- a/Source/FieldSolver/WarpXPushFieldsHybridPIC.cpp +++ b/Source/FieldSolver/WarpXPushFieldsHybridPIC.cpp @@ -107,7 +107,7 @@ void WarpX::HybridPICEvolveFields () m_fields.get_mr_levels_alldirs("Bfield_fp", finest_level), m_fields.get_mr_levels_alldirs("Efield_fp", finest_level), current_fp_temp, rho_fp_temp, - m_fields.get_mr_levels_alldirs("edge_lenghts", finest_level), + m_fields.get_mr_levels_alldirs("edge_lengths", finest_level), 0.5_rt/sub_steps*dt[0], DtType::FirstHalf, guard_cells.ng_FieldSolver, WarpX::sync_nodal_points @@ -134,7 +134,7 @@ void WarpX::HybridPICEvolveFields () m_fields.get_mr_levels_alldirs("Efield_fp", finest_level), m_fields.get_mr_levels_alldirs("current_fp", finest_level), rho_fp_temp, - m_fields.get_mr_levels_alldirs("edge_lenghts", finest_level), + m_fields.get_mr_levels_alldirs("edge_lengths", finest_level), 0.5_rt/sub_steps*dt[0], DtType::SecondHalf, guard_cells.ng_FieldSolver, WarpX::sync_nodal_points diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index a44808195e0..472461d3317 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -472,7 +472,7 @@ MultiParticleContainer::Evolve (ablastr::fields::MultiFabRegister& fields, fields.get(current_fp_string, Direction{2}, lev)->setVal(0.0); if (fields.has("current_buf", Direction{0}, lev)) { fields.get("current_buf", Direction{0}, lev)->setVal(0.0); } if (fields.has("current_buf", Direction{1}, lev)) { fields.get("current_buf", Direction{1}, lev)->setVal(0.0); } - if (fields.has("current_buf", Direction{1}, lev)) { fields.get("current_buf", Direction{2}, lev)->setVal(0.0); } + if (fields.has("current_buf", Direction{2}, lev)) { fields.get("current_buf", Direction{2}, lev)->setVal(0.0); } if (fields.has("rho_fp", lev)) { fields.get("rho_fp", lev)->setVal(0.0); } if (fields.has("rho_buf", lev)) { fields.get("rho_buf", lev)->setVal(0.0); } } diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 1ff712538ef..4cf6345c520 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1762,7 +1762,6 @@ PhysicalParticleContainer::Evolve (ablastr::fields::MultiFabRegister& fields, const iMultiFab* current_masks = WarpX::CurrentBufferMasks(lev); const iMultiFab* gather_masks = WarpX::GatherBufferMasks(lev); - using ablastr::fields::Direction; const bool has_rho = fields.has("rho_fp", lev); const bool has_cjx = fields.has("current_buf", Direction{0}, lev); const bool has_cEx = fields.has("Efield_cax", Direction{0}, lev); diff --git a/Source/WarpX.H b/Source/WarpX.H index 338a88b28b1..45ffa150c3d 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -485,7 +485,7 @@ public: * Set the dotMask container */ void SetDotMask( std::unique_ptr& field_dotMask, - const std::string& field_name, int lev, int dir ) const; + std::string const & field_name, int lev, int dir ) const; [[nodiscard]] bool DoPML () const {return do_pml;} [[nodiscard]] bool DoFluidSpecies () const {return do_fluid_species;} diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index d89404f17bf..5ef8590d0ae 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -2259,12 +2259,12 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm if (fft_do_time_averaging) { m_fields.alloc_init( "Bfield_avg_fp", Direction{0}, lev, amrex::convert(ba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init( "Bfield_avg_fp", Direction{1}, lev, amrex::convert(ba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init( "Bfield_avg_fp", Direction{2}, lev, amrex::convert(ba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init( "Bfield_avg_fp", Direction{1}, lev, amrex::convert(ba, By_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init( "Bfield_avg_fp", Direction{2}, lev, amrex::convert(ba, Bz_nodal_flag), dm, ncomps, ngEB, 0.0_rt); m_fields.alloc_init( "Efield_avg_fp", Direction{0}, lev, amrex::convert(ba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init( "Efield_avg_fp", Direction{1}, lev, amrex::convert(ba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init( "Efield_avg_fp", Direction{2}, lev, amrex::convert(ba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init( "Efield_avg_fp", Direction{1}, lev, amrex::convert(ba, Ey_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init( "Efield_avg_fp", Direction{2}, lev, amrex::convert(ba, Ez_nodal_flag), dm, ncomps, ngEB, 0.0_rt); } if (EB::enabled()) { @@ -2530,9 +2530,15 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm } if (mypc->m_B_ext_particle_s == "read_from_file") { // These fields will be added to the fields that the particles see, and need to match the index type +<<<<<<< HEAD auto* Bfield_aux_levl_0 = m_fields.get("Bfield_aux", Direction{0}, lev); auto* Bfield_aux_levl_1 = m_fields.get("Bfield_aux", Direction{1}, lev); auto* Bfield_aux_levl_2 = m_fields.get("Bfield_aux", Direction{2}, lev); +======= + auto *Bfield_aux_levl_0 = m_fields.get("Bfield_aux", Direction{0}, lev); + auto *Bfield_aux_levl_1 = m_fields.get("Bfield_aux", Direction{1}, lev); + auto *Bfield_aux_levl_2 = m_fields.get("Bfield_aux", Direction{2}, lev); +>>>>>>> 1dfeb9f0ff8b104502d31bfd8aa90827de58ea7a // Same as Bfield_fp for reading external field data m_fields.alloc_init( "B_external_particle_field", Direction{0}, lev, amrex::convert(ba, Bfield_aux_levl_0->ixType()), @@ -2553,9 +2559,15 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm } if (mypc->m_E_ext_particle_s == "read_from_file") { // These fields will be added to the fields that the particles see, and need to match the index type +<<<<<<< HEAD auto* Efield_aux_levl_0 = m_fields.get("Efield_aux", Direction{0}, lev); auto* Efield_aux_levl_1 = m_fields.get("Efield_aux", Direction{1}, lev); auto* Efield_aux_levl_2 = m_fields.get("Efield_aux", Direction{2}, lev); +======= + auto *Efield_aux_levl_0 = m_fields.get("Efield_aux", Direction{0}, lev); + auto *Efield_aux_levl_1 = m_fields.get("Efield_aux", Direction{1}, lev); + auto *Efield_aux_levl_2 = m_fields.get("Efield_aux", Direction{2}, lev); +>>>>>>> 1dfeb9f0ff8b104502d31bfd8aa90827de58ea7a // Same as Efield_fp for reading external field data m_fields.alloc_init( "E_external_particle_field", Direction{0}, lev, amrex::convert(ba, Efield_aux_levl_0->ixType()), @@ -2588,12 +2600,12 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm if (fft_do_time_averaging) { m_fields.alloc_init("Bfield_avg_cp", Direction{0}, lev, amrex::convert(cba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init("Bfield_avg_cp", Direction{1}, lev, amrex::convert(cba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init("Bfield_avg_cp", Direction{2}, lev, amrex::convert(cba, Bx_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init("Bfield_avg_cp", Direction{1}, lev, amrex::convert(cba, By_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init("Bfield_avg_cp", Direction{2}, lev, amrex::convert(cba, Bz_nodal_flag), dm, ncomps, ngEB, 0.0_rt); m_fields.alloc_init("Efield_avg_cp", Direction{0}, lev, amrex::convert(cba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init("Efield_avg_cp", Direction{1}, lev, amrex::convert(cba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt); - m_fields.alloc_init("Efield_avg_cp", Direction{2}, lev, amrex::convert(cba, Ex_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init("Efield_avg_cp", Direction{1}, lev, amrex::convert(cba, Ey_nodal_flag), dm, ncomps, ngEB, 0.0_rt); + m_fields.alloc_init("Efield_avg_cp", Direction{2}, lev, amrex::convert(cba, Ez_nodal_flag), dm, ncomps, ngEB, 0.0_rt); } // Create the MultiFabs for the current @@ -3410,7 +3422,7 @@ WarpX::getFieldDotMaskPointer ( FieldType field_type, int lev, int dir ) const } void WarpX::SetDotMask( std::unique_ptr& field_dotMask, - const std::string& field_name, int lev, int dir ) const + std::string const & field_name, int lev, int dir ) const { // Define the dot mask for this field_type needed to properly compute dotProduct() // for field values that have shared locations on different MPI ranks diff --git a/Source/ablastr/fields/MultiFabRegister.cpp b/Source/ablastr/fields/MultiFabRegister.cpp index 4e91180c7eb..f5e19c19db1 100644 --- a/Source/ablastr/fields/MultiFabRegister.cpp +++ b/Source/ablastr/fields/MultiFabRegister.cpp @@ -569,10 +569,9 @@ namespace ablastr::fields // C++20: Replace with std::erase_if for (auto first = m_mf_register.begin(), last = m_mf_register.end(); first != last;) { - if (first->second.m_level == level){ + if (first->second.m_level == level) { first = m_mf_register.erase(first); - } - else{ + } else { ++first; } }