v0.14.0
diffusion_Tensor0.hpp
Go to the documentation of this file.
1 /* Computes 2*del^2 of a Tensor0_ptr but uses diagonal derivatives for
2  half of it. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  template <class T>
9  typename promote<T, double>::V
10  diffusion(const Tensor0<T *> &a, const int &di, const int &dj, const int &dk,
11  const double &dx)
12  {
13  return ((*(&a + di) - 2 * a + *(&a - di))
14  + (*(&a + dj) - 2 * a + *(&a - dj))
15  + (*(&a + dk) - 2 * a + *(&a - dk))
16  + ((*(&a + di + dj) + *(&a + di - dj) + *(&a - di + dj)
17  + *(&a - di - dj) - 4 * a)
18  + (*(&a + di + dk) + *(&a + di - dk) + *(&a - di + dk)
19  + *(&a - di - dk) - 4 * a)
20  + (*(&a + dj + dk) + *(&a + dj - dk) + *(&a - dj + dk)
21  + *(&a - dj - dk) - 4 * a))
22  / (std::sqrt(2.0)))
23  * dx * dx;
24  }
25 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::diffusion
promote< T, double >::V diffusion(const Tensor0< T * > &a, const int &di, const int &dj, const int &dk, const double &dx)
Definition: diffusion_Tensor0.hpp:10
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