aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpX.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2020-10-19 10:17:46 +0200
committerGravatar GitHub <noreply@github.com> 2020-10-19 01:17:46 -0700
commit1e7de3b536c974327513d17f9aee156d93030825 (patch)
treefb5885e8fbbbfdd51d5d9efcc53c597a41b2fa1d /Source/WarpX.cpp
parent1f8f4f74adf7d460c593752a83e3574cc5cc0589 (diff)
downloadWarpX-1e7de3b536c974327513d17f9aee156d93030825.tar.gz
WarpX-1e7de3b536c974327513d17f9aee156d93030825.tar.zst
WarpX-1e7de3b536c974327513d17f9aee156d93030825.zip
Replace wherever possible '.reset(new' with '= make_unique' (#1429)
* replace wherever possible .reset(new with = make_unique * fixed bug * fixed bug * revert WarpXOpenPMD.cpp to the original version * removed another .reset(new
Diffstat (limited to 'Source/WarpX.cpp')
-rw-r--r--Source/WarpX.cpp32
1 files changed, 16 insertions, 16 deletions
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);
}
}