v0.14.0
Tensor2_symmetric_minus_Tensor2.hpp
Go to the documentation of this file.
1 /* Subtracts a Tensor2 from a Tensor2_symmetric (or vice versa),
2  yielding a Tensor2. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  /* Base Template */
9  template <class A, class B, class T, class U, int Dim_0, int Dim0_1,
10  int Dim1_1, char i0, char j0, char i1, char j1>
12  {};
13 
14  /* A(i,j)-B(i,j), A is symmetric, B is not. */
15 
16  template <class A, class B, class T, class U, int Dim, char i, char j>
17  class Tensor2_symmetric_minus_Tensor2<A, B, T, U, Dim, Dim, Dim, i, j, i, j>
18  {
21 
22  public:
23  typename promote<T, U>::V operator()(const int N1, const int N2) const
24  {
25  return iterA(N1, N2) - iterB(N1, N2);
26  }
27 
31  : iterA(a), iterB(b)
32  {}
33  };
34 
35  /* A(i,j)-B(j,i), A is symmetric, B is not. */
36 
37  template <class A, class B, class T, class U, int Dim, char i, char j>
38  class Tensor2_symmetric_minus_Tensor2<A, B, T, U, Dim, Dim, Dim, i, j, j, i>
39  {
42 
43  public:
44  typename promote<T, U>::V operator()(const int N1, const int N2) const
45  {
46  return iterA(N1, N2) - iterB(N2, N1);
47  }
48 
52  : iterA(a), iterB(b)
53  {}
54  };
55 
56  template <class A, class B, class T, class U, int Dim_0, int Dim0_1,
57  int Dim1_1, char i0, char j0, char i1, char j1>
58  Tensor2_Expr<Tensor2_symmetric_minus_Tensor2<A, B, T, U, Dim_0, Dim0_1,
59  Dim1_1, i0, j0, i1, j1>,
60  typename promote<T, U>::V, Dim_0, Dim_0, i0, j0>
63  {
64  using TensorExpr
65  = Tensor2_symmetric_minus_Tensor2<A, B, T, U, Dim_0, Dim0_1, Dim1_1, i0,
66  j0, i1, j1>;
67  static_assert(
68  !std::is_empty<TensorExpr>::value,
69  "Indexes or Dimensions are not compatible with the - operator");
71  i0, j0>(TensorExpr(a, b));
72  }
73 
74  // TODO: Maybe we should consider moving the following functions to the space
75  // of Tensor2 for organization sake
76  /* B(i,j)-A(i,j), A is symmetric, B is not. */
77 
78  /* Base Template */
79  template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
80  int Dim_1, char i0, char j0, char i1, char j1>
82  {};
83 
84  template <class A, class B, class T, class U, int Dim, char i, char j>
85  class Tensor2_minus_Tensor2_symmetric<A, B, T, U, Dim, Dim, Dim, i, j, i, j>
86  {
89 
90  public:
91  typename promote<T, U>::V operator()(const int N1, const int N2) const
92  {
93  return iterA(N1, N2) - iterB(N1, N2);
94  }
95 
99  : iterA(a), iterB(b)
100  {}
101  };
102 
103  /* B(i,j)-A(j,i), A is symmetric, B is not. */
104 
105  template <class A, class B, class T, class U, int Dim, char i, char j>
106  class Tensor2_minus_Tensor2_symmetric<A, B, T, U, Dim, Dim, Dim, i, j, j, i>
107  {
110 
111  public:
112  typename promote<T, U>::V operator()(const int N1, const int N2) const
113  {
114  return iterA(N1, N2) - iterB(N2, N1);
115  }
116 
120  : iterA(a), iterB(b)
121  {}
122  };
123 
124  template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
125  int Dim_1, char i0, char j0, char i1, char j1>
126  Tensor2_Expr<Tensor2_minus_Tensor2_symmetric<A, B, T, U, Dim0_0, Dim1_0,
127  Dim_1, i0, j0, i1, j1>,
128  typename promote<T, U>::V, Dim0_0, Dim1_0, i0, j0>
131  {
132  using TensorExpr
133  = Tensor2_minus_Tensor2_symmetric<A, B, T, U, Dim0_0, Dim1_0, Dim_1, i0,
134  j0, i1, j1>;
135  static_assert(
136  !std::is_empty<TensorExpr>::value,
137  "Indexes or Dimensions are not compatible with the - operator");
139  i0, j0>(TensorExpr(a, b));
140  }
141 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::Tensor2_minus_Tensor2_symmetric
Tensor2_minus_Tensor2_symmetric(const Tensor2_Expr< A, T, Dim, Dim, i, j > &a, const Tensor2_symmetric_Expr< B, U, Dim, j, i > &b)
Definition: Tensor2_symmetric_minus_Tensor2.hpp:117
FTensor::Tensor2_symmetric_Expr
Definition: Tensor2_symmetric_Expr.hpp:36
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_minus_Tensor2.hpp:112
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::iterB
Tensor2_symmetric_Expr< B, U, Dim, i, j > iterB
Definition: Tensor2_symmetric_minus_Tensor2.hpp:88
FTensor::Tensor2_Expr< B, U, Dim, Dim, i, j >
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::Tensor2_minus_Tensor2_symmetric
Tensor2_minus_Tensor2_symmetric(const Tensor2_Expr< A, T, Dim, Dim, i, j > &a, const Tensor2_symmetric_Expr< B, U, Dim, i, j > &b)
Definition: Tensor2_symmetric_minus_Tensor2.hpp:96
FTensor::Tensor2_minus_Tensor2_symmetric
Definition: Tensor2_symmetric_minus_Tensor2.hpp:81
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_minus_Tensor2.hpp:91
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::iterB
Tensor2_Expr< B, U, Dim, Dim, i, j > iterB
Definition: Tensor2_symmetric_minus_Tensor2.hpp:20
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::iterA
Tensor2_Expr< A, T, Dim, Dim, i, j > iterA
Definition: Tensor2_symmetric_minus_Tensor2.hpp:87
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::iterA
Tensor2_Expr< A, T, Dim, Dim, i, j > iterA
Definition: Tensor2_symmetric_minus_Tensor2.hpp:108
FTensor::Tensor2_symmetric_minus_Tensor2
Definition: Tensor2_symmetric_minus_Tensor2.hpp:11
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::Tensor2_symmetric_minus_Tensor2
Tensor2_symmetric_minus_Tensor2(const Tensor2_symmetric_Expr< A, T, Dim, i, j > &a, const Tensor2_Expr< B, U, Dim, Dim, i, j > &b)
Definition: Tensor2_symmetric_minus_Tensor2.hpp:28
FTensor::Tensor2_minus_Tensor2_symmetric< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::iterB
Tensor2_symmetric_Expr< B, U, Dim, j, i > iterB
Definition: Tensor2_symmetric_minus_Tensor2.hpp:109
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::iterB
Tensor2_Expr< B, U, Dim, Dim, j, i > iterB
Definition: Tensor2_symmetric_minus_Tensor2.hpp:41
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::Tensor2_symmetric_minus_Tensor2
Tensor2_symmetric_minus_Tensor2(const Tensor2_symmetric_Expr< A, T, Dim, i, j > &a, const Tensor2_Expr< B, U, Dim, Dim, j, i > &b)
Definition: Tensor2_symmetric_minus_Tensor2.hpp:49
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_minus_Tensor2.hpp:44
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Tensor2_symmetric_minus_Tensor2.hpp:23
FTensor::operator-
Ddg_Expr< Ddg_minus_Ddg< A, B, T, U, Dim01, Dim23, i, j, k, l >, typename promote< T, U >::V, Dim01, Dim23, i, j, k, l > operator-(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Ddg_Expr< B, U, Dim01, Dim23, i, j, k, l > &b)
Definition: Ddg_minus_Ddg.hpp:33
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, i, j >::iterA
Tensor2_symmetric_Expr< A, T, Dim, i, j > iterA
Definition: Tensor2_symmetric_minus_Tensor2.hpp:19
FTensor::Tensor2_symmetric_minus_Tensor2< A, B, T, U, Dim, Dim, Dim, i, j, j, i >::iterA
Tensor2_symmetric_Expr< A, T, Dim, i, j > iterA
Definition: Tensor2_symmetric_minus_Tensor2.hpp:40
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197