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 >:
Collaboration diagram for Tensor< Cmpt >:

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 initialised 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 DiagTensor< Cmpt > &)
 Construct given DiagTensor. 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 DiagTensor< Cmpt > &)
 Assign to a DiagTensor. 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 initialised 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 initialised 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 215 of file complexI.H.

Member Typedef Documentation

◆ labelType

Equivalent type of labels used for valid component indexing.

Definition at line 72 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 87 of file Tensor.H.

Constructor & Destructor Documentation

◆ Tensor() [1/12]

Tensor ( )
inline

Construct null.

Definition at line 32 of file TensorI.H.

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

Here is the caller graph for this function:

◆ Tensor() [2/12]

Tensor ( const Foam::zero  )
inline

Construct initialised to zero.

Definition at line 37 of file TensorI.H.

◆ Tensor() [3/12]

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

Construct given MatrixSpace of the same rank.

Definition at line 46 of file TensorI.H.

◆ Tensor() [4/12]

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

Construct given VectorSpace of the same rank.

Definition at line 57 of file TensorI.H.

◆ Tensor() [5/12]

Tensor ( const SphericalTensor< Cmpt > &  st)
inline

Construct given SphericalTensor.

Definition at line 66 of file TensorI.H.

◆ Tensor() [6/12]

Tensor ( const SymmTensor< Cmpt > &  st)
inline

Construct given SymmTensor.

Definition at line 75 of file TensorI.H.

◆ Tensor() [7/12]

Tensor ( const DiagTensor< Cmpt > &  st)
inline

Construct given DiagTensor.

Definition at line 84 of file TensorI.H.

◆ Tensor() [8/12]

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

Construct given triad.

Definition at line 93 of file TensorI.H.

◆ Tensor() [9/12]

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

Construct given the three vector components.

Definition at line 111 of file TensorI.H.

◆ Tensor() [10/12]

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 125 of file TensorI.H.

◆ Tensor() [11/12]

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

Construct from a block of another matrix space.

Definition at line 145 of file TensorI.H.

◆ Tensor() [12/12]

Tensor ( Istream is)
inline

Construct from Istream.

Definition at line 154 of file TensorI.H.

Member Function Documentation

◆ xx() [1/2]

◆ xy() [1/2]

◆ xz() [1/2]

◆ yx() [1/2]

◆ yy() [1/2]

◆ yz() [1/2]

◆ zx() [1/2]

◆ zy() [1/2]

◆ zz() [1/2]

◆ xx() [2/2]

Cmpt & xx ( )
inline

Definition at line 226 of file TensorI.H.

◆ xy() [2/2]

Cmpt & xy ( )
inline

Definition at line 233 of file TensorI.H.

◆ xz() [2/2]

Cmpt & xz ( )
inline

Definition at line 240 of file TensorI.H.

◆ yx() [2/2]

Cmpt & yx ( )
inline

Definition at line 247 of file TensorI.H.

◆ yy() [2/2]

Cmpt & yy ( )
inline

Definition at line 254 of file TensorI.H.

◆ yz() [2/2]

Cmpt & yz ( )
inline

Definition at line 261 of file TensorI.H.

◆ zx() [2/2]

Cmpt & zx ( )
inline

Definition at line 268 of file TensorI.H.

◆ zy() [2/2]

Cmpt & zy ( )
inline

Definition at line 275 of file TensorI.H.

◆ zz() [2/2]

Cmpt & zz ( )
inline

Definition at line 282 of file TensorI.H.

◆ x()

◆ y()

◆ z()

◆ vectorComponent()

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

Definition at line 311 of file TensorI.H.

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

Here is the caller graph for this function:

◆ T()

◆ inv()

Tensor< Cmpt > inv ( ) const
inline

Return inverse.

Definition at line 652 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/5]

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

Assign to an equivalent vector space.

Definition at line 370 of file TensorI.H.

◆ operator=() [2/5]

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

Assign to a SphericalTensor.

Definition at line 379 of file TensorI.H.

◆ operator=() [3/5]

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

Assign to a SymmTensor.

Definition at line 388 of file TensorI.H.

◆ operator=() [4/5]

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

Assign to a DiagTensor.

◆ operator=() [5/5]

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

Assign to a triad.

Definition at line 397 of file TensorI.H.

Member Data Documentation

◆ rank

const direction rank = 2
static

Rank of Tensor is 2.

Definition at line 78 of file Tensor.H.

◆ I

const Foam::floatTensor I
static

Definition at line 83 of file Tensor.H.


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