Skip to content

Commit

Permalink
Reintroduce readability-qualified-auto check. (Exawind#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Dec 30, 2021
1 parent cc2ecaf commit a587fff
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,corecppguidelines-*,modernize-*,readability-*,-readability-magic-numbers,-readability-identifier-naming,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-implicit-bool-conversion,-readability-isolate-declaration,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-modernize-use-emplace,-readability-qualified-auto,-modernize-pass-by-value,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-core.NonNullParamChecker'
Checks: 'clang-diagnostic-*,clang-analyzer-*,corecppguidelines-*,modernize-*,readability-*,-readability-magic-numbers,-readability-identifier-naming,-modernize-avoid-c-arrays,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-implicit-bool-conversion,-readability-isolate-declaration,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-modernize-use-emplace,-modernize-pass-by-value,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-core.NonNullParamChecker'
WarningsAsErrors: ''
HeaderFilterRegex: '^((?!/amrex/Src/|/googletest/).)*$'
AnalyzeTemporaryDtors: false
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/boundary_conditions/BCInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void BCIface::read_bctype()
{
const std::string key = m_field.name() + "_type";
auto& ibctype = m_field.bc_type();
auto& geom = m_field.repo().mesh().Geom(0);
const auto& geom = m_field.repo().mesh().Geom(0);
for (amrex::OrientationIter oit; oit; ++oit) {
auto ori = oit();
const auto& bcid = bcnames[ori];
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/core/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool FieldInfo::bc_initialized()
// Check that BC has been initialized properly
bool has_bogus = false;
for (int dir = 0; dir < m_ncomp; ++dir) {
auto* bcrec = m_bcrec[dir].vect();
const auto* bcrec = m_bcrec[dir].vect();
for (int i = 0; i < AMREX_SPACEDIM * 2; ++i) {
if (bcrec[i] == amrex::BCType::bogus) {
has_bogus = true;
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/core/ScratchField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void ScratchField::fillpatch(
amrex::MultiFab& mfab,
const amrex::IntVect& nghost) noexcept
{
auto& mesh = repo().mesh();
const auto& mesh = repo().mesh();
auto bcrec = scratch_field_bcrec(mesh.Geom(lev), num_comp());
fillpatch(lev, time, mfab, nghost, bcrec);
}
Expand All @@ -79,7 +79,7 @@ void ScratchField::fillpatch(
const amrex::IntVect& nghost,
amrex::Vector<amrex::BCRec>& bcrec) noexcept
{
auto& mesh = repo().mesh();
const auto& mesh = repo().mesh();
amrex::Interpolater* mapper = &amrex::cell_cons_interp;

if (lev == 0) {
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/equation_systems/icns/icns_advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void MacProjOp::init_projector(const amrex::Real beta) noexcept
void MacProjOp::operator()(const FieldState fstate, const amrex::Real dt)
{
BL_PROFILE("amr-wind::ICNS::advection_mac_project");
auto& geom = m_repo.mesh().Geom();
const auto& geom = m_repo.mesh().Geom();
const auto& pressure = m_repo.get_field("p");
auto& u_mac = m_repo.get_field("u_mac");
auto& v_mac = m_repo.get_field("v_mac");
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/physics/FreeStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ void FreeStream::pre_init_actions()
const auto& repo = m_sim.repo();
m_field_funcs["density"] = process_field_func(repo.get_field("density"));

auto& pde_mgr = m_sim.pde_manager();
const auto& pde_mgr = m_sim.pde_manager();
{
auto& vel = pde_mgr.icns().fields().field;
m_field_funcs[vel.name()] = process_field_func(vel);
}
for (auto& eqn : pde_mgr.scalar_eqns()) {
for (const auto& eqn : pde_mgr.scalar_eqns()) {
auto& fld = eqn->fields().field;
m_field_funcs[fld.name()] = process_field_func(fld);
}
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/physics/VortexRing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void VortexRing::initialize_velocity(const VortexRingType& vorticity_theta)
}

amrex::LPInfo info;
auto& mesh = m_velocity.repo().mesh();
const auto& mesh = m_velocity.repo().mesh();

amrex::MLNodeLaplacian linop(
mesh.Geom(0, mesh.finestLevel()), mesh.boxArray(0, mesh.finestLevel()),
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/physics/multiphase/MultiPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ amrex::Real MultiPhase::volume_fraction_sum()
BL_PROFILE("amr-wind::multiphase::ComputeVolumeFractionSum");
const int nlevels = m_sim.repo().num_active_levels();
const auto& geom = m_sim.mesh().Geom();
auto& mesh = m_sim.mesh();
const auto& mesh = m_sim.mesh();

amrex::Real total_volume_frac = 0.0;

Expand Down
2 changes: 1 addition & 1 deletion amr-wind/physics/multiphase/VortexPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void VortexPatch::initialize_fields(int level, const amrex::Geometry& geom)
const amrex::Real zc = m_loc[2];
const amrex::Real radius = m_radius;

auto& mphase = m_sim.physics_manager().get<MultiPhase>();
const auto& mphase = m_sim.physics_manager().get<MultiPhase>();
const amrex::Real rho1 = mphase.rho1();
const amrex::Real rho2 = mphase.rho2();

Expand Down
2 changes: 1 addition & 1 deletion amr-wind/physics/multiphase/ZalesakDisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void ZalesakDisk::initialize_fields(int level, const amrex::Geometry& geom)
const auto& dx = geom.CellSizeArray();
const auto& problo = geom.ProbLoArray();

auto& mphase = m_sim.physics_manager().get<MultiPhase>();
const auto& mphase = m_sim.physics_manager().get<MultiPhase>();
const amrex::Real rho1 = mphase.rho1();
const amrex::Real rho2 = mphase.rho2();

Expand Down
2 changes: 1 addition & 1 deletion amr-wind/physics/multiphase/wave_basin/NWB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void NWB::initialize_fields(int level, const amrex::Geometry& geom)
auto& levelset = m_levelset(level);
auto& density = m_density(level);

auto& mphase = m_sim.physics_manager().get<MultiPhase>();
const auto& mphase = m_sim.physics_manager().get<MultiPhase>();
const amrex::Real rho1 = mphase.rho1();
const amrex::Real rho2 = mphase.rho2();
velocity.setVal(0.0, 0, AMREX_SPACEDIM);
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/projection/incflo_apply_nodal_projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void incflo::set_inflow_velocity(
auto& phy_mgr = m_sim.physics_manager();
if (phy_mgr.contains("ABL")) {
auto& abl = phy_mgr.get<amr_wind::ABL>();
auto& bndry_plane = abl.bndry_plane();
const auto& bndry_plane = abl.bndry_plane();
bndry_plane.populate_data(lev, time, velocity, vel);
}
}
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/utilities/DerivedQuantity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool DerivedQtyMgr::contains(const std::string& key) const noexcept
void DerivedQtyMgr::var_names(
amrex::Vector<std::string>& plt_var_names) const noexcept
{
for (auto& qty : m_derived_vec) {
for (const auto& qty : m_derived_vec) {
qty->var_names(plt_var_names);
}
}
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/utilities/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void incflo::ReadCheckpointFile()

for (int d = 0; d < AMREX_SPACEDIM; d++) {
auto new_domain = ba_rep.minimalBox();
auto hi_vect = new_domain.hiVect();
const auto* hi_vect = new_domain.hiVect();

if (hi_vect[d] + 1 != n_cell_input[d]) {
amrex::Abort(
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/utilities/sampling/FreeSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void FreeSurface::post_advance_work()
level_mask.setVal(1);
}

auto& vof = m_vof(lev);
const auto& vof = m_vof(lev);
const auto& geom = m_sim.mesh().Geom(lev);
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx =
geom.CellSizeArray();
Expand Down
4 changes: 2 additions & 2 deletions amr-wind/utilities/sampling/SamplingContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void SamplingContainer::initialize_particles(
if (owner != iproc) return;

int num_particles = 0;
for (auto& probes : samplers) num_particles += probes->num_points();
for (const auto& probes : samplers) num_particles += probes->num_points();
m_total_particles = num_particles;

const int grid_id = 0;
Expand All @@ -116,7 +116,7 @@ void SamplingContainer::initialize_particles(
const int nextid = ParticleType::NextID();
auto* pstruct = ptile.GetArrayOfStructs()().data();
SamplerBase::SampleLocType locs;
for (auto& probe : samplers) {
for (const auto& probe : samplers) {
probe->sampling_locations(locs);
const int npts = locs.size();
const auto probe_id = probe->id();
Expand Down
8 changes: 4 additions & 4 deletions amr-wind/wind_energy/ABLWallFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ void ABLVelWallFunc::wall_model(
const auto& domain = geom.Domain();
amrex::MFItInfo mfi_info{};

auto& rho_lev = density(lev);
const auto& rho_lev = density(lev);
auto& vold_lev = velocity.state(FieldState::Old)(lev);
auto& vel_lev = velocity(lev);
auto& eta_lev = viscosity(lev);
const auto& eta_lev = viscosity(lev);

if (amrex::Gpu::notInLaunchRegion()) mfi_info.SetDynamic(true);
#ifdef _OPENMP
Expand Down Expand Up @@ -293,11 +293,11 @@ void ABLTempWallFunc::wall_model(
const auto& domain = geom.Domain();
amrex::MFItInfo mfi_info{};

auto& rho_lev = density(lev);
const auto& rho_lev = density(lev);
auto& vold_lev = velocity.state(FieldState::Old)(lev);
auto& told_lev = temperature.state(FieldState::Old)(lev);
auto& theta = temperature(lev);
auto& eta_lev = alpha(lev);
const auto& eta_lev = alpha(lev);

if (amrex::Gpu::notInLaunchRegion()) mfi_info.SetDynamic(true);
#ifdef _OPENMP
Expand Down
2 changes: 1 addition & 1 deletion amr-wind/wind_energy/actuator/ActuatorContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void ActuatorContainer::update_positions()
AMREX_ALWAYS_ASSERT(m_container_initialized && !m_is_scattered);

const auto dpos = gpu::device_view(m_data.position);
const auto dptr = dpos.data();
const auto* const dptr = dpos.data();
const int nlevels = m_mesh.finestLevel() + 1;
for (int lev = 0; lev < nlevels; ++lev) {
for (ParIterType pti(*this, lev); pti.isValid(); ++pti) {
Expand Down
2 changes: 1 addition & 1 deletion unit_tests/core/test_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST_F(FieldRepoTest, field_pre_declare)
int num_cc = 0;
int num_nd = 0;
int num_invalid = 0;
for (auto& field : frepo.fields()) {
for (const auto& field : frepo.fields()) {
switch (field->field_location()) {
case amr_wind::FieldLoc::CELL:
++num_cc;
Expand Down
6 changes: 3 additions & 3 deletions unit_tests/fvm/test_fvm_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ amrex::Real grad_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.00213);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.00346);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down Expand Up @@ -139,7 +139,7 @@ amrex::Real laplacian_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.00213);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.00346);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down Expand Up @@ -196,7 +196,7 @@ amrex::Real divergence_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.00213);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.00346);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down
8 changes: 4 additions & 4 deletions unit_tests/fvm/test_fvm_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ amrex::Real strainrate_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.00213);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.00346);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down Expand Up @@ -120,7 +120,7 @@ amrex::Real vorticity_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.000463);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.000386);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down Expand Up @@ -185,7 +185,7 @@ amrex::Real vorticity_mag_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.00213);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.00346);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down Expand Up @@ -250,7 +250,7 @@ amrex::Real q_criterion_test_impl(amr_wind::Field& vel, const int pdegree)
amrex::Gpu::DeviceVector<amrex::Real> cv(ncoeff, 0.00213);
amrex::Gpu::DeviceVector<amrex::Real> cw(ncoeff, 0.00346);

auto& geom = vel.repo().mesh().Geom();
const auto& geom = vel.repo().mesh().Geom();

run_algorithm(vel, [&](const int lev, const amrex::MFIter& mfi) {
auto vel_arr = vel(lev).array(mfi);
Expand Down

0 comments on commit a587fff

Please sign in to comment.