v0.14.0
Ddg_Expr.hpp
Go to the documentation of this file.
1 /* Declares a wrapper class for rank 4 Tensor expressions symmetric on
2  the first two and last two indices. */
3 
4 #pragma once
5 
6 #include "Ddg_and_Ddg.hpp"
8 #include "Ddg_carat_Ddg.hpp"
10 #include "Ddg_minus_Ddg.hpp"
12 #include "Ddg_or_Ddg.hpp"
13 #include "Ddg_plus_Ddg.hpp"
14 #include "Ddg_times_Ddg.hpp"
15 #include "Ddg_times_Tensor1.hpp"
16 #include "Ddg_times_Tensor2.hpp"
17 #include "Ddg_times_Tensor4.hpp"
18 #include "Ddg_times_Dg.hpp"
20 #include "Ddg_times_generic.hpp"
21 #include "minus_Ddg.hpp"
22 // #include "Ddg_mod_Ddg.hpp"
23 
24 namespace FTensor
25 {
26  template <class A, class T, int Dim01, int Dim23, char i, char j, char k,
27  char l>
28  class Ddg_Expr
29  {
31 
32  public:
33  Ddg_Expr(const A &a) : iter(a) {}
34  T operator()(const int N1, const int N2, const int N3, const int N4) const
35  {
36  return iter(N1, N2, N3, N4);
37  }
38  };
39 
40  template <class A, class T, int Tensor_Dim01, int Tensor_Dim23, int Dim01,
41  int Dim23, char i, char j, char k, char l>
42  class Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k,
43  l>
44  {
46 
47  public:
49  T operator()(const int N1, const int N2, const int N3, const int N4) const
50  {
51  return iter(N1, N2, N3, N4);
52  }
53 
54  /* Various assignment operators. I have to explicitly declare the
55  second operator= because otherwise the compiler will generate its
56  own and not use the template code. */
57 
58  template <class B, class U>
59  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
60  operator=(const Ddg_Expr<B, U, Dim01, Dim23, i, j, k, l> &result);
61 
62  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
63  operator=(const Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01,
64  Dim23, i, j, k, l> &result);
65 
66  template <class B, class U>
67  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
68  operator+=(const Ddg_Expr<B, U, Dim01, Dim23, i, j, k, l> &result);
69 
70  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
71  operator+=(const Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01,
72  Dim23, i, j, k, l> &result);
73 
74  template <class B, class U>
75  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
76  operator-=(const Ddg_Expr<B, U, Dim01, Dim23, i, j, k, l> &result);
77 
78  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
79  operator-=(const Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01,
80  Dim23, i, j, k, l> &result);
81 
82  template <class U>
83  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
84  operator*=(const U &d);
85 
86  template <class U>
87  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
88  operator=(const U &d);
89  };
90 }
91 
92 #include "Ddg_Expr_equals.hpp"
Ddg_times_Tensor4.hpp
minus_Ddg.hpp
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
Ddg_times_Tensor1.hpp
Ddg_carat_Tensor2_symmetric.hpp
FTensor::Ddg_Expr::Ddg_Expr
Ddg_Expr(const A &a)
Definition: Ddg_Expr.hpp:33
FTensor::d
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
Ddg_and_Ddg.hpp
Ddg_minus_Ddg.hpp
FTensor::Ddg_Expr
Definition: Ddg_Expr.hpp:28
Ddg_or_Ddg.hpp
Ddg_times_Tensor2.hpp
Ddg_times_Tensor2_symmetric.hpp
FTensor::Ddg_Expr< Ddg< A, Tensor_Dim01, Tensor_Dim23 >, T, Dim01, Dim23, i, j, k, l >::iter
Ddg< A, Tensor_Dim01, Tensor_Dim23 > & iter
Definition: Ddg_Expr.hpp:45
FTensor::Ddg_Expr< Ddg< A, Tensor_Dim01, Tensor_Dim23 >, T, Dim01, Dim23, i, j, k, l >::operator()
T operator()(const int N1, const int N2, const int N3, const int N4) const
Definition: Ddg_Expr.hpp:49
a
constexpr double a
Definition: approx_sphere.cpp:30
Ddg_Expr_equals.hpp
FTensor::Ddg_Expr::iter
A iter
Definition: Ddg_Expr.hpp:30
Ddg_and_Tensor2_symmetric.hpp
Ddg_times_generic.hpp
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Ddg_Expr::operator()
T operator()(const int N1, const int N2, const int N3, const int N4) const
Definition: Ddg_Expr.hpp:34
Ddg_mod_Tensor2_symmetric.hpp
Ddg_times_Dg.hpp
Ddg times Dg.
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
Ddg_carat_Ddg.hpp
FTensor::Ddg
Definition: Ddg_value.hpp:7
Ddg_plus_Ddg.hpp
Ddg_times_Ddg.hpp
FTensor::Ddg_Expr< Ddg< A, Tensor_Dim01, Tensor_Dim23 >, T, Dim01, Dim23, i, j, k, l >::Ddg_Expr
Ddg_Expr(Ddg< A, Tensor_Dim01, Tensor_Dim23 > &a)
Definition: Ddg_Expr.hpp:48
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