v0.14.0
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 
7 namespace FTensor
8 {
9  template <class T, int Dim01, int Dim2, char i, char j, char k>
11  {
16 
17  public:
18  typename promote<T, double>::V
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 }
FTensor::d_boundary_Tensor2_symmetric::a
const Tensor2_symmetric< T *, Dim01 > & a
Definition: d_boundary_Tensor2_symmetric.hpp:12
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor1< int, Dim2 >
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_symmetric< T *, Dim01 >
FTensor::Tensor2< bool, Dim2, 2 >
FTensor::d_boundary_Tensor2_symmetric::d_boundary_Tensor2_symmetric
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)
Definition: d_boundary_Tensor2_symmetric.hpp:29
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::d_boundary
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)
Definition: d_boundary_Tensor0.hpp:35
FTensor::d_boundary_Tensor2_symmetric::d_xyz
const Tensor1< double, Dim2 > & d_xyz
Definition: d_boundary_Tensor2_symmetric.hpp:14
FTensor::promote::V
T1 V
Definition: promote.hpp:17
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index
Definition: Index.hpp:23
FTensor::d_boundary_Tensor2_symmetric::operator()
promote< T, double >::V operator()(const int N1, const int N2, const int N3) const
Definition: d_boundary_Tensor2_symmetric.hpp:19
FTensor::d_boundary_Tensor2_symmetric::d_ijk
const Tensor1< int, Dim2 > & d_ijk
Definition: d_boundary_Tensor2_symmetric.hpp:13
FTensor::Dg_Expr
Definition: Dg_Expr.hpp:25
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::d_boundary_Tensor2_symmetric
Definition: d_boundary_Tensor2_symmetric.hpp:10
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::d_boundary_Tensor2_symmetric::boundary
const Tensor2< bool, Dim2, 2 > & boundary
Definition: d_boundary_Tensor2_symmetric.hpp:15