v0.14.0
Ddg_times_Tensor4.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Ddg*Tensor4 and Tensor4*Ddg, yielding a
3  Tensor4. */
4 
5 #pragma once
6 
7 namespace FTensor {
8 
9 /* S(i,j,m,n)*A(m,n,k,l) */
10 
11 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
12  int Dim3, char i, char j, char k, char l, char m, char n>
16 
17  template <int Current_Dim0, int Current_Dim1>
18  inline typename promote<T, U>::V
19  eval(const int N1, const int N2, const int N3, const int N4,
20  const Number<Current_Dim0> &, const Number<Current_Dim1> &) const {
21  return iterA(N1, N2, Current_Dim0 - 1, Current_Dim1 - 1) *
22  iterB(Current_Dim0 - 1, Current_Dim1 - 1, N3, N4) +
23  eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>(),
25  }
26  template <int Current_Dim1>
27  inline typename promote<T, U>::V
28  eval(const int N1, const int N2, const int N3, const int N4,
29  const Number<1> &, const Number<Current_Dim1> &) const {
30  return iterA(N1, N2, 0, Current_Dim1 - 1) *
31  iterB(0, Current_Dim1 - 1, N3, N4) +
32  eval(N1, N2, N3, N4, Number<Dim23>(), Number<Current_Dim1 - 1>());
33  }
34  inline typename promote<T, U>::V eval(const int N1, const int N2,
35  const int N3, const int N4,
36  const Number<1> &,
37  const Number<1> &) const {
38  return iterA(N1, N2, 0, 0) * iterB(0, 0, N3, N4);
39  }
40 
41 public:
45  : iterA(a), iterB(b) {}
46  typename promote<T, U>::V operator()(const int N1, const int N2, const int N3,
47  const int N4) const {
48  return eval(N1, N2, N3, N4, Number<Dim23>(), Number<Dim23>());
49  }
50 };
51 
52 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
53  int Dim3, char i, char j, char k, char l, char m, char n>
54 Tensor4_Expr<Ddg_times_Tensor4_2301_ijkl<A, B, T, U, Dim01, Dim23, Dim2, Dim3, i, j,
55  k, l, m, n>,
56  typename promote<T, U>::V, Dim01, Dim01, Dim2, Dim3, i, j, k, l>
59  using TensorExpr = Ddg_times_Tensor4_2301_ijkl<A, B, T, U, Dim01, Dim23, Dim2,
60  Dim3, i, j, k, l, m, n>;
61  return Tensor4_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim01, Dim2,
62  Dim3, i, j, k, l>(TensorExpr(a, b));
63 }
64 
65 /* A(m,n,k,l)*S(i,j,m,n) */
66 
67 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
68  int Dim3, char i, char j, char k, char l, char m, char n>
69 Tensor4_Expr<Ddg_times_Tensor4_2301_ijkl<A, B, T, U, Dim01, Dim23, Dim2, Dim3, i, j,
70  k, l, m, n>,
71  typename promote<T, U>::V, Dim01, Dim01, Dim2, Dim3, i, j, k, l>
74  using TensorExpr = Ddg_times_Tensor4_2301_ijkl<A, B, T, U, Dim01, Dim23, Dim2,
75  Dim3, i, j, k, l, m, n>;
76  return Tensor4_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim01, Dim2,
77  Dim3, i, j, k, l>(TensorExpr(a, b));
78 }
79 
80 /* S(m,n,k,l)*A(i,j,m,n) */
81 /* A(i,j,m,n)*S(m,n,k,l) */
82 
83 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim0,
84  int Dim1, char i, char j, char k, char l, char m, char n>
88 
89  template <int Current_Dim0, int Current_Dim1>
90  inline typename promote<T, U>::V
91  eval(const int N1, const int N2, const int N3, const int N4,
92  const Number<Current_Dim0> &, const Number<Current_Dim1> &) const {
93  return iterA(Current_Dim0 - 1, Current_Dim1 - 1, N3, N4) *
94  iterB(N1, N2, Current_Dim0 - 1, Current_Dim1 - 1) +
95  eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>(),
97  }
98  template <int Current_Dim1>
99  inline typename promote<T, U>::V
100  eval(const int N1, const int N2, const int N3, const int N4,
101  const Number<1> &, const Number<Current_Dim1> &) const {
102  return iterA(0, Current_Dim1 - 1, N3, N4) *
103  iterB(N1, N2, 0, Current_Dim1 - 1) +
104  eval(N1, N2, N3, N4, Number<Dim23>(), Number<Current_Dim1 - 1>());
105  }
106  inline typename promote<T, U>::V eval(const int N1, const int N2,
107  const int N3, const int N4,
108  const Number<1> &,
109  const Number<1> &) const {
110  return iterA(0, 0, N3, N4) * iterB(N1, N2, 0, 0);
111  }
112 
113 public:
117  : iterA(a), iterB(b) {}
118  typename promote<T, U>::V operator()(const int N1, const int N2, const int N3,
119  const int N4) const {
120  return eval(N1, N2, N3, N4, Number<Dim01>(), Number<Dim01>());
121  }
122 };
123 
124 /* S(k,l,m,n)*A(i,j,m,n) */
125 
126 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim0,
127  int Dim1, char i, char j, char k, char l, char m, char n>
128 Tensor4_Expr<Ddg_times_Tensor4_2323_klij<A, B, T, U, Dim01, Dim23, Dim0, Dim1,
129  i, j, k, l, m, n>,
130  typename promote<T, U>::V, Dim0, Dim1, Dim23, Dim23, i, j, k, l>
133  using TensorExpr = Ddg_times_Tensor4_2323_klij<A, B, T, U, Dim01, Dim23, Dim0,
134  Dim1, i, j, k, l, m, n>;
135  return Tensor4_Expr<TensorExpr, typename promote<T, U>::V, Dim0, Dim1, Dim23,
136  Dim23, i, j, k, l>(TensorExpr(a, b));
137 }
138 
139 /* A(i,j,m,n)*S(k,l,m,n) */
140 
141 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim0,
142  int Dim1, char i, char j, char k, char l, char m, char n>
143 Tensor4_Expr<Ddg_times_Tensor4_2323_klij<A, B, T, U, Dim01, Dim23, Dim0, Dim1,
144  i, j, k, l, m, n>,
145  typename promote<T, U>::V, Dim0, Dim1, Dim23, Dim23, i, j, k, l>
148  using TensorExpr = Ddg_times_Tensor4_2323_klij<A, B, T, U, Dim01, Dim23, Dim0,
149  Dim1, i, j, k, l, m, n>;
150  return Tensor4_Expr<TensorExpr, typename promote<T, U>::V, Dim0, Dim1, Dim23,
151  Dim23, i, j, k, l>(TensorExpr(a, b));
152 }
153 
154 } // namespace FTensor
FTensor::Ddg_times_Tensor4_2301_ijkl::iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, m, n > iterA
Definition: Ddg_times_Tensor4.hpp:14
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_Tensor4_2323_klij::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor4.hpp:91
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Ddg_Expr< A, T, Dim01, Dim23, i, j, m, n >
FTensor::Ddg_times_Tensor4_2323_klij::iterB
Tensor4_Expr< B, U, Dim0, Dim1, Dim23, Dim23, i, j, m, n > iterB
Definition: Ddg_times_Tensor4.hpp:87
FTensor::Ddg_times_Tensor4_2301_ijkl::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Tensor4.hpp:34
FTensor::Ddg_times_Tensor4_2301_ijkl
Definition: Ddg_times_Tensor4.hpp:13
FTensor::Tensor4_Expr< B, U, Dim23, Dim23, Dim2, Dim3, m, n, k, l >
FTensor::Ddg_times_Tensor4_2301_ijkl::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor4.hpp:28
FTensor::Ddg_times_Tensor4_2323_klij::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor4.hpp:100
FTensor::Number
Definition: Number.hpp:11
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Ddg_times_Tensor4_2301_ijkl::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Tensor4.hpp:19
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Ddg_times_Tensor4_2323_klij
Definition: Ddg_times_Tensor4.hpp:85
FTensor::Ddg_times_Tensor4_2323_klij::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Tensor4.hpp:106
FTensor::Ddg_times_Tensor4_2323_klij::iterA
Ddg_Expr< A, T, Dim01, Dim23, m, n, k, l > iterA
Definition: Ddg_times_Tensor4.hpp:86
FTensor::Ddg_times_Tensor4_2323_klij::Ddg_times_Tensor4_2323_klij
Ddg_times_Tensor4_2323_klij(const Ddg_Expr< A, T, Dim01, Dim23, m, n, k, l > &a, const Tensor4_Expr< B, U, Dim0, Dim1, Dim23, Dim23, i, j, m, n > &b)
Definition: Ddg_times_Tensor4.hpp:114
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
convert.n
n
Definition: convert.py:82
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg_times_Tensor4_2301_ijkl::iterB
Tensor4_Expr< B, U, Dim23, Dim23, Dim2, Dim3, m, n, k, l > iterB
Definition: Ddg_times_Tensor4.hpp:15
FTensor::Ddg_times_Tensor4_2323_klij::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Definition: Ddg_times_Tensor4.hpp:118
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
FTensor::Ddg_times_Tensor4_2301_ijkl::Ddg_times_Tensor4_2301_ijkl
Ddg_times_Tensor4_2301_ijkl(const Ddg_Expr< A, T, Dim01, Dim23, i, j, m, n > &a, const Tensor4_Expr< B, U, Dim23, Dim23, Dim2, Dim3, m, n, k, l > &b)
Definition: Ddg_times_Tensor4.hpp:42
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Ddg_times_Tensor4_2301_ijkl::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Definition: Ddg_times_Tensor4.hpp:46
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21