From 46cca702972c1ded7316bc680551f9bd969e11a0 Mon Sep 17 00:00:00 2001 From: Jon Rood Date: Thu, 30 Dec 2021 11:38:04 -0700 Subject: [PATCH] Reintroduce readability-make-member-function-const check. (#537) --- .clang-tidy | 2 +- amr-wind/core/SimTime.H | 12 ++++++------ amr-wind/core/SimTime.cpp | 12 ++++++------ amr-wind/incflo.H | 6 +++--- amr-wind/utilities/diagnostics.cpp | 6 +++--- amr-wind/wind_energy/ABLFieldInit.H | 2 +- amr-wind/wind_energy/ABLFieldInit.cpp | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9d19861e6e..2313312a2a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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,-readability-static-accessed-through-instance,-readability-make-member-function-const,-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,-readability-qualified-auto,-readability-static-accessed-through-instance,-modernize-pass-by-value,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-core.NonNullParamChecker' WarningsAsErrors: '' HeaderFilterRegex: '^((?!/amrex/Src/|/googletest/).)*$' AnalyzeTemporaryDtors: false diff --git a/amr-wind/core/SimTime.H b/amr-wind/core/SimTime.H index 424fc617a5..44cbb8694e 100644 --- a/amr-wind/core/SimTime.H +++ b/amr-wind/core/SimTime.H @@ -27,27 +27,27 @@ public: /** Return true if simulation should continue */ - bool continue_simulation(); + bool continue_simulation() const; /** Return true if mesh refinement should be performed at this timestep */ - bool do_regrid(); + bool do_regrid() const; /** Return true if plot files should be written at this timestep */ - bool write_plot_file(); + bool write_plot_file() const; /** Return true if checkpoint files should be written at this timestep */ - bool write_checkpoint(); + bool write_checkpoint() const; /** Return true if plot files should be written at this timestep */ - bool write_last_plot_file(); + bool write_last_plot_file() const; /** Return true if checkpoint files should be written at this timestep */ - bool write_last_checkpoint(); + bool write_last_checkpoint() const; /** Set current CFL and update timestep based on CFL components * diff --git a/amr-wind/core/SimTime.cpp b/amr-wind/core/SimTime.cpp index f677c6a1f3..e08d94951a 100644 --- a/amr-wind/core/SimTime.cpp +++ b/amr-wind/core/SimTime.cpp @@ -147,7 +147,7 @@ void SimTime::set_current_cfl( << "; dt_inp: " << m_fixed_dt << std::endl; } -bool SimTime::continue_simulation() +bool SimTime::continue_simulation() const { constexpr double eps = 1.0e-12; bool stop_simulation = false; @@ -163,7 +163,7 @@ bool SimTime::continue_simulation() return !(stop_simulation); } -bool SimTime::do_regrid() +bool SimTime::do_regrid() const { return ( (m_regrid_interval > 0) && @@ -171,28 +171,28 @@ bool SimTime::do_regrid() ((m_time_index - m_regrid_start_index) % m_regrid_interval == 0)); } -bool SimTime::write_plot_file() +bool SimTime::write_plot_file() const { return ( (m_plt_interval > 0) && ((m_time_index - m_plt_start_index) % m_plt_interval == 0)); } -bool SimTime::write_checkpoint() +bool SimTime::write_checkpoint() const { return ( (m_chkpt_interval > 0) && ((m_time_index - m_chkpt_start_index) % m_chkpt_interval == 0)); } -bool SimTime::write_last_plot_file() +bool SimTime::write_last_plot_file() const { return ( (m_plt_interval > 0) && ((m_time_index - m_plt_start_index) % m_plt_interval != 0)); } -bool SimTime::write_last_checkpoint() +bool SimTime::write_last_checkpoint() const { return ( (m_chkpt_interval > 0) && diff --git a/amr-wind/incflo.H b/amr-wind/incflo.H index 417945f4ee..05da9c0e64 100644 --- a/amr-wind/incflo.H +++ b/amr-wind/incflo.H @@ -211,9 +211,9 @@ private: // /////////////////////////////////////////////////////////////////////////// void PrintMaxValues(const std::string& header); - void PrintMaxVel(int lev); - void PrintMaxGp(int lev); - void CheckForNans(int lev); + void PrintMaxVel(int lev) const; + void PrintMaxGp(int lev) const; + void CheckForNans(int lev) const; }; #endif diff --git a/amr-wind/utilities/diagnostics.cpp b/amr-wind/utilities/diagnostics.cpp index 0299b0fc00..a37b9fbd8e 100644 --- a/amr-wind/utilities/diagnostics.cpp +++ b/amr-wind/utilities/diagnostics.cpp @@ -48,7 +48,7 @@ void incflo::PrintMaxValues(const std::string& header) // // Print the maximum values of the velocity components and velocity divergence // -void incflo::PrintMaxVel(int lev) +void incflo::PrintMaxVel(int lev) const { BL_PROFILE("amr-wind::incflo::PrintMaxVel"); amrex::Print() << "max(abs(u/v/w)) = " << velocity()(lev).norm0(0) << " " @@ -59,7 +59,7 @@ void incflo::PrintMaxVel(int lev) // // Print the maximum values of the pressure gradient components and pressure // -void incflo::PrintMaxGp(int lev) +void incflo::PrintMaxGp(int lev) const { BL_PROFILE("amr-wind::incflo::PrintMaxGp"); amrex::Print() << "max(abs(gpx/gpy/gpz/p)) = " << grad_p()(lev).norm0(0) @@ -68,7 +68,7 @@ void incflo::PrintMaxGp(int lev) << " " << std::endl; } -void incflo::CheckForNans(int lev) +void incflo::CheckForNans(int lev) const { BL_PROFILE("amr-wind::incflo::CheckForNans"); bool ro_has_nans = density()(lev).contains_nan(false); diff --git a/amr-wind/wind_energy/ABLFieldInit.H b/amr-wind/wind_energy/ABLFieldInit.H index 4cb1a68e0c..ad9ae31212 100644 --- a/amr-wind/wind_energy/ABLFieldInit.H +++ b/amr-wind/wind_energy/ABLFieldInit.H @@ -35,7 +35,7 @@ public: * pushes the field to device. */ void perturb_temperature( - const int lev, const amrex::Geometry& geom, Field& temperature); + const int lev, const amrex::Geometry& geom, Field& temperature) const; //! Flag indicating whether temperature field needs perturbations bool add_temperature_perturbations() const { return m_perturb_theta; } diff --git a/amr-wind/wind_energy/ABLFieldInit.cpp b/amr-wind/wind_energy/ABLFieldInit.cpp index da975a0c9d..c69a9f0523 100644 --- a/amr-wind/wind_energy/ABLFieldInit.cpp +++ b/amr-wind/wind_energy/ABLFieldInit.cpp @@ -111,7 +111,7 @@ void ABLFieldInit::operator()( } void ABLFieldInit::perturb_temperature( - const int lev, const amrex::Geometry& geom, Field& temperature) + const int lev, const amrex::Geometry& geom, Field& temperature) const { /** Perturbations for the temperature field is adapted from the following * paper: