OpenWalnut
1.4.0
|
Symmetric tensor base class. More...
#include <WTensorBase.h>
Classes | |
class | PositionIndexer |
A class that maps symmetric tensor indices to vector positions. More... | |
Public Types | |
enum | { dataSize = WBinom< order + dim - 1, order >::value } |
Declare a compile-time constant as enum and not as static constant. More... | |
Public Member Functions | |
WTensorBaseSym () | |
Standard constructor. More... | |
WTensorBaseSym (const WValue< Data_T > &data) | |
Constructs the symmetrical tensor and initialize with the given data. More... | |
WTensorBaseSym (const boost::array< Data_T, dataSize > &data) | |
Constructs the symmetrical tensor and initialize with the given data. More... | |
WTensorBaseSym (WTensorBaseSym const &t) | |
Copy constructor. More... | |
WTensorBaseSym const & | operator= (WTensorBaseSym 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... | |
void | setValues (WValue< Data_T > const &values) |
Set internal data from a WValue. More... | |
void | setValues (boost::array< Data_T, dataSize > const &values) |
Set internal data from a boost array. 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== (WTensorBaseSym const &other) const |
Compare this WTensorBaseSym to another one. More... | |
bool | operator!= (WTensorBaseSym const &other) const |
Compare this WTensorBaseSym to another one. More... | |
Protected Attributes | |
boost::array< Data_T, dataSize > | m_data |
Stores the elements of this tensor lexicographical ordered on their indices, where for each set of permutations the lexicographical lowest index is used. More... | |
Private Member Functions | |
BOOST_STATIC_ASSERT (dim!=0) | |
For dim == 0, create an artificial compiler error. More... | |
Static Private Attributes | |
static PositionIndexer const | m_indexer |
A static PositionIndexer that maps tensor indices to vector positions. More... | |
Friends | |
class | ::WTensorBaseSymTest |
class | ::WTensorFuncTest |
Symmetric 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 53 of file WTensorBase.h.
anonymous enum |
Declare a compile-time constant as enum and not as static constant.
Enumerator | |
---|---|
dataSize |
The number of elements to store. |
Definition at line 662 of file WTensorBase.h.
WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym | ( | ) |
Standard constructor.
All elements are set to Data_T().
Definition at line 916 of file WTensorBase.h.
References WTensorBaseSym< order, dim, Data_T >::m_data.
|
explicit |
Constructs the symmetrical tensor and initialize with the given data.
data | The components of the symmetrical tensor: Take care of the ordering of the components to match the ordering in |
Definition at line 922 of file WTensorBase.h.
References WTensorBaseSym< order, dim, Data_T >::dataSize, WTensorBaseSym< order, dim, Data_T >::m_data, and WValue< T >::size().
|
explicit |
Constructs the symmetrical tensor and initialize with the given data.
data | The components of the symmetrical tensor: Take care of the ordering of the components to match the ordering in |
Definition at line 929 of file WTensorBase.h.
References WTensorBaseSym< order, dim, Data_T >::dataSize, and WTensorBaseSym< order, dim, Data_T >::m_data.
WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym | ( | WTensorBaseSym< order, dim, Data_T > const & | t | ) |
Copy constructor.
t | The tensor to copy from. |
Definition at line 935 of file WTensorBase.h.
|
private |
For dim == 0, create an artificial compiler error.
std::size_t WTensorBaseSym< order, dim, Data_T >::getDimension | ( | ) | const |
Get the dimension of this tensor.
Definition at line 948 of file WTensorBase.h.
std::size_t WTensorBaseSym< order, dim, Data_T >::getOrder | ( | ) | const |
Get the order of this tensor.
Definition at line 954 of file WTensorBase.h.
bool WTensorBaseSym< order, dim, Data_T >::operator!= | ( | WTensorBaseSym< order, dim, Data_T > const & | other | ) | const |
Compare this WTensorBaseSym to another one.
other | The WTensorBaseSym to compare to. |
Definition at line 1010 of file WTensorBase.h.
References WTensorBaseSym< order, dim, Data_T >::m_data.
WTensorBaseSym< order, dim, Data_T > const & WTensorBaseSym< order, dim, Data_T >::operator= | ( | WTensorBaseSym< order, dim, Data_T > const & | t | ) |
Copy operator.
t | The tensor to copy from. |
Definition at line 941 of file WTensorBase.h.
References WTensorBaseSym< order, dim, Data_T >::m_data.
bool WTensorBaseSym< order, dim, Data_T >::operator== | ( | WTensorBaseSym< order, dim, Data_T > const & | other | ) | const |
Compare this WTensorBaseSym to another one.
other | The WTensorBaseSym to compare to. |
Definition at line 1004 of file WTensorBase.h.
References WTensorBaseSym< order, dim, Data_T >::m_data.
Data_T & WTensorBaseSym< 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 974 of file WTensorBase.h.
Data_T const & WTensorBaseSym< 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 981 of file WTensorBase.h.
Data_T & WTensorBaseSym< 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 989 of file WTensorBase.h.
Data_T const & WTensorBaseSym< 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 996 of file WTensorBase.h.
void WTensorBaseSym< order, dim, Data_T >::setValues | ( | WValue< Data_T > const & | values | ) |
Set internal data from a WValue.
values | The input values. |
Definition at line 960 of file WTensorBase.h.
References WValue< T >::size().
void WTensorBaseSym< order, dim, Data_T >::setValues | ( | boost::array< Data_T, dataSize > const & | values | ) |
Set internal data from a boost array.
values | The input values. |
Definition at line 967 of file WTensorBase.h.
|
protected |
Stores the elements of this tensor lexicographical ordered on their indices, where for each set of permutations the lexicographical lowest index is used.
Definition at line 806 of file WTensorBase.h.
Referenced by WTensorBaseSym< order, dim, Data_T >::operator!=(), WTensorBaseSym< 0, dim, Data_T >::operator!=(), WTensorBaseSym< order, dim, Data_T >::operator=(), WTensorBaseSym< 0, dim, Data_T >::operator=(), WTensorBaseSym< order, dim, Data_T >::operator==(), WTensorBaseSym< 0, dim, Data_T >::operator==(), WTensorBaseSym< 0, dim, Data_T >::operator[](), WTensorFuncTest::testAccessOperatorSymmetry(), WTensorBaseSymTest::testWTensorBaseSymAccessOperatorPermutations(), WTensorBaseSymTest::testWTensorBaseSymArrayAccess(), WTensorBaseSymTest::testWTensorBaseSymCopyConstructor(), WTensorBaseSymTest::testWTensorBaseSymCopyOperatorSelfCopy(), WTensorBaseSymTest::testWTensorBaseSymCopyOperatorSimple(), and WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym().
|
staticprivate |
A static PositionIndexer that maps tensor indices to vector positions.
Definition at line 851 of file WTensorBase.h.