v0.14.0
Dg_or_Dg.hpp
Go to the documentation of this file.
1 /* Adds two Dg's to make a Dg, but with different
2  symmetries. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  /* A(i,j,k)+B(i,k,j) -> Dg(j,k,i) */
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(N3, N1, N2) + iterB(N3, N2, N1);
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  Dg_Expr<Dg_or_Dg_12<A, B, T, U, Dim, i, j, k>, typename promote<T, U>::V,
31  Dim, Dim, j, k, i>
34  {
35  using TensorExpr = Dg_or_Dg_12<A, B, T, U, Dim, i, j, k>;
37  TensorExpr(a, b));
38  }
39 
40  /* A(j,i,k)+B(k,i,j) -> Dg(j,k,i) */
41 
42  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
44  {
47 
48  public:
49  typename promote<T, U>::V
50  operator()(const int N1, const int N2, const int N3) const
51  {
52  return iterA(N1, N3, N2) + iterB(N2, N3, N1);
53  }
54 
57  : iterA(a), iterB(b)
58  {}
59  };
60 
61  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
62  Dg_Expr<Dg_or_Dg_02<A, B, T, U, Dim, i, j, k>, typename promote<T, U>::V,
63  Dim, Dim, j, k, i>
66  {
67  using TensorExpr = Dg_or_Dg_02<A, B, T, U, Dim, i, j, k>;
69  TensorExpr(a, b));
70  }
71 }
FTensor::Dg_or_Dg_12::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_or_Dg.hpp:18
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Dg_or_Dg_02::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_or_Dg.hpp:50
FTensor::operator||
Ddg_Expr< Ddg_or_Ddg< A, B, T, U, Dim, i, j, k, l >, typename promote< T, U >::V, Dim, Dim, i, k, j, l > operator||(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, l, k, j > &b)
Definition: Ddg_or_Ddg.hpp:33
FTensor::Dg_or_Dg_12::iterA
Dg_Expr< A, T, Dim, Dim, i, j, k > iterA
Definition: Dg_or_Dg.hpp:13
FTensor::Dg_or_Dg_12::iterB
Dg_Expr< B, U, Dim, Dim, i, k, j > iterB
Definition: Dg_or_Dg.hpp:14
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Dg_or_Dg_02::iterA
Dg_Expr< A, T, Dim, Dim, j, i, k > iterA
Definition: Dg_or_Dg.hpp:45
FTensor::Dg_or_Dg_12::Dg_or_Dg_12
Dg_or_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_or_Dg.hpp:23
FTensor::Dg_or_Dg_02::Dg_or_Dg_02
Dg_or_Dg_02(const Dg_Expr< A, T, Dim, Dim, j, i, k > &a, const Dg_Expr< B, U, Dim, Dim, k, i, j > &b)
Definition: Dg_or_Dg.hpp:55
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Dg_or_Dg_12
Definition: Dg_or_Dg.hpp:11
FTensor::Dg_or_Dg_02::iterB
Dg_Expr< B, U, Dim, Dim, k, i, j > iterB
Definition: Dg_or_Dg.hpp:46
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Dg_Expr< A, T, Dim, Dim, i, j, k >
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Dg_or_Dg_02
Definition: Dg_or_Dg.hpp:43
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20