OpenWalnut
1.3.1
|
Implements a symmetric tensor that has the same number of components in every direction. More...
#include <WTensorSym.h>
Public Member Functions | |
WTensorSym () | |
Default constructor of the symmetric tensor. More... | |
WTensorSym (const WValue< Data_T > &data) | |
Constructs and initializes the symmetrical Tensor with a WValue. More... | |
WTensorSym (const boost::array< Data_T, WTensorBaseSym< order, dim, Data_T >::dataSize > &data) | |
Constructs and initializes the symmetrical Tensor with a boost array. More... | |
Data_T | evaluateSphericalFunction (WValue< Data_T > const &gradient) const |
Evaluate - for a given gradient - the spherical function represented by this symmetric tensor. More... | |
Data_T | evaluateSphericalFunction (WVector3d const &gradient) const |
Evaluate - for a given gradient - the spherical function represented by this 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, WTensorBaseSym< order, dim, Data_T >::dataSize > &data) | |
Initializes the tensor with the given data. More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
enum | { dataSize = WBinom< order + dim - 1, order >::value } |
Declare a compile-time constant as enum and not as static constant. More... | |
![]() | |
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... | |
Implements a symmetric tensor that has the same number of components in every direction.
A symmetric tensor has the same value for every permutation of the indices.
For example, t(i,j) = t(j,i) for a tensor of order 2, and t(i,j,k) = t(j,i,k) = t(i,k,j) = t(j,k,i) = t(k,i,j) = t(k,j,i) for a tensor of order 3.
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:
This class optimizes memory usage. For example, for a symmetric tensor of order 2 and dimension 3, only 6 values (instead of 9) need to be stored. However, there is additional memory overhead per class (i.e. per allocation of the template parameters), which is of constant size and thus does not depend on the number of instances.
Usage and operators are the same as with WTensor. Note that changes to an element t(i,j,k,...) also change every element whose indices are a permutation of i,j,k... .
Definition at line 73 of file WTensorSym.h.
WTensorSym< order, dim, Data_T >::WTensorSym | ( | ) |
Default constructor of the symmetric tensor.
Definition at line 135 of file WTensorSym.h.
|
explicit |
Constructs and initializes the symmetrical Tensor with a WValue.
data | The components in same ordering as for the data member m_data is required, ( |
Definition at line 141 of file WTensorSym.h.
|
explicit |
Constructs and initializes the symmetrical Tensor with a boost array.
data | The components in same ordering as for the data member m_data is required, ( |
Definition at line 147 of file WTensorSym.h.
Data_T WTensorSym< order, dim, Data_T >::evaluateSphericalFunction | ( | WValue< Data_T > const & | gradient) | const |
Evaluate - for a given gradient - the spherical function represented by this symmetric tensor.
The | type that stores the gradient, must implement operator []. |
gradient | The normalized vector that represents the gradient direction. |
Thanks to CHeine for the idea for this algorithm.
Definition at line 153 of file WTensorSym.h.
References WRecursiveTensorEvaluation< Data_T, k, n, N, m >::evaluate().
Referenced by WTensorSymTest::testEvaluateSphericalFunction().
Data_T WTensorSym< order, dim, Data_T >::evaluateSphericalFunction | ( | WVector3d const & | gradient) | const |
Evaluate - for a given gradient - the spherical function represented by this symmetric tensor.
The | type that stores the gradient, must implement operator []. |
gradient | The normalized vector that represents the gradient direction. |
Thanks to CHeine for the idea for this algorithm.
Definition at line 161 of file WTensorSym.h.
References WRecursiveTensorEvaluation< Data_T, k, n, N, m >::evaluate().