From e8805bf18c47a103aa04a2874db3d5872646095d Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 6 May 2024 18:25:58 -0400 Subject: [PATCH] fix some clang-tidy issues with flame_wave (#2840) and silence some new clang-tidy 18 warnings for now --- .clang-tidy | 3 +++ Source/diffusion/Castro_diffusion.cpp | 4 ++-- Source/diffusion/Diffusion.H | 2 +- Source/driver/Castro_io.cpp | 2 -- Source/rotation/rotation_sources.cpp | 18 +++++++++--------- Source/scf/scf_relax.cpp | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index df06bf21df..7e1d9c67aa 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -26,6 +26,7 @@ Checks: > -modernize-use-trailing-return-type, performance-*, -performance-avoid-endl, + -performance-enum-size, portability-*, readability-*, -readability-avoid-const-params-in-decls, @@ -38,6 +39,8 @@ Checks: > -readability-isolate-declaration, -readability-magic-numbers, -readability-named-parameter, + -readability-redundant-inline-specifier, + -readability-redundant-member-init, -readability-simplify-boolean-expr, -readability-static-accessed-through-instance, mpi-*, diff --git a/Source/diffusion/Castro_diffusion.cpp b/Source/diffusion/Castro_diffusion.cpp index b1f0fd1542..c02fc3f611 100644 --- a/Source/diffusion/Castro_diffusion.cpp +++ b/Source/diffusion/Castro_diffusion.cpp @@ -88,8 +88,8 @@ Castro::add_temp_diffusion_to_source (MultiFab& ext_src, MultiFab& state_in, Mul } if (diffuse_temp == 1) { - MultiFab::Saxpy(ext_src,mult_factor,DiffTerm,0,UEDEN,1,0); - MultiFab::Saxpy(ext_src,mult_factor,DiffTerm,0,UEINT,1,0); + MultiFab::Saxpy(ext_src,mult_factor,DiffTerm,0,UEDEN,1,0); // NOLINT(readability-suspicious-call-argument) + MultiFab::Saxpy(ext_src,mult_factor,DiffTerm,0,UEINT,1,0); // NOLINT(readability-suspicious-call-argument) } } diff --git a/Source/diffusion/Diffusion.H b/Source/diffusion/Diffusion.H index 5c5a670d79..2d418066dc 100644 --- a/Source/diffusion/Diffusion.H +++ b/Source/diffusion/Diffusion.H @@ -36,7 +36,7 @@ public: /// /// @param jobInfoFile /// - void output_job_info_params(std::ostream& jobInfoFile); + static void output_job_info_params(std::ostream& jobInfoFile); /// diff --git a/Source/driver/Castro_io.cpp b/Source/driver/Castro_io.cpp index 75b5a45d54..b0c58b5da2 100644 --- a/Source/driver/Castro_io.cpp +++ b/Source/driver/Castro_io.cpp @@ -842,8 +842,6 @@ void Castro::writeBuildInfo () { std::string PrettyLine = std::string(78, '=') + "\n"; - std::string OtherLine = std::string(78, '-') + "\n"; - std::string SkipSpace = std::string(8, ' '); // build information std::cout << PrettyLine; diff --git a/Source/rotation/rotation_sources.cpp b/Source/rotation/rotation_sources.cpp index 3af464f0f3..4c034810d8 100644 --- a/Source/rotation/rotation_sources.cpp +++ b/Source/rotation/rotation_sources.cpp @@ -49,8 +49,8 @@ Castro::rsrc(const Box& bx, bool coriolis = true; rotational_acceleration(loc, v, coriolis, Sr); - for (int n = 0; n < 3; n++) { - Sr[n] = rho * Sr[n]; + for (auto& e : Sr) { + e *= rho; } src[UMX] = Sr[0]; @@ -85,7 +85,7 @@ Castro::rsrc(const Box& bx, Real SrE; - if (rot_source_type == 1 || rot_source_type == 2) { + if (rot_source_type == 1 || rot_source_type == 2) { // NOLINT(bugprone-branch-clone) SrE = uold(i,j,k,UMX) * rhoInv * Sr[0] + uold(i,j,k,UMY) * rhoInv * Sr[1] + @@ -196,8 +196,8 @@ Castro::corrrsrc(const Box& bx, } else { - for (int idir = 0; idir < 3; idir++) { - dt_omega[idir] = 0.0_rt; + for (auto& e : dt_omega) { + e = 0.0_rt; } } @@ -269,8 +269,8 @@ Castro::corrrsrc(const Box& bx, bool coriolis = true; rotational_acceleration(loc, vold, coriolis, Sr_old); - for (int n = 0; n < 3; n++) { - Sr_old[n] = rhoo * Sr_old[n]; + for (auto& e : Sr_old) { + e *= rhoo; } Real SrE_old = vold[0] * Sr_old[0] + vold[1] * Sr_old[1] + vold[2] * Sr_old[2]; @@ -286,8 +286,8 @@ Castro::corrrsrc(const Box& bx, rotational_acceleration(loc, vnew, coriolis, Sr_new); - for (int n = 0; n < 3; n++) { - Sr_new[n] = rhon * Sr_new[n]; + for (auto& e : Sr_new) { + e *= rhon; } Real SrE_new = vnew[0] * Sr_new[0] + vnew[1] * Sr_new[1] + vnew[2] * Sr_new[2]; diff --git a/Source/scf/scf_relax.cpp b/Source/scf/scf_relax.cpp index ec55704406..22935bb4e9 100644 --- a/Source/scf/scf_relax.cpp +++ b/Source/scf/scf_relax.cpp @@ -639,7 +639,7 @@ Castro::do_hscf_solve() { Real dM = 0.0, dK = 0.0, dU = 0.0, dE = 0.0; - auto problo = geomdata.ProbLo(); + const auto* problo = geomdata.ProbLo(); GpuArray r = {0.0};