From 6e227575c1aaa7a484a1ee55596c772befc8d0b5 Mon Sep 17 00:00:00 2001 From: "Marc T. Henry de Frahan" Date: Thu, 10 Oct 2024 12:08:19 -0600 Subject: [PATCH] Fix clang-tidy (#535) --- Mechanisms/Null/mechanism.H | 6 ------ Source/PelePhysics.H | 6 +++--- Source/Reactions/ReactorCvode.cpp | 1 + Source/Reactions/ReactorUtils.H | 3 +-- Source/Soot/SootData.H | 10 +++++---- Source/Soot/SootModel.H | 8 +++---- Source/Spray/SprayJet.H | 36 +++++++++++++++---------------- Source/Spray/SprayParticles.H | 10 ++++----- 8 files changed, 38 insertions(+), 42 deletions(-) diff --git a/Mechanisms/Null/mechanism.H b/Mechanisms/Null/mechanism.H index a6ea1be61..dc1764dae 100644 --- a/Mechanisms/Null/mechanism.H +++ b/Mechanisms/Null/mechanism.H @@ -4,12 +4,6 @@ #include #include -#if 0 -/* Elements -0 X -*/ -#endif - /* Species */ #define XO_ID 0 diff --git a/Source/PelePhysics.H b/Source/PelePhysics.H index 867095367..d83ab06e0 100644 --- a/Source/PelePhysics.H +++ b/Source/PelePhysics.H @@ -13,14 +13,14 @@ namespace pele::physics { template struct is_eos_type { - static constexpr bool value = std::is_base_of::value; + static constexpr bool value = std::is_base_of_v; }; template struct is_transport_type { static constexpr bool value = - std::is_base_of::value; + std::is_base_of_v; }; template @@ -41,7 +41,7 @@ struct PelePhysics static std::string identifier() { - if (std::is_same::value) { + if (std::is_same_v) { return EosModel::identifier(); } return EosModel::identifier() + "-" + TransportModel::identifier(); diff --git a/Source/Reactions/ReactorCvode.cpp b/Source/Reactions/ReactorCvode.cpp index de01dd283..3706197a1 100644 --- a/Source/Reactions/ReactorCvode.cpp +++ b/Source/Reactions/ReactorCvode.cpp @@ -1394,6 +1394,7 @@ ReactorCvode::react( initCvode(y, A, udata, NLS, LS, cvode_mem, time_start, ncells); // Update TypicalValues + // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) utils::set_sundials_solver_tols( *amrex::sundials::The_Sundials_Context(), cvode_mem, udata->ncells, relTol, absTol, m_typ_vals, "cvode", verbose); diff --git a/Source/Reactions/ReactorUtils.H b/Source/Reactions/ReactorUtils.H index cd513883d..c4cf2972f 100644 --- a/Source/Reactions/ReactorUtils.H +++ b/Source/Reactions/ReactorUtils.H @@ -44,8 +44,7 @@ struct CYOrder template struct is_ordering_type { - static constexpr bool value = - std::is_base_of::value; + static constexpr bool value = std::is_base_of_v; }; template diff --git a/Source/Soot/SootData.H b/Source/Soot/SootData.H index f314e4993..0db1e05b9 100644 --- a/Source/Soot/SootData.H +++ b/Source/Soot/SootData.H @@ -1,4 +1,3 @@ - #ifndef SOOTDATA_H #define SOOTDATA_H @@ -312,9 +311,7 @@ struct SootData } weightDelta = sc.smallWeight; } - if (weightDelta > moments[0]) { - weightDelta = moments[0]; - } + weightDelta = amrex::min(weightDelta, moments[0]); moments[NUM_SOOT_MOMENTS] = weightDelta; } @@ -642,6 +639,7 @@ struct SootData default: amrex::Abort( "SootModel::FMCoagSL: Moment not contained in number of moments!"); + break; } return 0.; } @@ -754,6 +752,8 @@ struct SootData } return 2. * weightDelta * (p1 + p2 + p3); } + default: + return 0.; } return 0.; } @@ -793,6 +793,8 @@ struct SootData return CNCoagLLFunc(1., 0., 0., 1., lambda, momFV); case 5: // M02 return CNCoagLLFunc(0., 1., lambda, momFV); + default: + return 0.; } return 0.; } diff --git a/Source/Soot/SootModel.H b/Source/Soot/SootModel.H index 74c8baed2..0980f1583 100644 --- a/Source/Soot/SootModel.H +++ b/Source/Soot/SootModel.H @@ -100,12 +100,12 @@ public: // // Set the indices for primitive and conservative variables // - inline void setIndices(const SootComps& sootIndx) { m_sootIndx = sootIndx; } + void setIndices(const SootComps& sootIndx) { m_sootIndx = sootIndx; } // // Return string of the names of each variable // - inline std::string sootVariableName(const int indx) const + std::string sootVariableName(const int indx) const { AMREX_ASSERT(indx >= 0 && indx < NUM_SOOT_MOMENTS + 1); return m_sootVarName[indx]; @@ -114,8 +114,8 @@ public: // // Return pointer to soot data // - inline SootData* getSootData() const { return m_sootData; } - inline SootData* getSootData_d() const { return d_sootData; } + SootData* getSootData() const { return m_sootData; } + SootData* getSootData_d() const { return d_sootData; } /*********************************************************************** Member data diff --git a/Source/Spray/SprayJet.H b/Source/Spray/SprayJet.H index 13cf91d45..9290e148d 100644 --- a/Source/Spray/SprayJet.H +++ b/Source/Spray/SprayJet.H @@ -40,32 +40,32 @@ public: virtual ~SprayJet() = default; - inline const amrex::RealVect& jet_norm() const { return m_norm; } - inline const amrex::RealVect& jet_cent() const { return m_cent; } - inline amrex::Real jet_vel(const amrex::Real time) const + const amrex::RealVect& jet_norm() const { return m_norm; } + const amrex::RealVect& jet_cent() const { return m_cent; } + amrex::Real jet_vel(const amrex::Real time) const { if (m_useROI) { return interpolateVel(time); } return m_jetVel; } - inline const amrex::Real& max_jet_vel() const { return m_maxJetVel; } - inline const amrex::Real& jet_dia() const { return m_jetDia; } - inline const amrex::Real& spread_angle() const { return m_spreadAngle; } - inline amrex::Real mass_flow_rate(const amrex::Real time) const + const amrex::Real& max_jet_vel() const { return m_maxJetVel; } + const amrex::Real& jet_dia() const { return m_jetDia; } + const amrex::Real& spread_angle() const { return m_spreadAngle; } + amrex::Real mass_flow_rate(const amrex::Real time) const { if (m_useROI) { return interpolateMdot(time); } return m_massFlow; } - inline const amrex::Real& Y(const int spf) const { return m_jetY[spf]; } - inline const amrex::Real& T() const { return m_jetT; } - inline const amrex::Real& start_time() const { return m_startTime; } - inline const amrex::Real& end_time() const { return m_endTime; } - inline const amrex::Real& num_ppp() const { return m_numPPP; } - inline const std::string& jet_name() const { return m_jetName; } - inline int Proc() const { return m_proc; } + const amrex::Real& Y(const int spf) const { return m_jetY[spf]; } + const amrex::Real& T() const { return m_jetT; } + const amrex::Real& start_time() const { return m_startTime; } + const amrex::Real& end_time() const { return m_endTime; } + const amrex::Real& num_ppp() const { return m_numPPP; } + const std::string& jet_name() const { return m_jetName; } + int Proc() const { return m_proc; } // Call this before using spray jet bool jet_active(const amrex::Real time) const @@ -84,7 +84,7 @@ public: return check; } - inline bool hollow_spray() const { return m_hollowSpray; } + bool hollow_spray() const { return m_hollowSpray; } /// Returns the average values given for the jet amrex::Real get_avg_dia() const { return m_avgDia; } @@ -230,7 +230,7 @@ public: part_vel *= umag; } - inline amrex::Real + amrex::Real interpolateROI(const amrex::Real& time, const amrex::Real* vals) const { int i = 0; @@ -246,12 +246,12 @@ public: return val1 + (val2 - val1) * invt; } - inline amrex::Real interpolateMdot(const amrex::Real time) const + amrex::Real interpolateMdot(const amrex::Real time) const { return interpolateROI(time, inject_mass.dataPtr()); } - inline amrex::Real interpolateVel(const amrex::Real time) const + amrex::Real interpolateVel(const amrex::Real time) const { return interpolateROI(time, inject_vel.dataPtr()); } diff --git a/Source/Spray/SprayParticles.H b/Source/Spray/SprayParticles.H index 6c809e370..9a8514722 100644 --- a/Source/Spray/SprayParticles.H +++ b/Source/Spray/SprayParticles.H @@ -104,7 +104,7 @@ public: amrex::Real estTimestep(int level) const; /// \brief Reset the particle ID in case we need to reinitialize the particles - static inline void resetID(const int id) { ParticleType::NextID(id); } + static void resetID(const int id) { ParticleType::NextID(id); } /// \brief Returns the number of ghost cells for making ghost particles. This /// is called on level N-1 to make ghost particles on level N from valid @@ -115,7 +115,7 @@ public: /// @param cfl Particle CFL number on level N /// @param depos_width Number of cells adjacent to the cell containing the /// particle needed to interpolate the particle source term to the mesh - static inline int getGhostPartCells( + static int getGhostPartCells( const int level, const int finest_level, const int amr_ncycle, @@ -141,7 +141,7 @@ public: /// is 1 for trilinear interpolation /// @param depos_width Number of cells adjacent to the cell containing the /// particle needed to interpolate the particle source term to the mesh - static inline int getStateGhostCells( + static int getStateGhostCells( const int level, const int finest_level, const int amr_ncycle, @@ -168,7 +168,7 @@ public: /// @param cfl Particle CFL number on level N /// @param depos_width Number of cells adjacent to the cell containing the /// particle needed to interpolate the particle source term to the mesh - static inline int getSourceGhostCells( + static int getSourceGhostCells( const int level, const int finest_level, const int amr_ncycle, @@ -241,7 +241,7 @@ public: /// @param level Current AMR level /// @param tmpSource MultiFab containing the temporary spray source data /// @param actSource MultiFab where final source data should end up - inline void transferSource( + void transferSource( const int& source_ghosts, const int& level, amrex::MultiFab& tmpSource,