v0.14.0
Tensor2_symmetric_times_Tensor1.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Tensor2_symmetric*Tensor1 and Tensor1*Tensor2_symmetric, yielding a
3  Tensor1 or Dg. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  /* A(i,j)*B(j) -> Tensor1 */
10 
11  template <class A, class B, class T, class U, int Dim, char i, char j>
13  {
16 
17  template <int Current_Dim>
18  typename promote<T, U>::V
19  eval(const int N1, const Number<Current_Dim> &) const
20  {
21  return iterA(N1, Current_Dim - 1) * iterB(Current_Dim - 1)
23  }
24  typename promote<T, U>::V eval(const int N1, const Number<1> &) const
25  {
26  return iterA(N1, 0) * iterB(0);
27  }
28 
29  public:
33  : iterA(a), iterB(b)
34  {}
35  typename promote<T, U>::V operator()(const int N1) const
36  {
37  return eval(N1, Number<Dim>());
38  }
39  };
40 
41  template <class A, class B, class T, class U, int Dim, char i, char j>
43  typename promote<T, U>::V, Dim, i>
46  {
47  using TensorExpr
50  TensorExpr(a, b));
51  }
52 
53  /* A(j,i)*B(j) -> Tensor1 */
54 
55  template <class A, class B, class T, class U, int Dim, char i, char j>
57  {
60 
61  template <int Current_Dim>
62  typename promote<T, U>::V
63  eval(const int N1, const Number<Current_Dim> &) const
64  {
65  return iterA(Current_Dim - 1, N1) * iterB(Current_Dim - 1)
67  }
68  typename promote<T, U>::V eval(const int N1, const Number<1> &) const
69  {
70  return iterA(0, N1) * iterB(0);
71  }
72 
73  public:
77  : iterA(a), iterB(b)
78  {}
79  typename promote<T, U>::V operator()(const int N1) const
80  {
81  return eval(N1, Number<Dim>());
82  }
83  };
84 
85  template <class A, class B, class T, class U, int Dim, char i, char j>
87  typename promote<T, U>::V, Dim, i>
90  {
91  using TensorExpr
94  TensorExpr(a, b));
95  }
96 
97  /* B(j)*A(i,j) -> Tensor1 */
98 
99  template <class A, class B, class T, class U, int Dim, char i, char j>
101  typename promote<T, U>::V, Dim, i>
104  {
105  using TensorExpr
108  TensorExpr(a, b));
109  }
110 
111  /* B(j)*A(j,i) -> Tensor1 */
112 
113  template <class A, class B, class T, class U, int Dim, char i, char j>
115  typename promote<T, U>::V, Dim, i>
118  {
119  using TensorExpr
122  TensorExpr(a, b));
123  }
124 
125  /* A(i,j)*B(k) -> Dg */
126 
127  template <class A, class B, class T, class U, int Dim, int Dim2, char i,
128  char j, char k>
130  {
133 
134  public:
138  : iterA(a), iterB(b)
139  {}
140  typename promote<T, U>::V
141  operator()(const int N1, const int N2, const int N3) const
142  {
143  return iterA(N1, N2) * iterB(N3);
144  }
145  };
146 
147  template <class A, class B, class T, class U, int Dim, int Dim2, char i,
148  char j, char k>
149  Dg_Expr<Tensor2_symmetric_times_Tensor1<A, B, T, U, Dim, Dim2, i, j, k>,
150  typename promote<T, U>::V, Dim, Dim2, i, j, k>
153  {
154  using TensorExpr
156  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim, Dim2, i, j, k>(
157  TensorExpr(a, b));
158  }
159 
160  /* B(k)*A(i,j) -> Dg */
161 
162  template <class A, class B, class T, class U, int Dim, int Dim2, char i,
163  char j, char k>
164  Dg_Expr<Tensor2_symmetric_times_Tensor1<A, B, T, U, Dim, Dim2, i, j, k>,
165  typename promote<T, U>::V, Dim, Dim2, i, j, k>
168  {
169  using TensorExpr
171  return Dg_Expr<TensorExpr, typename promote<T, U>::V, Dim, Dim2, i, j, k>(
172  TensorExpr(a, b));
173  }
174 }
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::Tensor2_symmetric_times_Tensor1_0
Definition: Tensor2_symmetric_times_Tensor1.hpp:56
FTensor::Tensor2_symmetric_Expr
Definition: Tensor2_symmetric_Expr.hpp:36
FTensor::Tensor2_symmetric_times_Tensor1_0::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:68
FTensor::Tensor2_symmetric_times_Tensor1_0::iterA
Tensor2_symmetric_Expr< A, T, Dim, j, i > iterA
Definition: Tensor2_symmetric_times_Tensor1.hpp:58
FTensor::Tensor2_symmetric_times_Tensor1_0::operator()
promote< T, U >::V operator()(const int N1) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:79
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_symmetric_times_Tensor1_1::Tensor2_symmetric_times_Tensor1_1
Tensor2_symmetric_times_Tensor1_1(const Tensor2_symmetric_Expr< A, T, Dim, i, j > &a, const Tensor1_Expr< B, U, Dim, j > &b)
Definition: Tensor2_symmetric_times_Tensor1.hpp:30
FTensor::Tensor2_symmetric_times_Tensor1_0::eval
promote< T, U >::V eval(const int N1, const Number< Current_Dim > &) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:63
FTensor::Tensor2_symmetric_times_Tensor1_1::eval
promote< T, U >::V eval(const int N1, const Number< Current_Dim > &) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:19
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor2_symmetric_times_Tensor1_0::Tensor2_symmetric_times_Tensor1_0
Tensor2_symmetric_times_Tensor1_0(const Tensor2_symmetric_Expr< A, T, Dim, j, i > &a, const Tensor1_Expr< B, U, Dim, j > &b)
Definition: Tensor2_symmetric_times_Tensor1.hpp:74
FTensor::Tensor1_Expr< B, U, Dim, j >
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor2_symmetric_times_Tensor1_0::iterB
Tensor1_Expr< B, U, Dim, j > iterB
Definition: Tensor2_symmetric_times_Tensor1.hpp:59
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Tensor2_symmetric_times_Tensor1
Definition: Tensor2_symmetric_times_Tensor1.hpp:129
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor2_symmetric_times_Tensor1_1::operator()
promote< T, U >::V operator()(const int N1) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:35
FTensor::Tensor2_symmetric_times_Tensor1_1::iterA
Tensor2_symmetric_Expr< A, T, Dim, i, j > iterA
Definition: Tensor2_symmetric_times_Tensor1.hpp:14
Tensor1_Expr
Definition: single.cpp:11
FTensor::Tensor2_symmetric_times_Tensor1::iterB
Tensor1_Expr< B, U, Dim2, k > iterB
Definition: Tensor2_symmetric_times_Tensor1.hpp:132
FTensor::Dg_Expr
Definition: Dg_Expr.hpp:25
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Tensor2_symmetric_times_Tensor1::Tensor2_symmetric_times_Tensor1
Tensor2_symmetric_times_Tensor1(const Tensor2_symmetric_Expr< A, T, Dim, i, j > &a, const Tensor1_Expr< B, U, Dim2, k > &b)
Definition: Tensor2_symmetric_times_Tensor1.hpp:135
FTensor::Tensor2_symmetric_times_Tensor1::iterA
Tensor2_symmetric_Expr< A, T, Dim, i, j > iterA
Definition: Tensor2_symmetric_times_Tensor1.hpp:131
FTensor::Tensor2_symmetric_times_Tensor1::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:141
FTensor::Tensor2_symmetric_times_Tensor1_1
Definition: Tensor2_symmetric_times_Tensor1.hpp:12
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
FTensor::Tensor2_symmetric_times_Tensor1_1::iterB
Tensor1_Expr< B, U, Dim, j > iterB
Definition: Tensor2_symmetric_times_Tensor1.hpp:15
FTensor::Tensor2_symmetric_times_Tensor1_1::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &) const
Definition: Tensor2_symmetric_times_Tensor1.hpp:24