From a483a4e33ba6a06654c565b6cb2003f571645bb1 Mon Sep 17 00:00:00 2001 From: llibert94 Date: Wed, 21 Feb 2024 16:51:41 +0000 Subject: [PATCH] clang format --- Examples/Fluid_Kerr/Fluxes.hpp | 13 +++++++------ Examples/Fluid_Kerr/PerfectFluid.impl.hpp | 9 ++++++--- Examples/Fluid_Kerr/PerfectFluidLevel.cpp | 2 +- Examples/Fluid_Kerr/PerfectFluidLevel.hpp | 3 ++- Examples/Fluid_Kerr/PrimitiveRecovery.hpp | 8 ++++---- Examples/Fluid_Kerr/Sources.hpp | 13 ++++++------- Source/simd/arm/neon.hpp | 15 +++++++++------ Source/simd/arm/sve.hpp | 6 ++++-- Source/simd/simd.hpp | 8 +++----- 9 files changed, 42 insertions(+), 35 deletions(-) diff --git a/Examples/Fluid_Kerr/Fluxes.hpp b/Examples/Fluid_Kerr/Fluxes.hpp index e4211606f..50582d70b 100644 --- a/Examples/Fluid_Kerr/Fluxes.hpp +++ b/Examples/Fluid_Kerr/Fluxes.hpp @@ -40,16 +40,17 @@ vars_t compute_flux(const data_t P_over_rho, const vars_t &vars, data_t WW = 1. / (1. - v2); data_t hh = 1. + vars.eps + P_over_rho; - - data_t rho_conformal = vars.rho / pow(vars.chi, 1.5); + + data_t rho_conformal = vars.rho / pow(vars.chi, 1.5); FOR(j) { - out.Sj[j] = vars.lapse * rho_conformal * hh * WW * vars.vi[idir] * vi_D[j] - - vars.shift[idir] * vars.Sj[j]; + out.Sj[j] = + vars.lapse * rho_conformal * hh * WW * vars.vi[idir] * vi_D[j] - + vars.shift[idir] * vars.Sj[j]; FOR(k) - out.Sj[j] += - vars.lapse * rho_conformal * P_over_rho * h_UU[idir][k] * vars.h[j][k]; + out.Sj[j] += vars.lapse * rho_conformal * P_over_rho * h_UU[idir][k] * + vars.h[j][k]; } out.tau = vars.lapse * (Sj_U[idir] - vars.D * vars.vi[idir]) - diff --git a/Examples/Fluid_Kerr/PerfectFluid.impl.hpp b/Examples/Fluid_Kerr/PerfectFluid.impl.hpp index 0f6bb4cb9..21e639753 100644 --- a/Examples/Fluid_Kerr/PerfectFluid.impl.hpp +++ b/Examples/Fluid_Kerr/PerfectFluid.impl.hpp @@ -82,12 +82,15 @@ void PerfectFluid::add_matter_rhs( data_t advec_chi = 0.; FOR(i) advec_chi += vars.shift[i] * d1.chi[i] / chi_regularised; rhs.D = source.D /*- vars.D * (vars.lapse * vars.K - divshift + - GR_SPACEDIM / 2. * advec_chi)*/; + GR_SPACEDIM / 2. * advec_chi)*/ + ; FOR(i) rhs.Sj[i] = source.Sj[i] /*- vars.Sj[i] * (vars.lapse * vars.K - divshift + - GR_SPACEDIM / 2. * advec_chi)*/; + GR_SPACEDIM / 2. * advec_chi)*/ + ; rhs.tau = source.tau /*- vars.tau * (vars.lapse * vars.K - divshift + - GR_SPACEDIM / 2. * advec_chi)*/; + GR_SPACEDIM / 2. * advec_chi)*/ + ; /*FOR(i) { vars_t flux = Fluxes::compute_flux(P_over_rho, vars, i); diff --git a/Examples/Fluid_Kerr/PerfectFluidLevel.cpp b/Examples/Fluid_Kerr/PerfectFluidLevel.cpp index a7cb1d768..26e7c25e5 100644 --- a/Examples/Fluid_Kerr/PerfectFluidLevel.cpp +++ b/Examples/Fluid_Kerr/PerfectFluidLevel.cpp @@ -90,7 +90,7 @@ void PerfectFluidLevel::specificEvalRHS(GRLevelData &a_soln, GRLevelData &a_rhs, BoxLoops::loop(make_compute_pack(TraceARemoval(), PositiveDensity(), PositiveChiAndAlpha(), PrimitiveRecovery()), - a_soln, a_soln, INCLUDE_GHOST_CELLS/*, disable_simd()*/); + a_soln, a_soln, INCLUDE_GHOST_CELLS /*, disable_simd()*/); // Calculate MatterCCZ4 right hand side with matter_t = ScalarField EoS eos(m_p.eos_params); diff --git a/Examples/Fluid_Kerr/PerfectFluidLevel.hpp b/Examples/Fluid_Kerr/PerfectFluidLevel.hpp index a35b4a239..5106b02f4 100644 --- a/Examples/Fluid_Kerr/PerfectFluidLevel.hpp +++ b/Examples/Fluid_Kerr/PerfectFluidLevel.hpp @@ -47,7 +47,8 @@ class PerfectFluidLevel : public GRAMRLevel //! Things to do in UpdateODE step, after soln + rhs update virtual void specificUpdateODE(GRLevelData &a_soln, - const GRLevelData &a_rhs, Real a_dt) override; + const GRLevelData &a_rhs, + Real a_dt) override; /// Things to do before tagging cells (i.e. filling ghosts) virtual void preTagCells() override; diff --git a/Examples/Fluid_Kerr/PrimitiveRecovery.hpp b/Examples/Fluid_Kerr/PrimitiveRecovery.hpp index 159eeb3d0..46f805a08 100644 --- a/Examples/Fluid_Kerr/PrimitiveRecovery.hpp +++ b/Examples/Fluid_Kerr/PrimitiveRecovery.hpp @@ -10,12 +10,12 @@ #include "CCZ4Geometry.hpp" #include "Cell.hpp" #include "DefaultEoS.hpp" -#include "simd.hpp" #include "Tensor.hpp" #include "TensorAlgebra.hpp" #include "UserVariables.hpp" #include "UsingNamespace.H" #include "VarsTools.hpp" +#include "simd.hpp" // template class PrimitiveRecovery @@ -60,10 +60,10 @@ class PrimitiveRecovery int i = 0; - data_t empty; - while (!simd_all_false(simd_compare_lt(tolerance, diff), empty)) + data_t empty; + while (!simd_all_false(simd_compare_lt(tolerance, diff), empty)) { - i++; + i++; Wa = sqrt(pow(xa, 2.) / (pow(xa, 2.) - r)); vars.rho = pow(vars.chi, 1.5) * vars.D / Wa; diff --git a/Examples/Fluid_Kerr/Sources.hpp b/Examples/Fluid_Kerr/Sources.hpp index 66121e787..dcccc2a6d 100644 --- a/Examples/Fluid_Kerr/Sources.hpp +++ b/Examples/Fluid_Kerr/Sources.hpp @@ -43,19 +43,18 @@ vars_t compute_source(const data_t P_over_rho, out.Sj[j] += vars.lapse / 2. * (d1.h[i][k][j] - vars.h[i][k] * d1.chi[j] / chi_regularised) * - (rho_conformal * hh * WW * vars.vi[i] * vars.vi[k] / - chi_regularised + - P_over_rho * h_UU[i][k]); + (rho_conformal * hh * WW * vars.vi[i] * + vars.vi[k] / chi_regularised + + P_over_rho * h_UU[i][k]); } } } out.tau = 0.; FOR(i, j) { - out.tau += vars.lapse * - (vars.A[i][j] + vars.h[i][j] / 3. * vars.K) * - (rho_conformal * - hh * WW * vars.vi[i] * vars.vi[j] / chi_regularised + + out.tau += vars.lapse * (vars.A[i][j] + vars.h[i][j] / 3. * vars.K) * + (rho_conformal * hh * WW * vars.vi[i] * vars.vi[j] / + chi_regularised + P_over_rho * h_UU[i][j]) - vars.chi * h_UU[i][j] * vars.Sj[i] * d1.lapse[j]; } diff --git a/Source/simd/arm/neon.hpp b/Source/simd/arm/neon.hpp index d6a7f59cf..7eb11a289 100644 --- a/Source/simd/arm/neon.hpp +++ b/Source/simd/arm/neon.hpp @@ -98,8 +98,9 @@ template <> struct simd : public simd_base friend ALWAYS_INLINE bool simd_all_false(const mask_t cond, const simd &b) { uint64x2_t high_bits = vshrq_n_u64(input, 63); - //Lanes are indexed like bits (big-endian) - int moved_mask = vgetq_lane_u64(high_bits, 0) | (vgetq_lane_u64(high_bits, 1) << 1); + // Lanes are indexed like bits (big-endian) + int moved_mask = + vgetq_lane_u64(high_bits, 0) | (vgetq_lane_u64(high_bits, 1) << 1); return moved_mask == 0 ? true : false; } @@ -181,12 +182,14 @@ template <> struct simd : public simd_base friend ALWAYS_INLINE bool simd_all_false(const mask_t cond, const simd &b) { uint32x4_t high_bits = vshrq_n_u32(input, 31); - //Lanes are indexed like bits (big-endian) - int moved_mask = vgetq_lane_u32(high_bits, 0) | (vgetq_lane_u32(high_bits, 1) << 1) - | (vgetq_lane_u32(high_bits, 2) << 2) (vgetq_lane_u32(high_bits, 3) << 3); + // Lanes are indexed like bits (big-endian) + int moved_mask = vgetq_lane_u32(high_bits, 0) | + (vgetq_lane_u32(high_bits, 1) << 1) | + (vgetq_lane_u32(high_bits, 2) + << 2)(vgetq_lane_u32(high_bits, 3) << 3); return moved_mask == 0 ? true : false; } - + friend ALWAYS_INLINE simd simd_sqrt(const simd &a) { return vsqrtq_f32(a); } }; diff --git a/Source/simd/arm/sve.hpp b/Source/simd/arm/sve.hpp index 65d31923c..f5314bdcf 100644 --- a/Source/simd/arm/sve.hpp +++ b/Source/simd/arm/sve.hpp @@ -124,7 +124,8 @@ template <> struct simd : public simd_base friend ALWAYS_INLINE bool simd_all_false(const mask_t cond, const simd &b) { - //Would be nice to implement a movemask here, for extensions to lane-specific info + // Would be nice to implement a movemask here, for extensions to + // lane-specific info return !svptest_any(svptrue_b64(), cond); } @@ -214,7 +215,8 @@ template <> struct simd : public simd_base friend ALWAYS_INLINE bool simd_all_false(const mask_t cond, const simd &b) { - //Would be nice to implement a movemask here, for extensions to lane-specific info + // Would be nice to implement a movemask here, for extensions to + // lane-specific info return !svptest_any(svptrue_b32(), cond); } diff --git a/Source/simd/simd.hpp b/Source/simd/simd.hpp index 1cb5aee50..3742ba66c 100644 --- a/Source/simd/simd.hpp +++ b/Source/simd/simd.hpp @@ -127,10 +127,7 @@ template struct simd return (a > b) ? a : b; } - friend ALWAYS_INLINE bool simd_all_false(const bool cond) - { - return !cond; - } + friend ALWAYS_INLINE bool simd_all_false(const bool cond) { return !cond; } }; // Define all the simd-functions whose implementation does not depend on the @@ -176,7 +173,8 @@ template ALWAYS_INLINE t simd_max(const t &a, const t &b) } // Here, t is some simd variable -template ALWAYS_INLINE bool simd_all_false(const bool cond, const t &b) +template +ALWAYS_INLINE bool simd_all_false(const bool cond, const t &b) { return !cond; }