YXQEXAD63KY6PZRPJGGIXZ44L7O3BU5CO7JFBRTFXGAUROGN76ZQC
inline CCTK_ATTRIBUTE_ALWAYS_INLINE T deriv2_2d(const T *restrict const var,
const ptrdiff_t di,
const ptrdiff_t dj, const T dx,
const T dy) {
inline Z4C_INLINE T deriv2_2d(const T *restrict const var, const ptrdiff_t di,
const ptrdiff_t dj, const T dx, const T dy) {
inline CCTK_ATTRIBUTE_ALWAYS_INLINE T
deriv_upwind(const GF3D<const T, 0, 0, 0> &gf_, const vect<int, dim> &I,
const bool sign, const vec3<T, UP> &dx) {
inline Z4C_INLINE T deriv_upwind(const GF3D<const T, 0, 0, 0> &gf_,
const vect<int, dim> &I, const bool sign,
const vec3<T, UP> &dx) {
inline CCTK_ATTRIBUTE_ALWAYS_INLINE vec3<T, DN>
deriv(const GF3D<const T, 0, 0, 0> &gf_, const vect<int, dim> &I,
const vec3<T, UP> &dx) {
inline Z4C_INLINE vec3<T, DN> deriv(const GF3D<const T, 0, 0, 0> &gf_,
const vect<int, dim> &I,
const vec3<T, UP> &dx) {
inline CCTK_ATTRIBUTE_ALWAYS_INLINE mat3<T, DN, DN>
deriv2(const GF3D<const T, 0, 0, 0> &gf_, const vect<int, dim> &I,
const vec3<T, UP> &dx) {
inline Z4C_INLINE mat3<T, DN, DN> deriv2(const GF3D<const T, 0, 0, 0> &gf_,
const vect<int, dim> &I,
const vec3<T, UP> &dx) {
loop_int<0, 0, 0>(cctkGH,
[&](const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const auto dval = deriv(gf_, p.I, dx);
for (int a = 0; a < 3; ++a)
dgf_(a)(p.I) = dval(a);
});
loop_int<0, 0, 0>(cctkGH, [&](const PointDesc &p) Z4C_INLINE {
const auto dval = deriv(gf_, p.I, dx);
for (int a = 0; a < 3; ++a)
dgf_(a)(p.I) = dval(a);
});
loop_int<0, 0, 0>(cctkGH,
[&](const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const auto dval = deriv(gf_, p.I, dx);
for (int a = 0; a < 3; ++a)
dgf_(a)(p.I) = dval(a);
const auto ddval = deriv2(gf_, p.I, dx);
for (int a = 0; a < 3; ++a)
for (int b = a; b < 3; ++b)
ddgf_(a, b)(p.I) = ddval(a, b);
});
loop_int<0, 0, 0>(cctkGH, [&](const PointDesc &p) Z4C_INLINE {
const auto dval = deriv(gf_, p.I, dx);
for (int a = 0; a < 3; ++a)
dgf_(a)(p.I) = dval(a);
const auto ddval = deriv2(gf_, p.I, dx);
for (int a = 0; a < 3; ++a)
for (int b = a; b < 3; ++b)
ddgf_(a, b)(p.I) = ddval(a, b);
});
loop_int<0, 0, 0>(
cctkGH, [&](const PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE {
const vec3<CCTK_REAL, UP> betaG = gf_betaG_(p.I);
const vec3<CCTK_REAL, DN> dgf_upwind(deriv_upwind(gf_, p.I, betaG, dx));
gf_rhs_(p.I) += sum1([&](int x) { return betaG(x) * dgf_upwind(x); });
});
loop_int<0, 0, 0>(cctkGH, [&](const PointDesc &p) Z4C_INLINE {
const vec3<CCTK_REAL, UP> betaG = gf_betaG_(p.I);
const vec3<CCTK_REAL, DN> dgf_upwind(deriv_upwind(gf_, p.I, betaG, dx));
gf_rhs_(p.I) += sum1([&](int x) { return betaG(x) * dgf_upwind(x); });
});
return mat3<vec3<T, DN>, UP, UP>(
[&](int a, int b) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return vec3<T, DN>([&](int c) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return sum2(
[&](int x, int y) { return -gu(a, x) * gu(b, y) * dg(x, y)(c); });
});
});
return mat3<vec3<T, DN>, UP, UP>([&](int a, int b) Z4C_INLINE {
return vec3<T, DN>([&](int c) Z4C_INLINE {
return sum2(
[&](int x, int y) { return -gu(a, x) * gu(b, y) * dg(x, y)(c); });
});
});
return mat3<vec3<T, DN>, UP, UP>(
[&](int a, int b) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return vec3<T, DN>([&](int c) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return sum2([&](int x, int y) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return dgu(a, x)(c) * gu(b, y) * A(x, y) //
+ gu(a, x) * dgu(b, y)(c) * A(x, y) //
+ gu(a, x) * gu(b, y) * dA(x, y)(c);
});
});
return mat3<vec3<T, DN>, UP, UP>([&](int a, int b) Z4C_INLINE {
return vec3<T, DN>([&](int c) Z4C_INLINE {
return sum2([&](int x, int y) Z4C_INLINE {
return dgu(a, x)(c) * gu(b, y) * A(x, y) //
+ gu(a, x) * dgu(b, y)(c) * A(x, y) //
+ gu(a, x) * gu(b, y) * dA(x, y)(c);
return vec3<mat3<T, DN, DN>, DN>([&](int a) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return mat3<T, DN, DN>([&](int b, int c) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return vec3<mat3<T, DN, DN>, DN>([&](int a) Z4C_INLINE {
return mat3<T, DN, DN>([&](int b, int c) Z4C_INLINE {
return vec3<mat3<T, DN, DN>, UP>([&](int a) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return mat3<T, DN, DN>([&](int b, int c) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return sum1([&](int x) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return gu(a, x) * Gammal(x)(b, c);
});
return vec3<mat3<T, DN, DN>, UP>([&](int a) Z4C_INLINE {
return mat3<T, DN, DN>([&](int b, int c) Z4C_INLINE {
return sum1([&](int x) Z4C_INLINE { return gu(a, x) * Gammal(x)(b, c); });
template <typename T> CCTK_ATTRIBUTE_ALWAYS_INLINE constexpr T pow2(const T x) {
return x * x;
}
template <typename T> CCTK_ATTRIBUTE_ALWAYS_INLINE constexpr T pow3(const T x) {
template <typename T> Z4C_INLINE constexpr T pow2(const T x) { return x * x; }
template <typename T> Z4C_INLINE constexpr T pow3(const T x) {
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3(const vect<T, 3> &elts)
: elts(elts) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3(vect<T, 3> &&elts)
: elts(move(elts)) {}
constexpr Z4C_INLINE vec3(const vect<T, 3> &elts) : elts(elts) {}
constexpr Z4C_INLINE vec3(vect<T, 3> &&elts) : elts(move(elts)) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3(initializer_list<T> v)
: elts(v) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3(const vector<T> &v) : elts(v) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3(vector<T> &&v) : elts(move(v)) {}
constexpr Z4C_INLINE vec3(initializer_list<T> v) : elts(v) {}
constexpr Z4C_INLINE vec3(const vector<T> &v) : elts(v) {}
constexpr Z4C_INLINE vec3(vector<T> &&v) : elts(move(v)) {}
CCTK_ATTRIBUTE_ALWAYS_INLINE void store(const GF3D<T, 0, 0, 0> &gf_vx_,
const GF3D<T, 0, 0, 0> &gf_vy_,
const GF3D<T, 0, 0, 0> &gf_vz_,
const vect<int, 3> &I) const {
Z4C_INLINE void store(const GF3D<T, 0, 0, 0> &gf_vx_,
const GF3D<T, 0, 0, 0> &gf_vy_,
const GF3D<T, 0, 0, 0> &gf_vz_,
const vect<int, 3> &I) const {
CCTK_ATTRIBUTE_ALWAYS_INLINE const T &operator()(int i) const {
return elts[ind(i)];
}
CCTK_ATTRIBUTE_ALWAYS_INLINE T &operator()(int i) { return elts[ind(i)]; }
Z4C_INLINE const T &operator()(int i) const { return elts[ind(i)]; }
Z4C_INLINE T &operator()(int i) { return elts[ind(i)]; }
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3<T, dnup>
operator+(const vec3<T, dnup> &x, const vec3<T, dnup> &y) {
friend constexpr Z4C_INLINE vec3<T, dnup> operator+(const vec3<T, dnup> &x,
const vec3<T, dnup> &y) {
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3<T, dnup>
operator-(const vec3<T, dnup> &x, const vec3<T, dnup> &y) {
friend constexpr Z4C_INLINE vec3<T, dnup> operator-(const vec3<T, dnup> &x,
const vec3<T, dnup> &y) {
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE vec3<T, dnup>
operator*(const T &a, const vec3<T, dnup> &x) {
friend constexpr Z4C_INLINE vec3<T, dnup> operator*(const T &a,
const vec3<T, dnup> &x) {
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE bool
operator==(const vec3<T, dnup> &x, const vec3<T, dnup> &y) {
friend constexpr Z4C_INLINE bool operator==(const vec3<T, dnup> &x,
const vec3<T, dnup> &y) {
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE bool
operator!=(const vec3<T, dnup> &x, const vec3<T, dnup> &y) {
friend constexpr Z4C_INLINE bool operator!=(const vec3<T, dnup> &x,
const vec3<T, dnup> &y) {
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE mat3(const vect<T, 6> &elts)
: elts(elts) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE mat3(vect<T, 6> &&elts)
: elts(move(elts)) {}
constexpr Z4C_INLINE mat3(const vect<T, 6> &elts) : elts(elts) {}
constexpr Z4C_INLINE mat3(vect<T, 6> &&elts) : elts(move(elts)) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE mat3(initializer_list<T> A)
: elts(A) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE mat3(const vector<T> &A) : elts(A) {}
constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE mat3(vector<T> &&A) : elts(move(A)) {}
constexpr Z4C_INLINE mat3(initializer_list<T> A) : elts(A) {}
constexpr Z4C_INLINE mat3(const vector<T> &A) : elts(A) {}
constexpr Z4C_INLINE mat3(vector<T> &&A) : elts(move(A)) {}
CCTK_ATTRIBUTE_ALWAYS_INLINE const T &operator()(int i, int j) const {
return elts[ind(i, j)];
}
// CCTK_ATTRIBUTE_ALWAYS_INLINE T &operator()(int i, int j) { return
Z4C_INLINE const T &operator()(int i, int j) const { return elts[ind(i, j)]; }
// Z4C_INLINE T &operator()(int i, int j) { return
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE bool
operator==(const mat3<T, dnup1, dnup2> &x, const mat3<T, dnup1, dnup2> &y) {
friend constexpr Z4C_INLINE bool operator==(const mat3<T, dnup1, dnup2> &x,
const mat3<T, dnup1, dnup2> &y) {
friend constexpr CCTK_ATTRIBUTE_ALWAYS_INLINE bool
operator!=(const mat3<T, dnup1, dnup2> &x, const mat3<T, dnup1, dnup2> &y) {
friend constexpr Z4C_INLINE bool operator!=(const mat3<T, dnup1, dnup2> &x,
const mat3<T, dnup1, dnup2> &y) {
return mat3<T, dnup1, dnup2>([&](int a, int b) CCTK_ATTRIBUTE_ALWAYS_INLINE {
return sum1([&](int x)
CCTK_ATTRIBUTE_ALWAYS_INLINE { return A(a, x) * B(x, b); });
return mat3<T, dnup1, dnup2>([&](int a, int b) Z4C_INLINE {
return sum1([&](int x) Z4C_INLINE { return A(a, x) * B(x, b); });