diff --git a/Source/BoundaryConditions/PML_RZ.cpp b/Source/BoundaryConditions/PML_RZ.cpp index 0fc24bf8817..cc05c126a55 100644 --- a/Source/BoundaryConditions/PML_RZ.cpp +++ b/Source/BoundaryConditions/PML_RZ.cpp @@ -138,7 +138,7 @@ PML_RZ::FillBoundaryE (ablastr::fields::MultiFabRegister& fields, PatchType patc if (patch_type == PatchType::fine && pml_Er->nGrowVect().max() > 0) { amrex::Periodicity const& period = m_geom->periodicity(); - const amrex::Vector mf = {pml_Er, pml_Et}; + amrex::Vector mf = {pml_Er, pml_Et}; ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period, nodal_sync); } } @@ -152,7 +152,7 @@ PML_RZ::FillBoundaryB (ablastr::fields::MultiFabRegister& fields, PatchType patc amrex::MultiFab * pml_Bt = fields.get("pml_B_fp", Direction{1}, 0); amrex::Periodicity const& period = m_geom->periodicity(); - const amrex::Vector mf = {pml_Br, pml_Bt}; + amrex::Vector mf = {pml_Br, pml_Bt}; ablastr::utils::communication::FillBoundary(mf, WarpX::do_single_precision_comms, period, nodal_sync); } } diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp index bd01aeaf359..a4df5ea73bd 100644 --- a/Source/Evolve/WarpXEvolve.cpp +++ b/Source/Evolve/WarpXEvolve.cpp @@ -663,8 +663,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) // (after checking that pointer to rho_fp on MR level 0 is not null) if (m_fields.has("rho_fp", 0) && rho_in_time == RhoInTime::Linear) { - const ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level); - const ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level); + ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level); + ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level); // Deposit rho at relative time -dt // (dt[0] denotes the time step on mesh refinement level 0) @@ -732,8 +732,8 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) // (after checking that pointer to rho_fp on MR level 0 is not null) if (m_fields.has("rho_fp", 0)) { - const ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level); - const ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_cp", finest_level); + ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level); + ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_cp", finest_level); // Move rho from new to old if rho is linear in time if (rho_in_time == RhoInTime::Linear) { PSATDMoveRhoNewToRhoOld(); } diff --git a/Source/FieldSolver/ElectrostaticSolvers/LabFrameExplicitES.cpp b/Source/FieldSolver/ElectrostaticSolvers/LabFrameExplicitES.cpp index a2d45bcdb8d..de9f20a54aa 100644 --- a/Source/FieldSolver/ElectrostaticSolvers/LabFrameExplicitES.cpp +++ b/Source/FieldSolver/ElectrostaticSolvers/LabFrameExplicitES.cpp @@ -29,10 +29,10 @@ void LabFrameExplicitES::ComputeSpaceChargeField ( using ablastr::fields::MultiLevelScalarField; using ablastr::fields::MultiLevelVectorField; - const MultiLevelScalarField rho_fp = fields.get_mr_levels("rho_fp", max_level); - const MultiLevelScalarField rho_cp = fields.get_mr_levels("rho_cp", max_level); + MultiLevelScalarField rho_fp = fields.get_mr_levels("rho_fp", max_level); + MultiLevelScalarField rho_cp = fields.get_mr_levels("rho_cp", max_level); MultiLevelScalarField phi_fp = fields.get_mr_levels("phi_fp", max_level); - const MultiLevelVectorField Efield_fp = fields.get_mr_levels_alldirs("Efield_fp", max_level); + MultiLevelVectorField Efield_fp = fields.get_mr_levels_alldirs("Efield_fp", max_level); mpc.DepositCharge(rho_fp, 0.0_rt); if (mfl) { @@ -41,7 +41,7 @@ void LabFrameExplicitES::ComputeSpaceChargeField ( } // Apply filter, perform MPI exchange, interpolate across levels - const Vector > rho_buf(num_levels); + Vector > rho_buf(num_levels); auto & warpx = WarpX::GetInstance(); warpx.SyncRho( rho_fp, rho_cp, amrex::GetVecOfPtrs(rho_buf) ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp index a5b85f7fbd7..2fcc18a33d0 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp @@ -56,9 +56,9 @@ void FiniteDifferenceSolver::EvolveB ( [[maybe_unused]] amrex::Real const dt ) { using ablastr::fields::Direction; - const ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ? + ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ? fields.get_alldirs("Bfield_fp", lev) : fields.get_alldirs("Bfield_cp", lev); - const ablastr::fields::VectorField Efield = patch_type == PatchType::fine ? + ablastr::fields::VectorField Efield = patch_type == PatchType::fine ? fields.get_alldirs("Efield_fp", lev) : fields.get_alldirs("Efield_cp", lev); // Select algorithm (The choice of algorithm is a runtime option, diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp index 5d46d18ff4e..9a83b4bc072 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveBPML.cpp @@ -56,9 +56,9 @@ void FiniteDifferenceSolver::EvolveBPML ( WARPX_ABORT_WITH_MESSAGE( "PML are not implemented in cylindrical geometry."); #else - const ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ? + ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ? fields.get_alldirs("pml_B_fp", level) : fields.get_alldirs("pml_B_cp", level); - const ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ? + ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ? fields.get_alldirs("pml_E_fp", level) : fields.get_alldirs("pml_E_cp", level); if (m_grid_type == ablastr::utils::enums::GridType::Collocated) { diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp index d80ca9db15e..60fa68ff918 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp @@ -58,9 +58,9 @@ void FiniteDifferenceSolver::EvolveE ( ) { using ablastr::fields::Direction; - const ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ? + ablastr::fields::VectorField Bfield = patch_type == PatchType::fine ? fields.get_alldirs("Bfield_fp", lev) : fields.get_alldirs("Bfield_cp", lev); - const ablastr::fields::VectorField Jfield = patch_type == PatchType::fine ? + ablastr::fields::VectorField Jfield = patch_type == PatchType::fine ? fields.get_alldirs("current_fp", lev) : fields.get_alldirs("current_cp", lev); amrex::MultiFab* Ffield = nullptr; @@ -71,19 +71,23 @@ void FiniteDifferenceSolver::EvolveE ( ablastr::fields::VectorField edge_lengths; if (fields.has("edge_lengths", Direction{0}, lev)) { - edge_lengths = fields.get_alldirs("edge_lengths", lev); + edge_lengths = patch_type == PatchType::fine ? + fields.get_alldirs("edge_lengths", lev) : fields.get_alldirs("edge_lengths", lev); } ablastr::fields::VectorField face_areas; if (fields.has("face_areas", Direction{0}, lev)) { - face_areas = fields.get_alldirs("face_areas", lev); + face_areas = patch_type == PatchType::fine ? + fields.get_alldirs("face_areas", lev) : fields.get_alldirs("face_areas", lev); } ablastr::fields::VectorField area_mod; - if (fields.has("area_mod", Direction{0}, lev)) { - area_mod = fields.get_alldirs("area_mod", lev); + if (fields.has("face_areas", Direction{0}, lev)) { + area_mod = patch_type == PatchType::fine ? + fields.get_alldirs("area_mod", lev) : fields.get_alldirs("area_mod", lev); } ablastr::fields::VectorField ECTRhofield; if (fields.has("ECTRhofield", Direction{0}, lev)) { - ECTRhofield = fields.get_alldirs("ECTRhofield", lev); + ECTRhofield = patch_type == PatchType::fine ? + fields.get_alldirs("ECTRhofield", lev) : fields.get_alldirs("ECTRhofield", lev); } // Select algorithm (The choice of algorithm is a runtime option, @@ -217,7 +221,7 @@ void FiniteDifferenceSolver::EvolveECartesian ( if (Ffield) { // Extract field data for this grid/tile - const Array4 F = Ffield->array(mfi); + Array4 F = Ffield->array(mfi); // Loop over the cells and update the fields amrex::ParallelFor(tex, tey, tez, diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp index d678bed3b01..4da403156b0 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveEPML.cpp @@ -59,11 +59,11 @@ void FiniteDifferenceSolver::EvolveEPML ( "PML are not implemented in cylindrical geometry."); #else using ablastr::fields::Direction; - const ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ? + ablastr::fields::VectorField Efield = (patch_type == PatchType::fine) ? fields.get_alldirs("pml_E_fp", level) : fields.get_alldirs("pml_E_cp", level); - const ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ? + ablastr::fields::VectorField Bfield = (patch_type == PatchType::fine) ? fields.get_alldirs("pml_B_fp", level) : fields.get_alldirs("pml_B_cp", level); - const ablastr::fields::VectorField Jfield = (patch_type == PatchType::fine) ? + ablastr::fields::VectorField Jfield = (patch_type == PatchType::fine) ? fields.get_alldirs("pml_j_fp", level) : fields.get_alldirs("pml_j_cp", level); ablastr::fields::VectorField edge_lengths; if (fields.has("pml_edge_lengths", Direction{0}, level)) { diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H index 03f51f7ba62..a3656142384 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H +++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H @@ -226,7 +226,7 @@ class FiniteDifferenceSolver void EvolveFCylindrical ( amrex::MultiFab* Ffield, ablastr::fields::VectorField const & Efield, - amrex::MultiFab* rhofield, + amrex::MultiFab* const rhofield, int rhocomp, amrex::Real dt ); diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp index f8505d91d44..07a4935a83b 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp @@ -468,8 +468,8 @@ void HybridPICModel::HybridPICSolveE ( auto& warpx = WarpX::GetInstance(); ablastr::fields::VectorField current_fp_ampere = warpx.m_fields.get_alldirs("hybrid_current_fp_ampere", lev); - const ablastr::fields::VectorField current_fp_external = warpx.m_fields.get_alldirs("hybrid_current_fp_external", lev); - const ablastr::fields::ScalarField electron_pressure_fp = warpx.m_fields.get("hybrid_electron_pressure_fp", lev); + ablastr::fields::VectorField current_fp_external = warpx.m_fields.get_alldirs("hybrid_current_fp_external", lev); + ablastr::fields::ScalarField electron_pressure_fp = warpx.m_fields.get("hybrid_electron_pressure_fp", lev); // Solve E field in regular cells warpx.get_pointer_fdtd_solver_fp(lev)->HybridPICSolveE( diff --git a/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H b/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H index b109229328e..74e45ba631c 100644 --- a/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H +++ b/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H @@ -68,8 +68,8 @@ public: [[nodiscard]] inline bool IsDefined () const { return m_is_defined; } void Define ( WarpX* a_WarpX, - const std::string& a_vector_type_name, - const std::string& a_scalar_type_name = "none" ); + std::string a_vector_type_name, + std::string a_scalar_type_name = "none" ); inline void Define ( const WarpXSolverVec& a_solver_vec ) diff --git a/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.cpp b/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.cpp index 10673704759..da359f35248 100644 --- a/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.cpp +++ b/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.cpp @@ -21,8 +21,8 @@ WarpXSolverVec::~WarpXSolverVec () } void WarpXSolverVec::Define ( WarpX* a_WarpX, - const std::string& a_vector_type_name, - const std::string& a_scalar_type_name ) + std::string a_vector_type_name, + std::string a_scalar_type_name ) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( !IsDefined(), @@ -41,7 +41,7 @@ void WarpXSolverVec::Define ( WarpX* a_WarpX, m_array_type = FieldType::Efield_fp; } else if (m_vector_type_name=="Bfield_fp") { - m_array_type = FieldType::Bfield_fp; + m_array_type = FieldType::Efield_fp; } else if (m_vector_type_name=="vector_potential_fp_nodal") { m_array_type = FieldType::vector_potential_fp; diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp index 43a964c1806..ede04b39632 100644 --- a/Source/FieldSolver/WarpXPushFieldsEM.cpp +++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp @@ -669,11 +669,11 @@ WarpX::PushPSATD () const int rho_old = spectral_solver_fp[0]->m_spectral_index.rho_old; const int rho_new = spectral_solver_fp[0]->m_spectral_index.rho_new; - const ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level); - const ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level); - const ablastr::fields::MultiLevelVectorField current_fp = m_fields.get_mr_levels_alldirs("current_fp", finest_level); - const ablastr::fields::MultiLevelVectorField current_cp = m_fields.get_mr_levels_alldirs("current_cp", finest_level); - const ablastr::fields::MultiLevelVectorField current_buf = m_fields.get_mr_levels_alldirs("current_buf", finest_level); + ablastr::fields::MultiLevelScalarField rho_fp = m_fields.get_mr_levels("rho_fp", finest_level); + ablastr::fields::MultiLevelScalarField rho_cp = m_fields.get_mr_levels("rho_fp", finest_level); + ablastr::fields::MultiLevelVectorField current_fp = m_fields.get_mr_levels_alldirs("current_fp", finest_level); + ablastr::fields::MultiLevelVectorField current_cp = m_fields.get_mr_levels_alldirs("current_cp", finest_level); + ablastr::fields::MultiLevelVectorField current_buf = m_fields.get_mr_levels_alldirs("current_buf", finest_level); if (fft_periodic_single_box) { diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 5ef8590d0ae..5457b633504 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -2530,15 +2530,9 @@ 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()), @@ -2559,15 +2553,9 @@ 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()), diff --git a/Source/ablastr/fields/MultiFabRegister.cpp b/Source/ablastr/fields/MultiFabRegister.cpp index f5e19c19db1..c290266176e 100644 --- a/Source/ablastr/fields/MultiFabRegister.cpp +++ b/Source/ablastr/fields/MultiFabRegister.cpp @@ -628,7 +628,7 @@ namespace ablastr::fields const amrex::Vector, 3 > >& old_vector_on_levels ) { - auto const finest_level = static_cast(old_vector_on_levels.size() - 1u); + int const finest_level = old_vector_on_levels.size() - 1u; MultiLevelVectorField field_on_level; field_on_level.reserve(finest_level+1); @@ -654,7 +654,7 @@ namespace ablastr::fields const amrex::Vector >& old_scalar_on_levels ) { - auto const finest_level = static_cast(old_scalar_on_levels.size() - 1u); + int const finest_level = old_scalar_on_levels.size() - 1u; MultiLevelScalarField field_on_level; field_on_level.reserve(finest_level+1);