From cc94602bb0063b2f76e329c99b9fd58d03eb6bc8 Mon Sep 17 00:00:00 2001 From: Liwei Ji Date: Mon, 16 Sep 2024 14:38:19 -0400 Subject: [PATCH] Derivs: add support for tensor type vec --- Derivs/src/derivs.cxx | 20 ++++++++++++++++++++ Derivs/src/derivs.hxx | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/Derivs/src/derivs.cxx b/Derivs/src/derivs.cxx index b6ec271d7..480b330bc 100644 --- a/Derivs/src/derivs.cxx +++ b/Derivs/src/derivs.cxx @@ -149,6 +149,19 @@ calc_derivs(const smat, dim> &gf, deriv_order); } +template +CCTK_ATTRIBUTE_NOINLINE void +calc_derivs(const vec, dim>, dim> &gf, + const vec, dim>, dim>, dim> &dgf, + const GF3D5layout layout, const GridDescBaseDevice &grid, + const vec, dim>, dim> &gf0, + const vect dx, const int deriv_order) { + for (int c = 0; c < dim; ++c) + for (int a = 0; a < dim; ++a) + calc_derivs(gf(c)(a), dgf(c)(a), layout, grid, gf0(c)(a), dx, + deriv_order); +} + template CCTK_ATTRIBUTE_NOINLINE void calc_derivs(const vec, dim>, dim> &gf, @@ -316,6 +329,13 @@ template void calc_derivs<0, 0, 0>(const smat, dim> &gf, const vect dx, const int deriv_order); +template void +calc_derivs<0, 0, 0>(const vec, dim>, dim> &gf, + const vec, dim>, dim>, dim> &dgf, + const GF3D5layout layout, const GridDescBaseDevice &grid, + const vec, dim>, dim> &gf0, + const vect dx, const int deriv_order); + template void calc_derivs<0, 0, 0>(const vec, dim>, dim> &gf, const vec, dim>, dim>, dim> &dgf, diff --git a/Derivs/src/derivs.hxx b/Derivs/src/derivs.hxx index 488b839e1..d39a3fa0e 100644 --- a/Derivs/src/derivs.hxx +++ b/Derivs/src/derivs.hxx @@ -795,6 +795,17 @@ CCTK_ATTRIBUTE_NOINLINE void calc_derivs( const Arith::smat, Loop::dim> &gf0, const Arith::vect dx, const int deriv_order); +template +CCTK_ATTRIBUTE_NOINLINE void calc_derivs( + const Arith::vec, Loop::dim>, Loop::dim> &gf, + const Arith::vec< + Arith::vec, Loop::dim>, Loop::dim>, Loop::dim> + &dgf, + const Loop::GF3D5layout layout, const Loop::GridDescBaseDevice &grid, + const Arith::vec, Loop::dim>, Loop::dim> + &gf0, + const Arith::vect dx, const int deriv_order); + template CCTK_ATTRIBUTE_NOINLINE void calc_derivs( const Arith::vec, Loop::dim>, Loop::dim> &gf,