v0.13.1
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 > Class Template Reference

#include <src/ftensor/src/FTensor/Tensor2/Tensor2_value.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

template<class... U>
 Tensor2 (U... d)
 
 Tensor2 ()
 
Tptr (const int N1, const int N2) const
 
Toperator() (const int N1, const int N2)
 
T operator() (const int N1, const int N2) const
 
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >=Dim0 &&Tensor_Dim1 >=Dim1), Tensor2_Expr< Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > >::type operator() (const Index< i, Dim0 >, const Index< j, Dim1 >)
 
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >=Dim0 &&Tensor_Dim1 >=Dim1), Tensor2_Expr< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > >::type operator() (const Index< i, Dim0 >, const Index< j, Dim1 >) const
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >N), Tensor1_Expr< Tensor2_number_rhs_1< Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > >::type operator() (const Index< i, Dim >, const Number< N >)
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >N &&Tensor_Dim1 >=Dim), Tensor1_Expr< Tensor2_number_rhs_0< Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > >::type operator() (const Number< N >, const Index< i, Dim >)
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >N), Tensor1_Expr< constTensor2_number_1< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > >::type operator() (const Index< i, Dim >, const Number< N >) const
 
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >N &&Tensor_Dim1 >=Dim), Tensor1_Expr< constTensor2_number_0< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > >::type operator() (const Number< N >, const Index< i, Dim >) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim), Tensor1_Expr< Tensor2_numeral_1< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > >::type operator() (const Index< i, Dim >, const int N) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim1 >=Dim), Tensor1_Expr< Tensor2_numeral_0< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > >::type operator() (const int N, const Index< i, Dim >) const
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >=Dim), T >::type operator() (const Index< i, Dim >, const Index< i, Dim >)
 
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >=Dim), T >::type operator() (const Index< i, Dim >, const Index< i, Dim >) const
 

Private Member Functions

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

Private Attributes

T data [Tensor_Dim0][Tensor_Dim1]
 

Detailed Description

template<class T, int Tensor_Dim0, int Tensor_Dim1>
class FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >
Examples
ContactOps.hpp, ElasticityMixedFormulation.hpp, EshelbianOperators.cpp, EshelbianPlasticity.cpp, HookeElement.cpp, HookeElement.hpp, HookeInternalStressElement.hpp, NavierStokesElement.cpp, NavierStokesElement.hpp, NeoHookean.hpp, PlasticOps.hpp, PlasticOpsGeneric.hpp, PlasticOpsLargeStrains.hpp, PlasticOpsSmallStrains.hpp, Remodeling.cpp, Remodeling.hpp, approx_sphere.cpp, hcurl_check_approx_in_2d.cpp, higher_derivatives.cpp, lorentz_force.cpp, matrix_function.cpp, plate.cpp, shallow_wave.cpp, and simple_elasticity.cpp.

Definition at line 16 of file Tensor2_value.hpp.

Constructor & Destructor Documentation

◆ Tensor2() [1/2]

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 22 of file Tensor2_value.hpp.

22 : data{d...}
23 {
24 static_assert(sizeof...(d) == sizeof(data) / sizeof(T),
25 "Incorrect number of Arguments. Constructor should "
26 "initialize the entire Tensor");
27 }
T data[Tensor_Dim0][Tensor_Dim1]
const double T
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

◆ Tensor2() [2/2]

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

Definition at line 29 of file Tensor2_value.hpp.

29{}

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 220 of file Tensor2_value.hpp.

220{ 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 215 of file Tensor2_value.hpp.

216 {
217 return data[N - 1][N - 1] + internal_contract(Number<N - 1>());
218 }
T internal_contract(Number< N >) const
const int N
Definition: speed_test.cpp:3

◆ operator()() [1/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >=Dim), T >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
)
inline

Definition at line 202 of file Tensor2_value.hpp.

203 {
204 return internal_contract(Number<Dim>());
205 }

◆ operator()() [2/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >=Dim), T >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Index< i, Dim >   
) const
inline

Definition at line 209 of file Tensor2_value.hpp.

210 {
211 return internal_contract(Number<Dim>());
212 }

◆ operator()() [3/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim>
std::enable_if<(Tensor_Dim0 >=Dim), Tensor1_Expr< Tensor2_numeral_1< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const int  N 
) const
inline

Definition at line 175 of file Tensor2_value.hpp.

176 {
177 using TensorExpr
178 = Tensor2_numeral_1<const Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T>;
179 return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
180 }

◆ operator()() [4/12]

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

Definition at line 115 of file Tensor2_value.hpp.

116 {
117 using TensorExpr
118 = Tensor2_number_rhs_1<Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T, N>;
120 }

◆ operator()() [5/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >=Dim &&Tensor_Dim1 >N), Tensor1_Expr< constTensor2_number_1< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim >  ,
const Number< N  
) const
inline

Definition at line 141 of file Tensor2_value.hpp.

142 {
143 using TensorExpr
144 = Tensor2_number_1<const Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T, N>;
145 return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
146 }

◆ operator()() [6/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >=Dim0 &&Tensor_Dim1 >=Dim1), Tensor2_Expr< Tensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
)
inline

Definition at line 85 of file Tensor2_value.hpp.

86 {
87 return Tensor2_Expr<Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T, Dim0, Dim1,
88 i, j>(*this);
89 }
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j

◆ operator()() [7/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, char j, int Dim0, int Dim1>
std::enable_if<(Tensor_Dim0 >=Dim0 &&Tensor_Dim1 >=Dim1), Tensor2_Expr< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Index< i, Dim0 >  ,
const Index< j, Dim1 >   
) const
inline

Definition at line 96 of file Tensor2_value.hpp.

97 {
98 return Tensor2_Expr<const Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T, Dim0,
99 Dim1, i, j>(*this);
100 }

◆ operator()() [8/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim>
std::enable_if<(Tensor_Dim1 >=Dim), Tensor1_Expr< Tensor2_numeral_0< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T >, T, Dim, i > >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const int  N,
const Index< i, Dim >   
) const
inline

Definition at line 188 of file Tensor2_value.hpp.

189 {
190 using TensorExpr
191 = Tensor2_numeral_0<const Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T>;
192 return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this, N));
193 }

◆ operator()() [9/12]

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 48 of file Tensor2_value.hpp.

49 {
50#ifdef FTENSOR_DEBUG
51 if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0)
52 {
53 std::stringstream s;
54 s << "Bad index in Tensor2<T," << Tensor_Dim0 << "," << Tensor_Dim1
55 << ">.operator(" << N1 << "," << N2 << ")" << std::endl;
56 throw std::out_of_range(s.str());
57 }
58#endif
59 return data[N1][N2];
60 }
static Number< 2 > N2
static Number< 1 > N1

◆ operator()() [10/12]

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 62 of file Tensor2_value.hpp.

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

◆ operator()() [11/12]

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

Definition at line 128 of file Tensor2_value.hpp.

129 {
130 using TensorExpr
131 = Tensor2_number_rhs_0<Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T, N>;
133 }

◆ operator()() [12/12]

template<class T , int Tensor_Dim0, int Tensor_Dim1>
template<char i, int Dim, int N>
std::enable_if<(Tensor_Dim0 >N &&Tensor_Dim1 >=Dim), Tensor1_Expr< constTensor2_number_0< constTensor2< T, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > >::type FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::operator() ( const Number< N ,
const Index< i, Dim >   
) const
inline

Definition at line 154 of file Tensor2_value.hpp.

155 {
156 using TensorExpr
157 = Tensor2_number_0<const Tensor2<T, Tensor_Dim0, Tensor_Dim1>, T, N>;
158 return Tensor1_Expr<TensorExpr, T, Dim, i>(TensorExpr(*this));
159 }

◆ 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 33 of file Tensor2_value.hpp.

33 {
34#ifdef FTENSOR_DEBUG
35 if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
36 std::stringstream s;
37 s << "Bad index in Tensor2<T*," << Tensor_Dim0 << "," << Tensor_Dim1
38 << ">.ptr(" << N1 << "," << N2 << ")" << std::endl;
39 throw std::out_of_range(s.str());
40 }
41#endif
42 return &data[N1][N2];
43 }

Member Data Documentation

◆ data

template<class T , int Tensor_Dim0, int Tensor_Dim1>
T FTensor::Tensor2< T, Tensor_Dim0, Tensor_Dim1 >::data[Tensor_Dim0][Tensor_Dim1]
private

Definition at line 18 of file Tensor2_value.hpp.


The documentation for this class was generated from the following files: