v0.14.0
Permutation2.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace FTensor
6 {
7  template <int Dim0, int Dim1, char i, char j> struct Permutation2
8  {
9  Permutation2() = default;
10 
11  template <class B, class U>
12  U eval(const Tensor2_Expr<B, U, Dim0, Dim1, i, j> &rhs, const int N0,
13  const int N1)
14  {
15  return rhs(N0, N1);
16  }
17 
18  template <class B, class U>
19  U eval(const Tensor2_Expr<B, U, Dim1, Dim0, j, i> &rhs, const int N0,
20  const int N1)
21  {
22  return rhs(N1, N0);
23  }
24 
25  template <class B, class U, int Dim1_0, int Dim1_1, char i1, char j1>
27  const int N1)
28  {
29  static_assert(error_when_instantiated<B>(), "Incompatible indices");
30  return rhs(0, 0);
31  }
32 
33  template <class B, class U>
34  U& eval_ref(const Tensor2_Expr<B, U, Dim0, Dim1, i, j> &rhs, const int N0,
35  const int N1) {
36  return *rhs.ptr(N0, N1);
37  }
38 
39  template <class B, class U>
40  U& eval_ref(const Tensor2_Expr<B, U, Dim1, Dim0, j, i> &rhs, const int N0,
41  const int N1) {
42  return rhs.ptr(N0, N1);;
43  }
44 
45  template <class B, class U, int Dim1_0, int Dim1_1, char i1, char j1>
47  const int N1) {
48  static_assert(error_when_instantiated<B>(), "Incompatible indices");
49  return rhs.ptr(N0, N1);;
50  }
51  };
52 }
FTensor::Permutation2::eval
U eval(const Tensor2_Expr< B, U, Dim0, Dim1, i, j > &rhs, const int N0, const int N1)
Definition: Permutation2.hpp:12
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor2_Expr< B, U, Dim0, Dim1, i, j >
FTensor::Permutation2::Permutation2
Permutation2()=default
FTensor::Permutation2::eval_ref
U & eval_ref(const Tensor2_Expr< B, U, Dim0, Dim1, i, j > &rhs, const int N0, const int N1)
Definition: Permutation2.hpp:34
FTensor::Permutation2::eval
U eval(const Tensor2_Expr< B, U, Dim1_0, Dim1_1, i1, j1 > &rhs, const int N0, const int N1)
Definition: Permutation2.hpp:26
FTensor::Permutation2::eval_ref
U & eval_ref(const Tensor2_Expr< B, U, Dim1_0, Dim1_1, i1, j1 > &rhs, const int N0, const int N1)
Definition: Permutation2.hpp:46
FTensor::Permutation2::eval
U eval(const Tensor2_Expr< B, U, Dim1, Dim0, j, i > &rhs, const int N0, const int N1)
Definition: Permutation2.hpp:19
FTensor::Permutation2
Definition: Permutation2.hpp:7
FTensor::Permutation2::eval_ref
U & eval_ref(const Tensor2_Expr< B, U, Dim1, Dim0, j, i > &rhs, const int N0, const int N1)
Definition: Permutation2.hpp:40
error_when_instantiated.hpp
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197