v0.14.0
Dg_plus_Dg.hpp
Go to the documentation of this file.
1 /* Adds two Dg's together, yielding a Dg or Tensor3. */
2 
3 #pragma once
4 
5 namespace FTensor
6 {
7  /* A(i,j,k)+B(i,j,k)->Dg */
8 
9  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
10  char j, char k>
11  class Dg_plus_Dg
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, N2, N3);
21  }
22 
25  : iterA(a), iterB(b)
26  {}
27  };
28 
29  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
30  char j, char k>
31  Dg_Expr<Dg_plus_Dg<A, B, T, U, Dim01, Dim2, i, j, k>,
32  typename promote<T, U>::V, Dim01, Dim2, i, j, k>
35  {
37  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim2, i, j, k>(
38  TensorExpr(a, b));
39  }
40 
41  /* A(i,j,k)+B(j,i,k)->Dg */
42 
43  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
44  char j, char k>
46  {
49 
50  public:
51  typename promote<T, U>::V
52  operator()(const int N1, const int N2, const int N3) const
53  {
54  return iterA(N1, N2, N3) + iterB(N1, N2, N3);
55  }
56 
59  : iterA(a), iterB(b)
60  {}
61  };
62 
63  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
64  char j, char k>
65  Dg_Expr<Dg_plus_Dg_10<A, B, T, U, Dim01, Dim2, i, j, k>,
66  typename promote<T, U>::V, Dim01, Dim2, i, j, k>
69  {
71  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim2, i, j, k>(
72  TensorExpr(a, b));
73  }
74 
75  /* A(i,j,k)+B(k,j,i)->Tensor3 */
76 
77  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
79  {
82 
83  public:
84  typename promote<T, U>::V
85  operator()(const int N1, const int N2, const int N3) const
86  {
87  return iterA(N1, N2, N3) + iterB(N3, N2, N1);
88  }
89 
92  : iterA(a), iterB(b)
93  {}
94  };
95 
96  template <class A, class B, class T, class U, int Dim, char i, char j, char k>
97  Tensor3_Expr<Dg_plus_Dg_210<A, B, T, U, Dim, i, j, k>,
98  typename promote<T, U>::V, Dim, Dim, Dim, i, j, k>
101  {
102  using TensorExpr = Dg_plus_Dg_210<A, B, T, U, Dim, i, j, k>;
104  i, j, k>(TensorExpr(a, b));
105  }
106 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Dg_plus_Dg_10
Definition: Dg_plus_Dg.hpp:45
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Dg_plus_Dg_210::iterA
Dg_Expr< A, T, Dim, Dim, i, j, k > iterA
Definition: Dg_plus_Dg.hpp:80
FTensor::Dg_plus_Dg_10::Dg_plus_Dg_10
Dg_plus_Dg_10(const Dg_Expr< A, T, Dim01, Dim2, i, j, k > &a, const Dg_Expr< B, U, Dim01, Dim2, j, i, k > &b)
Definition: Dg_plus_Dg.hpp:57
FTensor::Dg_plus_Dg_10::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_plus_Dg.hpp:52
FTensor::Dg_plus_Dg
Definition: Dg_plus_Dg.hpp:11
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Dg_plus_Dg_210
Definition: Dg_plus_Dg.hpp:78
FTensor::Tensor3_Expr
Definition: Tensor3_Expr.hpp:24
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Dg_plus_Dg_10::iterB
Dg_Expr< B, U, Dim01, Dim2, j, i, k > iterB
Definition: Dg_plus_Dg.hpp:48
FTensor::Dg_plus_Dg_210::Dg_plus_Dg_210
Dg_plus_Dg_210(const Dg_Expr< A, T, Dim, Dim, i, j, k > &a, const Dg_Expr< B, U, Dim, Dim, k, j, i > &b)
Definition: Dg_plus_Dg.hpp:90
FTensor::Dg_plus_Dg::iterB
Dg_Expr< B, U, Dim01, Dim2, i, j, k > iterB
Definition: Dg_plus_Dg.hpp:14
FTensor::Dg_plus_Dg::Dg_plus_Dg
Dg_plus_Dg(const Dg_Expr< A, T, Dim01, Dim2, i, j, k > &a, const Dg_Expr< B, U, Dim01, Dim2, i, j, k > &b)
Definition: Dg_plus_Dg.hpp:23
FTensor::Dg_Expr
Definition: Dg_Expr.hpp:25
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Dg_plus_Dg::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_plus_Dg.hpp:18
FTensor::Dg_plus_Dg_210::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Dg_plus_Dg.hpp:85
FTensor::operator+
Ddg_Expr< Ddg_plus_Ddg< A, B, T, U, Dim01_0, Dim23_0, Dim01_1, Dim23_1, i0, j0, k0, l0, i1, j1, k1, l1 >, typename promote< T, U >::V, Dim01_0, Dim23_0, i0, j0, k0, l0 > operator+(const Ddg_Expr< A, T, Dim01_0, Dim23_0, i0, j0, k0, l0 > &a, const Ddg_Expr< B, U, Dim01_1, Dim23_1, i1, j1, k1, l1 > &b)
Definition: Ddg_plus_Ddg.hpp:66
FTensor::Dg_plus_Dg::iterA
Dg_Expr< A, T, Dim01, Dim2, i, j, k > iterA
Definition: Dg_plus_Dg.hpp:13
FTensor::Dg_plus_Dg_210::iterB
Dg_Expr< B, U, Dim, Dim, k, j, i > iterB
Definition: Dg_plus_Dg.hpp:81
FTensor::Dg_plus_Dg_10::iterA
Dg_Expr< A, T, Dim01, Dim2, i, j, k > iterA
Definition: Dg_plus_Dg.hpp:47
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197