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

#include <src/ftensor/src/FTensor/Tensor1/Tensor1_pointer.hpp>

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

Public Member Functions

 Tensor1 (T *d0, const int i=1)
 
 Tensor1 (T *d0, T *d1, const int i=1)
 
 Tensor1 (T *d0, T *d1, T *d2, const int i=1)
 
 Tensor1 (T *d0, T *d1, T *d2, T *d3, const int i=1)
 
 Tensor1 (T *d0, T *d1, T *d2, T *d3, T *d4, T *d5, const int i=1)
 
 Tensor1 (T *d0, T *d1, T *d2, T *d3, T *d4, T *d5, T *d6, T *d7, const int i=1)
 
 Tensor1 (T *d0, T *d1, T *d2, T *d3, T *d4, T *d5, T *d6, T *d7, T *d8, const int i=1)
 
template<class... U>
 Tensor1 (U *... d)
 
template<class U >
 Tensor1 (std::array< U *, Tensor_Dim > &a, const int i=1)
 
 Tensor1 (const int i=1)
 
Tensor1< T, Tensor_Dim > normalize ()
 
l2 () const
 
template<int Current_Dim>
l2_squared (const Number< Current_Dim > &) const
 
l2_squared (const Number< 1 > &) const
 
T & operator() (const int N)
 
operator() (const int N) const
 
T * ptr (const int N) const
 
T *& ptr (const int N)
 
template<char i, int Dim>
Tensor1_Expr< Tensor1< T *, Tensor_Dim >, T, Dim, ioperator() (const Index< i, Dim > &index)
 
template<char i, int Dim>
Tensor1_Expr< const Tensor1< T *, Tensor_Dim >, T, Dim, ioperator() (const Index< i, Dim > &index) const
 
const Tensor1operator++ () const
 

Protected Attributes

const int inc
 
T *restrict data [Tensor_Dim]
 

Private Member Functions

template<int I>
 Tensor1 (const Tensor1< PackPtr< T *, I >, Tensor_Dim > &)=delete
 Preventing casting on derived class. More...
 

Detailed Description

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

Definition at line 9 of file Tensor1_pointer.hpp.

Constructor & Destructor Documentation

◆ Tensor1() [1/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
const int  i = 1 
)
inline

Definition at line 24 of file Tensor1_pointer.hpp.

24  : inc(i) {
25  Tensor1_constructor<T * restrict, Tensor_Dim>(data, d0);
26  }

◆ Tensor1() [2/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
T *  d1,
const int  i = 1 
)
inline

Definition at line 27 of file Tensor1_pointer.hpp.

27  : inc(i) {
28  Tensor1_constructor<T * restrict, Tensor_Dim>(data, d0, d1);
29  }

◆ Tensor1() [3/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
T *  d1,
T *  d2,
const int  i = 1 
)
inline

Definition at line 30 of file Tensor1_pointer.hpp.

30  : inc(i) {
31  Tensor1_constructor<T * restrict, Tensor_Dim>(data, d0, d1, d2);
32  }

◆ Tensor1() [4/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
T *  d1,
T *  d2,
T *  d3,
const int  i = 1 
)
inline

Definition at line 33 of file Tensor1_pointer.hpp.

33  : inc(i) {
34  Tensor1_constructor<T * restrict, Tensor_Dim>(data, d0, d1, d2, d3);
35  }

◆ Tensor1() [5/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
T *  d1,
T *  d2,
T *  d3,
T *  d4,
T *  d5,
const int  i = 1 
)
inline

Definition at line 36 of file Tensor1_pointer.hpp.

36  : inc(i) {
37  Tensor1_constructor<T *restrict, Tensor_Dim>(data, d0, d1, d2, d3, d4, d5);
38  }

◆ Tensor1() [6/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
T *  d1,
T *  d2,
T *  d3,
T *  d4,
T *  d5,
T *  d6,
T *  d7,
const int  i = 1 
)
inline

Definition at line 39 of file Tensor1_pointer.hpp.

41  : inc(i) {
42  Tensor1_constructor<T *restrict, Tensor_Dim>(data, d0, d1, d2, d3, d4, d5,
43  d6, d7);
44  }

◆ Tensor1() [7/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( T *  d0,
T *  d1,
T *  d2,
T *  d3,
T *  d4,
T *  d5,
T *  d6,
T *  d7,
T *  d8,
const int  i = 1 
)
inline

Definition at line 45 of file Tensor1_pointer.hpp.

47  : inc(i) {
48  Tensor1_constructor<T *restrict, Tensor_Dim>(data, d0, d1, d2, d3, d4, d5,
49  d6, d7, d8);
50  }

◆ Tensor1() [8/11]

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

Definition at line 52 of file Tensor1_pointer.hpp.

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

◆ Tensor1() [9/11]

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

Definition at line 56 of file Tensor1_pointer.hpp.

56  : inc(i) {
57  std::copy(a.begin(), a.end(), data);
58  }

◆ Tensor1() [10/11]

template<class T , int Tensor_Dim>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( const int  i = 1)
inline

Definition at line 60 of file Tensor1_pointer.hpp.

60 : inc(i) {}

◆ Tensor1() [11/11]

template<class T , int Tensor_Dim>
template<int I>
FTensor::Tensor1< T *, Tensor_Dim >::Tensor1 ( const Tensor1< PackPtr< T *, I >, Tensor_Dim > &  )
privatedelete

Preventing casting on derived class.

That can be source of errors

Member Function Documentation

◆ l2()

template<class T , int Tensor_Dim>
T FTensor::Tensor1< T *, Tensor_Dim >::l2 ( ) const
inline

Definition at line 68 of file Tensor1_pointer.hpp.

68 { return sqrt(l2_squared(Number<Tensor_Dim>())); }

◆ l2_squared() [1/2]

template<class T , int Tensor_Dim>
T FTensor::Tensor1< T *, Tensor_Dim >::l2_squared ( const Number< 1 > &  ) const
inline

Definition at line 74 of file Tensor1_pointer.hpp.

74 { return (*data[0]) * (*data[0]); }

◆ l2_squared() [2/2]

template<class T , int Tensor_Dim>
template<int Current_Dim>
T FTensor::Tensor1< T *, Tensor_Dim >::l2_squared ( const Number< Current_Dim > &  ) const
inline

Definition at line 70 of file Tensor1_pointer.hpp.

70  {
71  return (*data[Current_Dim - 1]) * (*data[Current_Dim - 1]) +
72  l2_squared(Number<Current_Dim - 1>());
73  }

◆ normalize()

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

Definition at line 62 of file Tensor1_pointer.hpp.

62  {
64  (*this)(a) /= l2();
65  return *this;
66  }

◆ operator()() [1/4]

template<class T , int Tensor_Dim>
template<char i, int Dim>
Tensor1_Expr<Tensor1<T *, Tensor_Dim>, T, Dim, i> FTensor::Tensor1< T *, Tensor_Dim >::operator() ( const Index< i, Dim > &  index)
inline

Definition at line 137 of file Tensor1_pointer.hpp.

138  {
139  return Tensor1_Expr<Tensor1<T *, Tensor_Dim>, T, Dim, i>(*this);
140  }

◆ operator()() [2/4]

template<class T , int Tensor_Dim>
template<char i, int Dim>
Tensor1_Expr<const Tensor1<T *, Tensor_Dim>, T, Dim, i> FTensor::Tensor1< T *, Tensor_Dim >::operator() ( const Index< i, Dim > &  index) const
inline

Definition at line 144 of file Tensor1_pointer.hpp.

145  {
146  return Tensor1_Expr<const Tensor1<T *, Tensor_Dim>, T, Dim, i>(*this);
147  }

◆ operator()() [3/4]

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

Definition at line 79 of file Tensor1_pointer.hpp.

79  {
80 #ifdef FTENSOR_DEBUG
81  if(N >= Tensor_Dim || N < 0)
82  {
83  std::stringstream s;
84  s << "Bad index in Tensor1<T*," << Tensor_Dim << ">.operator(" << N
85  << ")" << std::endl;
86  throw std::out_of_range(s.str());
87  }
88 #endif
89  return *data[N];
90  }

◆ operator()() [4/4]

template<class T , int Tensor_Dim>
T FTensor::Tensor1< T *, Tensor_Dim >::operator() ( const int  N) const
inline

Definition at line 91 of file Tensor1_pointer.hpp.

92  {
93 #ifdef FTENSOR_DEBUG
94  if(N >= Tensor_Dim || N < 0)
95  {
96  std::stringstream s;
97  s << "Bad index in Tensor1<T*," << Tensor_Dim << ">.operator(" << N
98  << ") const" << std::endl;
99  throw std::out_of_range(s.str());
100  }
101 #endif
102  return *data[N];
103  }

◆ operator++()

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

Definition at line 152 of file Tensor1_pointer.hpp.

153  {
154  for(int i = 0; i < Tensor_Dim; ++i)
155  data[i] += inc;
156  return *this;
157  }

◆ ptr() [1/2]

template<class T , int Tensor_Dim>
T*& FTensor::Tensor1< T *, Tensor_Dim >::ptr ( const int  N)
inline

Definition at line 118 of file Tensor1_pointer.hpp.

118  {
119 #ifdef FTENSOR_DEBUG
120  if (N >= Tensor_Dim || N < 0) {
121  std::stringstream s;
122  s << "Bad index in Tensor1<T*," << Tensor_Dim << ">.ptr(" << N << ")"
123  << std::endl;
124  throw std::out_of_range(s.str());
125  }
126 #endif
127  return data[N];
128  }

◆ ptr() [2/2]

template<class T , int Tensor_Dim>
T* FTensor::Tensor1< T *, Tensor_Dim >::ptr ( const int  N) const
inline

Definition at line 104 of file Tensor1_pointer.hpp.

105  {
106 #ifdef FTENSOR_DEBUG
107  if(N >= Tensor_Dim || N < 0)
108  {
109  std::stringstream s;
110  s << "Bad index in Tensor1<T*," << Tensor_Dim << ">.ptr(" << N << ")"
111  << std::endl;
112  throw std::out_of_range(s.str());
113  }
114 #endif
115  return data[N];
116  }

Member Data Documentation

◆ data

template<class T , int Tensor_Dim>
T* restrict FTensor::Tensor1< T *, Tensor_Dim >::data[Tensor_Dim]
mutableprotected

Definition at line 17 of file Tensor1_pointer.hpp.

◆ inc

template<class T , int Tensor_Dim>
const int FTensor::Tensor1< T *, Tensor_Dim >::inc
protected

Definition at line 12 of file Tensor1_pointer.hpp.


The documentation for this class was generated from the following file:
d3
static constexpr std::array< double, 3 > d3
Definition: prism_elements_from_surface.cpp:20
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
Index
Definition: single.cpp:3
FTensor::Tensor1< T *, Tensor_Dim >::inc
const int inc
Definition: Tensor1_pointer.hpp:12
FTensor::Tensor1< T *, Tensor_Dim >::l2_squared
T l2_squared(const Number< Current_Dim > &) const
Definition: Tensor1_pointer.hpp:70
a
constexpr double a
Definition: approx_sphere.cpp:30
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
d4
static constexpr std::array< double, 3 > d4
Definition: prism_elements_from_surface.cpp:21
FTensor::Tensor1< T *, Tensor_Dim >::l2
T l2() const
Definition: Tensor1_pointer.hpp:68
FTensor::Tensor1< T *, Tensor_Dim >::data
T *restrict data[Tensor_Dim]
Definition: Tensor1_pointer.hpp:17