v0.13.2
Searching...
No Matches
interpolate_Tensor1.hpp
Go to the documentation of this file.
1/* Interpolates to (i0+distance[0], j0+distance[1], k0+distance[2])
2 yielding a Tensor1. (i0,j0,k0) are 3D array coordinates,
3 conjugate==1-distance, and (di,dj,dk) are the stride of the array
4 coordinates. It is assumed that the Tensor1<T*,Dim> is zero
5 centered. */
6
7#pragma once
8
9namespace FTensor
10{
11 template <class T, int Dim, char i> class interpolate_Tensor1
12 {
14 const int di, dj, dk, i0, j0, k0;
15 const double *distance, *conjugate;
16
17 public:
18 typename promote<T, double>::V operator()(const int N1) const
19 {
20 return conjugate[0] * conjugate[1] * conjugate[2]
21 * (*(a.ptr(N1) + di * i0 + dj * j0 + dk * k0))
22 + distance[0] * conjugate[1] * conjugate[2]
23 * (*(a.ptr(N1) + di * (i0 + 1) + dj * (j0) + dk * (k0)))
24 + conjugate[0] * distance[1] * conjugate[2]
25 * (*(a.ptr(N1) + di * (i0) + dj * (j0 + 1) + dk * (k0)))
26 + distance[0] * distance[1] * conjugate[2]
27 * (*(a.ptr(N1) + di * (i0 + 1) + dj * (j0 + 1) + dk * (k0)))
28 + conjugate[0] * conjugate[1] * distance[2]
29 * (*(a.ptr(N1) + di * (i0) + dj * (j0) + dk * (k0 + 1)))
30 + distance[0] * conjugate[1] * distance[2]
31 * (*(a.ptr(N1) + di * (i0 + 1) + dj * (j0) + dk * (k0 + 1)))
32 + conjugate[0] * distance[1] * distance[2]
33 * (*(a.ptr(N1) + di * (i0) + dj * (j0 + 1) + dk * (k0 + 1)))
34 + distance[0] * distance[1] * distance[2]
35 * (*(a.ptr(N1) + di * (i0 + 1) + dj * (j0 + 1)
36 + dk * (k0 + 1)));
37 }
38 interpolate_Tensor1(const Tensor1<T *, Dim> &A, const int Di, const int Dj,
39 const int Dk, const int I0, const int J0, const int K0,
40 const double Distance[3], const double Conjugate[3])
41 : a(A), di(Di), dj(Dj), dk(Dk), i0(I0), j0(J0), k0(K0),
42 distance(Distance), conjugate(Conjugate)
43 {}
44 };
45
46 template <class T, int Dim, char i>
48 typename promote<T, double>::V, Dim, i>
50 const int &di, const int &dj, const int &dk, const int &i0,
51 const int &j0, const int &k0, const double distance[3],
52 const double conjugate[3])
53 {
54 using Tensor_Expr = interpolate_Tensor1<T, Dim, i>;
56 Tensor_Expr(a, di, dj, dk, i0, j0, k0, distance, conjugate));
57 }
58}
static Number< 1 > N1
constexpr double a
const Tensor1< T *, Dim > & a
promote< T, double >::V operator()(const int N1) const
interpolate_Tensor1(const Tensor1< T *, Dim > &A, const int Di, const int Dj, const int Dk, const int I0, const int J0, const int K0, const double Distance[3], const double Conjugate[3])
FTensor::Index< 'i', SPACE_DIM > i
Tensors class implemented by Walter Landry.
Definition: FTensor.hpp:51
promote< T, double >::V interpolate(const Tensor0< T * > &a, const int &di, const int &dj, const int &dk, const int &i0, const int &j0, const int &k0, const double distance[3], const double conjugate[3])
constexpr AssemblyType A