|
PLaSK library
|
Diagonal tensor with all lateral components equal. More...
#include <plask/vector/tensor2.hpp>
Public Member Functions | |
| T & | tran () |
| const T & | tran () const |
| T & | vert () |
| const T & | vert () const |
| Tensor2 () | |
| Construct uninitialized Tensor. | |
| template<typename OtherT > | |
| Tensor2 (const Tensor2< OtherT > &p) | |
| Copy constructor from all other 2d tensors. | |
| Tensor2 (const T &val) | |
| Construct isotropic tensor. | |
| Tensor2 (const T &c00, const T &c11) | |
| Construct tensor with given diagonal values. | |
| template<typename T0 , typename T1 > | |
| Tensor2 (const std::pair< T0, T1 > &comp) | |
| Construct tensor components given in std::pair. | |
| Tensor2 (const Vec< 2, T > &vec) | |
| Construct tensor from 2D vector. | |
| 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) | |
| operator std::tuple< T, T > () const | |
| Convert to std::tuple. | |
| template<typename OtherT > | |
| bool | operator== (const Tensor2< OtherT > &p) const |
Compare two tensors, this and p. | |
| template<typename OtherT > | |
| constexpr bool | equals (const Tensor2< OtherT > &p) const |
Check if two tensors, this and p are almost equal. | |
| template<typename OtherT > | |
| bool | operator!= (const Tensor2< OtherT > &p) const |
Compare two tensors, this and p. | |
| template<typename OtherT > | |
| auto | operator+ (const Tensor2< OtherT > &other) const -> Tensor2< decltype(c00+other.c00)> |
Calculate sum of two tesnors, this and other. | |
| Tensor2< T > & | operator+= (const Tensor2< T > &other) |
Increase coordinates of this tensor by coordinates of other tensor other. | |
| template<typename OtherT > | |
| auto | operator- (const Tensor2< OtherT > &other) const -> Tensor2< decltype(c00 - other.c00)> |
Calculate difference of two tensors, this and other. | |
| Tensor2< T > & | operator-= (const Tensor2< T > &other) |
Decrease coordinates of this tensor by coordinates of other tensor other. | |
| template<typename OtherT > | |
| auto | operator* (const OtherT scale) const -> Tensor2< decltype(c00 *scale)> |
Calculate this tensor multiplied by scalar scale. | |
| Tensor2< T > & | operator*= (const T scalar) |
Multiple coordinates of this tensor by scalar. | |
| Tensor2< T > | operator/ (const T scale) const |
Calculate this tensor divided by scalar scale. | |
| Tensor2< T > & | operator/= (const T scalar) |
Divide coordinates of this tensor by scalar. | |
| Tensor2< T > | operator- () const |
| Calculate tensor opposite to this. | |
| Tensor2< T > | pow (double a) const |
| Power of each component of tensor. | |
Public Attributes | |
| T | c00 |
| Value of the tensor in lateral direction. | |
| T | c11 |
| Value of the tensor in vertical direction. | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Tensor2< T > &to_print) |
| Print tensor to stream using format (where c00 and c11 are tensor components): [c00, c11]. | |
Diagonal tensor with all lateral components equal.
[ c00 0 ] [ 0 c11 ]
Definition at line 34 of file tensor2.hpp.
|
inline |
Construct uninitialized Tensor.
Definition at line 45 of file tensor2.hpp.
|
inline |
Copy constructor from all other 2d tensors.
| p | tensor to copy from |
Definition at line 51 of file tensor2.hpp.
|
inline |
|
inline |
Construct tensor with given diagonal values.
| c00,c11 | components |
Definition at line 63 of file tensor2.hpp.
|
inline |
Construct tensor components given in std::pair.
| comp | components |
Definition at line 69 of file tensor2.hpp.
|
inline |
|
inlineconstexpr |
Check if two tensors, this and p are almost equal.
| p | tensors to compare |
true only if this tensors and p have almost equals coordinates Definition at line 114 of file tensor2.hpp.
|
inline |
Convert to std::tuple.
Definition at line 100 of file tensor2.hpp.
|
inline |
Compare two tensors, this and p.
| p | tensor to compare |
p don't have equals coordinates Definition at line 123 of file tensor2.hpp.
|
inline |
Calculate this tensor multiplied by scalar scale.
| scale | scalar |
Definition at line 171 of file tensor2.hpp.
|
inline |
Multiple coordinates of this tensor by scalar.
| scalar | scalar |
Definition at line 180 of file tensor2.hpp.
|
inline |
Calculate sum of two tesnors, this and other.
| other | tensor to add, can have different data type (than result type will be found using C++ types promotions rules) |
Definition at line 130 of file tensor2.hpp.
|
inline |
Increase coordinates of this tensor by coordinates of other tensor other.
| other | tensor to add |
Definition at line 139 of file tensor2.hpp.
|
inline |
Calculate tensor opposite to this.
Definition at line 208 of file tensor2.hpp.
|
inline |
Calculate difference of two tensors, this and other.
| other | tensor to subtract from this, can have different data type (than result type will be found using C++ types promotions rules) |
Definition at line 151 of file tensor2.hpp.
|
inline |
Decrease coordinates of this tensor by coordinates of other tensor other.
| other | tensor to subtract |
Definition at line 160 of file tensor2.hpp.
|
inline |
Calculate this tensor divided by scalar scale.
| scale | scalar |
Definition at line 191 of file tensor2.hpp.
|
inline |
Divide coordinates of this tensor by scalar.
| scalar | scalar |
Definition at line 198 of file tensor2.hpp.
|
inline |
Compare two tensors, this and p.
| p | tensor to compare |
p have equals coordinates Definition at line 107 of file tensor2.hpp.
|
inline |
Get i-th component WARNING This function does not check if it is valid (for efficiency reasons)
| i | number of coordinate |
Definition at line 83 of file tensor2.hpp.
|
inline |
Get i-th component WARNING This function does not check if it is valid (for efficiency reasons)
| i | number of coordinate |
Definition at line 94 of file tensor2.hpp.
|
inline |
Power of each component of tensor.
Definition at line 248 of file tensor2.hpp.
|
inline |
Definition at line 38 of file tensor2.hpp.
|
inline |
Definition at line 39 of file tensor2.hpp.
|
inline |
Definition at line 41 of file tensor2.hpp.
|
inline |
Definition at line 42 of file tensor2.hpp.
|
friend |
Print tensor to stream using format (where c00 and c11 are tensor components): [c00, c11].
| out | print destination, output stream |
| to_print | tensor to print |
Definition at line 256 of file tensor2.hpp.
| T plask::Tensor2< T >::c00 |
Value of the tensor in lateral direction.
Definition at line 35 of file tensor2.hpp.
| T plask::Tensor2< T >::c11 |
Value of the tensor in vertical direction.
Definition at line 36 of file tensor2.hpp.