v0.9.0
Ddg_Expr_equals.hpp
Go to the documentation of this file.
1 /* Various assignment operators. I have to explicitly declare the
2  second operator= because otherwise the compiler will generate its
3  own and not use the template code. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  template <class A, class B, class U, int Current_Dim0, int Current_Dim1,
10  int Current_Dim2, int Current_Dim3, int Dim01, int Dim23, char i,
11  char j, char k, char l>
12  void
15  const Number<Current_Dim0> &,
16  const Number<Current_Dim1> &,
17  const Number<Current_Dim2> &,
18  const Number<Current_Dim3> &)
19  {
20  iter(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1,
21  Current_Dim3 - 1)
22  = result(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1,
23  Current_Dim3 - 1);
27  }
28 
29  template <class A, class B, class U, int Current_Dim1, int Current_Dim2,
30  int Current_Dim3, int Dim01, int Dim23, char i, char j, char k,
31  char l>
32  void
35  const Number<1> &, const Number<Current_Dim1> &,
36  const Number<Current_Dim2> &,
37  const Number<Current_Dim3> &)
38  {
39  iter(0, Current_Dim1 - 1, Current_Dim2 - 1, Current_Dim3 - 1)
40  = result(0, Current_Dim1 - 1, Current_Dim2 - 1, Current_Dim3 - 1);
44  }
45 
46  template <class A, class B, class U, int Current_Dim2, int Current_Dim3,
47  int Dim01, int Dim23, char i, char j, char k, char l>
48  void
51  const Number<1> &, const Number<1> &,
52  const Number<Current_Dim2> &,
53  const Number<Current_Dim3> &)
54  {
55  iter(0, 0, Current_Dim2 - 1, Current_Dim3 - 1)
56  = result(0, 0, Current_Dim2 - 1, Current_Dim3 - 1);
59  }
60 
61  template <class A, class B, class U, int Current_Dim3, int Dim01, int Dim23,
62  char i, char j, char k, char l>
63  void
66  const Number<1> &, const Number<1> &, const Number<1> &,
67  const Number<Current_Dim3> &)
68  {
69  iter(0, 0, 0, Current_Dim3 - 1) = result(0, 0, 0, Current_Dim3 - 1);
72  }
73 
74  template <class A, class B, class U, int Dim01, int Dim23, char i, char j,
75  char k, char l>
76  void
79  const Number<1> &, const Number<1> &, const Number<1> &,
80  const Number<1> &)
81  {
82  iter(0, 0, 0, 0) = result(0, 0, 0, 0);
83  }
84 
85  template <class A, class T, int Tensor_Dim01, int Tensor_Dim23, int Dim01,
86  int Dim23, char i, char j, char k, char l>
87  template <class B, class U>
88  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
89  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l>::
91  {
94  return *this;
95  }
96 
97  template <class A, class T, int Tensor_Dim01, int Tensor_Dim23, int Dim01,
98  int Dim23, char i, char j, char k, char l>
99  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
100  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l>::
101  operator=(const Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23,
102  i, j, k, l> &result)
103  {
104  return operator=<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T>(result);
105  }
106 
107  template <class A, class B, class U, int Current_Dim0, int Current_Dim1,
108  int Current_Dim2, int Current_Dim3, int Dim01, int Dim23, char i,
109  char j, char k, char l>
111  A &iter, const Ddg_Expr<B, U, Dim01, Dim23, i, j, k, l> &result,
113  const Number<Current_Dim2> &, const Number<Current_Dim3> &) {
114  iter(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1,
115  Current_Dim3 - 1)
116  += result(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1,
117  Current_Dim3 - 1);
121  }
122 
123  template <class A, class B, class U, int Current_Dim1, int Current_Dim2,
124  int Current_Dim3, int Dim01, int Dim23, char i, char j, char k,
125  char l>
126  void
129  const Number<1> &, const Number<Current_Dim1> &,
130  const Number<Current_Dim2> &,
131  const Number<Current_Dim3> &)
132  {
133  iter(0, Current_Dim1 - 1, Current_Dim2 - 1, Current_Dim3 - 1)
134  += result(0, Current_Dim1 - 1, Current_Dim2 - 1, Current_Dim3 - 1);
138  }
139 
140  template <class A, class B, class U, int Current_Dim2, int Current_Dim3,
141  int Dim01, int Dim23, char i, char j, char k, char l>
142  void
145  const Number<1> &, const Number<1> &,
146  const Number<Current_Dim2> &,
147  const Number<Current_Dim3> &)
148  {
149  iter(0, 0, Current_Dim2 - 1, Current_Dim3 - 1)
150  += result(0, 0, Current_Dim2 - 1, Current_Dim3 - 1);
153  }
154 
155  template <class A, class B, class U, int Current_Dim3, int Dim01, int Dim23,
156  char i, char j, char k, char l>
157  void
160  const Number<1> &, const Number<1> &, const Number<1> &,
161  const Number<Current_Dim3> &)
162  {
163  iter(0, 0, 0, Current_Dim3 - 1) += result(0, 0, 0, Current_Dim3 - 1);
166  }
167 
168  template <class A, class B, class U, int Dim01, int Dim23, char i, char j,
169  char k, char l>
170  void
173  const Number<1> &, const Number<1> &, const Number<1> &,
174  const Number<1> &)
175  {
176  iter(0, 0, 0, 0) += result(0, 0, 0, 0);
177  }
178 
179  template <class A, class T, int Tensor_Dim01, int Tensor_Dim23, int Dim01,
180  int Dim23, char i, char j, char k, char l>
181  template <class B, class U>
182  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
183  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l>::
185  {
188  return *this;
189  }
190 
191  template <class A, class T, int Tensor_Dim01, int Tensor_Dim23, int Dim01,
192  int Dim23, char i, char j, char k, char l>
193  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
194  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l>::
195  operator+=(const Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23,
196  i, j, k, l> &result)
197  {
198  return operator+=<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T>(result);
199  }
200 
201  /* Ddgs*=U */
202 
203  template <class A, class T, class U, int Dim01, int Dim23>
205 
207  const U &u;
208 
209  template <int Current_Dim0, int Current_Dim1, int Current_Dim2,
210  int Current_Dim3>
212  const Number<Current_Dim2> &, const Number<Current_Dim3> &) {
213  iter(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1,
214  Current_Dim3 - 1) *= u;
217  }
218 
219  template <int Current_Dim1, int Current_Dim2, int Current_Dim3>
220  void eval(const Number<1> &, const Number<Current_Dim1> &,
221  const Number<Current_Dim2> &, const Number<Current_Dim3> &) {
222  iter(0, Current_Dim1 - 1, Current_Dim2 - 1, Current_Dim3 - 1) *= u;
225  }
226 
227  template <int Current_Dim2, int Current_Dim3>
228  void eval(const Number<1> &, const Number<1> &,
229  const Number<Current_Dim2> &, const Number<Current_Dim3> &) {
230  iter(0, 0, Current_Dim2 - 1, Current_Dim3 - 1) *= u;
233  }
234 
235  template <int Current_Dim3>
236  void eval(const Number<1> &, const Number<1> &, const Number<1> &,
237  const Number<Current_Dim3> &) {
238  iter(0, 0, 0, Current_Dim3 - 1) *= u;
241  }
242 
243  void eval(const Number<1> &, const Number<1> &, const Number<1> &,
244  const Number<1> &) {
245  iter(0, 0, 0, 0) *= u;
246  }
247 
248  public:
250  : iter(a), u(b) {}
251 
252  void operator()() {
254  }
255  };
256 
257  template <class A, class T, int Tensor_Dim01, int Tensor_Dim23, int Dim01,
258  int Dim23, char i, char j, char k, char l>
259  template <class U>
260  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l> &
261  Ddg_Expr<Ddg<A, Tensor_Dim01, Tensor_Dim23>, T, Dim01, Dim23, i, j, k, l>::
262  operator*=(const U &d) {
264  return *this;
265  }
266 
267 }
void eval(const Number< 1 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &)
Fully Antisymmetric Levi-Civita Tensor.
void eval(const Number< 1 > &, const Number< 1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &)
void eval(const Number< 1 > &, const Number< 1 > &, const Number< 1 > &, const Number< 1 > &)
void eval(const Number< 1 > &, const Number< 1 > &, const Number< 1 > &, const Number< Current_Dim3 > &)
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
void eval(const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &)
T4Ddg_times_equals_generic(Ddg< A, Dim01, Dim23 > &a, const U &b)
void T4ddg_plus_equals_T4ddg(A &iter, const Ddg_Expr< B, U, Dim01, Dim23, i, j, k, l > &result, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &)
void T4ddg_equals_T4ddg(A &iter, const Ddg_Expr< B, U, Dim01, Dim23, i, j, k, l > &result, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &)