v0.14.0
Ddg_times_Dg.hpp
Go to the documentation of this file.
1 /**
2  * @file Ddg_times_Dg.hpp
3  * @brief Ddg times Dg
4  * @date 2022-10-19
5  *
6  * @copyright Copyright (c) 2022
7  *
8  */
9 
10 #pragma once
11 
12 namespace FTensor {
13 /* A(i,j,k,l)*B(k,l,m) */
14 
15 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
16  char i, char j, char k, char l, char m>
20 
21  template <int Current_Dim0, int Current_Dim1>
22  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
23  const Number<Current_Dim0> &,
24  const Number<Current_Dim1> &) const {
25  return iterA(N1, N2, Current_Dim0 - 1, Current_Dim1 - 1) *
26  iterB(Current_Dim0 - 1, Current_Dim1 - 1, N3) +
28  }
29  template <int Current_Dim1>
30  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
31  const Number<1> &,
32  const Number<Current_Dim1> &) const {
33  return iterA(N1, N2, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1, N3) +
35  }
36  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
37  const Number<1> &, const Number<1> &) const {
38  return iterA(N1, N2, 0, 0) * iterB(0, 0, N3);
39  }
40 
41 public:
42  typename promote<T, U>::V operator()(const int N1, const int N2,
43  const int N3) const {
44  return eval(N1, N2, N3, Number<Dim23>(), Number<Dim23>());
45  }
46 
49  : iterA(a), iterB(b) {}
50 };
51 
52 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
53  char i, char j, char k, char l, char m>
56  using TensorExpr =
58  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim4, i, j, m>(
59  TensorExpr(a, b));
60 }
61 
62 /* B(k,l, m)*A(i,j,k,l) */
63 
64 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
65  char i, char j, char k, char l, char m>
68  using TensorExpr =
70  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim01, Dim4, i, j, m>(
71  TensorExpr(a, b));
72 }
73 
74 /* A(i,j,k,l)*B(i,j,m) */
75 
76 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
77  char i, char j, char k, char l, char m>
81 
82  template <int Current_Dim0, int Current_Dim1>
83  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
84  const Number<Current_Dim0> &,
85  const Number<Current_Dim1> &) const {
86  return iterA(Current_Dim0 - 1, Current_Dim1 - 1, N1, N2) *
87  iterB(Current_Dim0 - 1, Current_Dim1 - 1, N3) +
89  }
90  template <int Current_Dim1>
91  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
92  const Number<1> &,
93  const Number<Current_Dim1> &) const {
94  return iterA(0, Current_Dim1 - 1, N1, N2) * iterB(0, Current_Dim1 - 1, N3) +
96  }
97  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
98  const Number<1> &, const Number<1> &) const {
99  return iterA(0, 0, N1, N2) * iterB(0, 0, N3);
100  }
101 
102 public:
103  typename promote<T, U>::V operator()(const int N1, const int N2,
104  const int N3) const {
105  return eval(N1, N2, N3, Number<Dim01>(), Number<Dim01>());
106  }
107 
110  : iterA(a), iterB(b) {}
111 };
112 
113 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
114  char i, char j, char k, char l, char m>
117  using TensorExpr =
119  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim23, Dim4, k, l, m>(
120  TensorExpr(a, b));
121 }
122 
123 /* B(i,j,m)*A(i,j,k,l) */
124 
125 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
126  char i, char j, char k, char l, char m>
129  using TensorExpr =
131  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim23, Dim4, k, l, m>(
132  TensorExpr(a, b));
133 }
134 
135 } // namespace FTensor
FTensor::Ddg_times_Dg_23::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Dg.hpp:30
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_Dg_01::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Ddg_times_Dg.hpp:103
FTensor::Ddg_times_Dg_23::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Dg.hpp:22
FTensor::Ddg_times_Dg_23::Ddg_times_Dg_23
Ddg_times_Dg_23(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Dg_Expr< B, U, Dim23, Dim4, k, l, m > &b)
Definition: Ddg_times_Dg.hpp:47
FTensor::Ddg_times_Dg_01::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Dg.hpp:91
FTensor::Ddg_times_Dg_01::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Ddg_times_Dg.hpp:83
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Ddg_Expr
Definition: Ddg_Expr.hpp:28
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_Dg_23::iterA
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Dg.hpp:18
FTensor::Ddg_times_Dg_23
Definition: Ddg_times_Dg.hpp:17
FTensor::Ddg_times_Dg_01::iterB
const Dg_Expr< B, U, Dim01, Dim4, i, j, m > iterB
Definition: Ddg_times_Dg.hpp:80
FTensor::Ddg_times_Dg_01
Definition: Ddg_times_Dg.hpp:78
FTensor::Ddg_times_Dg_01::Ddg_times_Dg_01
Ddg_times_Dg_01(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Dg_Expr< B, U, Dim01, Dim4, i, j, m > &b)
Definition: Ddg_times_Dg.hpp:108
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Ddg_times_Dg_01::iterA
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Definition: Ddg_times_Dg.hpp:79
FTensor::Ddg_times_Dg_23::iterB
const Dg_Expr< B, U, Dim23, Dim4, k, l, m > iterB
Definition: Ddg_times_Dg.hpp:19
FTensor::Dg_Expr< B, U, Dim23, Dim4, k, l, m >
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg_times_Dg_23::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Dg.hpp:36
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
FTensor::Ddg_times_Dg_01::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< 1 > &) const
Definition: Ddg_times_Dg.hpp:97
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FTensor::Ddg_times_Dg_23::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Ddg_times_Dg.hpp:42