v0.14.0
Ddg_times_Tensor1.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Ddg*Tensor1 and Tensor1*Ddg, yielding a
3  Dg. */
4 
5 #pragma once
6 
7 namespace FTensor {
8 /* A(i,j,k,l)*B(k)->Dg */
9 
10 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
11  char j, char k, char l>
15 
16  template <int Current_Dim>
17  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
18  const Number<Current_Dim> &) const {
19  return iterA(N1, N2, Current_Dim - 1, N3) * iterB(Current_Dim - 1) +
20  eval(N1, N2, N3, Number<Current_Dim - 1>());
21  }
22  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
23  const Number<1> &) const {
24  return iterA(N1, N2, 0, N3) * iterB(0);
25  }
26 
27 public:
30  : iterA(a), iterB(b) {}
31  typename promote<T, U>::V operator()(const int N1, const int N2,
32  const int N3) const {
33  return eval(N1, N2, N3, Number<Dim23>());
34  }
35 };
36 
37 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
38  char j, char k, char l>
39 Dg_Expr<Ddg_times_Tensor1_2<A, B, T, U, Dim01, Dim23, i, j, k, l>,
40  typename promote<T, U>::V, Dim01, Dim23, i, j, l>
44  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, i, j, l>(
45  TensorExpr(a, b));
46 }
47 
48 /* B(k)*A(i,j,k,l)->Dg */
49 
50 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
51  char j, char k, char l>
52 Dg_Expr<Ddg_times_Tensor1_2<A, B, T, U, Dim01, Dim23, i, j, k, l>,
53  typename promote<T, U>::V, Dim01, Dim23, i, j, l>
57  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, i, j, l>(
58  TensorExpr(a, b));
59 }
60 
61 /* A(i,j,k,l)*B(l)->Dg */
62 
63 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
64  char j, char k, char l>
68 
69  template <int Current_Dim>
70  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
71  const Number<Current_Dim> &) const {
72  return iterA(N1, N2, Current_Dim - 1, N3) * iterB(Current_Dim - 1) +
73  eval(N1, N2, N3, Number<Current_Dim - 1>());
74  }
75  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
76  const Number<1> &) const {
77  return iterA(N1, N2, 0, N3) * iterB(0);
78  }
79 
80 public:
83  : iterA(a), iterB(b) {}
84  typename promote<T, U>::V operator()(const int N1, const int N2,
85  const int N3) const {
86  return eval(N1, N2, N3, Number<Dim23>());
87  }
88 };
89 
90 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
91  char j, char k, char l>
92 Dg_Expr<Ddg_times_Tensor1_3<A, B, T, U, Dim01, Dim23, i, j, k, l>,
93  typename promote<T, U>::V, Dim01, Dim23, i, j, k>
97  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, i, j, k>(
98  TensorExpr(a, b));
99 }
100 
101 /* B(l)*A(i,j,k,l)->Dg */
102 
103 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
104  char j, char k, char l>
105 Dg_Expr<Ddg_times_Tensor1_3<A, B, T, U, Dim01, Dim23, i, j, k, l>,
106  typename promote<T, U>::V, Dim01, Dim23, i, j, k>
110  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, i, j, k>(
111  TensorExpr(a, b));
112 }
113 
114 /* A(i,j,k,l)*B(i)->Christof */
115 
116 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
117  char j, char k, char l>
121 
122  template <int Current_Dim>
123  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
124  const Number<Current_Dim> &) const {
125  return iterA(Current_Dim - 1, N3, N1, N2) * iterB(Current_Dim - 1) +
126  eval(N1, N2, N3, Number<Current_Dim - 1>());
127  }
128  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
129  const Number<1> &) const {
130  return iterA(0, N3, N1, N2) * iterB(0);
131  }
132 
133 public:
136  : iterA(a), iterB(b) {}
137  typename promote<T, U>::V operator()(const int N1, const int N2,
138  const int N3) const {
139  return eval(N1, N2, N3, Number<Dim01>());
140  }
141 };
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 Dg_Expr<Ddg_times_Tensor1_0<A, B, T, U, Dim01, Dim23, i, j, k, l>,
146  typename promote<T, U>::V, Dim01, Dim23, j, k, l>
148  const Tensor1_Expr<B, U, Dim01, i> &b) {
150  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, j, k, l>(
151  TensorExpr(a, b));
152 }
153 
154 /* B(i)*A(i,j,k,l)->Christof */
155 
156 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
157  char j, char k, char l>
158 Dg_Expr<Ddg_times_Tensor1_0<A, B, T, U, Dim01, Dim23, i, j, k, l>,
159  typename promote<T, U>::V, Dim01, Dim23, j, k, l>
163  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, j, k, l>(
164  TensorExpr(a, b));
165 }
166 
167 /* A(i,j,k,l)*B(j)->Christof */
168 
169 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
170  char j, char k, char l>
174 
175  template <int Current_Dim>
176  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
177  const Number<Current_Dim> &) const {
178  return iterA(Current_Dim - 1, N3, N1, N2) * iterB(Current_Dim - 1) +
179  eval(N1, N2, N3, Number<Current_Dim - 1>());
180  }
181  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
182  const Number<1> &) const {
183  return iterA(0, N3, N1, N2) * iterB(0);
184  }
185 
186 public:
189  : iterA(a), iterB(b) {}
190  typename promote<T, U>::V operator()(const int N1, const int N2,
191  const int N3) const {
192  return eval(N1, N2, N3, Number<Dim01>());
193  }
194 };
195 
196 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
197  char j, char k, char l>
198 Dg_Expr<Ddg_times_Tensor1_1<A, B, T, U, Dim01, Dim23, i, j, k, l>,
199  typename promote<T, U>::V, Dim01, Dim23, i, k, l>
201  const Tensor1_Expr<B, U, Dim01, j> &b) {
203  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, i, k, l>(
204  TensorExpr(a, b));
205 }
206 
207 /* B(j)*A(i,j,k,l)->Christof */
208 
209 template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
210  char j, char k, char l>
211 Dg_Expr<Ddg_times_Tensor1_1<A, B, T, U, Dim01, Dim23, i, j, k, l>,
212  typename promote<T, U>::V, Dim01, Dim23, i, k, l>
216  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim23, i, k, l>(
217  TensorExpr(a, b));
218 }
219 
220 } // namespace FTensor
FTensor::Ddg_times_Tensor1_1::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim > &) const
Definition: Ddg_times_Tensor1.hpp:176
FTensor::Ddg_times_Tensor1_0::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim > &) const
Definition: Ddg_times_Tensor1.hpp:123
FTensor::Ddg_times_Tensor1_0
Definition: Ddg_times_Tensor1.hpp:118
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
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_Tensor1_0::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Ddg_times_Tensor1.hpp:137
FTensor::Ddg_times_Tensor1_2::iterB
Tensor1_Expr< B, U, Dim23, k > iterB
Definition: Ddg_times_Tensor1.hpp:14
FTensor::Ddg_times_Tensor1_1::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &) const
Definition: Ddg_times_Tensor1.hpp:181
FTensor::Ddg_times_Tensor1_2::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Ddg_times_Tensor1.hpp:31
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Ddg_times_Tensor1_3::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Tensor1.hpp:66
FTensor::Ddg_times_Tensor1_1
Definition: Ddg_times_Tensor1.hpp:171
FTensor::Ddg_Expr
Definition: Ddg_Expr.hpp:28
FTensor::Ddg_times_Tensor1_2::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &) const
Definition: Ddg_times_Tensor1.hpp:22
FTensor::Number
Definition: Number.hpp:11
FTensor::Ddg_times_Tensor1_3
Definition: Ddg_times_Tensor1.hpp:65
FTensor::Ddg_times_Tensor1_3::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Ddg_times_Tensor1.hpp:84
FTensor::Tensor1_Expr< B, U, Dim23, k >
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Ddg_times_Tensor1_2
Definition: Ddg_times_Tensor1.hpp:12
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Ddg_times_Tensor1_0::Ddg_times_Tensor1_0
Ddg_times_Tensor1_0(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor1_Expr< B, U, Dim01, i > &b)
Definition: Ddg_times_Tensor1.hpp:134
FTensor::Ddg_times_Tensor1_0::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Tensor1.hpp:119
FTensor::Ddg_times_Tensor1_1::Ddg_times_Tensor1_1
Ddg_times_Tensor1_1(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor1_Expr< B, U, Dim01, j > &b)
Definition: Ddg_times_Tensor1.hpp:187
FTensor::Ddg_times_Tensor1_1::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Ddg_times_Tensor1.hpp:190
FTensor::Ddg_times_Tensor1_1::iterB
Tensor1_Expr< B, U, Dim01, j > iterB
Definition: Ddg_times_Tensor1.hpp:173
FTensor::Ddg_times_Tensor1_3::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim > &) const
Definition: Ddg_times_Tensor1.hpp:70
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Ddg_times_Tensor1_3::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &) const
Definition: Ddg_times_Tensor1.hpp:75
FTensor::Ddg_times_Tensor1_0::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &) const
Definition: Ddg_times_Tensor1.hpp:128
FTensor::Ddg_times_Tensor1_3::Ddg_times_Tensor1_3
Ddg_times_Tensor1_3(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor1_Expr< B, U, Dim23, l > &b)
Definition: Ddg_times_Tensor1.hpp:81
FTensor::Dg_Expr
Definition: Dg_Expr.hpp:25
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg_times_Tensor1_2::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim > &) const
Definition: Ddg_times_Tensor1.hpp:17
FTensor::Ddg_times_Tensor1_0::iterB
Tensor1_Expr< B, U, Dim01, i > iterB
Definition: Ddg_times_Tensor1.hpp:120
FTensor::Ddg_times_Tensor1_2::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Tensor1.hpp:13
FTensor::Ddg_times_Tensor1_3::iterB
Tensor1_Expr< B, U, Dim23, l > iterB
Definition: Ddg_times_Tensor1.hpp:67
FTensor::Ddg_times_Tensor1_1::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Tensor1.hpp:172
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Ddg_times_Tensor1_2::Ddg_times_Tensor1_2
Ddg_times_Tensor1_2(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor1_Expr< B, U, Dim23, k > &b)
Definition: Ddg_times_Tensor1.hpp:28
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21