v0.14.0
Tensor2_symmetric_Expr.hpp
Go to the documentation of this file.
1 /* Declares a wrapper class for symmetric rank 2 Tensor expressions.
2  It is specialized for Tensor3_number_rhs_2. Note that
3  Tensor2_symmetric_Expr_equals.hpp is included at the end, because it
4  needs the definition of Tensor2_symmetric_Expr. */
5 
6 #pragma once
7 
23 #include "dTensor2_symmetric.hpp"
26 #include "ddTensor2_symmetric.hpp"
32 
33 namespace FTensor
34 {
35  template <class A, class T, int Dim, char i, char j>
37  {
39 
40  public:
42  T operator()(const int N1, const int N2) const { return iter(N1, N2); }
43  };
44 
45  template <class A, class T, int Tensor_Dim, int Dim, char i, char j>
46  class Tensor2_symmetric_Expr<Tensor2_symmetric<A, Tensor_Dim>, T, Dim, i, j>
47  {
49 
50  public:
52  T &operator()(const int N1, const int N2) { return iter(N1, N2); }
53  T operator()(const int N1, const int N2) const { return iter(N1, N2); }
54 
55  /* Various assignment operators. I have to explicitly declare the
56  second operator= because otherwise the compiler will generate its
57  own and not use the template code. */
58 
59  template <class B, class U>
61  j> &
62  operator=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
63 
65  j> &
67  Dim, i, j> &result);
68 
69  template <class B, class U>
71  j> &
72  operator+=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
73 
74  template <class B, class U>
76  j> &
77  operator-=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
78 
79  template <class B, class U>
81  j> &
82  operator&=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
83 
84  /* This is for when the indices are switched (i,j) -> (j,i). */
85 
86  template <class B, class U>
88  j> &
89  operator=(const Tensor2_symmetric_Expr<B, U, Dim, j, i> &result);
90 
91  template <class B, class U>
93  j> &
94  operator+=(const Tensor2_symmetric_Expr<B, U, Dim, j, i> &result);
95 
96  template <class B, class U>
98  j> &
99  operator-=(const Tensor2_symmetric_Expr<B, U, Dim, j, i> &result);
100 
101  /* Operations with just generics. */
102 
103  template <class U>
105  j> &
106  operator=(const U &d);
107  template <class U>
109  j> &
110  operator+=(const U &d);
111  template <class U>
113  j> &
114  operator-=(const U &d);
115  template <class U>
117  j> &
118  operator*=(const U &d);
119  template <class U>
121  j> &
122  operator/=(const U &d);
123  /* ADOL-C operators. */
124 
125  template <class B, class U>
127  j> &
128  operator<<=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
129 
131  j> &
133  T, Dim, i, j> &result);
134 
135  template <class B, class U>
137  Dim, i, j> &
138  operator<<=(const Tensor2_symmetric_Expr<B, U, Dim, j, i> &result);
139 
140  template <class U>
142  Dim, i, j> &
143  operator<<=(const U &d);
144  };
145 
146  /* Specialized for Dg_number_rhs_2 (Dg with the
147  second index explicitly given). */
148 
149  template <class A, class T, int Dim, char i, char j, int N>
150  class Tensor2_symmetric_Expr<Dg_number_rhs_2<A, T, N>, T, Dim, i, j>
151  {
152  A &iter;
153 
154  public:
156  T &operator()(const int N1, const int N2) { return iter(N1, N2, N); }
157  T operator()(const int N1, const int N2) const { return iter(N1, N2, N); }
158 
159  /* Various assignment operators. I have to explicitly declare the
160  second operator= because otherwise the compiler will generate its
161  own and not use the template code. */
162 
163  template <class B, class U>
165  operator=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
166 
168  operator=(const Tensor2_symmetric_Expr<Dg_number_rhs_2<A, T, N>, T, Dim, i,
169  j> &result);
170  };
171 
172  /* Specialized for Ddg_number_rhs_01 (Ddg with the
173  first and second index explicitly given). */
174 
175  template <class A, class T, int Dim, char i, char j, int N0, int N1>
176  class Tensor2_symmetric_Expr<Ddg_number_rhs_01<A, T, N0, N1>, T, Dim, i, j>
177  {
178  A &iter;
179 
180  public:
182  T &operator()(const int N2, const int N3) { return iter(N0, N1, N2, N3); }
183  T operator()(const int N2, const int N3) const
184  {
185  return iter(N0, N1, N2, N3);
186  }
187 
188  /* Various assignment operators. I have to explicitly declare the
189  second operator= because otherwise the compiler will generate its
190  own and not use the template code. */
191 
192  template <class B, class U>
194  &operator=(const Tensor2_symmetric_Expr<B, U, Dim, i, j> &result);
195 
198  T, Dim, i, j> &result);
199  };
200 }
201 
FTensor::Tensor2_symmetric_Expr< Dg_number_rhs_2< A, T, N >, T, Dim, i, j >::operator()
T & operator()(const int N1, const int N2)
Definition: Tensor2_symmetric_Expr.hpp:156
Tensor2_symmetric_carat_Tensor2_symmetric.hpp
diffusion_Tensor2_symmetric.hpp
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
Tensor2_symmetric_plus_Tensor2_symmetric.hpp
FTensor::Tensor2_symmetric_Expr
Definition: Tensor2_symmetric_Expr.hpp:36
FTensor::Tensor2_symmetric_Expr::Tensor2_symmetric_Expr
Tensor2_symmetric_Expr(const A &a)
Definition: Tensor2_symmetric_Expr.hpp:41
Tensor2_symmetric_plus_generic.hpp
FTensor::Tensor2_symmetric_Expr< Ddg_number_rhs_01< A, T, N0, N1 >, T, Dim, i, j >::iter
A & iter
Definition: Tensor2_symmetric_Expr.hpp:178
d_boundary_Tensor2_symmetric.hpp
Tensor2_symmetric_times_Tensor2_symmetric.hpp
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
FTensor::Tensor2_symmetric_Expr< Ddg_number_rhs_01< A, T, N0, N1 >, T, Dim, i, j >::Tensor2_symmetric_Expr
Tensor2_symmetric_Expr(A &a)
Definition: Tensor2_symmetric_Expr.hpp:181
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
dd_boundary_Tensor2_symmetric.hpp
interpolate_Tensor2_symmetric.hpp
Tensor2_symmetric_Expr_equals.hpp
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
Tensor2_symmetric_divide_generic.hpp
FTensor::Tensor2_symmetric_Expr< Tensor2_symmetric< A, Tensor_Dim >, T, Dim, i, j >::operator()
T operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_Expr.hpp:53
Tensor2_symmetric_times_generic.hpp
generic_minus_Tensor2_symmetric.hpp
Tensor2_symmetric_times_Tensor2.hpp
Tensor2_symmetric_carat_Tensor2.hpp
d_one_sided_Tensor2_symmetric.hpp
FTensor::Tensor2_symmetric_Expr< Tensor2_symmetric< A, Tensor_Dim >, T, Dim, i, j >::Tensor2_symmetric_Expr
Tensor2_symmetric_Expr(Tensor2_symmetric< A, Tensor_Dim > &a)
Definition: Tensor2_symmetric_Expr.hpp:51
a
constexpr double a
Definition: approx_sphere.cpp:30
Tensor2_symmetric_minus_Tensor2.hpp
FTensor::Tensor2_symmetric_Expr< Dg_number_rhs_2< A, T, N >, T, Dim, i, j >::Tensor2_symmetric_Expr
Tensor2_symmetric_Expr(A &a)
Definition: Tensor2_symmetric_Expr.hpp:155
Tensor2_symmetric_plus_Tensor2.hpp
dTensor2_symmetric.hpp
Tensor2_symmetric_minus_generic.hpp
FTensor::Tensor2_symmetric_Expr< Tensor2_symmetric< A, Tensor_Dim >, T, Dim, i, j >::operator()
T & operator()(const int N1, const int N2)
Definition: Tensor2_symmetric_Expr.hpp:52
FTensor::Tensor2_symmetric_Expr< Dg_number_rhs_2< A, T, N >, T, Dim, i, j >::operator()
T operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_Expr.hpp:157
FTensor::Dg_number_rhs_2
Definition: Dg_number.hpp:34
Tensor2_symmetric_minus_Tensor2_symmetric.hpp
FTensor::Tensor2_symmetric_Expr< Ddg_number_rhs_01< A, T, N0, N1 >, T, Dim, i, j >::operator()
T operator()(const int N2, const int N3) const
Definition: Tensor2_symmetric_Expr.hpp:183
Tensor2_symmetric_and_Tensor2_symmetric.hpp
FTensor::Tensor2_symmetric_Expr< Dg_number_rhs_2< A, T, N >, T, Dim, i, j >::iter
A & iter
Definition: Tensor2_symmetric_Expr.hpp:152
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
Tensor2_symmetric_times_Tensor1.hpp
FTensor::Tensor2_symmetric_Expr< Ddg_number_rhs_01< A, T, N0, N1 >, T, Dim, i, j >::operator()
T & operator()(const int N2, const int N3)
Definition: Tensor2_symmetric_Expr.hpp:182
FTensor::Tensor2_symmetric_Expr::operator()
T operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_Expr.hpp:42
FTensor::Ddg_number_rhs_01
Definition: Ddg_number.hpp:23
ddTensor2_symmetric.hpp
N
const int N
Definition: speed_test.cpp:3
Tensor2_symmetric_mod_Tensor2_symmetric.hpp
minus_Tensor2_symmetric.hpp
FTensor::Tensor2_symmetric_Expr< Tensor2_symmetric< A, Tensor_Dim >, T, Dim, i, j >::iter
Tensor2_symmetric< A, Tensor_Dim > & iter
Definition: Tensor2_symmetric_Expr.hpp:48
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Tensor2_symmetric_Expr::iter
A iter
Definition: Tensor2_symmetric_Expr.hpp:38
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197