From 532c0ca9f23f91e73628d91f56dac6535233d8c9 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Wed, 9 Oct 2024 09:03:29 -0600 Subject: [PATCH 1/8] Clang-tidy fixes --- Source/PelePhysics.H | 6 +++--- Source/Reactions/ReactorUtils.H | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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/ReactorUtils.H b/Source/Reactions/ReactorUtils.H index cd513883d..5dd058f23 100644 --- a/Source/Reactions/ReactorUtils.H +++ b/Source/Reactions/ReactorUtils.H @@ -45,7 +45,7 @@ template struct is_ordering_type { static constexpr bool value = - std::is_base_of::value; + std::is_base_of_v; }; template From 556a493c5b4c23b685c308543a76cfcc6ea5a689 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Wed, 9 Oct 2024 09:45:06 -0600 Subject: [PATCH 2/8] fixes --- Source/Soot/SootData.H | 6 +++++- Source/Soot/SootModel.H | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Soot/SootData.H b/Source/Soot/SootData.H index f314e4993..a78641b70 100644 --- a/Source/Soot/SootData.H +++ b/Source/Soot/SootData.H @@ -1,4 +1,3 @@ - #ifndef SOOTDATA_H #define SOOTDATA_H @@ -642,6 +641,7 @@ struct SootData default: amrex::Abort( "SootModel::FMCoagSL: Moment not contained in number of moments!"); + break; } return 0.; } @@ -754,6 +754,8 @@ struct SootData } return 2. * weightDelta * (p1 + p2 + p3); } + default: + return 0.; } return 0.; } @@ -793,6 +795,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 From 13a71b86c5f653e54b63a881017b035d4c8ba750 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Wed, 9 Oct 2024 09:50:09 -0600 Subject: [PATCH 3/8] format --- Source/Reactions/ReactorUtils.H | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Reactions/ReactorUtils.H b/Source/Reactions/ReactorUtils.H index 5dd058f23..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_v; + static constexpr bool value = std::is_base_of_v; }; template From 6adebfc102eb20c6d3470cb557081c888a9956d1 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Wed, 9 Oct 2024 10:14:55 -0600 Subject: [PATCH 4/8] fix spray --- Source/Spray/SprayJet.H | 36 +++++++++++++++++------------------ Source/Spray/SprayParticles.H | 10 +++++----- 2 files changed, 23 insertions(+), 23 deletions(-) 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, From 922eb637b92ed0cdeb706dd9c3e8393bc4f603b4 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Wed, 9 Oct 2024 15:40:18 -0600 Subject: [PATCH 5/8] fix --- Mechanisms/Null/mechanism.H | 6 ------ 1 file changed, 6 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 From c334be52a3cd48afed28a8c153d783b76a21aede Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Wed, 9 Oct 2024 15:42:06 -0600 Subject: [PATCH 6/8] no lint --- Source/Reactions/ReactorCvode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Reactions/ReactorCvode.cpp b/Source/Reactions/ReactorCvode.cpp index de01dd283..45ac192ff 100644 --- a/Source/Reactions/ReactorCvode.cpp +++ b/Source/Reactions/ReactorCvode.cpp @@ -1396,7 +1396,8 @@ ReactorCvode::react( // Update TypicalValues utils::set_sundials_solver_tols( *amrex::sundials::The_Sundials_Context(), cvode_mem, udata->ncells, relTol, - absTol, m_typ_vals, "cvode", verbose); + absTol, m_typ_vals, "cvode", + verbose); // NOLINT(clang-analyzer-core.CallAndMessage) const auto captured_reactor_type = m_reactor_type; const auto captured_clean_init_massfrac = m_clean_init_massfrac; From d64531054b76dd6c5f25750a3c90adc1e0f606c1 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Thu, 10 Oct 2024 08:25:27 -0600 Subject: [PATCH 7/8] a warn --- Source/Soot/SootData.H | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Soot/SootData.H b/Source/Soot/SootData.H index a78641b70..0db1e05b9 100644 --- a/Source/Soot/SootData.H +++ b/Source/Soot/SootData.H @@ -311,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; } From d01f9a964d113e326c3106bee88095f8d40ff459 Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Thu, 10 Oct 2024 08:26:56 -0600 Subject: [PATCH 8/8] no lint again --- Source/Reactions/ReactorCvode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Reactions/ReactorCvode.cpp b/Source/Reactions/ReactorCvode.cpp index 45ac192ff..3706197a1 100644 --- a/Source/Reactions/ReactorCvode.cpp +++ b/Source/Reactions/ReactorCvode.cpp @@ -1394,10 +1394,10 @@ 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); // NOLINT(clang-analyzer-core.CallAndMessage) + absTol, m_typ_vals, "cvode", verbose); const auto captured_reactor_type = m_reactor_type; const auto captured_clean_init_massfrac = m_clean_init_massfrac;