namespace ewalena  0.2.15
ewalena is not an acronym
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Attributes | Private Attributes | Friends
ewalena::Tensor< dim, rank, ValueType > Class Template Reference

#include <include/ewalena/base/tensor.h>

Inheritance diagram for ewalena::Tensor< dim, rank, ValueType >:
Inheritance graph
[legend]
Collaboration diagram for ewalena::Tensor< dim, rank, ValueType >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void clone (const Tensor< dim, rank, ValueType > &T)
void invert (const Tensor< dim, rank, ValueType > &T)
bool is_symmetric () const
unsigned int n_components () const
ValueType & operator() (const unsigned int index,...)
const ValueType & operator() (const unsigned int index,...) const
const ValueType * operator* () const
ValueType * operator* ()
void operator*= (const ValueType &scalar)
Tensor< dim, rank, ValueType > operator+ (const Tensor< dim, rank, ValueType > &T)
void operator+= (const Tensor< dim, rank, ValueType > &T)
Tensor< dim, rank, ValueType > operator- (const Tensor< dim, rank, ValueType > &T)
void operator-= (const Tensor< dim, rank, ValueType > &T)
void operator/= (const ValueType &scalar)
bool operator== (const Tensor< dim, rank, ValueType > &T) const
void reinit ()
void sadd (const ValueType &a, const Tensor< dim, rank, ValueType > &T_a)
void sadd (const ValueType &a, const Tensor< dim, rank, ValueType > &T_a, const ValueType &b, const Tensor< dim, rank, ValueType > &T_b)
void sadd (const ValueType &a, const Tensor< dim, rank, ValueType > &T_a, const ValueType &b, const Tensor< dim, rank, ValueType > &T_b, const ValueType &c, const Tensor< dim, rank, ValueType > &T_c)
void sadd (const std::vector< ValueType > &a, const std::vector< Tensor< dim, rank, ValueType > > &T_a)
 Tensor (const bool zero=true)
 Tensor (const Tensor &T)
std::pair< unsigned int,
unsigned int > 
voight_components () const
 ~Tensor ()

Protected Attributes

int __dim
unsigned int __n_components
int __rank

Private Attributes

ValueType * data

Friends

std::ostream & operator<< (std::ostream &output, const Tensor< dim, rank, ValueType > &T)

Detailed Description

template<int dim, int rank, typename ValueType = double>
class ewalena::Tensor< dim, rank, ValueType >

A class that denotes a tensor with no special qualities, ie. no special symmetries, data access, etc.

Author:
Toby D. Young 2012.

Constructor & Destructor Documentation

template<int dim, int rank, typename ValueType = double>
ewalena::Tensor< dim, rank, ValueType >::Tensor ( const bool  zero = true)

Constructor.

template<int dim, int rank, typename ValueType = double>
ewalena::Tensor< dim, rank, ValueType >::~Tensor ( )

Destructor.

template<int dim, int rank, typename ValueType = double>
ewalena::Tensor< dim, rank, ValueType >::Tensor ( const Tensor< dim, rank, ValueType > &  T)

Initialize a tensor with another tensor T with a memory copy.


Member Function Documentation

template<int dim, int rank, typename ValueType = double>
void ewalena::Tensor< dim, rank, ValueType >::clone ( const Tensor< dim, rank, ValueType > &  T)

Clone the contents of $T$ tensor to this tensor.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::invert ( const Tensor< dim, rank, ValueType > &  T) [inline]

Invert tensor $T$.

Note:
This is instantiated for all rank tensors, but will only work for rank two (everything else triggers an exception).
template<int dim, int rank, typename ValueType = double>
bool ewalena::Tensor< dim, rank, ValueType >::is_symmetric ( ) const

Return true if this tensor is symmetric.

template<int dim, int rank, typename ValueType >
unsigned int ewalena::Tensor< dim, rank, ValueType >::n_components ( ) const [inline]
template<int dim, int rank, typename ValueType >
ValueType & ewalena::Tensor< dim, rank, ValueType >::operator() ( const unsigned int  index,
  ... 
) [inline]

Read-write access to the ith, jth, etc. index of this tensor.

template<int dim, int rank, typename ValueType >
const ValueType & ewalena::Tensor< dim, rank, ValueType >::operator() ( const unsigned int  index,
  ... 
) const [inline]

Read only access to the ith, jth, etc. index of this tensor.

template<int dim, int rank, typename ValueType = double>
const ValueType* ewalena::Tensor< dim, rank, ValueType >::operator* ( ) const [inline]
template<int dim, int rank, typename ValueType = double>
ValueType* ewalena::Tensor< dim, rank, ValueType >::operator* ( ) [inline]

Read only access operator to the underlying C array structure associated with this tensor field.

Reimplemented in ewalena::Point< dim, ValueType >.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::operator*= ( const ValueType &  scalar) [inline]

Inline multiplication operator. Multiply each element in this tensor by a scalar value.

Reimplemented in ewalena::Point< dim, ValueType >.

template<int dim, int rank, typename ValueType>
Tensor< dim, rank, ValueType > ewalena::Tensor< dim, rank, ValueType >::operator+ ( const Tensor< dim, rank, ValueType > &  T) [inline]

Inline addition operator. Return this plus T tensor.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::operator+= ( const Tensor< dim, rank, ValueType > &  T) [inline]

Inline addition operator. Add T to this tensor.

template<int dim, int rank, typename ValueType>
Tensor< dim, rank, ValueType > ewalena::Tensor< dim, rank, ValueType >::operator- ( const Tensor< dim, rank, ValueType > &  T) [inline]

Inline subtraction operator. Return this minus T tensor.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::operator-= ( const Tensor< dim, rank, ValueType > &  T) [inline]

Inline subtraction operator. Subtract T from this tensor.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::operator/= ( const ValueType &  scalar) [inline]

Inline division operator. Divide each element in this tensor by a scalar value.

Reimplemented in ewalena::Point< dim, ValueType >.

template<int dim, int rank, typename ValueType>
bool ewalena::Tensor< dim, rank, ValueType >::operator== ( const Tensor< dim, rank, ValueType > &  T) const [inline]

Equivalence operator. Return true if this tensor is an identical copy of the tensor T.

template<int dim, int rank, typename ValueType = double>
void ewalena::Tensor< dim, rank, ValueType >::reinit ( )

Reinitialise the contents of this tensor to nothing (zero).

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::sadd ( const ValueType &  a,
const Tensor< dim, rank, ValueType > &  T_a 
) [inline]

Sum-add a tensor to this tensor: $T+=aT_a$\,.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::sadd ( const ValueType &  a,
const Tensor< dim, rank, ValueType > &  T_a,
const ValueType &  b,
const Tensor< dim, rank, ValueType > &  T_b 
) [inline]

Sum-add two tensors to this tensor: $T+=aT_a+bT_b$\,.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::sadd ( const ValueType &  a,
const Tensor< dim, rank, ValueType > &  T_a,
const ValueType &  b,
const Tensor< dim, rank, ValueType > &  T_b,
const ValueType &  c,
const Tensor< dim, rank, ValueType > &  T_c 
) [inline]

Sum-add three tensors to this tensor: $T+=aT_a+bT_b$\,.

template<int dim, int rank, typename ValueType>
void ewalena::Tensor< dim, rank, ValueType >::sadd ( const std::vector< ValueType > &  a,
const std::vector< Tensor< dim, rank, ValueType > > &  T_a 
) [inline]

Sum-add a vector of tensors to this tensor: $T+=\sum_ia)iT_{a_i}$\,.

template<int dim, int rank, typename ValueType = double>
std::pair<unsigned int, unsigned int> ewalena::Tensor< dim, rank, ValueType >::voight_components ( ) const

Return the size of the Voight matrix representation of this tensor.


Friends And Related Function Documentation

template<int dim, int rank, typename ValueType = double>
std::ostream& operator<< ( std::ostream &  output,
const Tensor< dim, rank, ValueType > &  T 
) [friend]

Output operator to stream.


Member Data Documentation

template<int dim, int rank, typename ValueType = double>
int ewalena::Tensor< dim, rank, ValueType >::__dim [protected]

Internal object storing the tensor dimension.

template<int dim, int rank, typename ValueType = double>
unsigned int ewalena::Tensor< dim, rank, ValueType >::__n_components [protected]

Internal reference to the number of components this tensor has, ie. $d^r$. (For internal reference this is just the length of the underlying data array structure).

template<int dim, int rank, typename ValueType = double>
int ewalena::Tensor< dim, rank, ValueType >::__rank [protected]

Internal object storing the tensor rank.

template<int dim, int rank, typename ValueType = double>
ValueType* ewalena::Tensor< dim, rank, ValueType >::data [private]

Internal object denoting this tensor data.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines