OpenWalnut
1.4.0
|
Implements a tensor that has the same number of components in every direction. More...
#include <WTensor.h>
Public Member Functions | |
WTensor () | |
Standard constructor. More... | |
WTensor (WTensorSym< order, dim, Data_T > const &t) | |
Construct a Tensor from a symmetric tensor. More... | |
WTensor const & | operator= (WTensorSym< order, dim, Data_T > const &t) |
Copy from a symmetric tensor. More... | |
![]() | |
WTensorFunc () | |
Default constructor. More... | |
WTensorFunc (const WValue< Data_T > &data) | |
Initializes the tensor with the given data. More... | |
WTensorFunc (const boost::array< Data_T, WTensorBase< order, dim, Data_T >::dataSize > &data) | |
Initializes the tensor with the given data. More... | |
![]() | |
WTensorBase () | |
Standard constructor. More... | |
WTensorBase (WTensorBase const &t) | |
Copy constructor. More... | |
WTensorBase (WTensorBaseSym< order, dim, Data_T > const &t) | |
Copy construct a WTensorBase from a WTensorBaseSym. More... | |
WTensorBase const & | operator= (WTensorBase const &t) |
Copy operator. More... | |
WTensorBase const & | operator= (WTensorBaseSym< order, dim, Data_T > const &t) |
Copy operator. More... | |
std::size_t | getDimension () const |
Get the dimension of this tensor. More... | |
std::size_t | getOrder () const |
Get the order of this tensor. More... | |
template<typename Index_T > | |
Data_T & | operator[] (std::vector< Index_T > const &indices) |
Get the element at a specific position. More... | |
template<typename Index_T > | |
Data_T const & | operator[] (std::vector< Index_T > const &indices) const |
Get the element at a specific position. More... | |
template<typename Index_T > | |
Data_T & | operator[] (Index_T indices[]) |
Get the element at a specific position. More... | |
template<typename Index_T > | |
Data_T const & | operator[] (Index_T indices[]) const |
Get the element at a specific position. More... | |
bool | operator== (WTensorBase const &other) const |
Compare this WTensorBase to another one. More... | |
bool | operator!= (WTensorBase const &other) const |
Compare this WTensorBase to another one. More... | |
template<typename Index_T > | |
std::size_t | getPos (Index_T pos[]) |
Additional Inherited Members | |
![]() | |
enum | { dataSize = WPower< dim, order >::value } |
Declare a compile-time constant as enum and not as static constant. More... | |
Implements a tensor that has the same number of components in every direction.
order | The order of the tensor. |
dim | The dimension of the tensor, i.e. the number of components in each direction. |
Data_T | The datatype of the components, double by default. |
Access to specific elements of the tensor can be achieved in 2 ways:
Examples:
Construct a tensor of order 2 and dimension 3 (i.e. a 3x3-Matrix):
WTensor< 2, 3 > w;
Change Element (2,0) to 4.0:
w( 2, 0 ) = 4.0;
Construct a 4D-vector:
WTensor< 1, 4 > v;
Access v at position 2:
v( 2 ) = ...;
std::vector< int > i( 1, 2 ); v[ i ] = ...;
WTensor< order, dim, Data_T >::WTensor | ( | WTensorSym< order, dim, Data_T > const & | t | ) |
Construct a Tensor from a symmetric tensor.
t | A symmetric tensor. |
Definition at line 110 of file WTensor.h.
References WTensorBase< order, dim, Data_T >::operator=().
WTensor< order, dim, Data_T > const & WTensor< order, dim, Data_T >::operator= | ( | WTensorSym< order, dim, Data_T > const & | t | ) |
Copy from a symmetric tensor.
t | A symmetric tensor. |
Definition at line 117 of file WTensor.h.
References WTensorBase< order, dim, Data_T >::operator=().