v0.13.2
Loading...
Searching...
No Matches
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
6namespace FTensor
7{
8 template <class T>
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}
constexpr double a
Tensors class implemented by Walter Landry.
Definition: FTensor.hpp:51
promote< T, double >::V diffusion(const Tensor0< T * > &a, const int &di, const int &dj, const int &dk, const double &dx)