diff --git a/TestDerivs/interface.ccl b/TestDerivs/interface.ccl index 827f05bf4..fc0369147 100644 --- a/TestDerivs/interface.ccl +++ b/TestDerivs/interface.ccl @@ -26,7 +26,7 @@ CCTK_REAL chi_diss TYPE=gf CENTERING={VVV} TAGS='checkpoint="no"' "dissipation t CCTK_REAL beta TYPE=gf CENTERING={VVV} { betax, betay, betaz -}"velocity function used for calculating upwind term" +} "velocity function used for calculating upwind term" CCTK_REAL chi_upwind TYPE=gf CENTERING={VVV} TAGS='checkpoint="no"' "upwind term" diff --git a/TestDerivs/src/test.cxx b/TestDerivs/src/test.cxx index 65793ae3f..d919800b9 100644 --- a/TestDerivs/src/test.cxx +++ b/TestDerivs/src/test.cxx @@ -23,12 +23,13 @@ template constexpr void poly_derivs(const T kxx, const T kxy, const T kyz, const T x, const T y, const T z, Arith::vec &du, Arith::smat &ddu) { - const T sinx = std::sin(x); - const T siny = std::sin(y); - const T sinz = std::sin(z); - const T cosx = std::cos(x); - const T cosy = std::cos(y); - const T cosz = std::cos(z); + using std::sin, std::cos, std::sqrt; + const T sinx = sin(x); + const T siny = sin(y); + const T sinz = sin(z); + const T cosx = cos(x); + const T cosy = cos(y); + const T cosz = cos(z); du(0) = -2 * kxx * cosx * sinx - kxy * sinx * siny; du(1) = kxy * cosx * cosy + kyz * cosy * sinz; du(2) = kyz * cosz * siny; @@ -43,10 +44,10 @@ constexpr void poly_derivs(const T kxx, const T kxy, const T kyz, const T x, template constexpr Arith::vec beta_profile(const T x, const T y, const T z) { - const T vx = 1 * std::sin(x); - const T vy = 2 * std::sin(y); - const T vz = 3 * std::sin(z); - const T norm = std::sqrt(vx * vx + vy * vy + vz * vz); + const T vx = 1 * sin(x); + const T vy = 2 * sin(y); + const T vz = 3 * sin(z); + const T norm = sqrt(vx * vx + vy * vy + vz * vz); return Arith::vec({vx / norm, vy / norm, vy / norm}); } @@ -54,10 +55,11 @@ template constexpr T poly_diss(const T kxx, const T kxy, const T kyz, const T x, const T y, const T z, const int diss_order, const Arith::vect &dx) { - const T sinx = std::sin(x); - const T siny = std::sin(y); - const T sinz = std::sin(z); - const T cosx = std::cos(x); + using std::sin, std::cos, std::fabs; + const T sinx = sin(x); + const T siny = sin(y); + const T sinz = sin(z); + const T cosx = cos(x); int coeff = 0; switch (diss_order) { @@ -77,7 +79,7 @@ constexpr T poly_diss(const T kxx, const T kxy, const T kyz, const T x, assert(0); } - const int abc = std::abs(coeff); + const int abc = fabs(coeff); const int sig = (abc == coeff) ? 1 : -1; return sig * ((abc * kxx * cosx * cosx - abc * kxx * sinx * sinx + kxy * cosx * siny) / @@ -104,6 +106,7 @@ extern "C" void TestDerivs_Set(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTSX_TestDerivs_Set; DECLARE_CCTK_PARAMETERS; + using std::sin; using vreal = Arith::simd; using vbool = Arith::simdl; constexpr std::size_t vsize = std::tuple_size_v; @@ -115,8 +118,7 @@ extern "C" void TestDerivs_Set(CCTK_ARGUMENTS) { const vreal x0 = p.x + Arith::iota() * p.dx; const CCTK_REAL y0 = p.y; const CCTK_REAL z0 = p.z; - chi.store(mask, p.I, - poly(kxx, kxy, kyz, cos(x0), std::sin(y0), std::sin(z0))); + chi.store(mask, p.I, poly(kxx, kxy, kyz, cos(x0), sin(y0), sin(z0))); }); grid.loop_int_device<0, 0, 0>( @@ -334,8 +336,7 @@ extern "C" void TestDerivs_CalcError(CCTK_ARGUMENTS) { const int diss_order = deriv_order + 2; const CCTK_REAL diss = - Arith::pown(-1, diss_order / 2.0 - 1.0) / - Arith::pown(2, diss_order) * + Arith::pown(-1, diss_order / 2 - 1) / Arith::pown(2, diss_order) * poly_diss(kxx, kxy, kyz, p.x, p.y, p.z, diss_order, dx); chi_diss_error(p.I) = diss - chi_diss(p.I);