aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy4
-rw-r--r--Source/Diagnostics/Diagnostics.cpp4
-rw-r--r--Source/Diagnostics/ParticleDiag/ParticleDiag.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldReduction.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp4
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H8
-rw-r--r--Source/Diagnostics/ReducedDiags/ReducedDiags.cpp2
-rw-r--r--Source/Evolve/WarpXEvolve.cpp16
-rw-r--r--Source/Initialization/PlasmaInjector.cpp10
-rw-r--r--Source/Initialization/TemperatureProperties.cpp2
-rw-r--r--Source/Utils/Parser/ParserUtils.cpp2
-rw-r--r--Source/WarpX.cpp4
13 files changed, 33 insertions, 29 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 8bc92cefb..a84816b32 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -42,6 +42,10 @@ Checks: '-*,
performance-move-const-arg,
performance-move-constructor-init,
readability-non-const-parameter,
+ readability-redundant-preprocessor,
+ readability-redundant-smartptr-get,
+ readability-redundant-string-cstr,
+ readability-redundant-string-init,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp
index 62c802483..a0e6db68d 100644
--- a/Source/Diagnostics/Diagnostics.cpp
+++ b/Source/Diagnostics/Diagnostics.cpp
@@ -124,14 +124,14 @@ Diagnostics::BaseReadParameters ()
// Get parser strings for particle fields and generate map of parsers
std::string parser_str;
- std::string filter_parser_str = "";
+ std::string filter_parser_str;
const amrex::ParmParse pp_diag_pfield(m_diag_name + ".particle_fields");
for (const auto& var : m_pfield_varnames) {
bool do_average = true;
pp_diag_pfield.query((var + ".do_average").c_str(), do_average);
m_pfield_do_average.push_back(do_average);
utils::parser::Store_parserString(
- pp_diag_pfield, (var + "(x,y,z,ux,uy,uz)").c_str(), parser_str);
+ pp_diag_pfield, (var + "(x,y,z,ux,uy,uz)"), parser_str);
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
parser_str != "",
diff --git a/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp b/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
index 6622fd9bd..18fbb4f59 100644
--- a/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
+++ b/Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
@@ -60,7 +60,7 @@ ParticleDiag::ParticleDiag(std::string diag_name, std::string name, WarpXParticl
buf);
if (m_do_parser_filter) {
- std::string function_string = "";
+ std::string function_string;
utils::parser::Store_parserString(
pp_diag_name_species_name,"plot_filter_function(t,x,y,z,ux,uy,uz)", function_string);
m_particle_filter_parser = std::make_unique<amrex::Parser>(
diff --git a/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp b/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
index c9ce3523f..c6f75e4a7 100644
--- a/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
+++ b/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
@@ -50,7 +50,7 @@ ChargeOnEB::ChargeOnEB (std::string rd_name)
const amrex::ParmParse pp_rd_name(rd_name);
m_do_parser_weighting = pp_rd_name.query("weighting_function(x,y,z)", buf);
if (m_do_parser_weighting) {
- std::string weighting_string = "";
+ std::string weighting_string;
utils::parser::Store_parserString(
pp_rd_name,"weighting_function(x,y,z)", weighting_string);
m_parser_weighting = std::make_unique<amrex::Parser>(
diff --git a/Source/Diagnostics/ReducedDiags/FieldReduction.cpp b/Source/Diagnostics/ReducedDiags/FieldReduction.cpp
index 32c8c9653..a0a7af0a8 100644
--- a/Source/Diagnostics/ReducedDiags/FieldReduction.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldReduction.cpp
@@ -49,7 +49,7 @@ FieldReduction::FieldReduction (std::string rd_name)
const amrex::ParmParse pp_rd_name(rd_name);
// read reduced function with parser
- std::string parser_string = "";
+ std::string parser_string;
utils::parser::Store_parserString(pp_rd_name,"reduced_function(x,y,z,Ex,Ey,Ez,Bx,By,Bz,jx,jy,jz)",
parser_string);
m_parser = std::make_unique<amrex::Parser>(
diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
index 1b34c1c7a..242659236 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
@@ -66,7 +66,7 @@ ParticleHistogram::ParticleHistogram (std::string rd_name)
m_bin_size = (m_bin_max - m_bin_min) / m_bin_num;
// read histogram function
- std::string function_string = "";
+ std::string function_string;
utils::parser::Store_parserString(pp_rd_name,"histogram_function(t,x,y,z,ux,uy,uz)",
function_string);
m_parser = std::make_unique<amrex::Parser>(
@@ -111,7 +111,7 @@ ParticleHistogram::ParticleHistogram (std::string rd_name)
std::string buf;
m_do_parser_filter = pp_rd_name.query("filter_function(t,x,y,z,ux,uy,uz)", buf);
if (m_do_parser_filter) {
- std::string filter_string = "";
+ std::string filter_string;
utils::parser::Store_parserString(
pp_rd_name,"filter_function(t,x,y,z,ux,uy,uz)", filter_string);
m_parser_filter = std::make_unique<amrex::Parser>(
diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H b/Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H
index cefe32dd4..6b8251456 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H
+++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H
@@ -56,10 +56,10 @@ public:
amrex::Real m_bin_size_ord;
/// functions
- std::string function_string_abs = "";
- std::string function_string_ord = "";
- std::string filter_string = "";
- std::string value_string = "";
+ std::string function_string_abs;
+ std::string function_string_ord;
+ std::string filter_string;
+ std::string value_string;
/// Parser to read expression for particle quantity from the input file.
/// 7 elements are t, x, y, z, ux, uy, uz, w
diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
index 38da1feff..77377c7d5 100644
--- a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
+++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp
@@ -38,7 +38,7 @@ ReducedDiags::ReducedDiags (std::string rd_name)
pp_rd_name.query("extension", m_extension);
// check if it is a restart run
- std::string restart_chkfile = "";
+ std::string restart_chkfile;
const ParmParse pp_amr("amr");
pp_amr.query("restart", restart_chkfile);
bool IsNotRestart = restart_chkfile.empty();
diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp
index 37023c8dd..40df059ad 100644
--- a/Source/Evolve/WarpXEvolve.cpp
+++ b/Source/Evolve/WarpXEvolve.cpp
@@ -564,7 +564,7 @@ void WarpX::SyncCurrentAndRho ()
// Reflect charge and current density over PEC boundaries, if needed.
for (int lev = 0; lev <= finest_level; ++lev)
{
- if (rho_fp[lev].get()) {
+ if (rho_fp[lev]) {
ApplyRhofieldBoundary(lev, rho_fp[lev].get(), PatchType::fine);
}
ApplyJfieldBoundary(
@@ -572,7 +572,7 @@ void WarpX::SyncCurrentAndRho ()
current_fp[lev][2].get(), PatchType::fine
);
if (lev > 0) {
- if (rho_cp[lev].get()) {
+ if (rho_cp[lev]) {
ApplyRhofieldBoundary(lev, rho_cp[lev].get(), PatchType::coarse);
}
ApplyJfieldBoundary(
@@ -1016,9 +1016,9 @@ WarpX::PushParticlesandDepose (int lev, amrex::Real cur_time, DtType a_dt_type,
if (current_buf[lev][0].get()) {
ApplyInverseVolumeScalingToCurrentDensity(current_buf[lev][0].get(), current_buf[lev][1].get(), current_buf[lev][2].get(), lev-1);
}
- if (rho_fp[lev].get()) {
+ if (rho_fp[lev]) {
ApplyInverseVolumeScalingToChargeDensity(rho_fp[lev].get(), lev);
- if (charge_buf[lev].get()) {
+ if (charge_buf[lev]) {
ApplyInverseVolumeScalingToChargeDensity(charge_buf[lev].get(), lev-1);
}
}
@@ -1079,8 +1079,8 @@ WarpX::applyMirrors(Real time)
NullifyMF(Bz, lev, z_min, z_max);
// If div(E)/div(B) cleaning are used, set F/G field to zero
- if (F_fp[lev]) NullifyMF(*F_fp[lev].get(), lev, z_min, z_max);
- if (G_fp[lev]) NullifyMF(*G_fp[lev].get(), lev, z_min, z_max);
+ if (F_fp[lev]) NullifyMF(*F_fp[lev], lev, z_min, z_max);
+ if (G_fp[lev]) NullifyMF(*G_fp[lev], lev, z_min, z_max);
if (lev>0)
{
@@ -1101,8 +1101,8 @@ WarpX::applyMirrors(Real time)
NullifyMF(cBz, lev, z_min, z_max);
// If div(E)/div(B) cleaning are used, set F/G field to zero
- if (F_cp[lev]) NullifyMF(*F_cp[lev].get(), lev, z_min, z_max);
- if (G_cp[lev]) NullifyMF(*G_cp[lev].get(), lev, z_min, z_max);
+ if (F_cp[lev]) NullifyMF(*F_cp[lev], lev, z_min, z_max);
+ if (G_cp[lev]) NullifyMF(*G_cp[lev], lev, z_min, z_max);
}
}
}
diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp
index 115fbfca1..03cee4c5e 100644
--- a/Source/Initialization/PlasmaInjector.cpp
+++ b/Source/Initialization/PlasmaInjector.cpp
@@ -50,7 +50,7 @@ namespace {
std::string string;
stringstream << var << " string '" << name << "' not recognized.";
string = stringstream.str();
- WARPX_ABORT_WITH_MESSAGE(string.c_str());
+ WARPX_ABORT_WITH_MESSAGE(string);
}
}
@@ -688,16 +688,16 @@ void PlasmaInjector::parseMomentum (const amrex::ParmParse& pp)
ux_min, uy_min, uz_min, ux_max, uy_max, uz_max));
} else if (mom_dist_s == "maxwell_boltzmann"){
h_mom_temp = std::make_unique<TemperatureProperties>(pp);
- const GetTemperature getTemp(*h_mom_temp.get());
+ const GetTemperature getTemp(*h_mom_temp);
h_mom_vel = std::make_unique<VelocityProperties>(pp);
- const GetVelocity getVel(*h_mom_vel.get());
+ const GetVelocity getVel(*h_mom_vel);
// Construct InjectorMomentum with InjectorMomentumBoltzmann.
h_inj_mom.reset(new InjectorMomentum((InjectorMomentumBoltzmann*)nullptr, getTemp, getVel));
} else if (mom_dist_s == "maxwell_juttner"){
h_mom_temp = std::make_unique<TemperatureProperties>(pp);
- const GetTemperature getTemp(*h_mom_temp.get());
+ const GetTemperature getTemp(*h_mom_temp);
h_mom_vel = std::make_unique<VelocityProperties>(pp);
- const GetVelocity getVel(*h_mom_vel.get());
+ const GetVelocity getVel(*h_mom_vel);
// Construct InjectorMomentum with InjectorMomentumJuttner.
h_inj_mom.reset(new InjectorMomentum((InjectorMomentumJuttner*)nullptr, getTemp, getVel));
} else if (mom_dist_s == "radial_expansion") {
diff --git a/Source/Initialization/TemperatureProperties.cpp b/Source/Initialization/TemperatureProperties.cpp
index 52af6637e..34e1d2b5f 100644
--- a/Source/Initialization/TemperatureProperties.cpp
+++ b/Source/Initialization/TemperatureProperties.cpp
@@ -69,6 +69,6 @@ TemperatureProperties::TemperatureProperties (const amrex::ParmParse& pp) {
std::string string;
stringstream << "Temperature distribution type '" << temp_dist_s << "' not recognized.";
string = stringstream.str();
- WARPX_ABORT_WITH_MESSAGE(string.c_str());
+ WARPX_ABORT_WITH_MESSAGE(string);
}
}
diff --git a/Source/Utils/Parser/ParserUtils.cpp b/Source/Utils/Parser/ParserUtils.cpp
index de4723241..0add95df1 100644
--- a/Source/Utils/Parser/ParserUtils.cpp
+++ b/Source/Utils/Parser/ParserUtils.cpp
@@ -87,7 +87,7 @@ amrex::Parser utils::parser::makeParser (
parser.registerVariables(varnames);
std::set<std::string> symbols = parser.symbols();
- for (auto const& v : varnames) symbols.erase(v.c_str());
+ for (auto const& v : varnames) symbols.erase(v);
// User can provide inputs under this name, through which expressions
// can be provided for arbitrary variables. PICMI inputs are aware of
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 24e3ceb30..8d4e98462 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -86,7 +86,7 @@ using namespace amrex;
Vector<Real> WarpX::E_external_grid(3, 0.0);
Vector<Real> WarpX::B_external_grid(3, 0.0);
-std::string WarpX::authors = "";
+std::string WarpX::authors;
std::string WarpX::B_ext_grid_s = "default";
std::string WarpX::E_ext_grid_s = "default";
bool WarpX::add_external_E_field = false;
@@ -546,7 +546,7 @@ WarpX::ReadParameters ()
ablastr::warn_manager::GetWMInstance().SetAlwaysWarnImmediately(always_warn_immediately);
// Set the WarnPriority threshold to decide if WarpX has to abort when a warning is recorded
- if(std::string str_abort_on_warning_threshold = "";
+ if(std::string str_abort_on_warning_threshold;
pp_warpx.query("abort_on_warning_threshold", str_abort_on_warning_threshold)){
std::optional<ablastr::warn_manager::WarnPriority> abort_on_warning_threshold = std::nullopt;
if (str_abort_on_warning_threshold == "high")