OpenWalnut  1.4.0
Classes | Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | Friends
WTensorBaseSym< order, dim, Data_T > Class Template Reference

Symmetric tensor base class. More...

#include <WTensorBase.h>

+ Inheritance diagram for WTensorBaseSym< order, dim, Data_T >:

List of all members.

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.
 WTensorBaseSym (const WValue< Data_T > &data)
 Constructs the symmetrical tensor and initialize with the given data.
 WTensorBaseSym (const boost::array< Data_T, dataSize > &data)
 Constructs the symmetrical tensor and initialize with the given data.
 WTensorBaseSym (WTensorBaseSym const &t)
 Copy constructor.
WTensorBaseSym const & operator= (WTensorBaseSym 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.
void setValues (WValue< Data_T > const &values)
 Set internal data from a WValue.
void setValues (boost::array< Data_T, dataSize > const &values)
 Set internal data from a boost array.
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== (WTensorBaseSym const &other) const
 Compare this WTensorBaseSym to another one.
bool operator!= (WTensorBaseSym const &other) const
 Compare this WTensorBaseSym to another one.

Protected Attributes

boost::array< Data_T, dataSizem_data
 Stores the elements of this tensor lexicographical ordered on their indices, where for each set of permutations the lexicographical lowest index is used.

Private Member Functions

 BOOST_STATIC_ASSERT (dim!=0)
 For dim == 0, create an artificial compiler error.

Static Private Attributes

static PositionIndexer const m_indexer
 A static PositionIndexer that maps tensor indices to vector positions.

Friends

class ::WTensorBaseSymTest
class ::WTensorFuncTest

Detailed Description

template<std::size_t order, std::size_t dim, typename Data_T>
class WTensorBaseSym< order, dim, Data_T >

Symmetric tensor base class.

Template Parameters:
orderThe order of the tensor.
dimThe dimension of the tensor, i.e. the number of components in each direction.
Data_TThe datatype of the components, double by default.
Notes:
The type Data_T may not throw exceptions on construction, destruction or during any assignment operator.
Notes:
The dimension may not be 0.
See also:
WTensorSym

Definition at line 641 of file WTensorBase.h.


Member Enumeration Documentation

template<std::size_t order, std::size_t dim, typename Data_T>
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 658 of file WTensorBase.h.


Constructor & Destructor Documentation

template<std::size_t order, std::size_t dim, typename Data_T >
WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym ( )

Standard constructor.

All elements are set to Data_T().

Definition at line 912 of file WTensorBase.h.

References WTensorBaseSym< order, dim, Data_T >::m_data.

template<std::size_t order, std::size_t dim, typename Data_T>
WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym ( const WValue< Data_T > &  data) [explicit]

Constructs the symmetrical tensor and initialize with the given data.

Parameters:
dataThe components of the symmetrical tensor: Take care of the ordering of the components to match the ordering in
See also:
m_data.

Definition at line 918 of file WTensorBase.h.

References WTensorBaseSym< order, dim, Data_T >::dataSize, WTensorBaseSym< order, dim, Data_T >::m_data, and WValue< T >::size().

template<std::size_t order, std::size_t dim, typename Data_T>
WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym ( const boost::array< Data_T, dataSize > &  data) [explicit]

Constructs the symmetrical tensor and initialize with the given data.

Parameters:
dataThe components of the symmetrical tensor: Take care of the ordering of the components to match the ordering in
See also:
m_data.

Definition at line 925 of file WTensorBase.h.

References WTensorBaseSym< order, dim, Data_T >::dataSize, and WTensorBaseSym< order, dim, Data_T >::m_data.

template<std::size_t order, std::size_t dim, typename Data_T>
WTensorBaseSym< order, dim, Data_T >::WTensorBaseSym ( WTensorBaseSym< order, dim, Data_T > const &  t)

Copy constructor.

Parameters:
tThe tensor to copy from.

Definition at line 931 of file WTensorBase.h.


Member Function Documentation

template<std::size_t order, std::size_t dim, typename Data_T>
WTensorBaseSym< order, dim, Data_T >::BOOST_STATIC_ASSERT ( dim!  = 0) [private]

For dim == 0, create an artificial compiler error.

template<std::size_t order, std::size_t dim, typename Data_T >
std::size_t WTensorBaseSym< order, dim, Data_T >::getDimension ( ) const

Get the dimension of this tensor.

Returns:
The dimension of this tensor.

Definition at line 944 of file WTensorBase.h.

template<std::size_t order, std::size_t dim, typename Data_T >
std::size_t WTensorBaseSym< order, dim, Data_T >::getOrder ( ) const

Get the order of this tensor.

Returns:
The order of this tensor.

Definition at line 950 of file WTensorBase.h.

template<std::size_t order, std::size_t dim, typename Data_T >
bool WTensorBaseSym< order, dim, Data_T >::operator!= ( WTensorBaseSym< order, dim, Data_T > const &  other) const

Compare this WTensorBaseSym to another one.

Parameters:
otherThe WTensorBaseSym to compare to.
Returns:
True, iff this tensors' elements are not equal to another tensors' elements.

Definition at line 1006 of file WTensorBase.h.

References WTensorBaseSym< order, dim, Data_T >::m_data.

template<std::size_t order, std::size_t dim, typename Data_T >
WTensorBaseSym< order, dim, Data_T > const & WTensorBaseSym< order, dim, Data_T >::operator= ( WTensorBaseSym< order, dim, Data_T > const &  t)

Copy operator.

Parameters:
tThe tensor to copy from.
Returns:
*this.

Definition at line 937 of file WTensorBase.h.

References WTensorBaseSym< order, dim, Data_T >::m_data.

template<std::size_t order, std::size_t dim, typename Data_T >
bool WTensorBaseSym< order, dim, Data_T >::operator== ( WTensorBaseSym< order, dim, Data_T > const &  other) const

Compare this WTensorBaseSym to another one.

Parameters:
otherThe WTensorBaseSym to compare to.
Returns:
True, iff this tensors' elements are equal to another tensors' elements.

Definition at line 1000 of file WTensorBase.h.

References WTensorBaseSym< order, dim, Data_T >::m_data.

template<std::size_t order, std::size_t dim, typename Data_T >
template<typename Index_T >
Data_T & WTensorBaseSym< order, dim, Data_T >::operator[] ( std::vector< Index_T > const &  indices)

Get the element at a specific position.

Parameters:
indicesA std::vector of indices that has a size of at least order.
Returns:
A reference to the element.

Definition at line 970 of file WTensorBase.h.

template<std::size_t order, std::size_t dim, typename Data_T >
template<typename Index_T >
Data_T const & WTensorBaseSym< order, dim, Data_T >::operator[] ( std::vector< Index_T > const &  indices) const

Get the element at a specific position.

Parameters:
indicesA std::vector of indices that has a size of at least order.
Returns:
A reference to the element.

Definition at line 977 of file WTensorBase.h.

template<std::size_t order, std::size_t dim, typename Data_T >
template<typename Index_T >
Data_T & WTensorBaseSym< order, dim, Data_T >::operator[] ( Index_T  indices[])

Get the element at a specific position.

Parameters:
indicesAn array of indices that has a size of at least order.
Returns:
A reference to the element.
Notes:
No bounds checking is performed.

Definition at line 985 of file WTensorBase.h.

template<std::size_t order, std::size_t dim, typename Data_T >
template<typename Index_T >
Data_T const & WTensorBaseSym< order, dim, Data_T >::operator[] ( Index_T  indices[]) const

Get the element at a specific position.

Parameters:
indicesAn array of indices that has a size of at least order.
Returns:
A reference to the element.
Notes:
No bounds checking is performed.

Definition at line 992 of file WTensorBase.h.

template<std::size_t order, std::size_t dim, typename Data_T>
void WTensorBaseSym< order, dim, Data_T >::setValues ( WValue< Data_T > const &  values)

Set internal data from a WValue.

Parameters:
valuesThe input values.

Definition at line 956 of file WTensorBase.h.

References WValue< T >::size().

template<std::size_t order, std::size_t dim, typename Data_T>
void WTensorBaseSym< order, dim, Data_T >::setValues ( boost::array< Data_T, dataSize > const &  values)

Set internal data from a boost array.

Parameters:
valuesThe input values.

Definition at line 963 of file WTensorBase.h.


Member Data Documentation

template<std::size_t order, std::size_t dim, typename Data_T>
boost::array< Data_T, dataSize > WTensorBaseSym< order, dim, Data_T >::m_data [protected]
template<std::size_t order, std::size_t dim, typename Data_T>
WTensorBaseSym< order, dim, Data_T >::PositionIndexer const WTensorBaseSym< order, dim, Data_T >::m_indexer [static, private]

A static PositionIndexer that maps tensor indices to vector positions.

Definition at line 847 of file WTensorBase.h.


The documentation for this class was generated from the following file: