diff --git a/TestSymmetries/configuration.ccl b/TestSymmetries/configuration.ccl index 38fae9ac2..e3b43dff3 100644 --- a/TestSymmetries/configuration.ccl +++ b/TestSymmetries/configuration.ccl @@ -1,3 +1,5 @@ # Configuration definitions for thorn TestSymmetries +REQUIRES Arith REQUIRES CarpetX +REQUIRES Loop diff --git a/TestSymmetries/interface.ccl b/TestSymmetries/interface.ccl index 4df5d4367..b30e95a5a 100644 --- a/TestSymmetries/interface.ccl +++ b/TestSymmetries/interface.ccl @@ -3,6 +3,7 @@ IMPLEMENTS: TestSymmetries USES INCLUDE HEADER: loop_device.hxx +USES INCLUDE HEADER: vect.hxx CCTK_REAL var_vvv_ppp TYPE=gf CENTERING={vvv} TAGS="parities={+1 +1 +1}" "var_vvv_ppp" CCTK_REAL var_vvc_ppp TYPE=gf CENTERING={vvc} TAGS="parities={+1 +1 +1}" "var_vvc_ppp" diff --git a/TestSymmetries/src/init.cxx b/TestSymmetries/src/init.cxx index 81c56e3ce..e6604c688 100644 --- a/TestSymmetries/src/init.cxx +++ b/TestSymmetries/src/init.cxx @@ -1,10 +1,11 @@ #include +#include + #include #include #include -#include #include #include #include @@ -12,6 +13,8 @@ namespace TestSymmetries { +using Arith::vect; + bool get_parameter(const std::string &name, const std::string þ) { int type; const void *const ptr = CCTK_ParameterGet(name.c_str(), thorn.c_str(), &type); @@ -23,21 +26,21 @@ bool get_parameter(const std::string &name, const std::string þ) { template void map_centering_parity(const cGH *restrict const cctkGH, - const std::array &parity, const F &f) { + const vect &parity, const F &f) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; - const std::array periodic{ + const vect periodic{ get_parameter("periodic_x", "CarpetX"), get_parameter("periodic_y", "CarpetX"), get_parameter("periodic_z", "CarpetX"), }; - const std::array reflection_lower{ + const vect reflection_lower{ get_parameter("reflection_x", "CarpetX"), get_parameter("reflection_y", "CarpetX"), get_parameter("reflection_z", "CarpetX"), }; - const std::array reflection_upper{ + const vect reflection_upper{ get_parameter("reflection_upper_x", "CarpetX"), get_parameter("reflection_upper_y", "CarpetX"), get_parameter("reflection_upper_z", "CarpetX"), @@ -46,7 +49,7 @@ void map_centering_parity(const cGH *restrict const cctkGH, // We assume the domain is [-1; +1] const auto makevalue = - [=] CCTK_DEVICE CCTK_HOST(const std::array &x) + [=] CCTK_DEVICE CCTK_HOST(const vect &x) CCTK_ATTRIBUTE_ALWAYS_INLINE { using std::acos, std::cos, std::sin; const CCTK_REAL pi = acos(CCTK_REAL(-1)); @@ -89,9 +92,9 @@ void map_centering_parity(const cGH *restrict const cctkGH, for (int k = -3; k <= 3; ++k) { for (int j = -3; j <= 3; ++j) { for (int i = -3; i <= 3; ++i) { - const std::array x{ - CCTK_REAL(0.5) * i, CCTK_REAL(0.5) * j, CCTK_REAL(0.5) * k}; - std::array x0 = x; + const vect x{CCTK_REAL(0.5) * i, CCTK_REAL(0.5) * j, + CCTK_REAL(0.5) * k}; + vect x0 = x; CCTK_REAL f = makevalue(x); // map f back into the domain for (int d = 0; d < 3; ++d) { @@ -129,15 +132,15 @@ void map_centering_parity(const cGH *restrict const cctkGH, 10 * std::numeric_limits::epsilon()); } } // for i - } // for j - } // for k + } // for j + } // for k // Test that the function is not just zero for (int k = -5; k <= 5; ++k) { for (int j = -5; j <= 5; ++j) { for (int i = -5; i <= 5; ++i) { if (abs(i) >= 3 && abs(j) >= 3 && abs(k) >= 3) { - const std::array x{ - CCTK_REAL(0.25) * i, CCTK_REAL(0.25) * j, CCTK_REAL(0.25) * k}; + const vect x{CCTK_REAL(0.25) * i, CCTK_REAL(0.25) * j, + CCTK_REAL(0.25) * k}; const CCTK_REAL f = makevalue(x); const bool want_zero = (parity[0] < 0 && reflection_lower[0] && i == -4) || @@ -160,9 +163,9 @@ void map_centering_parity(const cGH *restrict const cctkGH, } } - constexpr std::array centering{CI, CJ, CK}; + constexpr vect centering{CI, CJ, CK}; const Loop::GF3D2layout layout(cctkGH, centering); - const std::array, 2> gfptrs{{ + const vect, 2> gfptrs{{ {{ var_vvv_mmm, var_vvc_mmm, @@ -202,7 +205,7 @@ void map_centering_all_parities(const cGH *restrict const cctkGH, const F &f) { for (int pk = -1; pk <= +1; pk += 2) { for (int pj = -1; pj <= +1; pj += 2) { for (int pi = -1; pi <= +1; pi += 2) { - const std::array parity{pi, pj, pk}; + const vect parity{pi, pj, pk}; // Other parities are not (yet?) implemented and tested if (!((pi < 0 && pj < 0 && pk < 0) || (pi > 0 && pj > 0 && pk > 0)))