aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver')
-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
5 files changed, 31 insertions, 24 deletions
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