v0.14.0
d_one_sided_Tensor2_symmetric.hpp
Go to the documentation of this file.
1 /* Takes a one-sided derivative of a Tensor2_symmetric in a particular
2  direction, yielding a Tensor2_symmetric. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  template <class T, int Dim, char i, char j, int axis>
10  {
12  const int di, dj, dk;
13  const double dx, dy, dz;
14 
15  public:
16  typename promote<T, double>::V operator()(const int N1, const int N2) const
17  {
18  return axis == 0
19  ? (a(N1, N2) - *(a.ptr(N1, N2) - di)) * dx
20  : (axis == 1 ? (a(N1, N2) - *(a.ptr(N1, N2) - dj)) * dy
21  : (a(N1, N2) - *(a.ptr(N1, N2) - dk)) * dz);
22  }
24  const int Di, const int Dj, const int Dk,
25  const double Dx, const double Dy,
26  const double Dz)
27  : a(A), di(Di), dj(Dj), dk(Dk), dx(Dx), dy(Dy), dz(Dz)
28  {}
29  };
30 
31  template <class T, int Dim, char i, char j, int axis>
32  const Tensor2_symmetric_Expr<
33  const d_one_sided_Tensor2_symmetric<T, Dim, i, j, axis>,
34  typename promote<T, double>::V, Dim, i, j>
36  const Index<i, Dim> index1, const Index<j, Dim> index2,
37  const int &di, const int &dj, const int &dk, const double &dx,
38  const double &dy, const double &dz)
39  {
42  Dim, i, j>(
43  TensorExpr(a, di, dj, dk, dx, dy, dz));
44  }
45 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::d_one_sided_Tensor2_symmetric::dy
const double dy
Definition: d_one_sided_Tensor2_symmetric.hpp:13
FTensor::d_one_sided
promote< T, double >::V d_one_sided(const Tensor0< T * > &a, const Number< 0 > n1, const int &di, const int &dj, const int &dk, const double &dx, const double &dy, const double &dz)
Definition: d_one_sided_Tensor0.hpp:10
FTensor::Tensor2_symmetric_Expr
Definition: Tensor2_symmetric_Expr.hpp:36
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_symmetric< T *, Dim >
FTensor::d_one_sided_Tensor2_symmetric::dk
const int dk
Definition: d_one_sided_Tensor2_symmetric.hpp:12
FTensor::d_one_sided_Tensor2_symmetric::di
const int di
Definition: d_one_sided_Tensor2_symmetric.hpp:12
FTensor::d_one_sided_Tensor2_symmetric::a
const Tensor2_symmetric< T *, Dim > & a
Definition: d_one_sided_Tensor2_symmetric.hpp:11
FTensor::Number
Definition: Number.hpp:11
FTensor::d_one_sided_Tensor2_symmetric::operator()
promote< T, double >::V operator()(const int N1, const int N2) const
Definition: d_one_sided_Tensor2_symmetric.hpp:16
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::d_one_sided_Tensor2_symmetric
Definition: d_one_sided_Tensor2_symmetric.hpp:9
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::d_one_sided_Tensor2_symmetric::d_one_sided_Tensor2_symmetric
d_one_sided_Tensor2_symmetric(const Tensor2_symmetric< T *, Dim > &A, const int Di, const int Dj, const int Dk, const double Dx, const double Dy, const double Dz)
Definition: d_one_sided_Tensor2_symmetric.hpp:23
FTensor::d_one_sided_Tensor2_symmetric::dj
const int dj
Definition: d_one_sided_Tensor2_symmetric.hpp:12
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index
Definition: Index.hpp:23
FTensor::d_one_sided_Tensor2_symmetric::dz
const double dz
Definition: d_one_sided_Tensor2_symmetric.hpp:13
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::d_one_sided_Tensor2_symmetric::dx
const double dx
Definition: d_one_sided_Tensor2_symmetric.hpp:13