v0.14.0
Tensor3_times_generic.hpp
Go to the documentation of this file.
1 /* Multiplies a Tensor3 with a generic, yielding a Tensor3. */
2 
3 #pragma once
4 
5 namespace FTensor
6 {
7  /* A(i,j,k)*generic */
8 
9  template <class A, class T, class U, int Dim0, int Dim1, int Dim2, char i,
10  char j, char k>
12  const U &d0)
13  {
14  auto TensorExpr = [&a, &d0](const int N1, const int N2, const int N3) {
15  return a.operator()(N1, N2, N3) * d0;
16  };
17  return Tensor3_Expr<decltype(TensorExpr), typename promote<T, U>::V, Dim0,
18  Dim1, Dim2, i, j, k>(TensorExpr);
19  }
20 
21  /* generic*A(i,j,k) */
22 
23  template <class A, class T, class U, int Dim0, int Dim1, int Dim2, char i,
24  char j, char k>
25  auto operator*(const U &d0,
27  {
28  auto TensorExpr = [&a, &d0](const int N1, const int N2, const int N3) {
29  return d0 * a.operator()(N1, N2, N3);
30  };
31  return Tensor3_Expr<decltype(TensorExpr), typename promote<T, U>::V, Dim0,
32  Dim1, Dim2, i, j, k>(TensorExpr);
33  }
34 
35  /* A(i,j,k)/generic */
36 
37  template <class A, class T, class U, int Dim0, int Dim1, int Dim2, char i,
38  char j, char k>
40  const U &d0)
41  {
42  auto TensorExpr = [&a, &d0](const int N1, const int N2, const int N3) {
43  return a.operator()(N1, N2, N3) / d0;
44  };
45  return Tensor3_Expr<decltype(TensorExpr), typename promote<T, U>::V, Dim0,
46  Dim1, Dim2, i, j, k>(TensorExpr);
47  }
48 
49  /* generic/A(i,j,k) */
50 
51  template <class A, class T, class U, int Dim0, int Dim1, int Dim2, char i,
52  char j, char k>
53  auto operator/(const U &d0,
55  {
56  auto TensorExpr = [&a, &d0](const int N1, const int N2, const int N3) {
57  return d0 / a.operator()(N1, N2, N3);
58  };
59  return Tensor3_Expr<decltype(TensorExpr), typename promote<T, U>::V, Dim0,
60  Dim1, Dim2, i, j, k>(TensorExpr);
61  }
62 
63 }
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
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::operator/
auto operator/(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const U &d0)
Definition: Ddg_times_generic.hpp:36
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Tensor3_Expr
Definition: Tensor3_Expr.hpp:24
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197