Skip to content

Commit

Permalink
Derivs: add support of type vec<vec> vec<smat> for calc_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Sep 23, 2024
1 parent cc94602 commit d6fc118
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Derivs/src/derivs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ CCTK_ATTRIBUTE_NOINLINE void calc_copy(const smat<GF3D5<T>, dim> &gf,
calc_copy<CI, CJ, CK>(gf(a, b), layout, grid, gf0(a, b));
};

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void
calc_copy(const vec<vec<GF3D5<T>, dim>, dim> &gf, const GF3D5layout layout,
const GridDescBaseDevice &grid,
const vec<vec<GF3D2<const T>, dim>, dim> &gf0) {
for (int c = 0; c < dim; ++c)
for (int a = 0; a < dim; ++a)
calc_copy<CI, CJ, CK>(gf(c)(a), layout, grid, gf0(c)(a));
}

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void
calc_copy(const vec<smat<GF3D5<T>, dim>, dim> &gf, const GF3D5layout layout,
const GridDescBaseDevice &grid,
const vec<smat<GF3D2<const T>, dim>, dim> &gf0) {
for (int c = 0; c < dim; ++c)
for (int a = 0; a < dim; ++a)
for (int b = a; b < dim; ++b)
calc_copy<CI, CJ, CK>(gf(c)(a, b), layout, grid, gf0(c)(a, b));
}

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void
calc_derivs(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
Expand Down Expand Up @@ -307,6 +328,16 @@ template void calc_copy<0, 0, 0>(const smat<GF3D5<T>, dim> &gf,
const GF3D5layout layout,
const GridDescBaseDevice &grid,
const smat<GF3D2<const T>, dim> &gf0);
template void calc_copy<0, 0, 0>(const vec<vec<GF3D5<T>, dim>, dim> &gf,
const GF3D5layout layout,
const GridDescBaseDevice &grid,
const vec<vec<GF3D2<const T>, dim>, dim> &gf0);

template void
calc_copy<0, 0, 0>(const vec<smat<GF3D5<T>, dim>, dim> &gf,
const GF3D5layout layout, const GridDescBaseDevice &grid,
const vec<smat<GF3D2<const T>, dim>, dim> &gf0);

template void
calc_derivs<0, 0, 0>(const GF3D5<T> &gf, const vec<GF3D5<T>, dim> &dgf,
const GF3D5layout layout, const GridDescBaseDevice &grid,
Expand Down
14 changes: 14 additions & 0 deletions Derivs/src/derivs.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,20 @@ calc_copy(const Arith::smat<Loop::GF3D5<T>, Loop::dim> &gf,
const Loop::GF3D5layout layout, const Loop::GridDescBaseDevice &grid,
const Arith::smat<Loop::GF3D2<const T>, Loop::dim> &gf0);

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void calc_copy(
const Arith::vec<Arith::vec<Loop::GF3D5<T>, Loop::dim>, Loop::dim> &gf,
const Loop::GF3D5layout layout, const Loop::GridDescBaseDevice &grid,
const Arith::vec<Arith::vec<Loop::GF3D2<const T>, Loop::dim>, Loop::dim>
&gf0);

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void calc_copy(
const Arith::vec<Arith::smat<Loop::GF3D5<T>, Loop::dim>, Loop::dim> &gf,
const Loop::GF3D5layout layout, const Loop::GridDescBaseDevice &grid,
const Arith::vec<Arith::smat<Loop::GF3D2<const T>, Loop::dim>, Loop::dim>
&gf0);

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void calc_derivs(
const Loop::GF3D5<T> &gf, const Arith::vec<Loop::GF3D5<T>, Loop::dim> &dgf,
Expand Down

0 comments on commit d6fc118

Please sign in to comment.