Chi-Tech
chi_math::TensorRNX< 2, N, NumberFormat > Struct Template Reference

#include <chi_math_tensorRNX.h>

Public Member Functions

 TensorRNX ()
 
 TensorRNX (const NumberFormat value)
 
 TensorRNX (const TensorRNX< 2, N, NumberFormat > &that)
 
TensorRNXoperator= (const TensorRNX &rhs)
 
const VectorNX< N, NumberFormat > & operator[] (const int i) const
 
VectorNX< N, NumberFormat > & operator() (const int i)
 
TensorRNX< 2, N, NumberFormat > operator+ (const TensorRNX< 2, N, NumberFormat > &that) const
 
TensorRNX< 2, N, NumberFormat > & operator+= (const TensorRNX< 2, N, NumberFormat > &that)
 
TensorRNX< 2, N, NumberFormat > operator- (const TensorRNX< 2, N, NumberFormat > &that) const
 
TensorRNX< 2, N, NumberFormat > & operator-= (const TensorRNX< 2, N, NumberFormat > &that)
 
TensorRNX< 2, N, NumberFormat > operator* (const double value) const
 
TensorRNX< 2, N, NumberFormat > & operator*= (const double value)
 
TensorRNX< 2, N, NumberFormat > operator/ (const double value) const
 
TensorRNX< 2, N, NumberFormat > & operator/= (const double value)
 
TensorRNX< 2, N, NumberFormat > Transpose () const
 
VectorNX< N, NumberFormat > Dot (const VectorNX< N, NumberFormat > &v) const
 
VectorNX< N, NumberFormat > Diag () const
 
double DiagSum () const
 
std::string PrintS () const
 

Data Fields

std::vector< VectorNX< N, NumberFormat > > entries
 
const unsigned int rank
 
const unsigned int dimension
 

Detailed Description

template<int N, class NumberFormat>
struct chi_math::TensorRNX< 2, N, NumberFormat >

Specialized rank-2 tensor.

Definition at line 79 of file chi_math_tensorRNX.h.

Constructor & Destructor Documentation

◆ TensorRNX() [1/3]

template<int N, class NumberFormat >
chi_math::TensorRNX< 2, N, NumberFormat >::TensorRNX ( )
inline

Default constructor.

Definition at line 86 of file chi_math_tensorRNX.h.

◆ TensorRNX() [2/3]

template<int N, class NumberFormat >
chi_math::TensorRNX< 2, N, NumberFormat >::TensorRNX ( const NumberFormat  value)
inline

Constructor with value.

Definition at line 96 of file chi_math_tensorRNX.h.

◆ TensorRNX() [3/3]

template<int N, class NumberFormat >
chi_math::TensorRNX< 2, N, NumberFormat >::TensorRNX ( const TensorRNX< 2, N, NumberFormat > &  that)
inline

Copy constructor.

Definition at line 106 of file chi_math_tensorRNX.h.

Member Function Documentation

◆ Diag()

template<int N, class NumberFormat >
VectorNX< N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::Diag ( ) const
inline

Obtains the diagonal of a rank-2 tensor as a vector.

Definition at line 280 of file chi_math_tensorRNX.h.

◆ DiagSum()

template<int N, class NumberFormat >
double chi_math::TensorRNX< 2, N, NumberFormat >::DiagSum ( ) const
inline

Returns the sum of the diagonal. Sometimes useful to get divergence of a vector given its gradient.

Definition at line 294 of file chi_math_tensorRNX.h.

◆ Dot()

template<int N, class NumberFormat >
VectorNX< N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::Dot ( const VectorNX< N, NumberFormat > &  v) const
inline

Tensor dot-product with a vector.

Definition at line 266 of file chi_math_tensorRNX.h.

◆ operator()()

template<int N, class NumberFormat >
VectorNX< N, NumberFormat > & chi_math::TensorRNX< 2, N, NumberFormat >::operator() ( const int  i)
inline

Return reference to vector at given row.

Definition at line 126 of file chi_math_tensorRNX.h.

◆ operator*()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::operator* ( const double  value) const
inline

Component-wise multiplication by scalar. $ \vec{\vec{W}} = \vec{\vec{X}}\alpha $

Definition at line 196 of file chi_math_tensorRNX.h.

◆ operator*=()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > & chi_math::TensorRNX< 2, N, NumberFormat >::operator*= ( const double  value)
inline

In-place component-wise multiplication by scalar. $ \vec{\vec{X}} = \vec{\vec{X}}\alpha $

Definition at line 211 of file chi_math_tensorRNX.h.

◆ operator+()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::operator+ ( const TensorRNX< 2, N, NumberFormat > &  that) const
inline

Component-wise addition. $ \vec{\vec{W}} = \vec{\vec{X}} + \vec{\vec{Y}} $

Definition at line 134 of file chi_math_tensorRNX.h.

◆ operator+=()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > & chi_math::TensorRNX< 2, N, NumberFormat >::operator+= ( const TensorRNX< 2, N, NumberFormat > &  that)
inline

In-place component-wise addition. $ \vec{\vec{X}} = \vec{\vec{X}} + \vec{\vec{Y}} $

Definition at line 150 of file chi_math_tensorRNX.h.

◆ operator-()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::operator- ( const TensorRNX< 2, N, NumberFormat > &  that) const
inline

Component-wise subtraction. $ \vec{\vec{W}} = \vec{\vec{X}} - \vec{\vec{Y}} $

Definition at line 165 of file chi_math_tensorRNX.h.

◆ operator-=()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > & chi_math::TensorRNX< 2, N, NumberFormat >::operator-= ( const TensorRNX< 2, N, NumberFormat > &  that)
inline

In-place component-wise subtraction. $ \vec{\vec{X}} = \vec{\vec{X}} - \vec{\vec{Y}} $

Definition at line 181 of file chi_math_tensorRNX.h.

◆ operator/()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::operator/ ( const double  value) const
inline

Component-wise division by scalar. $ \vec{\vec{W}} = \vec{\vec{X}}\frac{1}{\alpha} $

Definition at line 223 of file chi_math_tensorRNX.h.

◆ operator/=()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > & chi_math::TensorRNX< 2, N, NumberFormat >::operator/= ( const double  value)
inline

In-place component-wise division by scalar. $ \vec{\vec{X}} = \vec{\vec{X}}\frac{1}{\alpha} $

Definition at line 238 of file chi_math_tensorRNX.h.

◆ operator=()

template<int N, class NumberFormat >
TensorRNX & chi_math::TensorRNX< 2, N, NumberFormat >::operator= ( const TensorRNX< 2, N, NumberFormat > &  rhs)
inline

Component-wise copy (assignment operator.

Definition at line 112 of file chi_math_tensorRNX.h.

◆ operator[]()

template<int N, class NumberFormat >
const VectorNX< N, NumberFormat > & chi_math::TensorRNX< 2, N, NumberFormat >::operator[] ( const int  i) const
inline

Return reference to vector at given row.

Definition at line 120 of file chi_math_tensorRNX.h.

◆ PrintS()

template<int N, class NumberFormat >
std::string chi_math::TensorRNX< 2, N, NumberFormat >::PrintS ( ) const
inline

Prints the tensor to a string and then returns the string.

Definition at line 308 of file chi_math_tensorRNX.h.

◆ Transpose()

template<int N, class NumberFormat >
TensorRNX< 2, N, NumberFormat > chi_math::TensorRNX< 2, N, NumberFormat >::Transpose ( ) const
inline

Classical transpose of the tensor. $ W_{ij} = T_{ji} $

Definition at line 250 of file chi_math_tensorRNX.h.

Field Documentation

◆ dimension

template<int N, class NumberFormat >
const unsigned int chi_math::TensorRNX< 2, N, NumberFormat >::dimension

Definition at line 83 of file chi_math_tensorRNX.h.

◆ entries

template<int N, class NumberFormat >
std::vector<VectorNX<N,NumberFormat> > chi_math::TensorRNX< 2, N, NumberFormat >::entries

Definition at line 81 of file chi_math_tensorRNX.h.

◆ rank

template<int N, class NumberFormat >
const unsigned int chi_math::TensorRNX< 2, N, NumberFormat >::rank

Definition at line 82 of file chi_math_tensorRNX.h.


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