v0.14.0
Tensor3_plus_Tensor3.hpp
Go to the documentation of this file.
1 /* Adds a Tensor3 to a Tensor3, yielding a Tensor3. */
2 
3 #pragma once
4 
5 namespace FTensor
6 {
7  /* Base Template */
8  template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
9  int Dim2_0, int Dim0_1, int Dim1_1, int Dim2_1, char i0, char j0,
10  char k0, char i1, char j1, char k1>
12  {};
13 
14  /* A(i,j,k)+B(i,j,k)->Tensor3 */
15 
16  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
17  char i, char j, char k>
18  class Tensor3_plus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim1, Dim2, i,
19  j, k, i, j, k>
20  {
23 
24  public:
25  typename promote<T, U>::V
26  operator()(const int N1, const int N2, const int N3) const
27  {
28  return iterA(N1, N2, N3) + iterB(N1, N2, N3);
29  }
30 
34  : iterA(a), iterB(b)
35  {}
36  };
37 
38  /* A(i,j,k)+B(i,k,j)->Tensor3 */
39 
40  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
41  char i, char j, char k>
42  class Tensor3_plus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim2, Dim1, i,
43  j, k, i, k, j>
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, N2, N3) + iterB(N1, N3, N2);
53  }
54 
58  : iterA(a), iterB(b)
59  {}
60  };
61 
62  /* A(i,j,k)+B(j,i,k)->Tensor3 */
63 
64  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
65  char i, char j, char k>
66  class Tensor3_plus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim0, Dim2, i,
67  j, k, j, i, k>
68  {
71 
72  public:
73  typename promote<T, U>::V
74  operator()(const int N1, const int N2, const int N3) const
75  {
76  return iterA(N1, N2, N3) + iterB(N2, N1, N3);
77  }
78 
82  : iterA(a), iterB(b)
83  {}
84  };
85 
86  /* A(i,j,k)+B(j,k,i)->Tensor3 */
87 
88  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
89  char i, char j, char k>
90  class Tensor3_plus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim2, Dim0, i,
91  j, k, j, k, i>
92  {
95 
96  public:
97  typename promote<T, U>::V
98  operator()(const int N1, const int N2, const int N3) const
99  {
100  return iterA(N1, N2, N3) + iterB(N2, N3, N1);
101  }
102 
106  : iterA(a), iterB(b)
107  {}
108  };
109 
110  /* A(i,j,k)+B(k,i,j)->Tensor3 */
111 
112  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
113  char i, char j, char k>
114  class Tensor3_plus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim0, Dim1, i,
115  j, k, k, i, j>
116  {
119 
120  public:
121  typename promote<T, U>::V
122  operator()(const int N1, const int N2, const int N3) const
123  {
124  return iterA(N1, N2, N3) + iterB(N3, N1, N2);
125  }
126 
130  : iterA(a), iterB(b)
131  {}
132  };
133 
134  /* A(i,j,k)+B(k,j,i)->Tensor3 */
135 
136  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
137  char i, char j, char k>
138  class Tensor3_plus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim1, Dim0, i,
139  j, k, k, j, i>
140  {
143 
144  public:
145  typename promote<T, U>::V
146  operator()(const int N1, const int N2, const int N3) const
147  {
148  return iterA(N1, N2, N3) + iterB(N3, N2, N1);
149  }
150 
154  : iterA(a), iterB(b)
155  {}
156  };
157 
158  template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
159  int Dim2_0, int Dim0_1, int Dim1_1, int Dim2_1, char i0, char j0,
160  char k0, char i1, char j1, char k1>
161  Tensor3_Expr<Tensor3_plus_Tensor3<A, B, T, U, Dim0_0, Dim1_0, Dim2_0, Dim0_1,
162  Dim1_1, Dim2_1, i0, j0, k0, i1, j1, k1>,
163  typename promote<T, U>::V, Dim0_0, Dim1_0, Dim2_0, i0, j0, k0>
166  {
167  using TensorExpr
168  = Tensor3_plus_Tensor3<A, B, T, U, Dim0_0, Dim1_0, Dim2_0, Dim0_1,
169  Dim1_1, Dim2_1, i0, j0, k0, i1, j1, k1>;
170  static_assert(
171  !std::is_empty<TensorExpr>::value,
172  "Indexes or Dimensions are not compatible with the + operator");
174  Dim2_0, i0, j0, k0>(TensorExpr(a, b));
175  }
176 }
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim2, Dim0, i, j, k, j, k, i >::iterA
Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_plus_Tensor3.hpp:93
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor3_plus_Tensor3
Definition: Tensor3_plus_Tensor3.hpp:11
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim2, Dim1, i, j, k, i, k, j >::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_plus_Tensor3.hpp:50
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim0, Dim2, i, j, k, j, i, k >::iterA
Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_plus_Tensor3.hpp:69
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim2, Dim1, i, j, k, i, k, j >::iterA
Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_plus_Tensor3.hpp:45
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim1, Dim2, i, j, k, i, j, k >::iterB
Tensor3_Expr< B, U, Dim0, Dim1, Dim2, i, j, k > iterB
Definition: Tensor3_plus_Tensor3.hpp:22
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim0, Dim2, i, j, k, j, i, k >::iterB
Tensor3_Expr< B, U, Dim1, Dim0, Dim2, j, i, k > iterB
Definition: Tensor3_plus_Tensor3.hpp:70
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim0, Dim1, i, j, k, k, i, j >::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_plus_Tensor3.hpp:122
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim2, Dim1, i, j, k, i, k, j >::Tensor3_plus_Tensor3
Tensor3_plus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim0, Dim2, Dim1, i, k, j > &b)
Definition: Tensor3_plus_Tensor3.hpp:55
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim0, Dim2, i, j, k, j, i, k >::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_plus_Tensor3.hpp:74
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim2, Dim1, i, j, k, i, k, j >::iterB
Tensor3_Expr< B, U, Dim0, Dim2, Dim1, i, k, j > iterB
Definition: Tensor3_plus_Tensor3.hpp:46
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim1, Dim0, i, j, k, k, j, i >::Tensor3_plus_Tensor3
Tensor3_plus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim2, Dim1, Dim0, k, j, i > &b)
Definition: Tensor3_plus_Tensor3.hpp:151
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim2, Dim0, i, j, k, j, k, i >::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_plus_Tensor3.hpp:98
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim1, Dim2, i, j, k, i, j, k >::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_plus_Tensor3.hpp:26
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim1, Dim0, i, j, k, k, j, i >::iterB
Tensor3_Expr< B, U, Dim2, Dim1, Dim0, k, j, i > iterB
Definition: Tensor3_plus_Tensor3.hpp:142
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim0, Dim1, i, j, k, k, i, j >::iterA
Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_plus_Tensor3.hpp:117
FTensor::Tensor3_Expr
Definition: Tensor3_Expr.hpp:24
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim1, Dim0, i, j, k, k, j, i >::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_plus_Tensor3.hpp:146
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim2, Dim0, i, j, k, j, k, i >::iterB
Tensor3_Expr< B, U, Dim1, Dim2, Dim0, j, k, i > iterB
Definition: Tensor3_plus_Tensor3.hpp:94
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim0, Dim1, i, j, k, k, i, j >::Tensor3_plus_Tensor3
Tensor3_plus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim2, Dim0, Dim1, k, i, j > &b)
Definition: Tensor3_plus_Tensor3.hpp:127
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim0, Dim1, i, j, k, k, i, j >::iterB
Tensor3_Expr< B, U, Dim2, Dim0, Dim1, k, i, j > iterB
Definition: Tensor3_plus_Tensor3.hpp:118
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim0, Dim2, i, j, k, j, i, k >::Tensor3_plus_Tensor3
Tensor3_plus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim1, Dim0, Dim2, j, i, k > &b)
Definition: Tensor3_plus_Tensor3.hpp:79
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim1, Dim2, i, j, k, i, j, k >::iterA
Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_plus_Tensor3.hpp:21
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim1, Dim0, i, j, k, k, j, i >::iterA
Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_plus_Tensor3.hpp:141
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::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim2, Dim0, i, j, k, j, k, i >::Tensor3_plus_Tensor3
Tensor3_plus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim1, Dim2, Dim0, j, k, i > &b)
Definition: Tensor3_plus_Tensor3.hpp:103
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
FTensor::Tensor3_plus_Tensor3< A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim1, Dim2, i, j, k, i, j, k >::Tensor3_plus_Tensor3
Tensor3_plus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim0, Dim1, Dim2, i, j, k > &b)
Definition: Tensor3_plus_Tensor3.hpp:31