Skip to content

Commit

Permalink
Derivs: add support for tensor type vec<vec>
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Sep 16, 2024
1 parent a4d8fa6 commit cc94602
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Derivs/src/derivs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ calc_derivs(const smat<GF3D5<T>, dim> &gf,
deriv_order);
}

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

template <int CI, int CJ, int CK, typename T>
CCTK_ATTRIBUTE_NOINLINE void
calc_derivs(const vec<smat<GF3D5<T>, dim>, dim> &gf,
Expand Down Expand Up @@ -316,6 +329,13 @@ template void calc_derivs<0, 0, 0>(const smat<GF3D5<T>, dim> &gf,
const vect<T, dim> dx,
const int deriv_order);

template void
calc_derivs<0, 0, 0>(const vec<vec<GF3D5<T>, dim>, dim> &gf,
const vec<vec<vec<GF3D5<T>, dim>, dim>, dim> &dgf,
const GF3D5layout layout, const GridDescBaseDevice &grid,
const vec<vec<GF3D2<const T>, dim>, dim> &gf0,
const vect<T, dim> dx, const int deriv_order);

template void
calc_derivs<0, 0, 0>(const vec<smat<GF3D5<T>, dim>, dim> &gf,
const vec<smat<vec<GF3D5<T>, dim>, dim>, dim> &dgf,
Expand Down
11 changes: 11 additions & 0 deletions Derivs/src/derivs.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,17 @@ CCTK_ATTRIBUTE_NOINLINE void calc_derivs(
const Arith::smat<Loop::GF3D2<const T>, Loop::dim> &gf0,
const Arith::vect<T, Loop::dim> dx, const int deriv_order);

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

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

0 comments on commit cc94602

Please sign in to comment.