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

#include <src/ftensor/src/FTensor/Tensor4/Tensor4_pointer.hpp>

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

Public Member Functions

 Tensor4 (T *d0000, T *d0001, T *d0010, T *d0011, T *d0100, T *d0101, T *d0110, T *d0111, T *d1000, T *d1001, T *d1010, T *d1011, T *d1100, T *d1101, T *d1110, T *d1111, const int i=1)
 
 Tensor4 (T *d0000, T *d0001, T *d0002, T *d0010, T *d0011, T *d0012, T *d0020, T *d0021, T *d0022, T *d0100, T *d0101, T *d0102, T *d0110, T *d0111, T *d0112, T *d0120, T *d0121, T *d0122, T *d0200, T *d0201, T *d0202, T *d0210, T *d0211, T *d0212, T *d0220, T *d0221, T *d0222, T *d1000, T *d1001, T *d1002, T *d1010, T *d1011, T *d1012, T *d1020, T *d1021, T *d1022, T *d1100, T *d1101, T *d1102, T *d1110, T *d1111, T *d1112, T *d1120, T *d1121, T *d1122, T *d1200, T *d1201, T *d1202, T *d1210, T *d1211, T *d1212, T *d1220, T *d1221, T *d1222, T *d2000, T *d2001, T *d2002, T *d2010, T *d2011, T *d2012, T *d2020, T *d2021, T *d2022, T *d2100, T *d2101, T *d2102, T *d2110, T *d2111, T *d2112, T *d2120, T *d2121, T *d2122, T *d2200, T *d2201, T *d2202, T *d2210, T *d2211, T *d2212, T *d2220, T *d2221, T *d2222, const int i=1)
 
 Tensor4 (T *d, const int shift, const int i=1)
 
template<class... U>
 Tensor4 (U *... d)
 
T & operator() (const int N1, const int N2, const int N3, const int N4)
 
operator() (const int N1, const int N2, const int N3, const int N4) const
 
template<char i, char j, char k, char l, int Dim0, int Dim1, int Dim2, int Dim3>
Tensor4_Expr< Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >, T, Dim0, Dim1, Dim2, Dim3, i, j, k, loperator() (const Index< i, Dim0 >, const Index< j, Dim1 >, const Index< k, Dim2 >, const Index< l, Dim3 >)
 
template<char i, char j, char k, char l, int Dim0, int Dim1, int Dim2, int Dim3>
Tensor4_Expr< const Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >, T, Dim0, Dim1, Dim2, Dim3, i, j, k, loperator() (const Index< i, Dim0 >, const Index< j, Dim1 >, const Index< k, Dim2 >, const Index< l, Dim3 >) const
 
template<int Current_Dim0, int Current_Dim1, int Current_Dim2, int Current_Dim3>
void increment (const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &) const
 
const Tensor4operator++ () const
 
T * ptr (const int N1, const int N2, const int N3, const int N4) const
 
T *restrict & ptr (const int N1, const int N2, const int N3, const int N4)
 

Protected Attributes

T *restrict data [Tensor_Dim0][Tensor_Dim1][Tensor_Dim2][Tensor_Dim3]
 

Private Member Functions

template<int I>
 Tensor4 (const Tensor4< PackPtr< T *, I >, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 > &)=delete
 

Private Attributes

const int inc
 

Detailed Description

template<class T, int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
class FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >

Definition at line 67 of file Tensor4_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor4() [1/5]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::Tensor4 ( T *  d0000,
T *  d0001,
T *  d0010,
T *  d0011,
T *  d0100,
T *  d0101,
T *  d0110,
T *  d0111,
T *  d1000,
T *  d1001,
T *  d1010,
T *  d1011,
T *  d1100,
T *  d1101,
T *  d1110,
T *  d1111,
const int  i = 1 
)
inline

Definition at line 76 of file Tensor4_pointer.hpp.

79  : inc(i)
80  {
81  Tensor4_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2,
82  Tensor_Dim3>(
83  data, d0000, d0001, d0010, d0011, d0100, d0101, d0110, d0111, d1000,
84  d1001, d1010, d1011, d1100, d1101, d1110, d1111);
85  }

◆ Tensor4() [2/5]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::Tensor4 ( T *  d0000,
T *  d0001,
T *  d0002,
T *  d0010,
T *  d0011,
T *  d0012,
T *  d0020,
T *  d0021,
T *  d0022,
T *  d0100,
T *  d0101,
T *  d0102,
T *  d0110,
T *  d0111,
T *  d0112,
T *  d0120,
T *  d0121,
T *  d0122,
T *  d0200,
T *  d0201,
T *  d0202,
T *  d0210,
T *  d0211,
T *  d0212,
T *  d0220,
T *  d0221,
T *  d0222,
T *  d1000,
T *  d1001,
T *  d1002,
T *  d1010,
T *  d1011,
T *  d1012,
T *  d1020,
T *  d1021,
T *  d1022,
T *  d1100,
T *  d1101,
T *  d1102,
T *  d1110,
T *  d1111,
T *  d1112,
T *  d1120,
T *  d1121,
T *  d1122,
T *  d1200,
T *  d1201,
T *  d1202,
T *  d1210,
T *  d1211,
T *  d1212,
T *  d1220,
T *  d1221,
T *  d1222,
T *  d2000,
T *  d2001,
T *  d2002,
T *  d2010,
T *  d2011,
T *  d2012,
T *  d2020,
T *  d2021,
T *  d2022,
T *  d2100,
T *  d2101,
T *  d2102,
T *  d2110,
T *  d2111,
T *  d2112,
T *  d2120,
T *  d2121,
T *  d2122,
T *  d2200,
T *  d2201,
T *  d2202,
T *  d2210,
T *  d2211,
T *  d2212,
T *  d2220,
T *  d2221,
T *  d2222,
const int  i = 1 
)
inline

Definition at line 87 of file Tensor4_pointer.hpp.

101  : inc(i)
102  {
103  Tensor4_constructor<T * restrict, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2,
104  Tensor_Dim3>(
105  data, d0000, d0001, d0002, d0010, d0011, d0012, d0020, d0021, d0022,
106  d0100, d0101, d0102, d0110, d0111, d0112, d0120, d0121, d0122, d0200,
107  d0201, d0202, d0210, d0211, d0212, d0220, d0221, d0222, d1000, d1001,
108  d1002, d1010, d1011, d1012, d1020, d1021, d1022, d1100, d1101, d1102,
109  d1110, d1111, d1112, d1120, d1121, d1122, d1200, d1201, d1202, d1210,
110  d1211, d1212, d1220, d1221, d1222, d2000, d2001, d2002, d2010, d2011,
111  d2012, d2020, d2021, d2022, d2100, d2101, d2102, d2110, d2111, d2112,
112  d2120, d2121, d2122, d2200, d2201, d2202, d2210, d2211, d2212, d2220,
113  d2221, d2222);
114  }

◆ Tensor4() [3/5]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::Tensor4 ( T *  d,
const int  shift,
const int  i = 1 
)
inline

Definition at line 116 of file Tensor4_pointer.hpp.

116  : inc(i)
117  {
118  int s = 0;
119  for (int i = 0; i != Tensor_Dim0; ++i)
120  {
121  for (int j = 0; j != Tensor_Dim1; ++j)
122  {
123  for (int k = 0; k != Tensor_Dim2; ++k)
124  {
125  for (int l = 0; l != Tensor_Dim3; ++l)
126  {
127  data[i][j][k][l] = &d[s];
128  s += shift;
129  }
130  }
131  }
132  }
133  }

◆ Tensor4() [4/5]

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

Definition at line 136 of file Tensor4_pointer.hpp.

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

◆ Tensor4() [5/5]

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

Member Function Documentation

◆ increment()

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
template<int Current_Dim0, int Current_Dim1, int Current_Dim2, int Current_Dim3>
void FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::increment ( const Number< Current_Dim0 > &  ,
const Number< Current_Dim1 > &  ,
const Number< Current_Dim2 > &  ,
const Number< Current_Dim3 > &   
) const
inline

Definition at line 208 of file Tensor4_pointer.hpp.

210  {
211  data[Current_Dim0 - 1][Current_Dim1 - 1][Current_Dim2 - 1]
212  [Current_Dim3 - 1] += inc;
213  }

◆ operator()() [1/4]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
template<char i, char j, char k, char l, int Dim0, int Dim1, int Dim2, int Dim3>
Tensor4_Expr< Tensor4<T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3>, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l> FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >  ,
const Index< k, Dim2 >  ,
const Index< l, Dim3 >   
)
inline

Definition at line 181 of file Tensor4_pointer.hpp.

183  {
184  return Tensor4_Expr<
185  Tensor4<T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3>, T,
186  Dim0, Dim1, Dim2, Dim3, i, j, k, l>(*this);
187  }

◆ operator()() [2/4]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
template<char i, char j, char k, char l, int Dim0, int Dim1, int Dim2, int Dim3>
Tensor4_Expr< const Tensor4<T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3>, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l> FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >  ,
const Index< k, Dim2 >  ,
const Index< l, Dim3 >   
) const
inline

Definition at line 194 of file Tensor4_pointer.hpp.

196  {
197  return Tensor4_Expr<
198  const Tensor4<T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3>,
199  T, Dim0, Dim1, Dim2, Dim3, i, j, k, l>(*this);
200  }

◆ operator()() [3/4]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
T& FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::operator() ( const int  N1,
const int  N2,
const int  N3,
const int  N4 
)
inline

Definition at line 141 of file Tensor4_pointer.hpp.

142  {
143 #ifdef FTENSOR_DEBUG
144  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0 || N3 >= Tensor_Dim2 || N3 < 0 || N4 >= Tensor_Dim3 || N4 < 0)
145  {
146  std::stringstream s;
147  s << "Bad index in Tensor4<T," << Tensor_Dim0 << "," << Tensor_Dim1
148  << "," << Tensor_Dim2 << "," << Tensor_Dim3 << ">.operator(" << N1
149  << "," << N2 << "," << N3 << "," << N4 << ") const" << std::endl;
150  throw std::runtime_error(s.str());
151  }
152 #endif
153  return *data[N1][N2][N3][N4];
154  }

◆ operator()() [4/4]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
T FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::operator() ( const int  N1,
const int  N2,
const int  N3,
const int  N4 
) const
inline

Definition at line 156 of file Tensor4_pointer.hpp.

157  {
158 #ifdef FTENSOR_DEBUG
159  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0 || N3 >= Tensor_Dim2 || N3 < 0 || N4 >= Tensor_Dim3 || N4 < 0)
160  {
161  std::stringstream s;
162  s << "Bad index in Tensor4<T," << Tensor_Dim0 << "," << Tensor_Dim1
163  << "," << Tensor_Dim2 << "," << Tensor_Dim3 << ">.operator(" << N1
164  << "," << N2 << "," << N3 << "," << N4 << ") const" << std::endl;
165  throw std::runtime_error(s.str());
166  }
167 #endif
168  return *data[N1][N2][N3][N4];
169  }

◆ operator++()

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

Definition at line 215 of file Tensor4_pointer.hpp.

216  {
217  T4_increment(*this, Number<Tensor_Dim0>(), Number<Tensor_Dim1>(),
218  Number<Tensor_Dim2>(), Number<Tensor_Dim3>());
219  return *this;
220  }

◆ ptr() [1/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
T* restrict& FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::ptr ( const int  N1,
const int  N2,
const int  N3,
const int  N4 
)
inline

Definition at line 238 of file Tensor4_pointer.hpp.

239  {
240 #ifdef FTENSOR_DEBUG
241  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0 ||
242  N3 >= Tensor_Dim2 || N3 < 0 || N4 >= Tensor_Dim3 || N4 < 0)
243  {
244  std::stringstream s;
245  s << "Bad index in Tensor4<T*," << Tensor_Dim0 << "," << Tensor_Dim1
246  << "," << Tensor_Dim2 << "," << Tensor_Dim3 << ">.ptr(" << N1 << ","
247  << N2 << "," << N3 << "," << N4 << ")" << std::endl;
248  throw std::out_of_range(s.str());
249  }
250 #endif
251  return data[N1][N2][N3][N4];
252  }

◆ ptr() [2/2]

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
T* FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::ptr ( const int  N1,
const int  N2,
const int  N3,
const int  N4 
) const
inline

Definition at line 222 of file Tensor4_pointer.hpp.

223  {
224 #ifdef FTENSOR_DEBUG
225  if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0 ||
226  N3 >= Tensor_Dim2 || N3 < 0 || N4 >= Tensor_Dim3 || N4 < 0)
227  {
228  std::stringstream s;
229  s << "Bad index in Tensor4<T*," << Tensor_Dim0 << "," << Tensor_Dim1
230  << "," << Tensor_Dim2 << "," << Tensor_Dim3 << ">.ptr(" << N1 << ","
231  << N2 << "," << N3 << "," << N4 << ")" << std::endl;
232  throw std::out_of_range(s.str());
233  }
234 #endif
235  return data[N1][N2][N3][N4];
236  }

Member Data Documentation

◆ data

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

Definition at line 73 of file Tensor4_pointer.hpp.

◆ inc

template<class T , int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2, int Tensor_Dim3>
const int FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::inc
private

Definition at line 69 of file Tensor4_pointer.hpp.


The documentation for this class was generated from the following file:
FTensor::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::data
T *restrict data[Tensor_Dim0][Tensor_Dim1][Tensor_Dim2][Tensor_Dim3]
Definition: Tensor4_pointer.hpp:73
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::Tensor4< T *, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3 >::inc
const int inc
Definition: Tensor4_pointer.hpp:69
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::T4_increment
void T4_increment(const Tensor4< T, Dim0, Dim1, Dim2, Dim3 > &iter, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &, const Number< Current_Dim2 > &, const Number< Current_Dim3 > &)
Definition: Tensor4_pointer.hpp:10
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21