OpenWalnut  1.3.1
Public Member Functions | List of all members
WTensor< order, dim, Data_T > Class Template Reference

Implements a tensor that has the same number of components in every direction. More...

#include <WTensor.h>

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

Public Member Functions

 WTensor ()
 Standard constructor.
 WTensor (WTensorSym< order, dim, Data_T > const &t)
 Construct a Tensor from a symmetric tensor.
WTensor const & operator= (WTensorSym< order, dim, Data_T > const &t)
 Copy from a symmetric tensor.
- Public Member Functions inherited from WTensorFunc< WTensorBase, order, dim, Data_T >
 WTensorFunc ()
 Default constructor.
 WTensorFunc (const WValue< Data_T > &data)
 Initializes the tensor with the given data.
 WTensorFunc (const boost::array< Data_T, WTensorBase< order, dim, Data_T >::dataSize > &data)
 Initializes the tensor with the given data.
- Public Member Functions inherited from WTensorBase< order, dim, Data_T >
 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.

Additional Inherited Members

- Public Types inherited from WTensorBase< order, dim, Data_T >
enum  { dataSize = WPower< dim, order >::value }
 Declare a compile-time constant as enum and not as static constant. More...

Detailed Description

template<std::size_t order, std::size_t dim, typename Data_T = double>
class WTensor< order, dim, Data_T >

Implements a tensor that has the same number of components in every direction.

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 dimension may never be 0.
Notes:
The type Data_T may not throw exceptions on construction, destruction or during any assignment operator.

Access to specific elements of the tensor can be achieved in 2 ways:

Notes:
The datatype of the array or std::vector can be any type castable to std::size_t.
Notes:
There is no bounds checking for the array version of operator [].
Notes:
Operator () is not supported for orders larger than 6.

Examples:

Definition at line 78 of file WTensor.h.

Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 104 of file WTensor.h.

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

Construct a Tensor from a symmetric tensor.

Parameters
tA symmetric tensor.

Definition at line 110 of file WTensor.h.

References WTensor< order, dim, Data_T >::operator=().

Member Function Documentation

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

Copy from a symmetric tensor.

Parameters
tA symmetric tensor.
Returns
new tensor

Definition at line 117 of file WTensor.h.

References WTensorBase< order, dim, Data_T >::operator=().

Referenced by WTensor< order, dim, Data_T >::WTensor().


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