aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/BoundaryConditions/PML.cpp93
-rw-r--r--Source/Diagnostics/BTDiagnostics.cpp8
-rw-r--r--Source/Diagnostics/BackTransformedDiagnostic.cpp24
-rw-r--r--Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp15
-rw-r--r--Source/Diagnostics/FieldIO.cpp14
-rw-r--r--Source/Diagnostics/MultiDiagnostics.H2
-rw-r--r--Source/Diagnostics/MultiDiagnostics.cpp4
-rw-r--r--Source/Diagnostics/ParticleDiag/ParticleDiag.H2
-rw-r--r--Source/Diagnostics/ParticleDiag/ParticleDiag.cpp4
-rw-r--r--Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp3
-rw-r--r--Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp28
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp7
-rw-r--r--Source/Diagnostics/SliceDiagnostic.cpp17
-rw-r--r--Source/Diagnostics/WarpXIO.cpp3
-rw-r--r--Source/FieldSolver/ElectrostaticSolver.cpp6
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp15
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp8
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.cpp18
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp8
-rw-r--r--Source/Initialization/PlasmaInjector.H1
-rw-r--r--Source/Initialization/PlasmaInjector.cpp17
-rw-r--r--Source/Initialization/WarpXInitData.cpp44
-rw-r--r--Source/Parallelization/WarpXComm.cpp13
-rw-r--r--Source/Parallelization/WarpXRegrid.cpp84
-rw-r--r--Source/Particles/MultiParticleContainer.cpp38
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp8
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp2
-rw-r--r--Source/Utils/Interpolate.H2
-rw-r--r--Source/Utils/Interpolate.cpp8
-rw-r--r--Source/WarpX.cpp32
30 files changed, 282 insertions, 246 deletions
diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp
index 202867bdb..3824ddcef 100644
--- a/Source/BoundaryConditions/PML.cpp
+++ b/Source/BoundaryConditions/PML.cpp
@@ -20,6 +20,7 @@
#endif
#include <algorithm>
+#include <memory>
using namespace amrex;
@@ -493,18 +494,18 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& /*grid_dm*/,
ngf = ngFFT;
#endif
- pml_E_fp[0].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getEfield_fp(0,0).ixType().toIntVect() ), dm, 3, nge ) );
- pml_E_fp[1].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getEfield_fp(0,1).ixType().toIntVect() ), dm, 3, nge ) );
- pml_E_fp[2].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getEfield_fp(0,2).ixType().toIntVect() ), dm, 3, nge ) );
- pml_B_fp[0].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getBfield_fp(0,0).ixType().toIntVect() ), dm, 2, ngb ) );
- pml_B_fp[1].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getBfield_fp(0,1).ixType().toIntVect() ), dm, 2, ngb ) );
- pml_B_fp[2].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getBfield_fp(0,2).ixType().toIntVect() ), dm, 2, ngb ) );
+ pml_E_fp[0] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getEfield_fp(0,0).ixType().toIntVect() ), dm, 3, nge );
+ pml_E_fp[1] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getEfield_fp(0,1).ixType().toIntVect() ), dm, 3, nge );
+ pml_E_fp[2] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getEfield_fp(0,2).ixType().toIntVect() ), dm, 3, nge );
+ pml_B_fp[0] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getBfield_fp(0,0).ixType().toIntVect() ), dm, 2, ngb );
+ pml_B_fp[1] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getBfield_fp(0,1).ixType().toIntVect() ), dm, 2, ngb );
+ pml_B_fp[2] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getBfield_fp(0,2).ixType().toIntVect() ), dm, 2, ngb );
pml_E_fp[0]->setVal(0.0);
@@ -514,27 +515,27 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& /*grid_dm*/,
pml_B_fp[1]->setVal(0.0);
pml_B_fp[2]->setVal(0.0);
- pml_j_fp[0].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getcurrent_fp(0,0).ixType().toIntVect() ), dm, 1, ngb ) );
- pml_j_fp[1].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getcurrent_fp(0,1).ixType().toIntVect() ), dm, 1, ngb ) );
- pml_j_fp[2].reset( new MultiFab( amrex::convert( ba,
- WarpX::GetInstance().getcurrent_fp(0,2).ixType().toIntVect() ), dm, 1, ngb ) );
+ pml_j_fp[0] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getcurrent_fp(0,0).ixType().toIntVect() ), dm, 1, ngb );
+ pml_j_fp[1] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getcurrent_fp(0,1).ixType().toIntVect() ), dm, 1, ngb );
+ pml_j_fp[2] = std::make_unique<MultiFab>(amrex::convert( ba,
+ WarpX::GetInstance().getcurrent_fp(0,2).ixType().toIntVect() ), dm, 1, ngb );
pml_j_fp[0]->setVal(0.0);
pml_j_fp[1]->setVal(0.0);
pml_j_fp[2]->setVal(0.0);
if (do_dive_cleaning)
{
- pml_F_fp.reset(new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()), dm, 3, ngf));
+ pml_F_fp = std::make_unique<MultiFab>(amrex::convert(ba,IntVect::TheUnitVector()), dm, 3, ngf);
pml_F_fp->setVal(0.0);
}
if (do_pml_in_domain){
- sigba_fp.reset(new MultiSigmaBox(ba, dm, grid_ba_reduced, geom->CellSize(), ncell, delta));
+ sigba_fp = std::make_unique<MultiSigmaBox>(ba, dm, grid_ba_reduced, geom->CellSize(), ncell, delta);
}
else {
- sigba_fp.reset(new MultiSigmaBox(ba, dm, grid_ba, geom->CellSize(), ncell, delta));
+ sigba_fp = std::make_unique<MultiSigmaBox>(ba, dm, grid_ba, geom->CellSize(), ncell, delta);
}
@@ -547,8 +548,8 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& /*grid_dm*/,
BoxArray realspace_ba = ba; // Copy box
Array<Real,3> v_galilean_zero = {0,0,0};
realspace_ba.enclosedCells().grow(nge); // cell-centered + guard cells
- spectral_solver_fp.reset( new SpectralSolver( realspace_ba, dm,
- nox_fft, noy_fft, noz_fft, do_nodal, v_galilean_zero, dx, dt, in_pml ) );
+ spectral_solver_fp = std::make_unique<SpectralSolver>(realspace_ba, dm,
+ nox_fft, noy_fft, noz_fft, do_nodal, v_galilean_zero, dx, dt, in_pml );
#endif
if (cgeom)
@@ -568,18 +569,18 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& /*grid_dm*/,
DistributionMapping cdm{cba};
- pml_E_cp[0].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getEfield_cp(1,0).ixType().toIntVect() ), cdm, 3, nge ) );
- pml_E_cp[1].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getEfield_cp(1,1).ixType().toIntVect() ), cdm, 3, nge ) );
- pml_E_cp[2].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getEfield_cp(1,2).ixType().toIntVect() ), cdm, 3, nge ) );
- pml_B_cp[0].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getBfield_cp(1,0).ixType().toIntVect() ), cdm, 2, ngb ) );
- pml_B_cp[1].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getBfield_cp(1,1).ixType().toIntVect() ), cdm, 2, ngb ) );
- pml_B_cp[2].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getBfield_cp(1,2).ixType().toIntVect() ), cdm, 2, ngb ) );
+ pml_E_cp[0] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getEfield_cp(1,0).ixType().toIntVect() ), cdm, 3, nge );
+ pml_E_cp[1] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getEfield_cp(1,1).ixType().toIntVect() ), cdm, 3, nge );
+ pml_E_cp[2] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getEfield_cp(1,2).ixType().toIntVect() ), cdm, 3, nge );
+ pml_B_cp[0] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getBfield_cp(1,0).ixType().toIntVect() ), cdm, 2, ngb );
+ pml_B_cp[1] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getBfield_cp(1,1).ixType().toIntVect() ), cdm, 2, ngb );
+ pml_B_cp[2] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getBfield_cp(1,2).ixType().toIntVect() ), cdm, 2, ngb );
pml_E_cp[0]->setVal(0.0);
pml_E_cp[1]->setVal(0.0);
@@ -590,24 +591,24 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& /*grid_dm*/,
if (do_dive_cleaning)
{
- pml_F_cp.reset(new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()), cdm, 3, ngf));
+ pml_F_cp = std::make_unique<MultiFab>(amrex::convert(cba,IntVect::TheUnitVector()), cdm, 3, ngf);
pml_F_cp->setVal(0.0);
}
- pml_j_cp[0].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getcurrent_cp(1,0).ixType().toIntVect() ), cdm, 1, ngb ) );
- pml_j_cp[1].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getcurrent_cp(1,1).ixType().toIntVect() ), cdm, 1, ngb ) );
- pml_j_cp[2].reset( new MultiFab( amrex::convert( cba,
- WarpX::GetInstance().getcurrent_cp(1,2).ixType().toIntVect() ), cdm, 1, ngb ) );
+ pml_j_cp[0] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getcurrent_cp(1,0).ixType().toIntVect() ), cdm, 1, ngb );
+ pml_j_cp[1] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getcurrent_cp(1,1).ixType().toIntVect() ), cdm, 1, ngb );
+ pml_j_cp[2] = std::make_unique<MultiFab>(amrex::convert( cba,
+ WarpX::GetInstance().getcurrent_cp(1,2).ixType().toIntVect() ), cdm, 1, ngb );
pml_j_cp[0]->setVal(0.0);
pml_j_cp[1]->setVal(0.0);
pml_j_cp[2]->setVal(0.0);
if (do_pml_in_domain){
- sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba_reduced, cgeom->CellSize(), ncell, delta));
+ sigba_cp = std::make_unique<MultiSigmaBox>(cba, cdm, grid_cba_reduced, cgeom->CellSize(), ncell, delta);
} else {
- sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba, cgeom->CellSize(), ncell, delta));
+ sigba_cp = std::make_unique<MultiSigmaBox>(cba, cdm, grid_cba, cgeom->CellSize(), ncell, delta);
}
#ifdef WARPX_USE_PSATD
@@ -617,8 +618,8 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& /*grid_dm*/,
// const bool in_pml = true; // Tells spectral solver to use split-PML equations
realspace_cba.enclosedCells().grow(nge); // cell-centered + guard cells
- spectral_solver_cp.reset( new SpectralSolver( realspace_cba, cdm,
- nox_fft, noy_fft, noz_fft, do_nodal, v_galilean_zero, cdx, dt, in_pml ) );
+ spectral_solver_cp = std::make_unique<SpectralSolver>(realspace_cba, cdm,
+ nox_fft, noy_fft, noz_fft, do_nodal, v_galilean_zero, cdx, dt, in_pml );
#endif
}
}
diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp
index d57af3ec0..b651874e4 100644
--- a/Source/Diagnostics/BTDiagnostics.cpp
+++ b/Source/Diagnostics/BTDiagnostics.cpp
@@ -6,9 +6,13 @@
#include "ComputeDiagFunctors/BackTransformFunctor.H"
#include "ComputeDiagFunctors/RhoFunctor.H"
#include "Utils/CoarsenIO.H"
+
#include <AMReX_ParallelDescriptor.H>
#include <AMReX_PlotFileUtil.H>
#include <AMReX_VisMF.H>
+
+#include <memory>
+
using namespace amrex::literals;
BTDiagnostics::BTDiagnostics (int i, std::string name)
@@ -303,8 +307,8 @@ BTDiagnostics::DefineCellCenteredMultiFab(int lev)
ba.coarsen(m_crse_ratio);
amrex::DistributionMapping dmap = warpx.DistributionMap(lev);
int ngrow = 1;
- m_cell_centered_data[lev].reset( new amrex::MultiFab(ba, dmap,
- m_cellcenter_varnames.size(), ngrow) );
+ m_cell_centered_data[lev] = std::make_unique<amrex::MultiFab>(ba, dmap,
+ m_cellcenter_varnames.size(), ngrow);
}
diff --git a/Source/Diagnostics/BackTransformedDiagnostic.cpp b/Source/Diagnostics/BackTransformedDiagnostic.cpp
index 5a251ad13..ee7f70f97 100644
--- a/Source/Diagnostics/BackTransformedDiagnostic.cpp
+++ b/Source/Diagnostics/BackTransformedDiagnostic.cpp
@@ -12,6 +12,8 @@
#include "SliceDiagnostic.H"
#include "WarpX.H"
+#include <memory>
+
using namespace amrex;
#ifdef WARPX_USE_HDF5
@@ -595,11 +597,11 @@ BackTransformedDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
prob_domain_lab.setLo(AMREX_SPACEDIM-1, zmin_lab + v_window_lab * t_lab);
prob_domain_lab.setHi(AMREX_SPACEDIM-1, zmax_lab + v_window_lab * t_lab);
Box diag_box = geom.Domain();
- m_LabFrameDiags_[i].reset(new LabFrameSnapShot(t_lab, t_boost,
+ m_LabFrameDiags_[i] = std::make_unique<LabFrameSnapShot>(t_lab, t_boost,
m_inv_gamma_boost_, m_inv_beta_boost_, m_dz_lab_,
prob_domain_lab, prob_ncells_lab,
m_ncomp_to_dump, m_mesh_field_names, prob_domain_lab,
- diag_box, i));
+ diag_box, i);
}
@@ -675,11 +677,11 @@ BackTransformedDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab,
v_window_lab * t_slice_lab );
// construct labframeslice
- m_LabFrameDiags_[i+N_snapshots].reset(new LabFrameSlice(t_slice_lab, t_boost,
+ m_LabFrameDiags_[i+N_snapshots] = std::make_unique<LabFrameSlice>(t_slice_lab, t_boost,
m_inv_gamma_boost_, m_inv_beta_boost_, m_dz_lab_,
prob_domain_lab, slice_ncells_lab,
m_ncomp_to_dump, m_mesh_field_names, slice_dom_lab,
- slicediag_box, i, m_particle_slice_width_lab_));
+ slicediag_box, i, m_particle_slice_width_lab_);
}
// sort diags based on their respective t_lab
std::stable_sort(m_LabFrameDiags_.begin(), m_LabFrameDiags_.end(), compare_tlab_uptr);
@@ -826,8 +828,8 @@ writeLabFrameData(const MultiFab* cell_centered_data,
BoxArray buff_ba(lf_diags->m_buff_box_);
buff_ba.maxSize(m_max_box_size_);
DistributionMapping buff_dm(buff_ba);
- lf_diags->m_data_buffer_.reset( new MultiFab(buff_ba,
- buff_dm, m_ncomp_to_dump, 0) );
+ lf_diags->m_data_buffer_ = std::make_unique<MultiFab>(buff_ba,
+ buff_dm, m_ncomp_to_dump, 0);
}
// ... reset particle buffer particles_buffer_[i]
if (WarpX::do_back_transformed_particles)
@@ -843,8 +845,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
if (lf_diags->m_t_lab != prev_t_lab ) {
if (slice)
{
- slice.reset(new MultiFab);
- slice.reset(nullptr);
+ slice = nullptr;
}
slice = amrex::get_slice_data(m_boost_direction_,
lf_diags->m_current_z_boost,
@@ -867,9 +868,9 @@ writeLabFrameData(const MultiFab* cell_centered_data,
// Make it a BoxArray slice_ba
BoxArray slice_ba(slice_box);
slice_ba.maxSize(m_max_box_size_);
- tmp_slice_ptr = std::unique_ptr<MultiFab>(new MultiFab(slice_ba,
+ tmp_slice_ptr = std::make_unique<MultiFab>(slice_ba,
lf_diags->m_data_buffer_->DistributionMap(),
- ncomp, 0));
+ ncomp, 0);
// slice is re-used if the t_lab of a diag is equal to
// that of the previous diag.
@@ -880,8 +881,7 @@ writeLabFrameData(const MultiFab* cell_centered_data,
tmp_slice_ptr->copy(*slice, 0, 0, ncomp);
lf_diags->AddDataToBuffer(*tmp_slice_ptr, i_lab,
map_actual_fields_to_dump);
- tmp_slice_ptr.reset(new MultiFab);
- tmp_slice_ptr.reset(nullptr);
+ tmp_slice_ptr = nullptr;
}
if (WarpX::do_back_transformed_particles) {
diff --git a/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
index 298a74c2b..f38373862 100644
--- a/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
+++ b/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
@@ -1,7 +1,11 @@
#include "BackTransformFunctor.H"
#include "WarpX.H"
+
#include <AMReX_MultiFabUtil.H>
#include <AMReX_MultiFabUtil_C.H>
+
+#include <memory>
+
using namespace amrex;
BackTransformFunctor::BackTransformFunctor (amrex::MultiFab const * mf_src, int lev,
@@ -50,8 +54,8 @@ BackTransformFunctor::operator ()(amrex::MultiFab& mf_dst, int /*dcomp*/, const
// Define MultiFab with the distribution map of the destination multifab and
// containing all ten components that were in the slice generated from m_mf_src.
std::unique_ptr< amrex::MultiFab > tmp_slice_ptr = nullptr;
- tmp_slice_ptr.reset( new MultiFab ( slice_ba, mf_dst.DistributionMap(),
- slice->nComp(), 0) );
+ tmp_slice_ptr = std::make_unique<MultiFab> ( slice_ba, mf_dst.DistributionMap(),
+ slice->nComp(), 0 );
// Parallel copy the lab-frame data from "slice" MultiFab with
// ncomp=10 and boosted-frame dmap to "tmp_slice_ptr" MultiFab with
// ncomp=10 and dmap of the destination Multifab, which will store the final data
@@ -96,11 +100,8 @@ BackTransformFunctor::operator ()(amrex::MultiFab& mf_dst, int /*dcomp*/, const
}
// Reset the temporary MultiFabs generated
- slice.reset(new MultiFab);
- slice.reset(nullptr);
- tmp_slice_ptr.reset(new MultiFab);
- tmp_slice_ptr.reset(nullptr);
-
+ slice = nullptr;
+ tmp_slice_ptr = nullptr;
}
}
diff --git a/Source/Diagnostics/FieldIO.cpp b/Source/Diagnostics/FieldIO.cpp
index 10195eb99..b1c5c27cf 100644
--- a/Source/Diagnostics/FieldIO.cpp
+++ b/Source/Diagnostics/FieldIO.cpp
@@ -20,6 +20,8 @@
#include <AMReX.H>
+#include <memory>
+
using namespace amrex;
/** \brief
@@ -121,15 +123,15 @@ AverageAndPackVectorField( MultiFab& mf_avg,
if (vector_field[0]->nComp() > 1) {
// With the RZ solver, if there are more than one component, the total
// fields needs to be constructed in temporary MultiFabs.
- vector_total[0].reset(new MultiFab(vector_field[0]->boxArray(), dm, 1, vector_field[0]->nGrowVect()));
- vector_total[1].reset(new MultiFab(vector_field[1]->boxArray(), dm, 1, vector_field[1]->nGrowVect()));
- vector_total[2].reset(new MultiFab(vector_field[2]->boxArray(), dm, 1, vector_field[2]->nGrowVect()));
+ vector_total[0] = std::make_unique<MultiFab>(vector_field[0]->boxArray(), dm, 1, vector_field[0]->nGrowVect());
+ vector_total[1] = std::make_unique<MultiFab>(vector_field[1]->boxArray(), dm, 1, vector_field[1]->nGrowVect());
+ vector_total[2] = std::make_unique<MultiFab>(vector_field[2]->boxArray(), dm, 1, vector_field[2]->nGrowVect());
ConstructTotalRZVectorField(vector_total, vector_field);
} else {
// Create aliases of the MultiFabs
- vector_total[0].reset(new MultiFab(*vector_field[0], amrex::make_alias, 0, 1));
- vector_total[1].reset(new MultiFab(*vector_field[1], amrex::make_alias, 0, 1));
- vector_total[2].reset(new MultiFab(*vector_field[2], amrex::make_alias, 0, 1));
+ vector_total[0] = std::make_unique<MultiFab>(*vector_field[0], amrex::make_alias, 0, 1);
+ vector_total[1] = std::make_unique<MultiFab>(*vector_field[1], amrex::make_alias, 0, 1);
+ vector_total[2] = std::make_unique<MultiFab>(*vector_field[2], amrex::make_alias, 0, 1);
}
#else
const std::array<std::unique_ptr<MultiFab>,3> &vector_total = vector_field;
diff --git a/Source/Diagnostics/MultiDiagnostics.H b/Source/Diagnostics/MultiDiagnostics.H
index d0c64e623..f59dea7dd 100644
--- a/Source/Diagnostics/MultiDiagnostics.H
+++ b/Source/Diagnostics/MultiDiagnostics.H
@@ -4,6 +4,8 @@
#include "FullDiagnostics.H"
#include "BTDiagnostics.H"
+#include <memory>
+
/** All types of diagnostics. */
enum struct DiagTypes {Full, BackTransformed};
diff --git a/Source/Diagnostics/MultiDiagnostics.cpp b/Source/Diagnostics/MultiDiagnostics.cpp
index d9300187e..554e823e8 100644
--- a/Source/Diagnostics/MultiDiagnostics.cpp
+++ b/Source/Diagnostics/MultiDiagnostics.cpp
@@ -12,9 +12,9 @@ MultiDiagnostics::MultiDiagnostics ()
alldiags.resize( ndiags );
for (int i=0; i<ndiags; i++){
if ( diags_types[i] == DiagTypes::Full ){
- alldiags[i].reset( new FullDiagnostics(i, diags_names[i]) );
+ alldiags[i] = std::make_unique<FullDiagnostics>(i, diags_names[i]);
} else if ( diags_types[i] == DiagTypes::BackTransformed ){
- alldiags[i].reset( new BTDiagnostics(i, diags_names[i]) );
+ alldiags[i] = std::make_unique<BTDiagnostics>(i, diags_names[i]);
} else {
amrex::Abort("Unknown diagnostic type");
}
diff --git a/Source/Diagnostics/ParticleDiag/ParticleDiag.H b/Source/Diagnostics/ParticleDiag/ParticleDiag.H
index 71a71fcc2..119a341b6 100644
--- a/Source/Diagnostics/ParticleDiag/ParticleDiag.H
+++ b/Source/Diagnostics/ParticleDiag/ParticleDiag.H
@@ -5,6 +5,8 @@
#include "Utils/WarpXUtil.H"
#include "Particles/WarpXParticleContainer.H"
+#include <memory>
+
class ParticleDiag
{
public:
diff --git a/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp b/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
index 9a9fe2055..b6219ba55 100644
--- a/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
+++ b/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
@@ -74,7 +74,7 @@ ParticleDiag::ParticleDiag(std::string diag_name, std::string name, WarpXParticl
std::string function_string = "";
Store_parserString(pp,"plot_filter_function(t,x,y,z,ux,uy,uz)",
function_string);
- m_particle_filter_parser.reset(new ParserWrapper<7>(
- makeParser(function_string,{"t","x","y","z","ux","uy","uz"})));
+ m_particle_filter_parser = std::make_unique<ParserWrapper<7>>(
+ makeParser(function_string,{"t","x","y","z","ux","uy","uz"}));
}
}
diff --git a/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp b/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
index 671355188..048aa7dab 100644
--- a/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
+++ b/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
@@ -9,6 +9,7 @@
#include "LoadBalanceCosts.H"
#include "Utils/WarpXUtil.H"
+#include <memory>
using namespace amrex;
@@ -58,7 +59,7 @@ void LoadBalanceCosts::ComputeDiags (int step)
costs.resize(nLevels);
for (int lev = 0; lev < nLevels; ++lev)
{
- costs[lev].reset(new amrex::LayoutData<Real>(*warpx.getCosts(lev)));
+ costs[lev] = std::make_unique<LayoutData<Real>>(*warpx.getCosts(lev));
}
if (warpx.load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Heuristic)
diff --git a/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp b/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp
index a6bb16e57..226068f57 100644
--- a/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp
+++ b/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp
@@ -48,38 +48,38 @@ MultiReducedDiags::MultiReducedDiags ()
// match diags
if (rd_type.compare("ParticleEnergy") == 0)
{
- m_multi_rd[i_rd].reset
- ( new ParticleEnergy(m_rd_names[i_rd]));
+ m_multi_rd[i_rd] =
+ std::make_unique<ParticleEnergy>(m_rd_names[i_rd]);
}
else if (rd_type.compare("FieldEnergy") == 0)
{
- m_multi_rd[i_rd].reset
- ( new FieldEnergy(m_rd_names[i_rd]));
+ m_multi_rd[i_rd] =
+ std::make_unique<FieldEnergy>(m_rd_names[i_rd]);
}
else if (rd_type.compare("FieldMaximum") == 0)
{
- m_multi_rd[i_rd].reset
- ( new FieldMaximum(m_rd_names[i_rd]));
+ m_multi_rd[i_rd] =
+ std::make_unique<FieldMaximum>(m_rd_names[i_rd]);
}
else if (rd_type.compare("BeamRelevant") == 0)
{
- m_multi_rd[i_rd].reset
- ( new BeamRelevant(m_rd_names[i_rd]));
+ m_multi_rd[i_rd] =
+ std::make_unique<BeamRelevant>(m_rd_names[i_rd]);
}
else if (rd_type.compare("LoadBalanceCosts") == 0)
{
- m_multi_rd[i_rd].reset
- ( new LoadBalanceCosts(m_rd_names[i_rd]));
+ m_multi_rd[i_rd] =
+ std::make_unique<LoadBalanceCosts>(m_rd_names[i_rd]);
}
else if (rd_type.compare("ParticleHistogram") == 0)
{
- m_multi_rd[i_rd].reset
- ( new ParticleHistogram(m_rd_names[i_rd]));
+ m_multi_rd[i_rd] =
+ std::make_unique<ParticleHistogram>(m_rd_names[i_rd]);
}
else if (rd_type.compare("ParticleNumber") == 0)
{
- m_multi_rd[i_rd].reset
- ( new ParticleNumber(m_rd_names[i_rd]));
+ m_multi_rd[i_rd]=
+ std::make_unique<ParticleNumber>(m_rd_names[i_rd]);
}
else
{ Abort("No matching reduced diagnostics type found."); }
diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
index 85624c6a1..b2fd64a98 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
@@ -8,9 +8,12 @@
#include "ParticleHistogram.H"
#include "WarpX.H"
#include "Utils/WarpXUtil.H"
+
#include <AMReX_REAL.H>
#include <AMReX_ParticleReduce.H>
+
#include <limits>
+#include <memory>
using namespace amrex;
@@ -44,8 +47,8 @@ ParticleHistogram::ParticleHistogram (std::string rd_name)
std::string function_string = "";
Store_parserString(pp,"histogram_function(t,x,y,z,ux,uy,uz)",
function_string);
- m_parser.reset(new ParserWrapper<m_nvars>(
- makeParser(function_string,{"t","x","y","z","ux","uy","uz"})));
+ m_parser = std::make_unique<ParserWrapper<m_nvars>>(
+ makeParser(function_string,{"t","x","y","z","ux","uy","uz"}));
// read normalization type
std::string norm_string = "default";
diff --git a/Source/Diagnostics/SliceDiagnostic.cpp b/Source/Diagnostics/SliceDiagnostic.cpp
index 1d0d2e39c..8b95217e7 100644
--- a/Source/Diagnostics/SliceDiagnostic.cpp
+++ b/Source/Diagnostics/SliceDiagnostic.cpp
@@ -11,6 +11,8 @@
#include <WarpX.H>
+#include <memory>
+
using namespace amrex;
@@ -113,8 +115,8 @@ CreateSlice( const MultiFab& mf, const Vector<Geometry> &dom_geom,
Vector<DistributionMapping> sdmap(1);
sdmap[0] = DistributionMapping{sba[0]};
- smf.reset(new MultiFab(amrex::convert(sba[0],SliceType), sdmap[0],
- ncomp, nghost));
+ smf = std::make_unique<MultiFab>(amrex::convert(sba[0],SliceType), sdmap[0],
+ ncomp, nghost);
// Copy data from domain to slice that has same cell size as that of //
// the domain mf. src and dst have the same number of ghost cells //
@@ -137,8 +139,8 @@ CreateSlice( const MultiFab& mf, const Vector<Geometry> &dom_geom,
AMREX_ALWAYS_ASSERT(crse_ba[0].size() == sba[0].size());
- cs_mf.reset( new MultiFab(amrex::convert(crse_ba[0],SliceType),
- sdmap[0], ncomp,nghost));
+ cs_mf = std::make_unique<MultiFab>(amrex::convert(crse_ba[0],SliceType),
+ sdmap[0], ncomp,nghost);
MultiFab& mfSrc = *smf;
MultiFab& mfDst = *cs_mf;
@@ -480,10 +482,3 @@ InterpolateLo(const Box& bx, FArrayBox &fabox, IntVect slice_lo,
}
}
-
-
-
-
-
-
-
diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp
index 42261caf6..6a2c12479 100644
--- a/Source/Diagnostics/WarpXIO.cpp
+++ b/Source/Diagnostics/WarpXIO.cpp
@@ -24,6 +24,7 @@
# include <AMReX_AmrMeshInSituBridge.H>
#endif
+#include <memory>
using namespace amrex;
@@ -251,7 +252,7 @@ WarpX::GetCellCenteredData() {
for (int lev = 0; lev <= finest_level; ++lev)
{
- cc[lev].reset( new MultiFab(grids[lev], dmap[lev], nc, ng) );
+ cc[lev] = std::make_unique<MultiFab>(grids[lev], dmap[lev], nc, ng );
int dcomp = 0;
// first the electric field
diff --git a/Source/FieldSolver/ElectrostaticSolver.cpp b/Source/FieldSolver/ElectrostaticSolver.cpp
index 25f672f90..73d7048b7 100644
--- a/Source/FieldSolver/ElectrostaticSolver.cpp
+++ b/Source/FieldSolver/ElectrostaticSolver.cpp
@@ -11,6 +11,8 @@
#include <WarpX.H>
+#include <memory>
+
using namespace amrex;
void
@@ -52,8 +54,8 @@ WarpX::AddSpaceChargeField (WarpXParticleContainer& pc)
for (int lev = 0; lev <= max_level; lev++) {
BoxArray nba = boxArray(lev);
nba.surroundingNodes();
- rho[lev].reset(new MultiFab(nba, dmap[lev], 1, ng));
- phi[lev].reset(new MultiFab(nba, dmap[lev], 1, 1));
+ rho[lev] = std::make_unique<MultiFab>(nba, dmap[lev], 1, ng);
+ phi[lev] = std::make_unique<MultiFab>(nba, dmap[lev], 1, 1);
phi[lev]->setVal(0.);
}
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp
index a368dc026..2232c4e5b 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp
+++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp
@@ -2,6 +2,8 @@
#include <AMReX_ParmParse.H>
#include "WarpX.H"
+#include <memory>
+
using namespace amrex;
MacroscopicProperties::MacroscopicProperties ()
@@ -34,8 +36,8 @@ MacroscopicProperties::ReadParameters ()
// initialization of sigma (conductivity) with parser
if (m_sigma_s == "parse_sigma_function") {
Store_parserString(pp, "sigma_function(x,y,z)", m_str_sigma_function);
- m_sigma_parser.reset(new ParserWrapper<3>(
- makeParser(m_str_sigma_function,{"x","y","z"}) ) );
+ m_sigma_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(m_str_sigma_function,{"x","y","z"}));
}
bool epsilon_specified = false;
@@ -54,8 +56,8 @@ MacroscopicProperties::ReadParameters ()
// initialization of epsilon (permittivity) with parser
if (m_epsilon_s == "parse_epsilon_function") {
Store_parserString(pp, "epsilon_function(x,y,z)", m_str_epsilon_function);
- m_epsilon_parser.reset(new ParserWrapper<3>(
- makeParser(m_str_epsilon_function,{"x","y","z"}) ) );
+ m_epsilon_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(m_str_epsilon_function,{"x","y","z"}));
}
// Query input for material permittivity, epsilon.
@@ -75,8 +77,8 @@ MacroscopicProperties::ReadParameters ()
// initialization of mu (permeability) with parser
if (m_mu_s == "parse_mu_function") {
Store_parserString(pp, "mu_function(x,y,z)", m_str_mu_function);
- m_mu_parser.reset(new ParserWrapper<3>(
- makeParser(m_str_mu_function,{"x","y","z"}) ) );
+ m_mu_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(m_str_mu_function,{"x","y","z"}));
}
}
@@ -194,4 +196,3 @@ MacroscopicProperties::InitializeMacroMultiFabUsingParser (
}
-
diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp
index 7886bd549..884ee5f45 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp
@@ -7,6 +7,8 @@
#include "Utils/WarpXConst.H"
#include "SpectralHankelTransformer.H"
+#include <memory>
+
SpectralHankelTransformer::SpectralHankelTransformer (int const nr,
int const n_rz_azimuthal_modes,
amrex::Real const rmax)
@@ -18,9 +20,9 @@ SpectralHankelTransformer::SpectralHankelTransformer (int const nr,
dhtm.resize(m_n_rz_azimuthal_modes);
for (int mode=0 ; mode < m_n_rz_azimuthal_modes ; mode++) {
- dht0[mode].reset( new HankelTransform(mode , mode, m_nr, rmax) );
- dhtp[mode].reset( new HankelTransform(mode+1, mode, m_nr, rmax) );
- dhtm[mode].reset( new HankelTransform(mode-1, mode, m_nr, rmax) );
+ dht0[mode] = std::make_unique<HankelTransform>(mode , mode, m_nr, rmax);
+ dhtp[mode] = std::make_unique<HankelTransform>(mode+1, mode, m_nr, rmax);
+ dhtm[mode] = std::make_unique<HankelTransform>(mode-1, mode, m_nr, rmax);
}
ExtractKrArray();
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
index 5d2c954ce..0cfd899df 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
@@ -14,6 +14,8 @@
#include "Utils/WarpXProfilerWrapper.H"
#include "Utils/WarpXUtil.H"
+#include <memory>
+
#if WARPX_USE_PSATD
/* \brief Initialize the spectral Maxwell solver
@@ -53,23 +55,23 @@ SpectralSolver::SpectralSolver(
// Initialize the corresponding coefficients over k space
if (pml) {
- algorithm = std::unique_ptr<PMLPsatdAlgorithm>( new PMLPsatdAlgorithm(
- k_space, dm, norder_x, norder_y, norder_z, nodal, dt ) );
+ algorithm = std::make_unique<PMLPsatdAlgorithm>(
+ k_space, dm, norder_x, norder_y, norder_z, nodal, dt);
}
else {
if (fft_do_time_averaging){
- algorithm = std::unique_ptr<AvgGalileanAlgorithm>( new AvgGalileanAlgorithm(
- k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt ) );
+ algorithm = std::make_unique<AvgGalileanAlgorithm>(
+ k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt);
}
else {
if ((v_galilean[0]==0) && (v_galilean[1]==0) && (v_galilean[2]==0)){
// v_galilean is 0: use standard PSATD algorithm
- algorithm = std::unique_ptr<PsatdAlgorithm>( new PsatdAlgorithm(
- k_space, dm, norder_x, norder_y, norder_z, nodal, dt, update_with_rho ) );
+ algorithm = std::make_unique<PsatdAlgorithm>(
+ k_space, dm, norder_x, norder_y, norder_z, nodal, dt, update_with_rho);
}
else {
- algorithm = std::unique_ptr<GalileanAlgorithm>( new GalileanAlgorithm(
- k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt, update_with_rho ) );
+ algorithm = std::make_unique<GalileanAlgorithm>(
+ k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt, update_with_rho);
}
}
}
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
index 38851ef50..581538d6a 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
@@ -45,12 +45,12 @@ SpectralSolverRZ::SpectralSolverRZ (amrex::BoxArray const & realspace_ba,
// PML is not supported.
if (v_galilean[2] == 0) {
// v_galilean is 0: use standard PSATD algorithm
- algorithm = std::unique_ptr<PsatdAlgorithmRZ>(
- new PsatdAlgorithmRZ(k_space, dm, n_rz_azimuthal_modes, norder_z, nodal, dt));
+ algorithm = std::make_unique<PsatdAlgorithmRZ>(
+ k_space, dm, n_rz_azimuthal_modes, norder_z, nodal, dt);
} else {
// Otherwise: use the Galilean algorithm
- algorithm = std::unique_ptr<GalileanPsatdAlgorithmRZ>(
- new GalileanPsatdAlgorithmRZ(k_space, dm, n_rz_azimuthal_modes, norder_z, nodal, v_galilean, dt));
+ algorithm = std::make_unique<GalileanPsatdAlgorithmRZ>(
+ k_space, dm, n_rz_azimuthal_modes, norder_z, nodal, v_galilean, dt);
}
// - Initialize arrays for fields in spectral space + FFT plans
diff --git a/Source/Initialization/PlasmaInjector.H b/Source/Initialization/PlasmaInjector.H
index f8ef29faf..62d6fed00 100644
--- a/Source/Initialization/PlasmaInjector.H
+++ b/Source/Initialization/PlasmaInjector.H
@@ -26,6 +26,7 @@
#endif
#include <array>
+#include <memory>
///
/// The PlasmaInjector class parses and stores information about the plasma
diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp
index 3930fd4de..69aefc47e 100644
--- a/Source/Initialization/PlasmaInjector.cpp
+++ b/Source/Initialization/PlasmaInjector.cpp
@@ -20,6 +20,7 @@
#include <functional>
#include <sstream>
#include <string>
+#include <memory>
using namespace amrex;
@@ -230,8 +231,9 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
"(Please visit PR#765 for more information.)");
#endif
// Construct InjectorPosition with InjectorPositionRandom.
- h_inj_pos.reset(new InjectorPosition((InjectorPositionRandom*)nullptr,
- xmin, xmax, ymin, ymax, zmin, zmax));
+ h_inj_pos = std::make_unique<InjectorPosition>(
+ (InjectorPositionRandom*)nullptr,
+ xmin, xmax, ymin, ymax, zmin, zmax);
parseDensity(pp);
parseMomentum(pp);
} else if (part_pos_s == "nuniformpercell") {
@@ -250,11 +252,12 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
"n_rz_azimuthal_modes (Please visit PR#765 for more information.)");
#endif
// Construct InjectorPosition from InjectorPositionRegular.
- h_inj_pos.reset(new InjectorPosition((InjectorPositionRegular*)nullptr,
- xmin, xmax, ymin, ymax, zmin, zmax,
- Dim3{num_particles_per_cell_each_dim[0],
- num_particles_per_cell_each_dim[1],
- num_particles_per_cell_each_dim[2]}));
+ h_inj_pos = std::make_unique<InjectorPosition>(
+ (InjectorPositionRegular*)nullptr,
+ xmin, xmax, ymin, ymax, zmin, zmax,
+ Dim3{num_particles_per_cell_each_dim[0],
+ num_particles_per_cell_each_dim[1],
+ num_particles_per_cell_each_dim[2]});
num_particles_per_cell = num_particles_per_cell_each_dim[0] *
num_particles_per_cell_each_dim[1] *
num_particles_per_cell_each_dim[2];
diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp
index b1e643354..14acc5647 100644
--- a/Source/Initialization/WarpXInitData.cpp
+++ b/Source/Initialization/WarpXInitData.cpp
@@ -22,6 +22,7 @@
# include <AMReX_AmrMeshInSituBridge.H>
#endif
+#include <memory>
using namespace amrex;
@@ -127,7 +128,8 @@ WarpX::InitDiagnostics () {
// Find the positions of the lab-frame box that corresponds to the boosted-frame box at t=0
Real zmin_lab = current_lo[moving_window_dir]/( (1.+beta_boost)*gamma_boost );
Real zmax_lab = current_hi[moving_window_dir]/( (1.+beta_boost)*gamma_boost );
- myBFD.reset(new BackTransformedDiagnostic(zmin_lab,
+ myBFD = std::make_unique<BackTransformedDiagnostic>(
+ zmin_lab,
zmax_lab,
moving_window_v, dt_snapshots_lab,
num_snapshots_lab,
@@ -136,7 +138,7 @@ WarpX::InitDiagnostics () {
gamma_boost, t_new[0], dt_boost,
moving_window_dir, geom[0],
slice_realbox,
- particle_slice_width_lab));
+ particle_slice_width_lab);
}
}
@@ -167,14 +169,14 @@ WarpX::InitPML ()
#ifdef WARPX_DIM_RZ
do_pml_Lo_corrected[0] = 0; // no PML at r=0, in cylindrical geometry
#endif
- pml[0].reset(new PML(boxArray(0), DistributionMap(0), &Geom(0), nullptr,
+ pml[0] = std::make_unique<PML>(boxArray(0), DistributionMap(0), &Geom(0), nullptr,
pml_ncell, pml_delta, 0,
#ifdef WARPX_USE_PSATD
dt[0], nox_fft, noy_fft, noz_fft, do_nodal,
#endif
do_dive_cleaning, do_moving_window,
pml_has_particles, do_pml_in_domain,
- do_pml_Lo_corrected, do_pml_Hi));
+ do_pml_Lo_corrected, do_pml_Hi);
for (int lev = 1; lev <= finest_level; ++lev)
{
amrex::IntVect do_pml_Lo_MR = amrex::IntVect::TheUnitVector();
@@ -184,7 +186,7 @@ WarpX::InitPML ()
do_pml_Lo_MR[0] = 0;
}
#endif
- pml[lev].reset(new PML(boxArray(lev), DistributionMap(lev),
+ pml[lev] = std::make_unique<PML>(boxArray(lev), DistributionMap(lev),
&Geom(lev), &Geom(lev-1),
pml_ncell, pml_delta, refRatio(lev-1)[0],
#ifdef WARPX_USE_PSATD
@@ -192,7 +194,7 @@ WarpX::InitPML ()
#endif
do_dive_cleaning, do_moving_window,
pml_has_particles, do_pml_in_domain,
- do_pml_Lo_MR, amrex::IntVect::TheUnitVector()));
+ do_pml_Lo_MR, amrex::IntVect::TheUnitVector());
}
}
}
@@ -229,9 +231,11 @@ WarpX::InitNCICorrector ()
// Initialize Godfrey filters
// Same filter for fields Ex, Ey and Bz
const bool nodal_gather = !galerkin_interpolation;
- nci_godfrey_filter_exeybz[lev].reset( new NCIGodfreyFilter(godfrey_coeff_set::Ex_Ey_Bz, cdtodz, nodal_gather) );
+ nci_godfrey_filter_exeybz[lev] = std::make_unique<NCIGodfreyFilter>(
+ godfrey_coeff_set::Ex_Ey_Bz, cdtodz, nodal_gather);
// Same filter for fields Bx, By and Ez
- nci_godfrey_filter_bxbyez[lev].reset( new NCIGodfreyFilter(godfrey_coeff_set::Bx_By_Ez, cdtodz, nodal_gather) );
+ nci_godfrey_filter_bxbyez[lev] = std::make_unique<NCIGodfreyFilter>(
+ godfrey_coeff_set::Bx_By_Ez, cdtodz, nodal_gather);
// Compute Godfrey filters stencils
nci_godfrey_filter_exeybz[lev]->ComputeStencils();
nci_godfrey_filter_bxbyez[lev]->ComputeStencils();
@@ -345,12 +349,12 @@ WarpX::InitLevelData (int lev, Real /*time*/)
str_By_ext_grid_function);
Store_parserString(pp, "Bz_external_grid_function(x,y,z)",
str_Bz_ext_grid_function);
- Bxfield_parser.reset(new ParserWrapper<3>(
- makeParser(str_Bx_ext_grid_function,{"x","y","z"})));
- Byfield_parser.reset(new ParserWrapper<3>(
- makeParser(str_By_ext_grid_function,{"x","y","z"})));
- Bzfield_parser.reset(new ParserWrapper<3>(
- makeParser(str_Bz_ext_grid_function,{"x","y","z"})));
+ Bxfield_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(str_Bx_ext_grid_function,{"x","y","z"}));
+ Byfield_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(str_By_ext_grid_function,{"x","y","z"}));
+ Bzfield_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(str_Bz_ext_grid_function,{"x","y","z"}));
// Initialize Bfield_fp with external function
InitializeExternalFieldsOnGridUsingParser(Bfield_fp[lev][0].get(),
@@ -394,12 +398,12 @@ WarpX::InitLevelData (int lev, Real /*time*/)
Store_parserString(pp, "Ez_external_grid_function(x,y,z)",
str_Ez_ext_grid_function);
- Exfield_parser.reset(new ParserWrapper<3>(
- makeParser(str_Ex_ext_grid_function,{"x","y","z"})));
- Eyfield_parser.reset(new ParserWrapper<3>(
- makeParser(str_Ey_ext_grid_function,{"x","y","z"})));
- Ezfield_parser.reset(new ParserWrapper<3>(
- makeParser(str_Ez_ext_grid_function,{"x","y","z"})));
+ Exfield_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(str_Ex_ext_grid_function,{"x","y","z"}));
+ Eyfield_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(str_Ey_ext_grid_function,{"x","y","z"}));
+ Ezfield_parser = std::make_unique<ParserWrapper<3>>(
+ makeParser(str_Ez_ext_grid_function,{"x","y","z"}));
// Initialize Efield_fp with external function
InitializeExternalFieldsOnGridUsingParser(Efield_fp[lev][0].get(),
diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp
index ac619a937..667be0696 100644
--- a/Source/Parallelization/WarpXComm.cpp
+++ b/Source/Parallelization/WarpXComm.cpp
@@ -14,6 +14,8 @@
#include <algorithm>
#include <cstdlib>
+#include <memory>
+
using namespace amrex;
void
@@ -114,12 +116,13 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
Array<std::unique_ptr<MultiFab>,3> Btmp;
if (Bfield_cax[lev][0]) {
for (int i = 0; i < 3; ++i) {
- Btmp[i].reset(new MultiFab(*Bfield_cax[lev][i], amrex::make_alias, 0, 1));
+ Btmp[i] = std::make_unique<MultiFab>(
+ *Bfield_cax[lev][i], amrex::make_alias, 0, 1);
}
} else {
IntVect ngtmp = Bfield_aux[lev-1][0]->nGrowVect();
for (int i = 0; i < 3; ++i) {
- Btmp[i].reset(new MultiFab(cnba, dm, 1, ngtmp));
+ Btmp[i] = std::make_unique<MultiFab>(cnba, dm, 1, ngtmp);
}
}
// ParallelCopy from coarse level
@@ -162,12 +165,14 @@ WarpX::UpdateAuxilaryDataStagToNodal ()
Array<std::unique_ptr<MultiFab>,3> Etmp;
if (Efield_cax[lev][0]) {
for (int i = 0; i < 3; ++i) {
- Etmp[i].reset(new MultiFab(*Efield_cax[lev][i], amrex::make_alias, 0, 1));
+ Etmp[i] = std::make_unique<MultiFab>(
+ *Efield_cax[lev][i], amrex::make_alias, 0, 1);
}
} else {
IntVect ngtmp = Efield_aux[lev-1][0]->nGrowVect();
for (int i = 0; i < 3; ++i) {
- Etmp[i].reset(new MultiFab(cnba, dm, 1, ngtmp));
+ Etmp[i] = std::make_unique<MultiFab>(
+ cnba, dm, 1, ngtmp);
}
}
// ParallelCopy from coarse level
diff --git a/Source/Parallelization/WarpXRegrid.cpp b/Source/Parallelization/WarpXRegrid.cpp
index 374948aa8..1fdfd6564 100644
--- a/Source/Parallelization/WarpXRegrid.cpp
+++ b/Source/Parallelization/WarpXRegrid.cpp
@@ -11,6 +11,8 @@
#include <AMReX_BLProfiler.H>
+#include <memory>
+
using namespace amrex;
void
@@ -107,29 +109,29 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
{
{
const IntVect& ng = Bfield_fp[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Bfield_fp[lev][idim]->boxArray(),
- dm, Bfield_fp[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Bfield_fp[lev][idim]->boxArray(),
+ dm, Bfield_fp[lev][idim]->nComp(), ng);
pmf->Redistribute(*Bfield_fp[lev][idim], 0, 0, Bfield_fp[lev][idim]->nComp(), ng);
Bfield_fp[lev][idim] = std::move(pmf);
}
{
const IntVect& ng = Efield_fp[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Efield_fp[lev][idim]->boxArray(),
- dm, Efield_fp[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Efield_fp[lev][idim]->boxArray(),
+ dm, Efield_fp[lev][idim]->nComp(), ng);
pmf->Redistribute(*Efield_fp[lev][idim], 0, 0, Efield_fp[lev][idim]->nComp(), ng);
Efield_fp[lev][idim] = std::move(pmf);
}
{
const IntVect& ng = current_fp[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(current_fp[lev][idim]->boxArray(),
- dm, current_fp[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(current_fp[lev][idim]->boxArray(),
+ dm, current_fp[lev][idim]->nComp(), ng);
current_fp[lev][idim] = std::move(pmf);
}
if (current_store[lev][idim])
{
const IntVect& ng = current_store[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(current_store[lev][idim]->boxArray(),
- dm, current_store[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(current_store[lev][idim]->boxArray(),
+ dm, current_store[lev][idim]->nComp(), ng);
// no need to redistribute
current_store[lev][idim] = std::move(pmf);
}
@@ -137,8 +139,8 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (F_fp[lev] != nullptr) {
const IntVect& ng = F_fp[lev]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(F_fp[lev]->boxArray(),
- dm, F_fp[lev]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(F_fp[lev]->boxArray(),
+ dm, F_fp[lev]->nComp(), ng);
pmf->Redistribute(*F_fp[lev], 0, 0, F_fp[lev]->nComp(), ng);
F_fp[lev] = std::move(pmf);
}
@@ -146,8 +148,8 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (rho_fp[lev] != nullptr) {
const int nc = rho_fp[lev]->nComp();
const IntVect& ng = rho_fp[lev]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(rho_fp[lev]->boxArray(),
- dm, nc, ng));
+ auto pmf = std::make_unique<MultiFab>(rho_fp[lev]->boxArray(),
+ dm, nc, ng);
rho_fp[lev] = std::move(pmf);
}
@@ -155,23 +157,23 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (lev == 0 && Bfield_aux[0][0]->ixType() == Bfield_fp[0][0]->ixType())
{
for (int idim = 0; idim < 3; ++idim) {
- Bfield_aux[lev][idim].reset(new MultiFab(*Bfield_fp[lev][idim], amrex::make_alias, 0, Bfield_aux[lev][idim]->nComp()));
- Efield_aux[lev][idim].reset(new MultiFab(*Efield_fp[lev][idim], amrex::make_alias, 0, Efield_aux[lev][idim]->nComp()));
+ Bfield_aux[lev][idim] = std::make_unique<MultiFab>(*Bfield_fp[lev][idim], amrex::make_alias, 0, Bfield_aux[lev][idim]->nComp());
+ Efield_aux[lev][idim] = std::make_unique<MultiFab>(*Efield_fp[lev][idim], amrex::make_alias, 0, Efield_aux[lev][idim]->nComp());
}
} else {
for (int idim=0; idim < 3; ++idim)
{
{
const IntVect& ng = Bfield_aux[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Bfield_aux[lev][idim]->boxArray(),
- dm, Bfield_aux[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Bfield_aux[lev][idim]->boxArray(),
+ dm, Bfield_aux[lev][idim]->nComp(), ng);
// pmf->Redistribute(*Bfield_aux[lev][idim], 0, 0, Bfield_aux[lev][idim]->nComp(), ng);
Bfield_aux[lev][idim] = std::move(pmf);
}
{
const IntVect& ng = Efield_aux[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Efield_aux[lev][idim]->boxArray(),
- dm, Efield_aux[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Efield_aux[lev][idim]->boxArray(),
+ dm, Efield_aux[lev][idim]->nComp(), ng);
// pmf->Redistribute(*Efield_aux[lev][idim], 0, 0, Efield_aux[lev][idim]->nComp(), ng);
Efield_aux[lev][idim] = std::move(pmf);
}
@@ -184,30 +186,30 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
{
{
const IntVect& ng = Bfield_cp[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Bfield_cp[lev][idim]->boxArray(),
- dm, Bfield_cp[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Bfield_cp[lev][idim]->boxArray(),
+ dm, Bfield_cp[lev][idim]->nComp(), ng);
pmf->Redistribute(*Bfield_cp[lev][idim], 0, 0, Bfield_cp[lev][idim]->nComp(), ng);
Bfield_cp[lev][idim] = std::move(pmf);
}
{
const IntVect& ng = Efield_cp[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Efield_cp[lev][idim]->boxArray(),
- dm, Efield_cp[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Efield_cp[lev][idim]->boxArray(),
+ dm, Efield_cp[lev][idim]->nComp(), ng);
pmf->Redistribute(*Efield_cp[lev][idim], 0, 0, Efield_cp[lev][idim]->nComp(), ng);
Efield_cp[lev][idim] = std::move(pmf);
}
{
const IntVect& ng = current_cp[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>( new MultiFab(current_cp[lev][idim]->boxArray(),
- dm, current_cp[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(current_cp[lev][idim]->boxArray(),
+ dm, current_cp[lev][idim]->nComp(), ng);
current_cp[lev][idim] = std::move(pmf);
}
}
if (F_cp[lev] != nullptr) {
const IntVect& ng = F_cp[lev]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(F_cp[lev]->boxArray(),
- dm, F_cp[lev]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(F_cp[lev]->boxArray(),
+ dm, F_cp[lev]->nComp(), ng);
pmf->Redistribute(*F_cp[lev], 0, 0, F_cp[lev]->nComp(), ng);
F_cp[lev] = std::move(pmf);
}
@@ -215,8 +217,8 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (rho_cp[lev] != nullptr) {
const int nc = rho_cp[lev]->nComp();
const IntVect& ng = rho_cp[lev]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(rho_cp[lev]->boxArray(),
- dm, nc, ng));
+ auto pmf = std::make_unique<MultiFab>(rho_cp[lev]->boxArray(),
+ dm, nc, ng);
rho_cp[lev] = std::move(pmf);
}
}
@@ -227,24 +229,24 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (Bfield_cax[lev][idim])
{
const IntVect& ng = Bfield_cax[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Bfield_cax[lev][idim]->boxArray(),
- dm, Bfield_cax[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Bfield_cax[lev][idim]->boxArray(),
+ dm, Bfield_cax[lev][idim]->nComp(), ng);
// pmf->ParallelCopy(*Bfield_cax[lev][idim], 0, 0, Bfield_cax[lev][idim]->nComp(), ng, ng);
Bfield_cax[lev][idim] = std::move(pmf);
}
if (Efield_cax[lev][idim])
{
const IntVect& ng = Efield_cax[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(Efield_cax[lev][idim]->boxArray(),
- dm, Efield_cax[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(Efield_cax[lev][idim]->boxArray(),
+ dm, Efield_cax[lev][idim]->nComp(), ng);
// pmf->ParallelCopy(*Efield_cax[lev][idim], 0, 0, Efield_cax[lev][idim]->nComp(), ng, ng);
Efield_cax[lev][idim] = std::move(pmf);
}
if (current_buf[lev][idim])
{
const IntVect& ng = current_buf[lev][idim]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(current_buf[lev][idim]->boxArray(),
- dm, current_buf[lev][idim]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(current_buf[lev][idim]->boxArray(),
+ dm, current_buf[lev][idim]->nComp(), ng);
// pmf->ParallelCopy(*current_buf[lev][idim], 0, 0, current_buf[lev][idim]->nComp(), ng, ng);
current_buf[lev][idim] = std::move(pmf);
}
@@ -252,24 +254,24 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (charge_buf[lev])
{
const IntVect& ng = charge_buf[lev]->nGrowVect();
- auto pmf = std::unique_ptr<MultiFab>(new MultiFab(charge_buf[lev]->boxArray(),
- dm, charge_buf[lev]->nComp(), ng));
+ auto pmf = std::make_unique<MultiFab>(charge_buf[lev]->boxArray(),
+ dm, charge_buf[lev]->nComp(), ng);
// pmf->ParallelCopy(*charge_buf[lev][idim], 0, 0, charge_buf[lev]->nComp(), ng, ng);
charge_buf[lev] = std::move(pmf);
}
if (current_buffer_masks[lev])
{
const IntVect& ng = current_buffer_masks[lev]->nGrowVect();
- auto pmf = std::unique_ptr<iMultiFab>(new iMultiFab(current_buffer_masks[lev]->boxArray(),
- dm, current_buffer_masks[lev]->nComp(), ng));
+ auto pmf = std::make_unique<iMultiFab>(current_buffer_masks[lev]->boxArray(),
+ dm, current_buffer_masks[lev]->nComp(), ng);
// pmf->ParallelCopy(*current_buffer_masks[lev], 0, 0, current_buffer_masks[lev]->nComp(), ng, ng);
current_buffer_masks[lev] = std::move(pmf);
}
if (gather_buffer_masks[lev])
{
const IntVect& ng = gather_buffer_masks[lev]->nGrowVect();
- auto pmf = std::unique_ptr<iMultiFab>(new iMultiFab(gather_buffer_masks[lev]->boxArray(),
- dm, gather_buffer_masks[lev]->nComp(), ng));
+ auto pmf = std::make_unique<iMultiFab>(gather_buffer_masks[lev]->boxArray(),
+ dm, gather_buffer_masks[lev]->nComp(), ng);
// pmf->ParallelCopy(*gather_buffer_masks[lev], 0, 0, gather_buffer_masks[lev]->nComp(), ng, ng);
gather_buffer_masks[lev] = std::move(pmf);
}
@@ -277,7 +279,7 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (costs[lev] != nullptr)
{
- costs[lev].reset(new amrex::LayoutData<Real>(ba, dm));
+ costs[lev] = std::make_unique<LayoutData<Real>>(ba, dm);
for (int i : costs[lev]->IndexArray())
{
(*costs[lev])[i] = 0.0;
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index d3e794b5d..ef23f9de5 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -39,23 +39,23 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
allcontainers.resize(nspecies + nlasers);
for (int i = 0; i < nspecies; ++i) {
if (species_types[i] == PCTypes::Physical) {
- allcontainers[i].reset(new PhysicalParticleContainer(amr_core, i, species_names[i]));
+ allcontainers[i] = std::make_unique<PhysicalParticleContainer>(amr_core, i, species_names[i]);
}
else if (species_types[i] == PCTypes::RigidInjected) {
- allcontainers[i].reset(new RigidInjectedParticleContainer(amr_core, i, species_names[i]));
+ allcontainers[i] = std::make_unique<RigidInjectedParticleContainer>(amr_core, i, species_names[i]);
}
else if (species_types[i] == PCTypes::Photon) {
- allcontainers[i].reset(new PhotonParticleContainer(amr_core, i, species_names[i]));
+ allcontainers[i] = std::make_unique<PhotonParticleContainer>(amr_core, i, species_names[i]);
}
allcontainers[i]->m_deposit_on_main_grid = m_deposit_on_main_grid[i];
allcontainers[i]->m_gather_from_main_grid = m_gather_from_main_grid[i];
}
for (int i = nspecies; i < nspecies+nlasers; ++i) {
- allcontainers[i].reset(new LaserParticleContainer(amr_core, i, lasers_names[i-nspecies]));
+ allcontainers[i] = std::make_unique<LaserParticleContainer>(amr_core, i, lasers_names[i-nspecies]);
}
- pc_tmp.reset(new PhysicalParticleContainer(amr_core));
+ pc_tmp = std::make_unique<PhysicalParticleContainer>(amr_core);
// Compute the number of species for which lab-frame data is dumped
// nspecies_lab_frame_diags, and map their ID to MultiParticleContainer
@@ -75,8 +75,8 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
auto const ncollisions = collision_names.size();
allcollisions.resize(ncollisions);
for (int i = 0; i < static_cast<int>(ncollisions); ++i) {
- allcollisions[i].reset
- (new CollisionType(species_names, collision_names[i]));
+ allcollisions[i] =
+ std::make_unique<CollisionType>(species_names, collision_names[i]);
}
}
@@ -139,12 +139,12 @@ MultiParticleContainer::ReadParameters ()
str_Bz_ext_particle_function);
// Parser for B_external on the particle
- m_Bx_particle_parser.reset(new ParserWrapper<4>(
- makeParser(str_Bx_ext_particle_function,{"x","y","z","t"})));
- m_By_particle_parser.reset(new ParserWrapper<4>(
- makeParser(str_By_ext_particle_function,{"x","y","z","t"})));
- m_Bz_particle_parser.reset(new ParserWrapper<4>(
- makeParser(str_Bz_ext_particle_function,{"x","y","z","t"})));
+ m_Bx_particle_parser = std::make_unique<ParserWrapper<4>>(
+ makeParser(str_Bx_ext_particle_function,{"x","y","z","t"}));
+ m_By_particle_parser = std::make_unique<ParserWrapper<4>>(
+ makeParser(str_By_ext_particle_function,{"x","y","z","t"}));
+ m_Bz_particle_parser = std::make_unique<ParserWrapper<4>>(
+ makeParser(str_Bz_ext_particle_function,{"x","y","z","t"}));
}
@@ -164,12 +164,12 @@ MultiParticleContainer::ReadParameters ()
Store_parserString(pp, "Ez_external_particle_function(x,y,z,t)",
str_Ez_ext_particle_function);
// Parser for E_external on the particle
- m_Ex_particle_parser.reset(new ParserWrapper<4>(
- makeParser(str_Ex_ext_particle_function,{"x","y","z","t"})));
- m_Ey_particle_parser.reset(new ParserWrapper<4>(
- makeParser(str_Ey_ext_particle_function,{"x","y","z","t"})));
- m_Ez_particle_parser.reset(new ParserWrapper<4>(
- makeParser(str_Ez_ext_particle_function,{"x","y","z","t"})));
+ m_Ex_particle_parser = std::make_unique<ParserWrapper<4>>(
+ makeParser(str_Ex_ext_particle_function,{"x","y","z","t"}));
+ m_Ey_particle_parser = std::make_unique<ParserWrapper<4>>(
+ makeParser(str_Ey_ext_particle_function,{"x","y","z","t"}));
+ m_Ez_particle_parser = std::make_unique<ParserWrapper<4>>(
+ makeParser(str_Ez_ext_particle_function,{"x","y","z","t"}));
}
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 107ac10bd..7af6c4dd3 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -96,7 +96,7 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
{
BackwardCompatibility();
- plasma_injector.reset(new PlasmaInjector(species_id, species_name));
+ plasma_injector = std::make_unique<PlasmaInjector>(species_id, species_name);
physical_species = plasma_injector->getPhysicalSpecies();
charge = plasma_injector->getCharge();
mass = plasma_injector->getMass();
@@ -179,8 +179,8 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
std::string function_string = "";
Store_parserString(pp,"plot_filter_function(t,x,y,z,ux,uy,uz)",
function_string);
- m_particle_filter_parser.reset(new ParserWrapper<7>(
- makeParser(function_string,{"t","x","y","z","ux","uy","uz"})));
+ m_particle_filter_parser = std::make_unique<ParserWrapper<7>>(
+ makeParser(function_string,{"t","x","y","z","ux","uy","uz"}));
}
}
@@ -188,7 +188,7 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core)
: WarpXParticleContainer(amr_core, 0)
{
- plasma_injector.reset(new PlasmaInjector());
+ plasma_injector = std::make_unique<PlasmaInjector>();
}
void
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index ba1e2b438..2374703fc 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -632,7 +632,7 @@ WarpXParticleContainer::GetChargeDensity (int lev, bool local)
WarpX& warpx = WarpX::GetInstance();
const int ng_rho = warpx.get_ng_depos_rho().max();
- auto rho = std::unique_ptr<MultiFab>(new MultiFab(nba,dm,WarpX::ncomps,ng_rho));
+ auto rho = std::make_unique<MultiFab>(nba,dm,WarpX::ncomps,ng_rho);
rho->setVal(0.0);
#ifdef _OPENMP
diff --git a/Source/Utils/Interpolate.H b/Source/Utils/Interpolate.H
index 96112cb24..cf4efaedd 100644
--- a/Source/Utils/Interpolate.H
+++ b/Source/Utils/Interpolate.H
@@ -3,6 +3,8 @@
#include "WarpX.H"
+#include<memory>
+
namespace Interpolate
{
using namespace amrex;
diff --git a/Source/Utils/Interpolate.cpp b/Source/Utils/Interpolate.cpp
index 11d6989a0..73bd530b8 100644
--- a/Source/Utils/Interpolate.cpp
+++ b/Source/Utils/Interpolate.cpp
@@ -13,7 +13,7 @@ namespace Interpolate
{
// Prepare the structure that will contain the returned fields
std::unique_ptr<MultiFab> interpolated_F;
- interpolated_F.reset( new MultiFab(F_fp.boxArray(), dm, 1, ngrow) );
+ interpolated_F = std::make_unique<MultiFab>(F_fp.boxArray(), dm, 1, ngrow);
interpolated_F->setVal(0.);
// Loop through the boxes and interpolate the values from the _cp data
@@ -61,9 +61,9 @@ namespace Interpolate
// Prepare the structure that will contain the returned fields
std::array<std::unique_ptr<MultiFab>, 3> interpolated_F;
- interpolated_F[0].reset( new MultiFab(Fx_fp->boxArray(), dm, 1, ngrow) );
- interpolated_F[1].reset( new MultiFab(Fy_fp->boxArray(), dm, 1, ngrow) );
- interpolated_F[2].reset( new MultiFab(Fz_fp->boxArray(), dm, 1, ngrow) );
+ interpolated_F[0] = std::make_unique<MultiFab>(Fx_fp->boxArray(), dm, 1, ngrow);
+ interpolated_F[1] = std::make_unique<MultiFab>(Fy_fp->boxArray(), dm, 1, ngrow);
+ interpolated_F[2] = std::make_unique<MultiFab>(Fz_fp->boxArray(), dm, 1, ngrow);
IntVect fx_type = interpolated_F[0]->ixType().toIntVect();
IntVect fy_type = interpolated_F[1]->ixType().toIntVect();
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 027d9b926..740eaacba 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -173,7 +173,7 @@ WarpX::WarpX ()
dt.resize(nlevs_max, std::numeric_limits<Real>::max());
// Particle Container
- mypc = std::unique_ptr<MultiParticleContainer> (new MultiParticleContainer(this));
+ mypc = std::make_unique<MultiParticleContainer>(this);
warpx_do_continuous_injection = mypc->doContinuousInjection();
if (warpx_do_continuous_injection){
if (moving_window_v >= 0){
@@ -187,7 +187,7 @@ WarpX::WarpX ()
do_back_transformed_particles = mypc->doBackTransformedDiagnostics();
// Diagnostics
- multi_diags = std::unique_ptr<MultiDiagnostics> (new MultiDiagnostics());
+ multi_diags = std::make_unique<MultiDiagnostics>();
/** create object for reduced diagnostics */
reduced_diags = new MultiReducedDiags();
@@ -229,7 +229,7 @@ WarpX::WarpX ()
if (em_solver_medium == MediumForEM::Macroscopic) {
// create object for macroscopic solver
- m_macroscopic_properties = std::unique_ptr<MacroscopicProperties> (new MacroscopicProperties());
+ m_macroscopic_properties = std::make_unique<MacroscopicProperties>();
}
@@ -975,7 +975,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
if (do_dive_cleaning || (plot_rho && do_back_transformed_diagnostics))
{
- rho_fp[lev].reset(new MultiFab(amrex::convert(ba,rho_nodal_flag),dm,2*ncomps,ngRho));
+ rho_fp[lev] = std::make_unique<MultiFab>(amrex::convert(ba,rho_nodal_flag),dm,2*ncomps,ngRho);
}
if (do_subcycling == 1 && lev == 0)
@@ -987,12 +987,12 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
if (do_dive_cleaning)
{
- F_fp[lev].reset (new MultiFab(amrex::convert(ba,IntVect::TheUnitVector()),dm,ncomps, ngF.max()));
+ F_fp[lev] = std::make_unique<MultiFab>(amrex::convert(ba,IntVect::TheUnitVector()),dm,ncomps, ngF.max());
}
#ifdef WARPX_USE_PSATD
else
{
- rho_fp[lev].reset(new MultiFab(amrex::convert(ba,rho_nodal_flag),dm,2*ncomps,ngRho));
+ rho_fp[lev] = std::make_unique<MultiFab>(amrex::convert(ba,rho_nodal_flag),dm,2*ncomps,ngRho);
}
// Allocate and initialize the spectral solver
# if (AMREX_SPACEDIM == 3)
@@ -1057,11 +1057,11 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
else if (lev == 0)
{
for (int idir = 0; idir < 3; ++idir) {
- Efield_aux[lev][idir].reset(new MultiFab(*Efield_fp[lev][idir], amrex::make_alias, 0, ncomps));
- Bfield_aux[lev][idir].reset(new MultiFab(*Bfield_fp[lev][idir], amrex::make_alias, 0, ncomps));
+ Efield_aux[lev][idir] = std::make_unique<MultiFab>(*Efield_fp[lev][idir], amrex::make_alias, 0, ncomps);
+ Bfield_aux[lev][idir] = std::make_unique<MultiFab>(*Bfield_fp[lev][idir], amrex::make_alias, 0, ncomps);
- Efield_avg_aux[lev][idir].reset(new MultiFab(*Efield_avg_fp[lev][idir], amrex::make_alias, 0, ncomps));
- Bfield_avg_aux[lev][idir].reset(new MultiFab(*Bfield_avg_fp[lev][idir], amrex::make_alias, 0, ncomps));
+ Efield_avg_aux[lev][idir] = std::make_unique<MultiFab>(*Efield_avg_fp[lev][idir], amrex::make_alias, 0, ncomps);
+ Bfield_avg_aux[lev][idir] = std::make_unique<MultiFab>(*Bfield_avg_fp[lev][idir], amrex::make_alias, 0, ncomps);
}
}
else
@@ -1120,16 +1120,16 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
current_cp[lev][2] = std::make_unique<MultiFab>(amrex::convert(cba,jz_nodal_flag),dm,ncomps,ngJ);
if (do_dive_cleaning || (plot_rho && do_back_transformed_diagnostics)) {
- rho_cp[lev].reset(new MultiFab(amrex::convert(cba,rho_nodal_flag),dm,2*ncomps,ngRho));
+ rho_cp[lev] = std::make_unique<MultiFab>(amrex::convert(cba,rho_nodal_flag),dm,2*ncomps,ngRho);
}
if (do_dive_cleaning)
{
- F_cp[lev].reset (new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()),dm,ncomps, ngF.max()));
+ F_cp[lev] = std::make_unique<MultiFab>(amrex::convert(cba,IntVect::TheUnitVector()),dm,ncomps, ngF.max());
}
#ifdef WARPX_USE_PSATD
else
{
- rho_cp[lev].reset(new MultiFab(amrex::convert(cba,rho_nodal_flag),dm,2*ncomps,ngRho));
+ rho_cp[lev] = std::make_unique<MultiFab>(amrex::convert(cba,rho_nodal_flag),dm,2*ncomps,ngRho);
}
// Allocate and initialize the spectral solver
# if (AMREX_SPACEDIM == 3)
@@ -1155,8 +1155,8 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
pml_flag_false, fft_periodic_single_box, update_with_rho, fft_do_time_averaging );
# endif
#endif
- m_fdtd_solver_cp[lev].reset(
- new FiniteDifferenceSolver( maxwell_solver_id, cdx, do_nodal ) );
+ m_fdtd_solver_cp[lev] = std::make_unique<FiniteDifferenceSolver>(
+ maxwell_solver_id, cdx, do_nodal);
}
//
@@ -1209,7 +1209,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
if (load_balance_intervals.isActivated())
{
- costs[lev].reset(new amrex::LayoutData<Real>(ba, dm));
+ costs[lev] = std::make_unique<LayoutData<Real>>(ba, dm);
}
}