v0.14.0
interpolate_Tensor0.hpp
Go to the documentation of this file.
1 /* Interpolates to (i0+distance[0], j0+distance[1], k0+distance[2]),
2  yielding a double. (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 Tensor0_ptr is zero
5  centered. */
6 
7 #pragma once
8 
9 namespace FTensor
10 {
11  template <class T>
12  typename promote<T, double>::V
13  interpolate(const Tensor0<T *> &a, const int &di, const int &dj,
14  const int &dk, const int &i0, const int &j0, const int &k0,
15  const double distance[3], const double conjugate[3])
16  {
17  return conjugate[0] * conjugate[1] * conjugate[2]
18  * (*(&a + di * i0 + dj * j0 + dk * k0))
19  + distance[0] * conjugate[1] * conjugate[2]
20  * (*(&a + di * (i0 + 1) + dj * (j0) + dk * (k0)))
21  + conjugate[0] * distance[1] * conjugate[2]
22  * (*(&a + di * (i0) + dj * (j0 + 1) + dk * (k0)))
23  + distance[0] * distance[1] * conjugate[2]
24  * (*(&a + di * (i0 + 1) + dj * (j0 + 1) + dk * (k0)))
25  + conjugate[0] * conjugate[1] * distance[2]
26  * (*(&a + di * (i0) + dj * (j0) + dk * (k0 + 1)))
27  + distance[0] * conjugate[1] * distance[2]
28  * (*(&a + di * (i0 + 1) + dj * (j0) + dk * (k0 + 1)))
29  + conjugate[0] * distance[1] * distance[2]
30  * (*(&a + di * (i0) + dj * (j0 + 1) + dk * (k0 + 1)))
31  + distance[0] * distance[1] * distance[2]
32  * (*(&a + di * (i0 + 1) + dj * (j0 + 1) + dk * (k0 + 1)));
33  }
34 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor0< T * >
Definition: Tensor0.hpp:19
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