v0.14.0
Dg_and_Dg.hpp
Go to the documentation of this file.
1 /* Subtracts a Dg from a Dg, yielding a
2  Tensor3_antisymmetric. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  /* A(i,j,k)-B(i,k,j)->Tensor3_antisymmetric */
9 
10  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
12  {
15 
16  public:
17  typename promote<T, U>::V
18  operator()(const int N1, const int N2, const int N3) const
19  {
20  return iterA(N1, N2, N3) - iterB(N1, N3, N2);
21  }
22 
25  : iterA(a), iterB(b)
26  {}
27  };
28 
29  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
30  Tensor3_antisymmetric_Expr<Dg_and_Dg_12<A, B, T, U, Dim, i, j, k>,
31  typename promote<T, U>::V, Dim, Dim, i, j, k>
34  {
35  using TensorExpr = Dg_and_Dg_12<A, B, T, U, Dim, i, j, k>;
37  Dim, Dim, i, j, k>(TensorExpr(a, b));
38  }
39 
40  /* A(i,j,k)-B(k,j,i)->Tensor3_antisymmetric */
41  /* We have to do a little index gymnastics here because a
42  Tensor3_antisymmetric is antisymmetric on the last two indices, not
43  the first and last index. */
44 
45  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
47  {
50 
51  public:
52  typename promote<T, U>::V
53  operator()(const int N1, const int N2, const int N3) const
54  {
55  return iterA(N2, N1, N3) - iterB(N3, N1, N2);
56  }
57 
60  : iterA(a), iterB(b)
61  {}
62  };
63 
64  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
65  Tensor3_antisymmetric_Expr<Dg_and_Dg_02<A, B, T, U, Dim, i, j, k>,
66  typename promote<T, U>::V, Dim, Dim, j, i, k>
69  {
70  using TensorExpr = Dg_and_Dg_02<A, B, T, U, Dim, i, j, k>;
72  Dim, Dim, j, i, k>(TensorExpr(a, b));
73  }
74 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Dg_and_Dg_12::iterB
Dg_Expr< B, U, Dim, Dim, i, k, j > iterB
Definition: Dg_and_Dg.hpp:14
FTensor::Dg_and_Dg_02::iterB
Dg_Expr< B, U, Dim, Dim, k, j, i > iterB
Definition: Dg_and_Dg.hpp:49
FTensor::Tensor3_antisymmetric_Expr
Definition: Tensor3_antisymmetric_Expr.hpp:18
FTensor::Dg_and_Dg_02::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_and_Dg.hpp:53
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Dg_and_Dg_12::iterA
Dg_Expr< A, T, Dim, Dim, i, j, k > iterA
Definition: Dg_and_Dg.hpp:13
FTensor::operator&&
Riemann_Expr< Ddg_and_Ddg0321< A, B, T, U, Dim, i, j, k, l >, typename promote< T, U >::V, Dim, i, j, k, l > operator&&(const Ddg_Expr< A, T, Dim, Dim, i, k, j, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, l, k, j > &b)
Definition: Ddg_and_Ddg.hpp:33
FTensor::promote::V
T1 V
Definition: promote.hpp:17
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Dg_and_Dg_02
Definition: Dg_and_Dg.hpp:46
FTensor::Dg_and_Dg_12::Dg_and_Dg_12
Dg_and_Dg_12(const Dg_Expr< A, T, Dim, Dim, i, j, k > &a, const Dg_Expr< B, U, Dim, Dim, i, k, j > &b)
Definition: Dg_and_Dg.hpp:23
FTensor::Dg_Expr< A, T, Dim, Dim, i, j, k >
FTensor::Dg_and_Dg_02::iterA
Dg_Expr< A, T, Dim, Dim, i, j, k > iterA
Definition: Dg_and_Dg.hpp:48
FTensor::Dg_and_Dg_12::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_and_Dg.hpp:18
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Dg_and_Dg_02::Dg_and_Dg_02
Dg_and_Dg_02(const Dg_Expr< A, T, Dim, Dim, i, j, k > &a, const Dg_Expr< B, U, Dim, Dim, k, j, i > &b)
Definition: Dg_and_Dg.hpp:58
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Dg_and_Dg_12
Definition: Dg_and_Dg.hpp:11