v0.14.0
Tensor3_antisymmetric_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  /* T3as=T3as */
10 
11  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
12  char k, int Current_Dim0, int Current_Dim1, int Current_Dim2>
14  A &iter,
17  const Number<Current_Dim2> &)
18  {
19  iter.unsafe(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1)
20  = result(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1);
21  T3as_equals_T3as(iter, result, Number<Current_Dim0>(),
23  }
24 
25  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
26  char k, int Current_Dim0, int Current_Dim2>
28  A &iter,
30  const Number<Current_Dim0> &, const Number<1> &,
31  const Number<Current_Dim2> &)
32  {
33  iter.unsafe(Current_Dim0 - 1, 0, Current_Dim2 - 1)
34  = result(Current_Dim0 - 1, 0, Current_Dim2 - 1);
35  T3as_equals_T3as(iter, result, Number<Current_Dim0>(),
37  }
38 
39  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
40  char k, int Current_Dim0>
42  A &iter,
44  const Number<Current_Dim0> &, const Number<1> &, const Number<2> &)
45  {
46  iter.unsafe(Current_Dim0 - 1, 0, 1) = result(Current_Dim0 - 1, 0, 1);
49  }
50 
51  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
52  char k>
54  A &iter,
56  const Number<1> &, const Number<1> &, const Number<2> &)
57  {
58  iter.unsafe(0, 0, 1) = result(0, 0, 1);
59  }
60 
61  template <class A, class T, int Dim0, int Dim12, char i, char j, char k>
62  template <class B, class U>
63  Tensor3_antisymmetric_Expr<Tensor3_antisymmetric<A, Dim0, Dim12>, T, Dim0,
64  Dim12, i, j, k> &
65  Tensor3_antisymmetric_Expr<Tensor3_antisymmetric<A, Dim0, Dim12>, T, Dim0,
66  Dim12, i, j, k>::
67  operator=(
69  {
71  Number<Dim12>());
72  return *this;
73  }
74 
75  /* T3as=T3as_Expr(T3as) */
76 
77  template <class A, class T, int Dim0, int Dim12, char i, char j, char k>
79  Dim12, i, j, k> &
81  Dim12, i, j, k>::
82  operator=(
84  Dim0, Dim12, i, j, k> &result)
85  {
86  return operator=<Tensor3_antisymmetric<A, Dim0, Dim12>, T>(result);
87  }
88 
89  /* This is for when the indices are switched (i,j,k) -> (i,k,j). */
90 
91  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
92  char k, int Current_Dim0, int Current_Dim1, int Current_Dim2>
94  A &iter,
97  const Number<Current_Dim2> &)
98  {
99  iter.unsafe(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1)
100  = -result(Current_Dim0 - 1, Current_Dim1 - 1, Current_Dim2 - 1);
104  }
105 
106  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
107  char k, int Current_Dim0, int Current_Dim2>
109  A &iter,
111  const Number<Current_Dim0> &, const Number<1> &,
112  const Number<Current_Dim2> &)
113  {
114  iter.unsafe(Current_Dim0 - 1, 0, Current_Dim2 - 1)
115  = -result(Current_Dim0 - 1, 0, Current_Dim2 - 1);
119  }
120 
121  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
122  char k, int Current_Dim0>
124  A &iter,
126  const Number<Current_Dim0> &, const Number<1> &, const Number<2> &)
127  {
128  iter.unsafe(Current_Dim0 - 1, 0, 1) = -result(Current_Dim0 - 1, 0, 1);
131  }
132 
133  template <class A, class B, class U, int Dim0, int Dim12, char i, char j,
134  char k>
136  A &iter,
138  const Number<1> &, const Number<1> &, const Number<2> &)
139  {
140  iter.unsafe(0, 0, 1) = -result(0, 0, 1);
141  }
142 
143  template <class A, class T, int Dim0, int Dim12, char i, char j, char k>
144  template <class B, class U>
145  Tensor3_antisymmetric_Expr<Tensor3_antisymmetric<A, Dim0, Dim12>, T, Dim0,
146  Dim12, i, j, k> &
147  Tensor3_antisymmetric_Expr<Tensor3_antisymmetric<A, Dim0, Dim12>, T, Dim0,
148  Dim12, i, j, k>::
149  operator=(
151  {
152  T3as_switched_equals_T3as(iter, result, Number<Dim0>(),
154  return *this;
155  }
156 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor3_antisymmetric_Expr< B, U, Dim0, Dim12, i, j, k >
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor3_antisymmetric< A, Dim0, Dim12 >
FTensor::T3as_equals_T3as
void T3as_equals_T3as(A &iter, const Tensor3_antisymmetric_Expr< B, U, Dim0, Dim12, i, j, k > &result, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &)
Definition: Tensor3_antisymmetric_Expr_equals.hpp:13
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::T3as_switched_equals_T3as
void T3as_switched_equals_T3as(A &iter, const Tensor3_antisymmetric_Expr< B, U, Dim0, Dim12, i, k, j > &result, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &)
Definition: Tensor3_antisymmetric_Expr_equals.hpp:93
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