v0.14.0
Loading...
Searching...
No Matches
interpolate_Tensor2_symmetric.hpp
Go to the documentation of this file.
1/* Interpolates to (i0+distance[0], j0+distance[1], k0+distance[2])
2 yielding a Tensor2_symmetric. (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 Tensor2_symmetric<T*,Dim> is zero
5 centered. */
6
7#pragma once
8
9namespace FTensor
10{
11 template <class T, int Dim, char i, char j>
13 {
15 const int di, dj, dk, i0, j0, k0;
16 const double *distance, *conjugate;
17
18 public:
19 typename promote<T, double>::V operator()(const int N1, const int N2) const
20 {
21 return conjugate[0] * conjugate[1] * conjugate[2]
22 * (*(a.ptr(N1, N2) + di * i0 + dj * j0 + dk * k0))
23 + distance[0] * conjugate[1] * conjugate[2]
24 * (*(a.ptr(N1, N2) + di * (i0 + 1) + dj * (j0) + dk * (k0)))
25 + conjugate[0] * distance[1] * conjugate[2]
26 * (*(a.ptr(N1, N2) + di * (i0) + dj * (j0 + 1) + dk * (k0)))
27 + distance[0] * distance[1] * conjugate[2]
28 * (*(a.ptr(N1, N2) + di * (i0 + 1) + dj * (j0 + 1)
29 + dk * (k0)))
30 + conjugate[0] * conjugate[1] * distance[2]
31 * (*(a.ptr(N1, N2) + di * (i0) + dj * (j0) + dk * (k0 + 1)))
32 + distance[0] * conjugate[1] * distance[2]
33 * (*(a.ptr(N1, N2) + di * (i0 + 1) + dj * (j0)
34 + dk * (k0 + 1)))
35 + conjugate[0] * distance[1] * distance[2]
36 * (*(a.ptr(N1, N2) + di * (i0) + dj * (j0 + 1)
37 + dk * (k0 + 1)))
38 + distance[0] * distance[1] * distance[2]
39 * (*(a.ptr(N1, N2) + di * (i0 + 1) + dj * (j0 + 1)
40 + dk * (k0 + 1)));
41 }
43 const int Di, const int Dj, const int Dk,
44 const int I0, const int J0, const int K0,
45 const double Distance[3],
46 const double Conjugate[3])
47 : a(A), di(Di), dj(Dj), dk(Dk), i0(I0), j0(J0), k0(K0),
48 distance(Distance), conjugate(Conjugate)
49 {}
50 };
51
52 template <class T, int Dim, char i, char j>
53 const Tensor2_symmetric_Expr<const interpolate_Tensor2_symmetric<T, Dim, i, j>,
54 typename promote<T, double>::V, Dim, i, j>
56 const Index<j, Dim> index2, const int &di, const int &dj,
57 const int &dk, const int &i0, const int &j0, const int &k0,
58 const double distance[3], const double conjugate[3])
59 {
62 Dim, i, j>(
63 Tensor_Expr(a, di, dj, dk, i0, j0, k0, distance, conjugate));
64 }
65}
constexpr double a
interpolate_Tensor2_symmetric(const Tensor2_symmetric< 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])
promote< T, double >::V operator()(const int N1, const int N2) const
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
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])