v0.14.0
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 
9 namespace 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 }
FTensor::interpolate_Tensor2_symmetric::conjugate
const double * conjugate
Definition: interpolate_Tensor2_symmetric.hpp:16
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::interpolate_Tensor2_symmetric::distance
const double * distance
Definition: interpolate_Tensor2_symmetric.hpp:16
FTensor::interpolate_Tensor2_symmetric::interpolate_Tensor2_symmetric
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])
Definition: interpolate_Tensor2_symmetric.hpp:42
FTensor::Tensor2_symmetric_Expr
Definition: Tensor2_symmetric_Expr.hpp:36
FTensor::interpolate_Tensor2_symmetric::a
const Tensor2_symmetric< T *, Dim > & a
Definition: interpolate_Tensor2_symmetric.hpp:14
FTensor::interpolate_Tensor2_symmetric::di
const int di
Definition: interpolate_Tensor2_symmetric.hpp:15
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_symmetric< T *, Dim >
FTensor::interpolate_Tensor2_symmetric::j0
const int j0
Definition: interpolate_Tensor2_symmetric.hpp:15
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::interpolate
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])
Definition: interpolate_Tensor0.hpp:13
FTensor::interpolate_Tensor2_symmetric::dj
const int dj
Definition: interpolate_Tensor2_symmetric.hpp:15
FTensor::interpolate_Tensor2_symmetric
Definition: interpolate_Tensor2_symmetric.hpp:12
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index
Definition: Index.hpp:23
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::interpolate_Tensor2_symmetric::k0
const int k0
Definition: interpolate_Tensor2_symmetric.hpp:15
FTensor::interpolate_Tensor2_symmetric::i0
const int i0
Definition: interpolate_Tensor2_symmetric.hpp:15
FTensor::interpolate_Tensor2_symmetric::operator()
promote< T, double >::V operator()(const int N1, const int N2) const
Definition: interpolate_Tensor2_symmetric.hpp:19
FTensor::interpolate_Tensor2_symmetric::dk
const int dk
Definition: interpolate_Tensor2_symmetric.hpp:15