v0.14.0
Dg_times_Tensor1.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Dg*Tensor1 and Tensor1*Dg, yielding a
3  Tensor2_symmetric or Tensor2. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  /* A(i,j,k)*B(k)->Tensor2_symmetric */
10 
11  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
12  char j, char k>
14  {
17 
18  template <int Current_Dim>
19  typename promote<T, U>::V
20  eval(const int N1, const int N2, const Number<Current_Dim> &) const
21  {
22  return iterA(N1, N2, Current_Dim - 1) * iterB(Current_Dim - 1)
23  + eval(N1, N2, Number<Current_Dim - 1>());
24  }
25  typename promote<T, U>::V
26  eval(const int N1, const int N2, const Number<1> &) const
27  {
28  return iterA(N1, N2, 0) * iterB(0);
29  }
30 
31  public:
34  : iterA(a), iterB(b)
35  {}
36  typename promote<T, U>::V operator()(const int N1, const int N2) const
37  {
38  return eval(N1, N2, Number<Dim2>());
39  }
40  };
41 
42  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
43  char j, char k>
44  Tensor2_symmetric_Expr<Dg_times_Tensor1_2<A, B, T, U, Dim01, Dim2, i, j, k>,
45  typename promote<T, U>::V, Dim01, i, j>
48  {
51  i, j>(TensorExpr(a, b));
52  }
53 
54  /* B(k)*A(i,j,k)->Tensor2_symmetric */
55 
56  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
57  char j, char k>
58  Tensor2_symmetric_Expr<Dg_times_Tensor1_2<A, B, T, U, Dim01, Dim2, i, j, k>,
59  typename promote<T, U>::V, Dim01, i, j>
62  {
65  i, j>(TensorExpr(a, b));
66  }
67 
68  /* A(i,k,j)*B(k)->Tensor2 */
69 
70  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
71  char j, char k>
73  {
76 
77  template <int Current_Dim>
78  typename promote<T, U>::V
79  eval(const int N1, const int N2, const Number<Current_Dim> &) const
80  {
81  return iterA(N1, Current_Dim - 1, N2) * iterB(Current_Dim - 1)
82  + eval(N1, N2, Number<Current_Dim - 1>());
83  }
84  typename promote<T, U>::V
85  eval(const int N1, const int N2, const Number<1> &) const
86  {
87  return iterA(N1, 0, N2) * iterB(0);
88  }
89 
90  public:
93  : iterA(a), iterB(b)
94  {}
95  typename promote<T, U>::V operator()(const int N1, const int N2) const
96  {
97  return eval(N1, N2, Number<Dim01>());
98  }
99  };
100 
101  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
102  char j, char k>
103  Tensor2_Expr<Dg_times_Tensor1_1<A, B, T, U, Dim01, Dim2, i, j, k>,
104  typename promote<T, U>::V, Dim01, Dim2, i, j>
107  {
110  j>(TensorExpr(a, b));
111  }
112 
113  /* B(k)*A(i,k,j)->Tensor2 */
114 
115  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
116  char j, char k>
117  Tensor2_Expr<Dg_times_Tensor1_1<A, B, T, U, Dim01, Dim2, i, j, k>,
118  typename promote<T, U>::V, Dim01, Dim2, i, j>
121  {
124  j>(TensorExpr(a, b));
125  }
126 
127  /* A(k,i,j)*B(k)->Tensor2 */
128 
129  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
130  char j, char k>
132  {
135 
136  template <int Current_Dim>
137  typename promote<T, U>::V
138  eval(const int N1, const int N2, const Number<Current_Dim> &) const
139  {
140  return iterA(N1, Current_Dim - 1, N2) * iterB(Current_Dim - 1)
141  + eval(N1, N2, Number<Current_Dim - 1>());
142  }
143  typename promote<T, U>::V
144  eval(const int N1, const int N2, const Number<1> &) const
145  {
146  return iterA(N1, 0, N2) * iterB(0);
147  }
148 
149  public:
152  : iterA(a), iterB(b)
153  {}
154  typename promote<T, U>::V operator()(const int N1, const int N2) const
155  {
156  return eval(N1, N2, Number<Dim01>());
157  }
158  };
159 
160  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
161  char j, char k>
162  Tensor2_Expr<Dg_times_Tensor1_0<A, B, T, U, Dim01, Dim2, i, j, k>,
163  typename promote<T, U>::V, Dim01, Dim2, i, j>
166  {
169  j>(TensorExpr(a, b));
170  }
171 
172  /* B(k)*A(k,i,j)->Tensor2 */
173 
174  template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
175  char j, char k>
176  Tensor2_Expr<Dg_times_Tensor1_0<A, B, T, U, Dim01, Dim2, i, j, k>,
177  typename promote<T, U>::V, Dim01, Dim2, i, j>
180  {
183  j>(TensorExpr(a, b));
184  }
185 }
FTensor::Dg_times_Tensor1_1
Definition: Dg_times_Tensor1.hpp:72
FTensor::Dg_times_Tensor1_1::iterA
Dg_Expr< A, T, Dim01, Dim2, i, k, j > iterA
Definition: Dg_times_Tensor1.hpp:74
FTensor::Dg_times_Tensor1_0::iterB
Tensor1_Expr< B, U, Dim01, k > iterB
Definition: Dg_times_Tensor1.hpp:134
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Dg_times_Tensor1_2::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Dg_times_Tensor1.hpp:36
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::Dg_times_Tensor1_1::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim > &) const
Definition: Dg_times_Tensor1.hpp:79
FTensor::Tensor2_symmetric_Expr
Definition: Tensor2_symmetric_Expr.hpp:36
FTensor::Tensor2_Expr
Definition: Tensor2_Expr.hpp:26
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Dg_times_Tensor1_2
Definition: Dg_times_Tensor1.hpp:13
FTensor::Dg_times_Tensor1_1::iterB
Tensor1_Expr< B, U, Dim01, k > iterB
Definition: Dg_times_Tensor1.hpp:75
FTensor::Dg_times_Tensor1_1::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Dg_times_Tensor1.hpp:95
FTensor::Dg_times_Tensor1_2::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim > &) const
Definition: Dg_times_Tensor1.hpp:20
FTensor::Dg_times_Tensor1_2::Dg_times_Tensor1_2
Dg_times_Tensor1_2(const Dg_Expr< A, T, Dim01, Dim2, i, j, k > &a, const Tensor1_Expr< B, U, Dim2, k > &b)
Definition: Dg_times_Tensor1.hpp:32
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor1_Expr< B, U, Dim2, k >
FTensor::Dg_times_Tensor1_2::iterA
Dg_Expr< A, T, Dim01, Dim2, i, j, k > iterA
Definition: Dg_times_Tensor1.hpp:15
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Dg_times_Tensor1_1::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &) const
Definition: Dg_times_Tensor1.hpp:85
FTensor::Dg_times_Tensor1_0::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &) const
Definition: Dg_times_Tensor1.hpp:144
FTensor::Dg_times_Tensor1_0::iterA
Dg_Expr< A, T, Dim01, Dim2, k, i, j > iterA
Definition: Dg_times_Tensor1.hpp:133
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Dg_times_Tensor1_0
Definition: Dg_times_Tensor1.hpp:131
FTensor::Dg_times_Tensor1_2::iterB
Tensor1_Expr< B, U, Dim2, k > iterB
Definition: Dg_times_Tensor1.hpp:16
FTensor::Dg_times_Tensor1_1::Dg_times_Tensor1_1
Dg_times_Tensor1_1(const Dg_Expr< A, T, Dim01, Dim2, i, k, j > &a, const Tensor1_Expr< B, U, Dim01, k > &b)
Definition: Dg_times_Tensor1.hpp:91
FTensor::Dg_Expr
Definition: Dg_Expr.hpp:25
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Dg_times_Tensor1_2::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &) const
Definition: Dg_times_Tensor1.hpp:26
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Dg_times_Tensor1_0::Dg_times_Tensor1_0
Dg_times_Tensor1_0(const Dg_Expr< A, T, Dim01, Dim2, k, i, j > &a, const Tensor1_Expr< B, U, Dim01, k > &b)
Definition: Dg_times_Tensor1.hpp:150
FTensor::Dg_times_Tensor1_0::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Dg_times_Tensor1.hpp:154
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
FTensor::Dg_times_Tensor1_0::eval
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim > &) const
Definition: Dg_times_Tensor1.hpp:138