From 1e7de3b536c974327513d17f9aee156d93030825 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 19 Oct 2020 10:17:46 +0200 Subject: 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 --- Source/Particles/MultiParticleContainer.cpp | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'Source/Particles/MultiParticleContainer.cpp') 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(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(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(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(amr_core, i, lasers_names[i-nspecies]); } - pc_tmp.reset(new PhysicalParticleContainer(amr_core)); + pc_tmp = std::make_unique(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(ncollisions); ++i) { - allcollisions[i].reset - (new CollisionType(species_names, collision_names[i])); + allcollisions[i] = + std::make_unique(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>( + makeParser(str_Bx_ext_particle_function,{"x","y","z","t"})); + m_By_particle_parser = std::make_unique>( + makeParser(str_By_ext_particle_function,{"x","y","z","t"})); + m_Bz_particle_parser = std::make_unique>( + 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>( + makeParser(str_Ex_ext_particle_function,{"x","y","z","t"})); + m_Ey_particle_parser = std::make_unique>( + makeParser(str_Ey_ext_particle_function,{"x","y","z","t"})); + m_Ez_particle_parser = std::make_unique>( + makeParser(str_Ez_ext_particle_function,{"x","y","z","t"})); } -- cgit v1.2.3