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

#include <src/ftensor/src/FTensor/Tensor2_symmetric/Tensor2_symmetric_pointer.hpp>

Inheritance diagram for FTensor::Tensor2_symmetric< T *, Tensor_Dim >:
[legend]
Collaboration diagram for FTensor::Tensor2_symmetric< T *, Tensor_Dim >:
[legend]

Public Member Functions

template<class... U>
 Tensor2_symmetric (U *... d)
 
template<class... U>
 Tensor2_symmetric (const int i, U *... d)
 
 Tensor2_symmetric ()
 
 Tensor2_symmetric (T *d00, T *d01, T *d11, const int i=1)
 
 Tensor2_symmetric (T *d00, T *d01, T *d02, T *d11, T *d12, T *d22, 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_symmetric< T *, Tensor_Dim >, T, Dim0, Dim1, i, joperator() (const Index< i, Dim0 > index1, const Index< j, Dim1 > index2)
 
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr< const Tensor2_symmetric< T *, Tensor_Dim >, T, Dim0, Dim1, i, joperator() (const Index< i, Dim0 > index1, const Index< j, Dim1 > index2) const
 
template<char i, char j, int Dim>
Tensor2_symmetric_Expr< Tensor2_symmetric< T *, Tensor_Dim >, T, Dim, i, joperator() (const Index< i, Dim > index1, const Index< j, Dim > index2)
 
template<char i, char j, int Dim>
Tensor2_symmetric_Expr< const Tensor2_symmetric< T *, Tensor_Dim >, T, Dim, i, joperator() (const Index< i, Dim > index1, const Index< j, Dim > index2) const
 
template<char i, int N, int Dim>
Tensor1_Expr< Tensor2_number_rhs_1< Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, ioperator() (const Index< i, Dim > index1, const Number< N > &n1)
 
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_1< const Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, ioperator() (const Index< i, Dim > index1, const Number< N > &n1) const
 
template<char i, int N, int Dim>
Tensor1_Expr< Tensor2_number_rhs_0< Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, ioperator() (const Number< N > &n1, const Index< i, Dim > index1)
 
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_0< const Tensor2_symmetric< T *, Tensor_Dim >, T, N >, T, Dim, ioperator() (const Number< N > &n1, const Index< i, Dim > index1) const
 
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_1< const Tensor2_symmetric< T *, Tensor_Dim >, T >, T, Dim, ioperator() (const Index< i, Dim > index1, const int N) const
 
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_0< const Tensor2_symmetric< T *, Tensor_Dim >, T >, T, Dim, ioperator() (const int N, const Index< i, Dim > index1) const
 
const Tensor2_symmetric< T *, Tensor_Dim > & operator++ () const
 
template<char i, int Dim>
operator() (const Index< i, Dim > index1, const Index< i, Dim > index2)
 
template<char i, int Dim>
operator() (const Index< i, Dim > index1, const Index< i, Dim > index2) const
 

Protected Attributes

T *restrict data [(Tensor_Dim *(Tensor_Dim+1))/2]
 

Private Member Functions

template<int N>
internal_contract (Number< N >) const
 
internal_contract (Number< 1 >) const
 

Private Attributes

const int inc
 

Detailed Description

template<class T, int Tensor_Dim>
class FTensor::Tensor2_symmetric< T *, Tensor_Dim >

Definition at line 7 of file Tensor2_symmetric_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor2_symmetric() [1/5]

template<class T , int Tensor_Dim>
template<class... U>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( U *...  d)
inlineexplicit

Definition at line 17 of file Tensor2_symmetric_pointer.hpp.

17  : data{d...}, inc(1) {
18  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
19  "Incorrect number of Arguments. Constructor should "
20  "initialize the entire Tensor");
21  }

◆ Tensor2_symmetric() [2/5]

template<class T , int Tensor_Dim>
template<class... U>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( const int  i,
U *...  d 
)
inlineexplicit

Definition at line 24 of file Tensor2_symmetric_pointer.hpp.

24  : data{d...}, inc(i) {
25  static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
26  "Incorrect number of Arguments. Constructor should "
27  "initialize the entire Tensor");
28  }

◆ Tensor2_symmetric() [3/5]

template<class T , int Tensor_Dim>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( )
inline

Definition at line 30 of file Tensor2_symmetric_pointer.hpp.

30 {}

◆ Tensor2_symmetric() [4/5]

template<class T , int Tensor_Dim>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( T *  d00,
T *  d01,
T *  d11,
const int  i = 1 
)
inline

Definition at line 33 of file Tensor2_symmetric_pointer.hpp.

33  : inc(i)
34  {
35  Tensor2_symmetric_constructor<T * restrict, Tensor_Dim>(data, d00, d01,
36  d11);
37  }

◆ Tensor2_symmetric() [5/5]

template<class T , int Tensor_Dim>
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::Tensor2_symmetric ( T *  d00,
T *  d01,
T *  d02,
T *  d11,
T *  d12,
T *  d22,
const int  i = 1 
)
inline

Definition at line 40 of file Tensor2_symmetric_pointer.hpp.

42  : inc(i) {
43  Tensor2_symmetric_constructor<T * restrict, Tensor_Dim>(
44  data, d00, d01, d02, d11, d12, d22);
45  }

Member Function Documentation

◆ internal_contract() [1/2]

template<class T , int Tensor_Dim>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::internal_contract ( Number< 1 >  ) const
inlineprivate

Definition at line 246 of file Tensor2_symmetric_pointer.hpp.

246 { return *data[0]; }

◆ internal_contract() [2/2]

template<class T , int Tensor_Dim>
template<int N>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::internal_contract ( Number< N ) const
inlineprivate

Definition at line 240 of file Tensor2_symmetric_pointer.hpp.

241  {
242  return *data[N - 1 + ((N - 1) * (2 * Tensor_Dim - N)) / 2]
243  + internal_contract(Number<N - 1>());
244  }

◆ operator()() [1/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< i, Dim >  index2 
)
inline

Definition at line 228 of file Tensor2_symmetric_pointer.hpp.

229  {
230  return internal_contract(Number<Dim>());
231  }

◆ operator()() [2/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< i, Dim >  index2 
) const
inline

Definition at line 234 of file Tensor2_symmetric_pointer.hpp.

235  {
236  return internal_contract(Number<Dim>());
237  }

◆ operator()() [3/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim>
Tensor2_symmetric_Expr<Tensor2_symmetric<T *, Tensor_Dim>, T, Dim, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< j, Dim >  index2 
)
inline

Definition at line 124 of file Tensor2_symmetric_pointer.hpp.

125  {
126  return Tensor2_symmetric_Expr<Tensor2_symmetric<T *, Tensor_Dim>, T, Dim,
127  i, j>(*this);
128  }

◆ operator()() [4/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim>
Tensor2_symmetric_Expr<const Tensor2_symmetric<T *, Tensor_Dim>, T, Dim, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Index< j, Dim >  index2 
) const
inline

Definition at line 133 of file Tensor2_symmetric_pointer.hpp.

134  {
135  return Tensor2_symmetric_Expr<const Tensor2_symmetric<T *, Tensor_Dim>,
136  T, Dim, i, j>(*this);
137  }

◆ operator()() [5/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_1<const Tensor2_symmetric<T *, Tensor_Dim>, T>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const int  N 
) const
inline

Definition at line 194 of file Tensor2_symmetric_pointer.hpp.

195  {
196  using TensorExpr
197  = Tensor2_numeral_1<const Tensor2_symmetric<T *, Tensor_Dim>, T>;
198  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
199  }

◆ operator()() [6/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr<Tensor2_number_rhs_1<Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Number< N > &  n1 
)
inline

Definition at line 149 of file Tensor2_symmetric_pointer.hpp.

150  {
151  using TensorExpr
152  = Tensor2_number_rhs_1<Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
154  }

◆ operator()() [7/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_1<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim >  index1,
const Number< N > &  n1 
) const
inline

Definition at line 160 of file Tensor2_symmetric_pointer.hpp.

161  {
162  using TensorExpr
163  = Tensor2_number_1<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
164  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
165  }

◆ operator()() [8/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<Tensor2_symmetric<T *, Tensor_Dim>, T, Dim0, Dim1, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim0 >  index1,
const Index< j, Dim1 >  index2 
)
inline

Definition at line 105 of file Tensor2_symmetric_pointer.hpp.

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

◆ operator()() [9/14]

template<class T , int Tensor_Dim>
template<char i, char j, int Dim0, int Dim1>
Tensor2_Expr<const Tensor2_symmetric<T *, Tensor_Dim>, T, Dim0, Dim1, i, j> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Index< i, Dim0 >  index1,
const Index< j, Dim1 >  index2 
) const
inline

Definition at line 113 of file Tensor2_symmetric_pointer.hpp.

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

◆ operator()() [10/14]

template<class T , int Tensor_Dim>
template<char i, int Dim>
Tensor1_Expr< const Tensor2_numeral_0<const Tensor2_symmetric<T *, Tensor_Dim>, T>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const int  N,
const Index< i, Dim >  index1 
) const
inline

Definition at line 205 of file Tensor2_symmetric_pointer.hpp.

206  {
207  using TensorExpr
208  = Tensor2_numeral_0<const Tensor2_symmetric<T *, Tensor_Dim>, T>;
209  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
210  }

◆ operator()() [11/14]

template<class T , int Tensor_Dim>
T& FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const int  N1,
const int  N2 
)
inline

Definition at line 50 of file Tensor2_symmetric_pointer.hpp.

51  {
52 #ifdef FTENSOR_DEBUG
53  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
54  {
55  std::stringstream s;
56  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
57  << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
58  throw std::out_of_range(s.str());
59  }
60 #endif
61  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
62  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
63  }

◆ operator()() [12/14]

template<class T , int Tensor_Dim>
T FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const int  N1,
const int  N2 
) const
inline

Definition at line 65 of file Tensor2_symmetric_pointer.hpp.

66  {
67 #ifdef FTENSOR_DEBUG
68  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
69  {
70  std::stringstream s;
71  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim
72  << ">.operator(" << N1 << "," << N2 << ") const" << std::endl;
73  throw std::out_of_range(s.str());
74  }
75 #endif
76  return N1 > N2 ? *data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
77  : *data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
78  }

◆ operator()() [13/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr<Tensor2_number_rhs_0<Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Number< N > &  n1,
const Index< i, Dim >  index1 
)
inline

Definition at line 170 of file Tensor2_symmetric_pointer.hpp.

171  {
172  using TensorExpr
173  = Tensor2_number_rhs_0<Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
175  }

◆ operator()() [14/14]

template<class T , int Tensor_Dim>
template<char i, int N, int Dim>
Tensor1_Expr< const Tensor2_number_0<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>, T, Dim, i> FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator() ( const Number< N > &  n1,
const Index< i, Dim >  index1 
) const
inline

Definition at line 181 of file Tensor2_symmetric_pointer.hpp.

182  {
183  using TensorExpr
184  = Tensor2_number_0<const Tensor2_symmetric<T *, Tensor_Dim>, T, N>;
185  return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
186  }

◆ operator++()

template<class T , int Tensor_Dim>
const Tensor2_symmetric<T *, Tensor_Dim>& FTensor::Tensor2_symmetric< T *, Tensor_Dim >::operator++ ( ) const
inline

Definition at line 215 of file Tensor2_symmetric_pointer.hpp.

216  {
217  for(int i = 0; i < (Tensor_Dim * (Tensor_Dim + 1)) / 2; ++i)
218  data[i] += inc;
219  return *this;
220  }

◆ ptr()

template<class T , int Tensor_Dim>
T* FTensor::Tensor2_symmetric< T *, Tensor_Dim >::ptr ( const int  N1,
const int  N2 
) const
inline

Definition at line 80 of file Tensor2_symmetric_pointer.hpp.

81  {
82 #ifdef FTENSOR_DEBUG
83  if(N1 >= Tensor_Dim || N1 < 0 || N2 >= Tensor_Dim || N2 < 0)
84  {
85  std::stringstream s;
86  s << "Bad index in Tensor2_symmetric<T*," << Tensor_Dim << ">.ptr("
87  << N1 << "," << N2 << ")" << std::endl;
88  throw std::out_of_range(s.str());
89  }
90 #endif
91  return N1 > N2 ? data[N1 + (N2 * (2 * Tensor_Dim - N2 - 1)) / 2]
92  : data[N2 + (N1 * (2 * Tensor_Dim - N1 - 1)) / 2];
93  }

Member Data Documentation

◆ data

template<class T , int Tensor_Dim>
T* restrict FTensor::Tensor2_symmetric< T *, Tensor_Dim >::data[(Tensor_Dim *(Tensor_Dim+1))/2]
mutableprotected

Definition at line 13 of file Tensor2_symmetric_pointer.hpp.

◆ inc

template<class T , int Tensor_Dim>
const int FTensor::Tensor2_symmetric< T *, Tensor_Dim >::inc
private

Definition at line 9 of file Tensor2_symmetric_pointer.hpp.


The documentation for this class was generated from the following file:
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::internal_contract
T internal_contract(Number< N >) const
Definition: Tensor2_symmetric_pointer.hpp:240
FTensor::Tensor2_symmetric< T *, Tensor_Dim >::data
T *restrict data[(Tensor_Dim *(Tensor_Dim+1))/2]
Definition: Tensor2_symmetric_pointer.hpp:13
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_symmetric< T *, Tensor_Dim >::inc
const int inc
Definition: Tensor2_symmetric_pointer.hpp:9
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
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