PLaSK library
Loading...
Searching...
No Matches
plask::Tensor3< T > Struct Template Reference

Non-diagonal tensor with all non-diagonal lateral projection. More...

#include <plask/vector/tensor3.hpp>

Collaboration diagram for plask::Tensor3< T >:
[legend]

Public Member Functions

T & tran ()
 
const T & lon () const
 
T & lon ()
 
const T & tran () const
 
T & vert ()
 
const T & vert () const
 
 Tensor3 ()
 Construct uninitialized Tensor.
 
template<typename OtherT >
 Tensor3 (const Tensor3< OtherT > &p)
 Copy constructor from all other 3d tensors.
 
 Tensor3 (const T &val)
 Construct isotropic tensor.
 
 Tensor3 (const T &c00, const T &c22)
 Construct tensor with given diagonal values.
 
 Tensor3 (const T &c00, const T &c11, const T &c22)
 Construct tensors with given diagonal values.
 
 Tensor3 (const T &c00, const T &c11, const T &c22, const T &c01)
 Construct tensors with given lateral Hermitian values.
 
 Tensor3 (const T &c00, const T &c11, const T &c22, const T &c01, const T &c10)
 Construct tensors with given lateral values.
 
 Tensor3 (const T &c00, const T &c11, const T &c22, const T &c01, const T &c02, const T &c12)
 Construct tensors with given Hermitian values.
 
 Tensor3 (const T &c00, const T &c11, const T &c22, const T &c01, const T &c10, const T &c02, const T &c20, const T &c12, const T &c21)
 Construct tensors with given all values.
 
template<typename T0 , typename T1 >
 Tensor3 (const std::pair< T0, T1 > &comp)
 Construct tensor components given in std::pair.
 
 Tensor3 (const Tensor2< T > &tens)
 Construct tensor from 2D tensor.
 
 Tensor3 (const Vec< 2, T > &vec)
 Construct tensor from 2D vector.
 
 Tensor3 (const Vec< 3, T > &vec)
 Construct tensor from 3D vector.
 
 Tensor3 (const T *data)
 Construct tensor from data.
 
T & operator[] (size_t i)
 Get i-th component WARNING This function does not check if it is valid (for efficiency reasons)
 
const T & operator[] (size_t i) const
 Get i-th component WARNING This function does not check if it is valid (for efficiency reasons)
 
T & operator() (size_t i, size_t j)
 Get ij component WARNING This function does not check if it is valid (for efficiency reasons)
 
const T & operator() (size_t i, size_t j) const
 Get ij component WARNING This function does not check if it is valid (for efficiency reasons)
 
 operator std::tuple< T, T, T, T, T, T, T, T, T > () const
 Convert to std::tuple.
 
template<typename OtherT >
bool operator== (const Tensor3< OtherT > &p) const
 Compare two tensors, this and p.
 
template<typename OtherT >
constexpr bool equals (const Tensor3< OtherT > &p) const
 Check if two tensors, this and p are almost equal.
 
template<typename OtherT >
bool operator!= (const Tensor3< OtherT > &p) const
 Compare two tensors, this and p.
 
template<typename OtherT >
auto operator+ (const Tensor3< OtherT > &other) const -> Tensor3< decltype(c00+other.c00)>
 Calculate sum of two tensors, this and other.
 
Tensor3< T > & operator+= (const Tensor3< T > &other)
 Increase coordinates of this tensor by coordinates of other tensor other.
 
template<typename OtherT >
auto operator- (const Tensor3< OtherT > &other) const -> Tensor3< decltype(c00 - other.c00)>
 Calculate difference of two tensors, this and other.
 
Tensor3< T > & operator-= (const Tensor3< T > &other)
 Decrease coordinates of this tensor by coordinates of other tensor other.
 
template<typename OtherT >
auto operator* (const OtherT scale) const -> Tensor3< decltype(c00 *scale)>
 Calculate this tensor multiplied by scalar scale.
 
Tensor3< T > & operator*= (const T scalar)
 Multiple coordinates of this tensor by scalar.
 
Tensor3< T > operator/ (const T scale) const
 Calculate this tensor divided by scalar scale.
 
Tensor3< T > & operator/= (const T scalar)
 Divide coordinates of this tensor by scalar.
 
Tensor3< T > operator- () const
 Calculate tensor opposite to this.
 
Tensor3< T > sqr () const
 Square each component of tensor.
 
Tensor3< T > pow (int n) const
 Power of tensor.
 
Tensor3< T > inv () const
 Inverse of the tensor https://www.wikihow.com/Find-the-Inverse-of-a-3x3-Matrix.
 

Public Attributes

c00
 Value of the tensor in LONG direction.
 
c01
 Non-diagonal component LONG-TRAN.
 
c02
 Non-diagonal component LONG-VERT.
 
c10
 Non-diagonal component TRAN-LONG.
 
c11
 Value of the tensor in TRAN direction.
 
c12
 Non-diagonal component TRAN-VERT.
 
c20
 Non-diagonal component VERT-LONG.
 
c21
 Non-diagonal component VERT-TRAN.
 
c22
 Value of the tensor in VERT direction.
 

Friends

std::ostream & operator<< (std::ostream &out, const Tensor3< T > &to_print)
 Print tensor to stream using format (where c00 and c11 are tensor components): [c00, c11].
 

Detailed Description

template<typename T>
struct plask::Tensor3< T >

Non-diagonal tensor with all non-diagonal lateral projection.

[ c00 c01 c02 ] [ c10 c11 c12 ] [ c20 c21 c22 ]

Definition at line 36 of file tensor3.hpp.

Constructor & Destructor Documentation

◆ Tensor3() [1/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( )
inline

Construct uninitialized Tensor.

Definition at line 59 of file tensor3.hpp.

◆ Tensor3() [2/14]

template<typename T >
template<typename OtherT >
plask::Tensor3< T >::Tensor3 ( const Tensor3< OtherT > &  p)
inline

Copy constructor from all other 3d tensors.

Parameters
ptensor to copy from

Definition at line 66 of file tensor3.hpp.

◆ Tensor3() [3/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  val)
inline

Construct isotropic tensor.

Parameters
valvalue

Definition at line 73 of file tensor3.hpp.

◆ Tensor3() [4/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  c00,
const T &  c22 
)
inline

Construct tensor with given diagonal values.

Parameters
c00,c22components

Definition at line 79 of file tensor3.hpp.

◆ Tensor3() [5/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  c00,
const T &  c11,
const T &  c22 
)
inline

Construct tensors with given diagonal values.

Parameters
c00,c11,c22components

Definition at line 85 of file tensor3.hpp.

◆ Tensor3() [6/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  c00,
const T &  c11,
const T &  c22,
const T &  c01 
)
inline

Construct tensors with given lateral Hermitian values.

Parameters
c00,c11,c22,c01components

Definition at line 92 of file tensor3.hpp.

◆ Tensor3() [7/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  c00,
const T &  c11,
const T &  c22,
const T &  c01,
const T &  c10 
)
inline

Construct tensors with given lateral values.

Parameters
c00,c11,c22,c01,c10components

Definition at line 99 of file tensor3.hpp.

◆ Tensor3() [8/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  c00,
const T &  c11,
const T &  c22,
const T &  c01,
const T &  c02,
const T &  c12 
)
inline

Construct tensors with given Hermitian values.

Parameters
c00,c11,c22,c01components

Definition at line 106 of file tensor3.hpp.

◆ Tensor3() [9/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T &  c00,
const T &  c11,
const T &  c22,
const T &  c01,
const T &  c10,
const T &  c02,
const T &  c20,
const T &  c12,
const T &  c21 
)
inline

Construct tensors with given all values.

Parameters
c00,c11,c22,c01,c02,c12components

Definition at line 113 of file tensor3.hpp.

◆ Tensor3() [10/14]

template<typename T >
template<typename T0 , typename T1 >
plask::Tensor3< T >::Tensor3 ( const std::pair< T0, T1 > &  comp)
inline

Construct tensor components given in std::pair.

Parameters
compcomponents

Definition at line 129 of file tensor3.hpp.

◆ Tensor3() [11/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const Tensor2< T > &  tens)
inline

Construct tensor from 2D tensor.

Parameters
tenstensor

Definition at line 136 of file tensor3.hpp.

◆ Tensor3() [12/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const Vec< 2, T > &  vec)
inline

Construct tensor from 2D vector.

Parameters
vecvector

Definition at line 143 of file tensor3.hpp.

◆ Tensor3() [13/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const Vec< 3, T > &  vec)
inline

Construct tensor from 3D vector.

Parameters
vecvector

Definition at line 149 of file tensor3.hpp.

◆ Tensor3() [14/14]

template<typename T >
plask::Tensor3< T >::Tensor3 ( const T *  data)
inline

Construct tensor from data.

Parameters
vecvector

Definition at line 155 of file tensor3.hpp.

Member Function Documentation

◆ equals()

template<typename T >
template<typename OtherT >
constexpr bool plask::Tensor3< T >::equals ( const Tensor3< OtherT > &  p) const
inlineconstexpr

Check if two tensors, this and p are almost equal.

Parameters
ptensors to compare
Returns
true only if this tensors and p have almost equals coordinates

Definition at line 228 of file tensor3.hpp.

◆ inv()

template<typename T >
Tensor3< T > plask::Tensor3< T >::inv ( ) const
inline

Inverse of the tensor https://www.wikihow.com/Find-the-Inverse-of-a-3x3-Matrix.

Returns
inverse of this

Definition at line 424 of file tensor3.hpp.

◆ lon() [1/2]

template<typename T >
T & plask::Tensor3< T >::lon ( )
inline

Definition at line 52 of file tensor3.hpp.

◆ lon() [2/2]

template<typename T >
const T & plask::Tensor3< T >::lon ( ) const
inline

Definition at line 50 of file tensor3.hpp.

◆ operator std::tuple< T, T, T, T, T, T, T, T, T >()

template<typename T >
plask::Tensor3< T >::operator std::tuple< T, T, T, T, T, T, T, T, T > ( ) const
inline

Convert to std::tuple.

Definition at line 211 of file tensor3.hpp.

◆ operator!=()

template<typename T >
template<typename OtherT >
bool plask::Tensor3< T >::operator!= ( const Tensor3< OtherT > &  p) const
inline

Compare two tensors, this and p.

Parameters
ptensor to compare
Returns
true only if this tensor and p don't have equals coordinates

Definition at line 238 of file tensor3.hpp.

◆ operator()() [1/2]

template<typename T >
T & plask::Tensor3< T >::operator() ( size_t  i,
size_t  j 
)
inline

Get ij component WARNING This function does not check if it is valid (for efficiency reasons)

Parameters
i,jcoordinates
Returns
ij tensor component

Definition at line 194 of file tensor3.hpp.

◆ operator()() [2/2]

template<typename T >
const T & plask::Tensor3< T >::operator() ( size_t  i,
size_t  j 
) const
inline

Get ij component WARNING This function does not check if it is valid (for efficiency reasons)

Parameters
i,jcoordinates
Returns
ij tensor component

Definition at line 205 of file tensor3.hpp.

◆ operator*()

template<typename T >
template<typename OtherT >
auto plask::Tensor3< T >::operator* ( const OtherT  scale) const -> Tensor3<decltype(c00 * scale)>
inline

Calculate this tensor multiplied by scalar scale.

Parameters
scalescalar
Returns
this tensor multiplied by scalar

Definition at line 307 of file tensor3.hpp.

◆ operator*=()

template<typename T >
Tensor3< T > & plask::Tensor3< T >::operator*= ( const scalar)
inline

Multiple coordinates of this tensor by scalar.

Parameters
scalarscalar
Returns
*this (after scale)

Definition at line 317 of file tensor3.hpp.

◆ operator+()

template<typename T >
template<typename OtherT >
auto plask::Tensor3< T >::operator+ ( const Tensor3< OtherT > &  other) const -> Tensor3<decltype(c00 + other.c00)>
inline

Calculate sum of two tensors, this and other.

Parameters
othertensor to add, can have different data type (than result type will be found using C++ types promotions rules)
Returns
tensors sum

Definition at line 248 of file tensor3.hpp.

◆ operator+=()

template<typename T >
Tensor3< T > & plask::Tensor3< T >::operator+= ( const Tensor3< T > &  other)
inline

Increase coordinates of this tensor by coordinates of other tensor other.

Parameters
othertensor to add
Returns
*this (after increase)

Definition at line 259 of file tensor3.hpp.

◆ operator-() [1/2]

template<typename T >
Tensor3< T > plask::Tensor3< T >::operator- ( ) const
inline

Calculate tensor opposite to this.

Returns
Tensor3<T>(-c00, -c11)

Definition at line 362 of file tensor3.hpp.

◆ operator-() [2/2]

template<typename T >
template<typename OtherT >
auto plask::Tensor3< T >::operator- ( const Tensor3< OtherT > &  other) const -> Tensor3<decltype(c00 - other.c00)>
inline

Calculate difference of two tensors, this and other.

Parameters
othertensor to subtract from this, can have different data type (than result type will be found using C++ types promotions rules)
Returns
tensors difference

Definition at line 278 of file tensor3.hpp.

◆ operator-=()

template<typename T >
Tensor3< T > & plask::Tensor3< T >::operator-= ( const Tensor3< T > &  other)
inline

Decrease coordinates of this tensor by coordinates of other tensor other.

Parameters
othertensor to subtract
Returns
*this (after decrease)

Definition at line 289 of file tensor3.hpp.

◆ operator/()

template<typename T >
Tensor3< T > plask::Tensor3< T >::operator/ ( const scale) const
inline

Calculate this tensor divided by scalar scale.

Parameters
scalescalar
Returns
this tensor divided by scalar

Definition at line 335 of file tensor3.hpp.

◆ operator/=()

template<typename T >
Tensor3< T > & plask::Tensor3< T >::operator/= ( const scalar)
inline

Divide coordinates of this tensor by scalar.

Parameters
scalarscalar
Returns
*this (after divide)

Definition at line 345 of file tensor3.hpp.

◆ operator==()

template<typename T >
template<typename OtherT >
bool plask::Tensor3< T >::operator== ( const Tensor3< OtherT > &  p) const
inline

Compare two tensors, this and p.

Parameters
ptensor to compare
Returns
true only if this tensor and p have equals coordinates

Definition at line 218 of file tensor3.hpp.

◆ operator[]() [1/2]

template<typename T >
T & plask::Tensor3< T >::operator[] ( size_t  i)
inline

Get i-th component WARNING This function does not check if it is valid (for efficiency reasons)

Parameters
inumber of coordinate
Returns
i-th component

Definition at line 172 of file tensor3.hpp.

◆ operator[]() [2/2]

template<typename T >
const T & plask::Tensor3< T >::operator[] ( size_t  i) const
inline

Get i-th component WARNING This function does not check if it is valid (for efficiency reasons)

Parameters
inumber of coordinate
Returns
i-th component

Definition at line 183 of file tensor3.hpp.

◆ pow()

template<typename T >
Tensor3< T > plask::Tensor3< T >::pow ( int  n) const
inline

Power of tensor.

Returns
squared tensor

Definition at line 385 of file tensor3.hpp.

◆ sqr()

template<typename T >
Tensor3< T > plask::Tensor3< T >::sqr ( ) const
inline

Square each component of tensor.

Returns
squared tensor

Definition at line 368 of file tensor3.hpp.

◆ tran() [1/2]

template<typename T >
T & plask::Tensor3< T >::tran ( )
inline

Definition at line 49 of file tensor3.hpp.

◆ tran() [2/2]

template<typename T >
const T & plask::Tensor3< T >::tran ( ) const
inline

Definition at line 53 of file tensor3.hpp.

◆ vert() [1/2]

template<typename T >
T & plask::Tensor3< T >::vert ( )
inline

Definition at line 55 of file tensor3.hpp.

◆ vert() [2/2]

template<typename T >
const T & plask::Tensor3< T >::vert ( ) const
inline

Definition at line 56 of file tensor3.hpp.

Friends And Related Symbol Documentation

◆ operator<<

template<typename T >
std::ostream & operator<< ( std::ostream &  out,
const Tensor3< T > &  to_print 
)
friend

Print tensor to stream using format (where c00 and c11 are tensor components): [c00, c11].

Parameters
outprint destination, output stream
to_printtensor to print
Returns
out stream

Definition at line 441 of file tensor3.hpp.

Member Data Documentation

◆ c00

template<typename T >
T plask::Tensor3< T >::c00

Value of the tensor in LONG direction.

Definition at line 38 of file tensor3.hpp.

◆ c01

template<typename T >
T plask::Tensor3< T >::c01

Non-diagonal component LONG-TRAN.

Definition at line 39 of file tensor3.hpp.

◆ c02

template<typename T >
T plask::Tensor3< T >::c02

Non-diagonal component LONG-VERT.

Definition at line 40 of file tensor3.hpp.

◆ c10

template<typename T >
T plask::Tensor3< T >::c10

Non-diagonal component TRAN-LONG.

Definition at line 41 of file tensor3.hpp.

◆ c11

template<typename T >
T plask::Tensor3< T >::c11

Value of the tensor in TRAN direction.

Definition at line 42 of file tensor3.hpp.

◆ c12

template<typename T >
T plask::Tensor3< T >::c12

Non-diagonal component TRAN-VERT.

Definition at line 43 of file tensor3.hpp.

◆ c20

template<typename T >
T plask::Tensor3< T >::c20

Non-diagonal component VERT-LONG.

Definition at line 44 of file tensor3.hpp.

◆ c21

template<typename T >
T plask::Tensor3< T >::c21

Non-diagonal component VERT-TRAN.

Definition at line 45 of file tensor3.hpp.

◆ c22

template<typename T >
T plask::Tensor3< T >::c22

Value of the tensor in VERT direction.

Definition at line 46 of file tensor3.hpp.


The documentation for this struct was generated from the following file: