v0.14.0
Ddg_times_Tensor2_symmetric.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Ddg*Tensor2_symmetric and Tensor2_symmetric*Ddg,
3  yielding a Tensor2 or Tensor2_symmetric. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  /* A(i,j,k,l)*B(j,l) */
10 
11  template <class A, class B, class T, class U, int Dim, char i, char j,
12  char k, char l>
14  {
17 
18  template <int Current_Dim0, int Current_Dim1>
19  typename promote<T, U>::V
20  eval(const int N1, const int N2, const Number<Current_Dim0> &,
21  const Number<Current_Dim1> &) const
22  {
23  return iterA(Current_Dim0 - 1, N1, Current_Dim1 - 1, N2)
24  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
25  + eval(N1, N2, Number<Current_Dim0 - 1>(),
27  }
28  template <int Current_Dim1>
29  typename promote<T, U>::V
30  eval(const int N1, const int N2, const Number<1> &,
31  const Number<Current_Dim1> &) const
32  {
33  return iterA(0, N1, Current_Dim1 - 1, N2) * iterB(0, Current_Dim1 - 1)
35  }
36  typename promote<T, U>::V eval(const int N1, const int N2,
37  const Number<1> &, const Number<1> &) const
38  {
39  return iterA(0, N1, 0, N2) * iterB(0, 0);
40  }
41 
42  public:
46  : iterA(a), iterB(b)
47  {}
48  typename promote<T, U>::V operator()(const int N1, const int N2) const
49  {
50  return eval(N1, N2, Number<Dim>(), Number<Dim>());
51  }
52  };
53 
54  template <class A, class B, class T, class U, int Dim, char i, char j,
55  char k, char l>
56  Tensor2_Expr<Ddg_times_Tensor2_symmetric_13<A, B, T, U, Dim, i, j, k, l>,
57  typename promote<T, U>::V, Dim, Dim, i, k>
60  {
61  using TensorExpr
64  TensorExpr(a, b));
65  }
66 
67  /* B(j,l)*A(i,j,k,l) */
68 
69  template <class A, class B, class T, class U, int Dim, char i, char j,
70  char k, char l>
71  Tensor2_Expr<Ddg_times_Tensor2_symmetric_13<A, B, T, U, Dim, i, j, k, l>,
72  typename promote<T, U>::V, Dim, Dim, i, k>
75  {
76  using TensorExpr
79  TensorExpr(a, b));
80  }
81 
82  /* A(i,j,k,l)*B(i,j) */
83 
84  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
85  char j, char k, char l>
87  {
90 
91  template <int Current_Dim0, int Current_Dim1>
92  typename promote<T, U>::V
93  eval(const int N1, const int N2, const Number<Current_Dim0> &,
94  const Number<Current_Dim1> &) const
95  {
96  return iterA(Current_Dim0 - 1, Current_Dim1 - 1, N1, N2)
97  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
98  + eval(N1, N2, Number<Current_Dim0 - 1>(),
100  }
101  template <int Current_Dim1>
102  typename promote<T, U>::V
103  eval(const int N1, const int N2, const Number<1> &,
104  const Number<Current_Dim1> &) const
105  {
106  return iterA(0, Current_Dim1 - 1, N1, N2) * iterB(0, Current_Dim1 - 1)
108  }
109  typename promote<T, U>::V eval(const int N1, const int N2,
110  const Number<1> &, const Number<1> &) const
111  {
112  return iterA(0, 0, N1, N2) * iterB(0, 0);
113  }
114 
115  public:
119  : iterA(a), iterB(b)
120  {}
121  typename promote<T, U>::V operator()(const int N1, const int N2) const
122  {
123  return eval(N1, N2, Number<Dim01>(), Number<Dim01>());
124  }
125  };
126 
127  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
128  char j, char k, char l>
129  Tensor2_symmetric_Expr<
130  Ddg_times_Tensor2_symmetric_01<A, B, T, U, Dim01, Dim23, i, j, k, l>,
131  typename promote<T, U>::V, Dim23, k, l>
134  {
135  using TensorExpr
138  k, l>(TensorExpr(a, b));
139  }
140 
141  /* B(i,j)*A(i,j,k,l) */
142 
143  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
144  char j, char k, char l>
145  Tensor2_symmetric_Expr<
146  Ddg_times_Tensor2_symmetric_01<A, B, T, U, Dim01, Dim23, i, j, k, l>,
147  typename promote<T, U>::V, Dim23, k, l>
150  {
151  using TensorExpr
154  k, l>(TensorExpr(a, b));
155  }
156 
157  /* A(i,j,k,l)*B(k,l) */
158 
159  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
160  char j, char k, char l>
162  {
165 
166  template <int Current_Dim0, int Current_Dim1>
167  typename promote<T, U>::V
168  eval(const int N1, const int N2, const Number<Current_Dim0> &,
169  const Number<Current_Dim1> &) const
170  {
171  return iterA(N1, N2, Current_Dim0 - 1, Current_Dim1 - 1)
172  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
173  + eval(N1, N2, Number<Current_Dim0 - 1>(),
175  }
176  template <int Current_Dim1>
177  typename promote<T, U>::V
178  eval(const int N1, const int N2, const Number<1> &,
179  const Number<Current_Dim1> &) const
180  {
181  return iterA(N1, N2, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1)
183  }
184  typename promote<T, U>::V eval(const int N1, const int N2,
185  const Number<1> &, const Number<1> &) const
186  {
187  return iterA(N1, N2, 0, 0) * iterB(0, 0);
188  }
189 
190  public:
194  : iterA(a), iterB(b)
195  {}
196  typename promote<T, U>::V operator()(const int N1, const int N2) const
197  {
198  return eval(N1, N2, Number<Dim23>(), Number<Dim23>());
199  }
200  };
201 
202  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
203  char j, char k, char l>
204  Tensor2_symmetric_Expr<
205  Ddg_times_Tensor2_symmetric_23<A, B, T, U, Dim01, Dim23, i, j, k, l>,
206  typename promote<T, U>::V, Dim01, i, j>
209  {
210  using TensorExpr
213  i, j>(TensorExpr(a, b));
214  }
215 
216  /* B(k,l)*A(i,j,k,l) */
217 
218  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
219  char j, char k, char l>
220  Tensor2_symmetric_Expr<
221  Ddg_times_Tensor2_symmetric_23<A, B, T, U, Dim01, Dim23, i, j, k, l>,
222  typename promote<T, U>::V, Dim01, i, j>
225  {
226  using TensorExpr
229  i, j>(TensorExpr(a, b));
230  }
231 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Ddg_times_Tensor2_symmetric_01
Definition: Ddg_times_Tensor2_symmetric.hpp:86
FTensor::operator*
promote< T, U >::V operator*(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, k, j, l > &b)
Definition: Ddg_times_Ddg.hpp:79
FTensor::Ddg_times_Tensor2_symmetric_01::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Ddg_times_Tensor2_symmetric.hpp:121
FTensor::Ddg_times_Tensor2_symmetric_01::iterB
Tensor2_symmetric_Expr< B, U, Dim01, i, j > iterB
Definition: Ddg_times_Tensor2_symmetric.hpp:89
FTensor::Ddg_times_Tensor2_symmetric_13::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Ddg_times_Tensor2_symmetric.hpp:48
FTensor::Tensor2_symmetric_Expr< B, U, Dim, j, l >
FTensor::Ddg_times_Tensor2_symmetric_13::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:30
FTensor::Ddg_times_Tensor2_symmetric_23::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Tensor2_symmetric.hpp:163
FTensor::Ddg_times_Tensor2_symmetric_13::Ddg_times_Tensor2_symmetric_13
Ddg_times_Tensor2_symmetric_13(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Tensor2_symmetric_Expr< B, U, Dim, j, l > &b)
Definition: Ddg_times_Tensor2_symmetric.hpp:43
FTensor::Tensor2_Expr
Definition: Tensor2_Expr.hpp:26
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Ddg_times_Tensor2_symmetric_23::Ddg_times_Tensor2_symmetric_23
Ddg_times_Tensor2_symmetric_23(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_symmetric_Expr< B, U, Dim23, k, l > &b)
Definition: Ddg_times_Tensor2_symmetric.hpp:191
FTensor::Ddg_Expr< A, T, Dim, Dim, i, j, k, l >
FTensor::Ddg_times_Tensor2_symmetric_13::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:20
FTensor::Ddg_times_Tensor2_symmetric_23
Definition: Ddg_times_Tensor2_symmetric.hpp:161
FTensor::Number
Definition: Number.hpp:11
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Ddg_times_Tensor2_symmetric_13::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:36
FTensor::Ddg_times_Tensor2_symmetric_23::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Ddg_times_Tensor2_symmetric.hpp:196
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Ddg_times_Tensor2_symmetric_01::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:103
FTensor::Ddg_times_Tensor2_symmetric_23::iterB
Tensor2_symmetric_Expr< B, U, Dim23, k, l > iterB
Definition: Ddg_times_Tensor2_symmetric.hpp:164
FTensor::Ddg_times_Tensor2_symmetric_01::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Tensor2_symmetric.hpp:88
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg_times_Tensor2_symmetric_23::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:168
FTensor::Ddg_times_Tensor2_symmetric_01::Ddg_times_Tensor2_symmetric_01
Ddg_times_Tensor2_symmetric_01(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_symmetric_Expr< B, U, Dim01, i, j > &b)
Definition: Ddg_times_Tensor2_symmetric.hpp:116
FTensor::Ddg_times_Tensor2_symmetric_23::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:178
FTensor::Ddg_times_Tensor2_symmetric_13
Definition: Ddg_times_Tensor2_symmetric.hpp:13
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Ddg_times_Tensor2_symmetric_23::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:184
FTensor::Ddg_times_Tensor2_symmetric_13::iterB
Tensor2_symmetric_Expr< B, U, Dim, j, l > iterB
Definition: Ddg_times_Tensor2_symmetric.hpp:16
FTensor::Ddg_times_Tensor2_symmetric_13::iterA
Ddg_Expr< A, T, Dim, Dim, i, j, k, l > iterA
Definition: Ddg_times_Tensor2_symmetric.hpp:15
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FTensor::Ddg_times_Tensor2_symmetric_01::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:93
FTensor::Ddg_times_Tensor2_symmetric_01::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Tensor2_symmetric.hpp:109