v0.14.0
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 > Class Template Reference

#include <src/ftensor/src/FTensor/Tensor2/Tensor2_pointer.hpp>

Inheritance diagram for FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >:
[legend]
Collaboration diagram for FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >:
[legend]

Public Member Functions

 Tensor2 (T *d00, T *d01, T *d10, T *d11, const int i)
 
 Tensor2 (T *d00, T *d01, T *d10, T *d11, T *d20, T *d21, const int i)
 
 Tensor2 (T *d00, T *d01, T *d02, T *d10, T *d11, T *d12, T *d20, T *d21, T *d22, const int i)
 
 Tensor2 (T *d00, T *d01, T *d02, T *d03, T *d10, T *d11, T *d12, T *d13, T *d20, T *d21, T *d22, T *d23, T *d30, T *d31, T *d32, T *d33, const int i)
 
template<class... U>
 Tensor2 (U *...d)
 
template<class U >
 Tensor2 (std::array< U *, Tensor_Dim0 *Tensor_Dim1 > &a, const int i=1)
 
 Tensor2 ()
 
 Tensor2 (const int i=1)
 
T & operator() (const int N1, const int N2)
 
operator() (const int N1, const int N2) const
 
T * ptr (const int N1, const int N2) const
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, joperator() (const Index< i, Dim0 >, const Index< j, Dim1 > index2)
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< const Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, joperator() (const Index< i, Dim0 >, const Index< j, Dim1 > index2) const
 
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_1< Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, ioperator() (const Index< i, Dim >, const Number< N >)
 
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_0< Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, ioperator() (const Number< N >, const Index< i, Dim >)
 
template<char i, int Dim, int N>
Tensor1_Expr< const Tensor2_number_1< const Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, ioperator() (const Index< i, Dim >, const Number< N >) const
 
template<char i, int Dim, int N>
Tensor1_Expr< const Tensor2_number_0< const Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, ioperator() (const Number< N >, const Index< i, Dim >) const
 
const Tensor2operator++ () const
 
template<char i, int Dim>
operator() (const Index< i, Dim >, const Index< i, Dim > index2)
 
template<char i, int Dim>
operator() (const Index< i, Dim >, const Index< i, Dim > index2) const
 

Protected Attributes

T *restrict data [Tensor_Dim0][Tensor_Dim1]
 
const int inc
 

Private Member Functions

template<int N>
internal_contract (Number< N >) const
 
internal_contract (Number< 1 >) const
 
template<int I>
 Tensor2 (const Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 > &)=delete
 Preventing casting on derived class. More...
 

Detailed Description

template<class T, int Tensor_Dim0, int Tensor_Dim1>
class FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >

Definition at line 8 of file Tensor2_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T *  d00,
T *  d01,
T *  d10,
T *  d11,
const int  i 
)
inline

Definition at line 18 of file Tensor2_pointer.hpp.

18  : inc(i) {
19  Tensor2_constructor<T *restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
20  data, d00, d01, d10, d11);
21  }

◆ Tensor2() [2/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T *  d00,
T *  d01,
T *  d10,
T *  d11,
T *  d20,
T *  d21,
const int  i 
)
inline

Definition at line 22 of file Tensor2_pointer.hpp.

23  : inc(i) {
24  Tensor2_constructor<T *restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
25  data, d00, d01, d10, d11, d20, d21);
26  }

◆ Tensor2() [3/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T *  d00,
T *  d01,
T *  d02,
T *  d10,
T *  d11,
T *  d12,
T *  d20,
T *  d21,
T *  d22,
const int  i 
)
inline

Definition at line 27 of file Tensor2_pointer.hpp.

29  : inc(i) {
30  Tensor2_constructor<T *restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
31  data, d00, d01, d02, d10, d11, d12, d20, d21, d22);
32  }

◆ Tensor2() [4/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( T *  d00,
T *  d01,
T *  d02,
T *  d03,
T *  d10,
T *  d11,
T *  d12,
T *  d13,
T *  d20,
T *  d21,
T *  d22,
T *  d23,
T *  d30,
T *  d31,
T *  d32,
T *  d33,
const int  i 
)
inline

Definition at line 33 of file Tensor2_pointer.hpp.

36  : inc(i) {
37  Tensor2_constructor<T *restrict, Tensor_Dim0, Tensor_Dim1, column_major>(
38  data, d00, d01, d02, d03, d10, d11, d12, d13, d20, d21, d22, d23, d30,
39  d31, d32, d33);
40  }

◆ Tensor2() [5/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<class... U>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( U *...  d)
inline

Definition at line 43 of file Tensor2_pointer.hpp.

43 : data{d...}, inc(1) {}

◆ Tensor2() [6/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<class U >
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( std::array< U *, Tensor_Dim0 *Tensor_Dim1 > &  a,
const int  i = 1 
)
inline

Definition at line 46 of file Tensor2_pointer.hpp.

47  : inc(i) {
48  int k = 0;
49  for (int i = 0; i != Tensor_Dim0; ++i) {
50  for (int j = 0; j != Tensor_Dim1; ++j, ++k) {
51  data[i][j] = a[k];
52  }
53  }
54  }

◆ Tensor2() [7/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( )
inline

Definition at line 56 of file Tensor2_pointer.hpp.

56 {}

◆ Tensor2() [8/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( const int  i = 1)
inline

Definition at line 58 of file Tensor2_pointer.hpp.

58 : inc(i) {}

◆ Tensor2() [9/9]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<int I>
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::Tensor2 ( const Tensor2< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1 > &  )
privatedelete

Preventing casting on derived class.

That can be source of errors

Member Function Documentation

◆ internal_contract() [1/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
T FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::internal_contract ( Number< 1 >  ) const
inlineprivate

Definition at line 196 of file Tensor2_pointer.hpp.

196 { return *data[0][0]; }

◆ internal_contract() [2/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<int N>
T FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::internal_contract ( Number< N ) const
inlineprivate

Definition at line 192 of file Tensor2_pointer.hpp.

192  {
193  return *data[N - 1][N - 1] + internal_contract(Number<N - 1>());
194  }

◆ operator()() [1/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim>
T FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >  index2 
)
inline

Definition at line 182 of file Tensor2_pointer.hpp.

182  {
183  return internal_contract(Number<Dim>());
184  }

◆ operator()() [2/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim>
T FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >  index2 
) const
inline

Definition at line 187 of file Tensor2_pointer.hpp.

187  {
188  return internal_contract(Number<Dim>());
189  }

◆ operator()() [3/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_1<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Number< N  
)
inline

Definition at line 130 of file Tensor2_pointer.hpp.

130  {
131  using TensorExpr =
132  Tensor2_number_rhs_1<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
134  }

◆ operator()() [4/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim, int N>
Tensor1_Expr<const Tensor2_number_1< const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Number< N  
) const
inline

Definition at line 150 of file Tensor2_pointer.hpp.

150  {
151  using TensorExpr =
152  Tensor2_number_1<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
153  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
154  }

◆ operator()() [5/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, Dim0, Dim1, i, j> FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >  index2 
)
inline

Definition at line 106 of file Tensor2_pointer.hpp.

106  {
107  return Tensor2_Expr<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, Dim0, Dim1,
108  i, j>(*this);
109  }

◆ operator()() [6/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, Dim0, Dim1, i, j> FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >  index2 
) const
inline

Definition at line 114 of file Tensor2_pointer.hpp.

114  {
115  return Tensor2_Expr<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, Dim0,
116  Dim1, i, j>(*this);
117  }

◆ operator()() [7/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
T& FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const int  N1,
const int  N2 
)
inline

Definition at line 63 of file Tensor2_pointer.hpp.

63  {
64 #ifdef FTENSOR_DEBUG
65  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
66  std::stringstream s;
67  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
68  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
69  throw std::out_of_range(s.str());
70  }
71 #endif
72  return *data[N1][N2];
73  }

◆ operator()() [8/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
T FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const int  N1,
const int  N2 
) const
inline

Definition at line 75 of file Tensor2_pointer.hpp.

75  {
76 #ifdef FTENSOR_DEBUG
77  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
78  std::stringstream s;
79  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
80  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
81  throw std::out_of_range(s.str());
82  }
83 #endif
84  return *data[N1][N2];
85  }

◆ operator()() [9/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim, int N>
Tensor1_Expr< Tensor2_number_rhs_0<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Number< N ,
const Index< i, Dim >   
)
inline

Definition at line 140 of file Tensor2_pointer.hpp.

140  {
141  using TensorExpr =
142  Tensor2_number_rhs_0<Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
144  }

◆ operator()() [10/10]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim, int N>
Tensor1_Expr<const Tensor2_number_0< const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>, T, Dim, i> FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Number< N ,
const Index< i, Dim >   
) const
inline

Definition at line 160 of file Tensor2_pointer.hpp.

160  {
161  using TensorExpr =
162  Tensor2_number_0<const Tensor2<T *, Tensor_Dim0, Tensor_Dim1>, T, N>;
163  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
164  }

◆ operator++()

template<class T , int Tensor_Dim0, int Tensor_Dim1>
const Tensor2& FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::operator++ ( ) const
inline

Definition at line 169 of file Tensor2_pointer.hpp.

169  {
170  for (int i = 0; i < Tensor_Dim0; ++i)
171  for (int j = 0; j < Tensor_Dim1; ++j)
172  data[i][j] += inc;
173  return *this;
174  }

◆ ptr()

template<class T , int Tensor_Dim0, int Tensor_Dim1>
T* FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::ptr ( const int  N1,
const int  N2 
) const
inline

Definition at line 87 of file Tensor2_pointer.hpp.

87  {
88 #ifdef FTENSOR_DEBUG
89  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
90  std::stringstream s;
91  s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
92  << ">.ptr(" << N1 << "," << N2 << ")" << std::endl;
93  throw std::out_of_range(s.str());
94  }
95 #endif
96  return data[N1][N2];
97  }

Member Data Documentation

◆ data

template<class T , int Tensor_Dim0, int Tensor_Dim1>
T* restrict FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::data[Tensor_Dim0][Tensor_Dim1]
mutableprotected

Definition at line 12 of file Tensor2_pointer.hpp.

◆ inc

template<class T , int Tensor_Dim0, int Tensor_Dim1>
const int FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::inc
protected

Definition at line 13 of file Tensor2_pointer.hpp.


The documentation for this class was generated from the following file:
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< T *, Tensor_Dim0, Tensor_Dim1 >::internal_contract
T internal_contract(Number< N >) const
Definition: Tensor2_pointer.hpp:192
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::data
T *restrict data[Tensor_Dim0][Tensor_Dim1]
Definition: Tensor2_pointer.hpp:12
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >::inc
const int inc
Definition: Tensor2_pointer.hpp:13
N
const int N
Definition: speed_test.cpp:3
Tensor1_Expr
Definition: single.cpp:11
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20