Public Types | Public Member Functions | Static Public Attributes | List of all members
Tensor< Cmpt > Class Template Reference

Templated 3D tensor derived from MatrixSpace adding construction from 9 components, element access using xx(), xy() etc. member functions and the inner-product (dot-product) and outer-product of two Vectors (tensor-product) operators. More...

Inheritance diagram for Tensor< Cmpt >:
Inheritance graph
[legend]
Collaboration diagram for Tensor< Cmpt >:
Collaboration graph
[legend]

Public Types

enum  components {
  XX, XY, XZ, YX,
  YY, YZ, ZX, ZY,
  ZZ
}
 Component labeling enumeration. More...
 
typedef Tensor< labellabelType
 Equivalent type of labels used for valid component indexing. More...
 
- Public Types inherited from MatrixSpace< Tensor< Cmpt >, Cmpt, 3, 3 >
typedef MatrixSpace< Tensor< Cmpt >, Cmpt, Mrows, Ncols > msType
 MatrixSpace type. More...
 
- Public Types inherited from VectorSpace< Tensor< Cmpt >, Cmpt, Mrows *Ncols >
typedef VectorSpace< Tensor< Cmpt >, Cmpt, Ncmpts > vsType
 VectorSpace type. More...
 
typedef Cmpt cmptType
 Component type. More...
 

Public Member Functions

 Tensor ()
 Construct null. More...
 
 Tensor (const Foam::zero)
 Construct initialized to zero. More...
 
template<class Cmpt2 >
 Tensor (const MatrixSpace< Tensor< Cmpt2 >, Cmpt2, 3, 3 > &)
 Construct given MatrixSpace of the same rank. More...
 
template<class Cmpt2 >
 Tensor (const VectorSpace< Tensor< Cmpt2 >, Cmpt2, 9 > &)
 Construct given VectorSpace of the same rank. More...
 
 Tensor (const SphericalTensor< Cmpt > &)
 Construct given SphericalTensor. More...
 
 Tensor (const SymmTensor< Cmpt > &)
 Construct given SymmTensor. More...
 
 Tensor (const Vector< Vector< Cmpt >> &)
 Construct given triad. More...
 
 Tensor (const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z)
 Construct given the three vector components. More...
 
 Tensor (const Cmpt txx, const Cmpt txy, const Cmpt txz, const Cmpt tyx, const Cmpt tyy, const Cmpt tyz, const Cmpt tzx, const Cmpt tzy, const Cmpt tzz)
 Construct given the nine components. More...
 
template<template< class, direction, direction > class Block2, direction BRowStart, direction BColStart>
 Tensor (const Block2< Tensor< Cmpt >, BRowStart, BColStart > &block)
 Construct from a block of another matrix space. More...
 
 Tensor (Istream &)
 Construct from Istream. More...
 
const Cmpt & xx () const
 
const Cmpt & xy () const
 
const Cmpt & xz () const
 
const Cmpt & yx () const
 
const Cmpt & yy () const
 
const Cmpt & yz () const
 
const Cmpt & zx () const
 
const Cmpt & zy () const
 
const Cmpt & zz () const
 
Cmpt & xx ()
 
Cmpt & xy ()
 
Cmpt & xz ()
 
Cmpt & yx ()
 
Cmpt & yy ()
 
Cmpt & yz ()
 
Cmpt & zx ()
 
Cmpt & zy ()
 
Cmpt & zz ()
 
Vector< Cmpt > x () const
 
Vector< Cmpt > y () const
 
Vector< Cmpt > z () const
 
Vector< Cmpt > vectorComponent (const direction) const
 
Tensor< Cmpt > T () const
 Return transpose. More...
 
Tensor< Cmpt > inv () const
 Return inverse. More...
 
void operator &= (const Tensor< Cmpt > &)
 Inner-product with a Tensor. More...
 
template<class Cmpt2 >
void operator= (const VectorSpace< Tensor< Cmpt2 >, Cmpt2, 9 > &)
 Assign to an equivalent vector space. More...
 
void operator= (const SphericalTensor< Cmpt > &)
 Assign to a SphericalTensor. More...
 
void operator= (const SymmTensor< Cmpt > &)
 Assign to a SymmTensor. More...
 
void operator= (const Vector< Vector< Cmpt >> &)
 Assign to a triad. More...
 
- Public Member Functions inherited from MatrixSpace< Tensor< Cmpt >, Cmpt, 3, 3 >
 MatrixSpace ()
 Construct null. More...
 
 MatrixSpace (const Foam::zero)
 Construct initialized to zero. More...
 
 MatrixSpace (const VectorSpace< Form2, Cmpt2, Mrows *Ncols > &)
 Construct as copy of a VectorSpace with the same size. More...
 
 MatrixSpace (const Block2< Tensor< Cmpt >, BRowStart, BColStart > &block)
 Construct from a block of another matrix space. More...
 
 MatrixSpace (Istream &)
 Construct from Istream. More...
 
const Cmpt & elmt () const
 Fast const element access using compile-time addressing. More...
 
Cmpt & elmt ()
 Fast element access using compile-time addressing. More...
 
const Cmpt & xx () const
 
Cmpt & xx ()
 
const Cmpt & xy () const
 
Cmpt & xy ()
 
const Cmpt & xz () const
 
Cmpt & xz ()
 
const Cmpt & yx () const
 
Cmpt & yx ()
 
const Cmpt & yy () const
 
Cmpt & yy ()
 
const Cmpt & yz () const
 
Cmpt & yz ()
 
const Cmpt & zx () const
 
Cmpt & zx ()
 
const Cmpt & zy () const
 
Cmpt & zy ()
 
const Cmpt & zz () const
 
Cmpt & zz ()
 
typeOfTranspose< Cmpt, Tensor< Cmpt > >::type T () const
 Return the transpose of the matrix. More...
 
ConstBlock< SubTensor, BRowStart, BColStart > block () const
 Return a const sub-block corresponding to the specified type. More...
 
Block< SubTensor, BRowStart, BColStart > block ()
 Return a sub-block corresponding to the specified type. More...
 
Foam::MatrixSpace< Tensor< Cmpt >, Cmpt, Mrows, Ncols >::template ConstBlock< SubTensor, BRowStart, BColStart > block () const
 
Foam::MatrixSpace< Tensor< Cmpt >, Cmpt, Mrows, Ncols >::template Block< SubTensor, BRowStart, BColStart > block ()
 
const Cmpt & operator() (const direction &i, const direction &j) const
 (i, j) const element access operator More...
 
Cmpt & operator() (const direction &i, const direction &j)
 (i, j) element access operator More...
 
void operator= (const Foam::zero)
 Assignment to zero. More...
 
void operator= (const Block2< Tensor< Cmpt >, BRowStart, BColStart > &block)
 Assignment to a block of another matrix space. More...
 
void operator&= (const MatrixSpace< Tensor< Cmpt >, Cmpt, Ncols, Ncols > &matrix)
 Inner product with a compatible square matrix. More...
 
- Public Member Functions inherited from VectorSpace< Tensor< Cmpt >, Cmpt, Mrows *Ncols >
 VectorSpace ()
 Construct null. More...
 
 VectorSpace (const Foam::zero)
 Construct initialized to zero. More...
 
 VectorSpace (Istream &)
 Construct from Istream. More...
 
 VectorSpace (const VectorSpace< Form2, Cmpt2, Ncmpts > &)
 Construct as copy of a VectorSpace with the same size. More...
 
const Cmpt & component (const direction) const
 
Cmpt & component (const direction)
 
void component (Cmpt &, const direction) const
 
void replace (const direction, const Cmpt &)
 
const ConstBlock< SubVector, BStart > block () const
 
const VectorSpace< Tensor< Cmpt >, Cmpt, Ncmpts >::template ConstBlock< SubVector, BStart > block () const
 
const Cmpt & operator[] (const direction) const
 
Cmpt & operator[] (const direction)
 
void operator+= (const VectorSpace< Tensor< Cmpt >, Cmpt, Ncmpts > &)
 
void operator-= (const VectorSpace< Tensor< Cmpt >, Cmpt, Ncmpts > &)
 
void operator= (const Foam::zero)
 
void operator*= (const scalar)
 
void operator/= (const scalar)
 

Static Public Attributes

static const direction rank = 2
 Rank of Tensor is 2. More...
 
static const Tensor I
 
- Static Public Attributes inherited from MatrixSpace< Tensor< Cmpt >, Cmpt, 3, 3 >
static const direction mRows
 
static const direction nCols
 
- Static Public Attributes inherited from VectorSpace< Tensor< Cmpt >, Cmpt, Mrows *Ncols >
static const direction dim
 Dimensionality of space. More...
 
static const direction nComponents
 Number of components in this vector space. More...
 
static const direction mRows
 
static const direction nCols
 
static const char *const typeName
 
static const char *const componentNames []
 
static const Tensor< Cmpt > zero
 
static const Tensor< Cmpt > one
 
static const Tensor< Cmpt > max
 
static const Tensor< Cmpt > min
 
static const Tensor< Cmpt > rootMax
 
static const Tensor< Cmpt > rootMin
 

Additional Inherited Members

- Static Public Member Functions inherited from MatrixSpace< Tensor< Cmpt >, Cmpt, 3, 3 >
static direction m ()
 Return the number of rows. More...
 
static direction n ()
 Return the number of columns. More...
 
static msType identity ()
 Return the identity matrix for square matrix spaces. More...
 
- Static Public Member Functions inherited from VectorSpace< Tensor< Cmpt >, Cmpt, Mrows *Ncols >
static direction size ()
 Return the number of elements in the VectorSpace = Ncmpts. More...
 
static Tensor< Cmpt > uniform (const Cmpt &s)
 Return a VectorSpace with all elements = s. More...
 
- Public Attributes inherited from VectorSpace< Tensor< Cmpt >, Cmpt, Mrows *Ncols >
Cmpt v_ [Ncmpts]
 The components of this vector space. More...
 

Detailed Description

template<class Cmpt>
class Foam::Tensor< Cmpt >

Templated 3D tensor derived from MatrixSpace adding construction from 9 components, element access using xx(), xy() etc. member functions and the inner-product (dot-product) and outer-product of two Vectors (tensor-product) operators.

Source files
See also
Foam::MatrixSpace Foam::Vector

Definition at line 222 of file complexI.H.

Member Typedef Documentation

◆ labelType

Equivalent type of labels used for valid component indexing.

Definition at line 69 of file Tensor.H.

Member Enumeration Documentation

◆ components

enum components

Component labeling enumeration.

Enumerator
XX 
XY 
XZ 
YX 
YY 
YZ 
ZX 
ZY 
ZZ 

Definition at line 84 of file Tensor.H.

Constructor & Destructor Documentation

◆ Tensor() [1/11]

Tensor ( )
inline

Construct null.

Definition at line 31 of file TensorI.H.

Referenced by Tensor< scalar >::Tensor().

Here is the caller graph for this function:

◆ Tensor() [2/11]

Tensor ( const Foam::zero  )
inline

Construct initialized to zero.

Definition at line 36 of file TensorI.H.

◆ Tensor() [3/11]

Tensor ( const MatrixSpace< Tensor< Cmpt2 >, Cmpt2, 3, 3 > &  vs)
inline

Construct given MatrixSpace of the same rank.

Definition at line 45 of file TensorI.H.

◆ Tensor() [4/11]

Tensor ( const VectorSpace< Tensor< Cmpt2 >, Cmpt2, 9 > &  vs)
inline

Construct given VectorSpace of the same rank.

Definition at line 56 of file TensorI.H.

◆ Tensor() [5/11]

Tensor ( const SphericalTensor< Cmpt > &  st)
inline

Construct given SphericalTensor.

Definition at line 65 of file TensorI.H.

◆ Tensor() [6/11]

Tensor ( const SymmTensor< Cmpt > &  st)
inline

Construct given SymmTensor.

Definition at line 74 of file TensorI.H.

◆ Tensor() [7/11]

Tensor ( const Vector< Vector< Cmpt >> &  tr)
inline

Construct given triad.

Definition at line 83 of file TensorI.H.

◆ Tensor() [8/11]

Tensor ( const Vector< Cmpt > &  x,
const Vector< Cmpt > &  y,
const Vector< Cmpt > &  z 
)
inline

Construct given the three vector components.

Definition at line 101 of file TensorI.H.

◆ Tensor() [9/11]

Tensor ( const Cmpt  txx,
const Cmpt  txy,
const Cmpt  txz,
const Cmpt  tyx,
const Cmpt  tyy,
const Cmpt  tyz,
const Cmpt  tzx,
const Cmpt  tzy,
const Cmpt  tzz 
)
inline

Construct given the nine components.

Definition at line 115 of file TensorI.H.

◆ Tensor() [10/11]

Tensor ( const Block2< Tensor< Cmpt >, BRowStart, BColStart > &  block)
inline

Construct from a block of another matrix space.

Definition at line 135 of file TensorI.H.

◆ Tensor() [11/11]

Tensor ( Istream is)
inline

Construct from Istream.

Definition at line 144 of file TensorI.H.

Member Function Documentation

◆ xx() [1/2]

const Cmpt & xx ( ) const
inline

◆ xy() [1/2]

const Cmpt & xy ( ) const
inline

◆ xz() [1/2]

const Cmpt & xz ( ) const
inline

◆ yx() [1/2]

const Cmpt & yx ( ) const
inline

◆ yy() [1/2]

const Cmpt & yy ( ) const
inline

◆ yz() [1/2]

const Cmpt & yz ( ) const
inline

◆ zx() [1/2]

const Cmpt & zx ( ) const
inline

◆ zy() [1/2]

const Cmpt & zy ( ) const
inline

◆ zz() [1/2]

const Cmpt & zz ( ) const
inline

◆ xx() [2/2]

Cmpt & xx ( )
inline

Definition at line 216 of file TensorI.H.

◆ xy() [2/2]

Cmpt & xy ( )
inline

Definition at line 223 of file TensorI.H.

◆ xz() [2/2]

Cmpt & xz ( )
inline

Definition at line 230 of file TensorI.H.

◆ yx() [2/2]

Cmpt & yx ( )
inline

Definition at line 237 of file TensorI.H.

◆ yy() [2/2]

Cmpt & yy ( )
inline

Definition at line 244 of file TensorI.H.

◆ yz() [2/2]

Cmpt & yz ( )
inline

Definition at line 251 of file TensorI.H.

◆ zx() [2/2]

Cmpt & zx ( )
inline

Definition at line 258 of file TensorI.H.

◆ zy() [2/2]

Cmpt & zy ( )
inline

Definition at line 265 of file TensorI.H.

◆ zz() [2/2]

Cmpt & zz ( )
inline

Definition at line 272 of file TensorI.H.

◆ x()

Foam::Vector< Cmpt > x ( ) const
inline

◆ y()

Foam::Vector< Cmpt > y ( ) const
inline

◆ z()

Foam::Vector< Cmpt > z ( ) const
inline

◆ vectorComponent()

Foam::Vector< Cmpt > vectorComponent ( const direction  cmpt) const
inline

Definition at line 301 of file TensorI.H.

Referenced by Tensor< scalar >::z().

Here is the caller graph for this function:

◆ T()

Foam::Tensor< Cmpt > T ( ) const
inline

◆ inv()

Tensor< Cmpt > inv ( ) const
inline

Return inverse.

Definition at line 642 of file TensorI.H.

◆ operator &=()

void operator&= ( const Tensor< Cmpt > &  )
inline

Inner-product with a Tensor.

Referenced by Tensor< scalar >::T().

Here is the caller graph for this function:

◆ operator=() [1/4]

void operator= ( const VectorSpace< Tensor< Cmpt2 >, Cmpt2, 9 > &  vs)
inline

Assign to an equivalent vector space.

Definition at line 360 of file TensorI.H.

◆ operator=() [2/4]

void operator= ( const SphericalTensor< Cmpt > &  st)
inline

Assign to a SphericalTensor.

Definition at line 369 of file TensorI.H.

◆ operator=() [3/4]

void operator= ( const SymmTensor< Cmpt > &  st)
inline

Assign to a SymmTensor.

Definition at line 378 of file TensorI.H.

◆ operator=() [4/4]

void operator= ( const Vector< Vector< Cmpt >> &  tr)
inline

Assign to a triad.

Definition at line 387 of file TensorI.H.

Member Data Documentation

◆ rank

const direction rank = 2
static

Rank of Tensor is 2.

Definition at line 75 of file Tensor.H.

◆ I

const Foam::floatTensor I
static

Definition at line 80 of file Tensor.H.


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