v0.14.0
Loading...
Searching...
No Matches
d_boundary_Tensor2_symmetric.hpp
Go to the documentation of this file.
1/* Takes a derivative of a Tensor2_symmetric, yielding a Dg.
2 This is mostly useful near boundaries where you might have to take
3 one-sided derivatives. */
4
5#pragma once
6
7namespace FTensor
8{
9 template <class T, int Dim01, int Dim2, char i, char j, char k>
11 {
16
17 public:
19 operator()(const int N1, const int N2, const int N3) const
20 {
21 return boundary(N3, 0)
22 ? (*(a.ptr(N1, N2) + d_ijk(N3)) - a(N1, N2)) * d_xyz(N3)
23 : (boundary(N3, 1)
24 ? (a(N1, N2) - *(a.ptr(N1, N2) - d_ijk(N3))) * d_xyz(N3)
25 : (*(a.ptr(N1, N2) + d_ijk(N3))
26 - *(a.ptr(N1, N2) - d_ijk(N3)))
27 * d_xyz(N3) * 0.5);
28 }
30 const Tensor1<int, Dim2> &D_ijk,
31 const Tensor1<double, Dim2> &D_xyz,
32 const Tensor2<bool, Dim2, 2> &Boundary)
33 : a(A), d_ijk(D_ijk), d_xyz(D_xyz), boundary(Boundary)
34 {}
35 };
36
37 template <class T, int Dim01, int Dim2, char i, char j, char k>
38 const Dg_Expr<const d_boundary_Tensor2_symmetric<T, Dim01, Dim2, i, j, k>,
39 typename promote<T, double>::V, Dim01, Dim2, i, j, k>
41 const Index<i, Dim01> index1, const Index<j, Dim01> index2,
42 const Index<k, Dim2> index3, const Tensor1<int, Dim2> &d_ijk,
43 const Tensor1<double, Dim2> &d_xyz,
44 const Tensor2<bool, Dim2, 2> &boundary)
45 {
48 j, k>(TensorExpr(a, d_ijk, d_xyz, boundary));
49 }
50}
constexpr double a
const Tensor2_symmetric< T *, Dim01 > & a
d_boundary_Tensor2_symmetric(const Tensor2_symmetric< T *, Dim01 > &A, const Tensor1< int, Dim2 > &D_ijk, const Tensor1< double, Dim2 > &D_xyz, const Tensor2< bool, Dim2, 2 > &Boundary)
promote< T, double >::V operator()(const int N1, const int N2, const int N3) const
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
Tensors class implemented by Walter Landry.
Definition FTensor.hpp:51
const Tensor1_Expr< const d_boundary_Tensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d_boundary(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz, const Tensor2< bool, Dim, 2 > &boundary)