v0.13.2
Searching...
No Matches
diffusion_Tensor2_symmetric.hpp
Go to the documentation of this file.
1/* Computes 2*del^2 of a Tensor2_symmetric<T*,Dim> but uses diagonal
2 derivatives for half of it. Yields a Tensor2_symmetric. */
3
4#pragma once
5
6namespace FTensor
7{
8 template <class T, int Dim, char i, char j> class diffusion_Tensor2_symmetric
9 {
11 const int di, dj, dk;
12 const double dx;
13
14 public:
15 typename promote<T, double>::V operator()(const int N1, const int N2) const
16 {
17 return ((*(a.ptr(N1, N2) + di) - 2 * a(N1, N2) + *(a.ptr(N1, N2) - di))
18 + (*(a.ptr(N1, N2) + dj) - 2 * a(N1, N2) + *(a.ptr(N1, N2) - dj))
19 + (*(a.ptr(N1, N2) + dk) - 2 * a(N1, N2) + *(a.ptr(N1, N2) - dk))
20 + ((*(a.ptr(N1, N2) + di + dj) + *(a.ptr(N1, N2) + di - dj)
21 + *(a.ptr(N1, N2) - di + dj) + *(a.ptr(N1, N2) - di - dj)
22 - 4 * a(N1, N2))
23 + (*(a.ptr(N1, N2) + di + dk) + *(a.ptr(N1, N2) + di - dk)
24 + *(a.ptr(N1, N2) - di + dk) + *(a.ptr(N1, N2) - di - dk)
25 - 4 * a(N1, N2))
26 + (*(a.ptr(N1, N2) + dj + dk) + *(a.ptr(N1, N2) + dj - dk)
27 + *(a.ptr(N1, N2) - dj + dk) + *(a.ptr(N1, N2) - dj - dk)
28 - 4 * a(N1, N2)))
29 / (std::sqrt(2.0)))
30 * dx * dx;
31 }
33 const int Di, const int Dj, const int Dk,
34 const double Dx)
35 : a(A), di(Di), dj(Dj), dk(Dk), dx(Dx)
36 {}
37 };
38
39 template <class T, int Dim, char i, char j>
40 const Tensor2_symmetric_Expr<const diffusion_Tensor2_symmetric<T, Dim, i, j>,
41 typename promote<T, double>::V, Dim, i, j>
43 const Index<j, Dim> index2, const int &di, const int &dj,
44 const int &dk, const double &dx)
45 {
48 Dim, i, j>(Tensor_Expr(a, di, dj, dk, dx));
49 }
50}
static Number< 2 > N2
static Number< 1 > N1
constexpr double a
const Tensor2_symmetric< T *, Dim > & a
promote< T, double >::V operator()(const int N1, const int N2) const
diffusion_Tensor2_symmetric(const Tensor2_symmetric< T *, Dim > &A, const int Di, const int Dj, const int Dk, const double Dx)
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 diffusion(const Tensor0< T * > &a, const int &di, const int &dj, const int &dk, const double &dx)
constexpr AssemblyType A