OpenWalnut
1.4.0
|
Normal tensor base class. More...
#include <WTensorBase.h>
Public Types | |
enum | { dataSize = WPower< dim, order >::value } |
Declare a compile-time constant as enum and not as static constant. More... | |
Public Member Functions | |
WTensorBase () | |
Standard constructor. | |
WTensorBase (WTensorBase const &t) | |
Copy constructor. | |
WTensorBase (WTensorBaseSym< order, dim, Data_T > const &t) | |
Copy construct a WTensorBase from a WTensorBaseSym. | |
WTensorBase const & | operator= (WTensorBase const &t) |
Copy operator. | |
WTensorBase const & | operator= (WTensorBaseSym< order, dim, Data_T > const &t) |
Copy operator. | |
std::size_t | getDimension () const |
Get the dimension of this tensor. | |
std::size_t | getOrder () const |
Get the order of this tensor. | |
template<typename Index_T > | |
Data_T & | operator[] (std::vector< Index_T > const &indices) |
Get the element at a specific position. | |
template<typename Index_T > | |
Data_T const & | operator[] (std::vector< Index_T > const &indices) const |
Get the element at a specific position. | |
template<typename Index_T > | |
Data_T & | operator[] (Index_T indices[]) |
Get the element at a specific position. | |
template<typename Index_T > | |
Data_T const & | operator[] (Index_T indices[]) const |
Get the element at a specific position. | |
bool | operator== (WTensorBase const &other) const |
Compare this WTensorBase to another one. | |
bool | operator!= (WTensorBase const &other) const |
Compare this WTensorBase to another one. | |
Private Member Functions | |
BOOST_STATIC_ASSERT (dim!=0) | |
For dim == 0, create an artificial compiler error. | |
Static Private Member Functions | |
template<typename Index_T > | |
static std::size_t | getPos (Index_T pos[]) |
Calculate the position of the element in the data vector. | |
Private Attributes | |
boost::array< Data_T, dataSize > | m_data |
Stores all elements. | |
Friends | |
class | WTensorBase< order+1, dim, Data_T > |
class | ::WTensorBaseTest |
class | ::WTensorFuncTest |
Normal tensor base class.
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. |
Definition at line 160 of file WTensorBase.h.
anonymous enum |
Declare a compile-time constant as enum and not as static constant.
Definition at line 295 of file WTensorBase.h.
WTensorBase< order, dim, Data_T >::WTensorBase | ( | ) |
Standard constructor.
All elements are set to Data_T().
Definition at line 321 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::m_data.
WTensorBase< order, dim, Data_T >::WTensorBase | ( | WTensorBase< order, dim, Data_T > const & | t | ) |
Copy constructor.
t | The tensor to copy from. |
Definition at line 327 of file WTensorBase.h.
WTensorBase< order, dim, Data_T >::WTensorBase | ( | WTensorBaseSym< order, dim, Data_T > const & | t | ) | [explicit] |
Copy construct a WTensorBase from a WTensorBaseSym.
t | The symmetric tensor to copy from. |
Definition at line 333 of file WTensorBase.h.
WTensorBase< order, dim, Data_T >::BOOST_STATIC_ASSERT | ( | dim! | = 0 | ) | [private] |
For dim == 0, create an artificial compiler error.
std::size_t WTensorBase< order, dim, Data_T >::getDimension | ( | ) | const |
Get the dimension of this tensor.
Definition at line 361 of file WTensorBase.h.
std::size_t WTensorBase< order, dim, Data_T >::getOrder | ( | ) | const |
Get the order of this tensor.
Definition at line 367 of file WTensorBase.h.
std::size_t WTensorBase< order, dim, Data_T >::getPos | ( | Index_T | pos[] | ) | [inline, static, private] |
Calculate the position of the element in the data vector.
The function is build recursively at compile-time.
pos | An array of indices. |
Definition at line 374 of file WTensorBase.h.
Referenced by WTensorBase< order, dim, Data_T >::operator[]().
bool WTensorBase< order, dim, Data_T >::operator!= | ( | WTensorBase< order, dim, Data_T > const & | other | ) | const |
Compare this WTensorBase to another one.
other | The WBensorBase to compare to. |
Definition at line 420 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::m_data.
WTensorBase< order, dim, Data_T > const & WTensorBase< order, dim, Data_T >::operator= | ( | WTensorBase< order, dim, Data_T > const & | t | ) |
Copy operator.
t | The tensor to copy from. |
Definition at line 339 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::m_data.
Referenced by WTensor< order, dim, Data_T >::operator=().
WTensorBase< order, dim, Data_T > const & WTensorBase< order, dim, Data_T >::operator= | ( | WTensorBaseSym< order, dim, Data_T > const & | t | ) |
Copy operator.
t | The symmetric tensor to copy from. |
Definition at line 346 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::dataSize.
bool WTensorBase< order, dim, Data_T >::operator== | ( | WTensorBase< order, dim, Data_T > const & | other | ) | const |
Compare this WTensorBase to another one.
other | The WBensorBase to compare to. |
Definition at line 414 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::m_data.
Data_T & WTensorBase< order, dim, Data_T >::operator[] | ( | std::vector< Index_T > const & | indices | ) |
Get the element at a specific position.
indices | A std::vector of indices that has a size of at least order. |
Definition at line 381 of file WTensorBase.h.
Referenced by WTensorBase< order, dim, Data_T >::operator[]().
Data_T const & WTensorBase< order, dim, Data_T >::operator[] | ( | std::vector< Index_T > const & | indices | ) | const |
Get the element at a specific position.
indices | A std::vector of indices that has a size of at least order. |
Definition at line 388 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::operator[]().
Data_T & WTensorBase< order, dim, Data_T >::operator[] | ( | Index_T | indices[] | ) |
Get the element at a specific position.
indices | An array of indices that has a size of at least order. |
Definition at line 396 of file WTensorBase.h.
Data_T const & WTensorBase< order, dim, Data_T >::operator[] | ( | Index_T | indices[] | ) | const |
Get the element at a specific position.
indices | An array of indices that has a size of at least order. |
Definition at line 403 of file WTensorBase.h.
References WTensorBase< order, dim, Data_T >::getPos(), and WTensorBase< order, dim, Data_T >::m_data.
boost::array< Data_T, dataSize > WTensorBase< order, dim, Data_T >::m_data [private] |
Stores all elements.
Definition at line 317 of file WTensorBase.h.
Referenced by WTensorBase< order, dim, Data_T >::operator!=(), WTensorBase< 0, dim, Data_T >::operator!=(), WTensorBase< order, dim, Data_T >::operator=(), WTensorBase< 0, dim, Data_T >::operator=(), WTensorBase< order, dim, Data_T >::operator==(), WTensorBase< 0, dim, Data_T >::operator==(), WTensorBase< order, dim, Data_T >::operator[](), WTensorBase< 0, dim, Data_T >::operator[](), WTensorFuncTest::testAccessOperator(), WTensorBaseTest::testWTensorBaseArrayAccess(), WTensorBaseTest::testWTensorBaseCopyConstructor(), WTensorBaseTest::testWTensorBaseCopyOperatorSelfCopy(), WTensorBaseTest::testWTensorBaseCopyOperatorSimple(), WTensorBase< order, dim, Data_T >::WTensorBase(), and WTensorBase< 0, dim, Data_T >::WTensorBase().