SymmTensor< Cmpt > Class Template Reference

A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements, derived from VectorSpace. More...

Inheritance diagram for SymmTensor< Cmpt >:
[legend]
Collaboration diagram for SymmTensor< Cmpt >:
[legend]

Public Types

enum  components {
  XX , XY , XZ , YY ,
  YZ , ZZ
}
 Component labeling enumeration. More...
 
typedef SymmTensor< label > labelType
 Equivalent type of labels used for valid component indexing. More...
 
- Public Types inherited from VectorSpace< SymmTensor< Cmpt >, Cmpt, 6 >
typedef VectorSpace< SymmTensor< Cmpt >, Cmpt, Ncmpts > vsType
 VectorSpace type. More...
 
typedef Cmpt cmptType
 Component type. More...
 
typedef Cmpt magType
 Magnitude type. More...
 
typedef Cmpt * iterator
 Random access iterator for traversing VectorSpace. More...
 
typedef const Cmpt * const_iterator
 Random access iterator for traversing VectorSpace. More...
 

Public Member Functions

 SymmTensor ()=default
 Default construct. More...
 
 SymmTensor (const SymmTensor &)=default
 Copy construct. More...
 
SymmTensoroperator= (const SymmTensor &)=default
 Copy assignment. More...
 
 SymmTensor (const Foam::zero)
 Construct initialized to zero. More...
 
template<class Cmpt2 >
 SymmTensor (const VectorSpace< SymmTensor< Cmpt2 >, Cmpt2, 6 > &)
 Construct given VectorSpace of the same rank. More...
 
 SymmTensor (const SphericalTensor< Cmpt > &)
 Construct given SphericalTensor. More...
 
 SymmTensor (const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z, const bool transposed=false)
 Construct given the three row (or column) vectors. More...
 
 SymmTensor (const Cmpt txx, const Cmpt txy, const Cmpt txz, const Cmpt tyy, const Cmpt tyz, const Cmpt tzz)
 Construct given the six components. More...
 
 SymmTensor (Istream &is)
 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 > cx () const
 Extract vector for column 0. More...
 
Vector< Cmpt > cy () const
 Extract vector for column 1. More...
 
Vector< Cmpt > cz () const
 Extract vector for column 2. More...
 
template<direction Idx>
Vector< Cmpt > col () const
 Extract vector for given column: compile-time check of index. More...
 
Vector< Cmpt > col (const direction c) const
 Extract vector for given column (0,1,2): runtime check of index. More...
 
void col (const direction c, const Vector< Cmpt > &v)
 Set values of given column (0,1,2): runtime check of index. More...
 
void cols (const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z)
 Set column values. More...
 
Vector< Cmpt > x () const
 Extract vector for row 0. More...
 
Vector< Cmpt > y () const
 Extract vector for row 1. More...
 
Vector< Cmpt > z () const
 Extract vector for row 2. More...
 
template<direction Row>
Vector< Cmpt > row () const
 Extract vector for given row: compile-time check of index. More...
 
Vector< Cmpt > row (const direction r) const
 Extract vector for given row (0,1,2): runtime check of index. More...
 
template<direction Idx>
void row (const Vector< Cmpt > &v)
 Set values of given row: compile-time check of index. More...
 
void row (const direction r, const Vector< Cmpt > &v)
 Set values of given row (0,1,2): runtime check of row. More...
 
void rows (const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z)
 Set row values. More...
 
Vector< Cmpt > diag () const
 Extract the diagonal as a vector. More...
 
void diag (const Vector< Cmpt > &v)
 Set values of the diagonal. More...
 
const SymmTensor< Cmpt > & T () const
 Return non-Hermitian transpose. More...
 
void operator= (const SphericalTensor< Cmpt > &)
 Assign to given SphericalTensor. More...
 
template<Foam::direction Idx>
Foam::Vector< Cmpt > row () const
 
- Public Member Functions inherited from VectorSpace< SymmTensor< Cmpt >, Cmpt, 6 >
 VectorSpace ()=default
 Default construct. More...
 
 VectorSpace (const Foam::zero)
 Construct initialized to zero. More...
 
 VectorSpace (const VectorSpace< SymmTensor< Cmpt >, Cmpt, Ncmpts > &vs)
 Copy construct. More...
 
 VectorSpace (const VectorSpace< Form2, Cmpt2, Ncmpts > &)
 Copy construct of a VectorSpace with the same size. More...
 
 VectorSpace (Istream &is)
 Construct from Istream. More...
 
const Cmpt & component (const direction) const
 
Cmpt & component (const direction)
 
void component (Cmpt &, const direction) const
 
void replace (const direction, const Cmpt &)
 
const Cmpt * cdata () const noexcept
 Return const pointer to the first data element. More...
 
Cmpt * data () noexcept
 Return pointer to the first data element. More...
 
const ConstBlock< SubVector, BStart > block () const
 
const Foam::VectorSpace< SymmTensor< Cmpt >, Cmpt, Ncmpts >::template ConstBlock< SubVector, BStart > block () const
 
const Cmpt & operator[] (const direction) const
 
Cmpt & operator[] (const direction)
 
void operator= (const VectorSpace< SymmTensor< Cmpt >, Cmpt, Ncmpts > &)
 
void operator= (const Foam::zero)
 
void operator+= (const VectorSpace< SymmTensor< Cmpt >, Cmpt, Ncmpts > &)
 
void operator-= (const VectorSpace< SymmTensor< Cmpt >, Cmpt, Ncmpts > &)
 
void operator*= (const scalar)
 
void operator/= (const scalar)
 
iterator begin () noexcept
 Return an iterator to begin of VectorSpace. More...
 
const_iterator begin () const noexcept
 Return const_iterator to begin of VectorSpace. More...
 
iterator end () noexcept
 Return an iterator to end of VectorSpace. More...
 
const_iterator end () const noexcept
 Return const_iterator to end of VectorSpace. More...
 
const_iterator cbegin () const noexcept
 Return const_iterator to begin of VectorSpace. More...
 
const_iterator cend () const noexcept
 Return const_iterator to end of VectorSpace. More...
 

Static Public Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from VectorSpace< SymmTensor< Cmpt >, Cmpt, 6 >
static constexpr direction size () noexcept
 The number of elements in the VectorSpace = Ncmpts. More...
 
static SymmTensor< Cmpt > uniform (const Cmpt &s)
 Return a VectorSpace with all elements = s. More...
 
- Public Attributes inherited from VectorSpace< SymmTensor< Cmpt >, Cmpt, 6 >
Cmpt v_ [Ncmpts]
 The components of this vector space. More...
 

Detailed Description

template<class Cmpt>
class Foam::SymmTensor< Cmpt >

A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements, derived from VectorSpace.

Source files

Definition at line 54 of file SymmTensor.H.

Member Typedef Documentation

◆ labelType

typedef SymmTensor<label> labelType

Equivalent type of labels used for valid component indexing.

Definition at line 63 of file SymmTensor.H.

Member Enumeration Documentation

◆ components

enum components

Component labeling enumeration.

Enumerator
XX 
XY 
XZ 
YY 
YZ 
ZZ 

Definition at line 78 of file SymmTensor.H.

Constructor & Destructor Documentation

◆ SymmTensor() [1/8]

SymmTensor ( )
default

Default construct.

◆ SymmTensor() [2/8]

SymmTensor ( const SymmTensor< Cmpt > &  )
default

Copy construct.

◆ SymmTensor() [3/8]

SymmTensor ( const Foam::zero  )
inline

Construct initialized to zero.

Definition at line 34 of file SymmTensorI.H.

◆ SymmTensor() [4/8]

SymmTensor ( const VectorSpace< SymmTensor< Cmpt2 >, Cmpt2, 6 > &  vs)
inline

Construct given VectorSpace of the same rank.

Definition at line 42 of file SymmTensorI.H.

◆ SymmTensor() [5/8]

SymmTensor ( const SphericalTensor< Cmpt > &  st)
inline

Construct given SphericalTensor.

Definition at line 52 of file SymmTensorI.H.

References SphericalTensor< Cmpt >::ii(), and Foam::Zero.

Here is the call graph for this function:

◆ SymmTensor() [6/8]

SymmTensor ( const Vector< Cmpt > &  x,
const Vector< Cmpt > &  y,
const Vector< Cmpt > &  z,
const bool  transposed = false 
)
inline

Construct given the three row (or column) vectors.

Definition at line 61 of file SymmTensorI.H.

References x, and y.

◆ SymmTensor() [7/8]

SymmTensor ( const Cmpt  txx,
const Cmpt  txy,
const Cmpt  txz,
const Cmpt  tyy,
const Cmpt  tyz,
const Cmpt  tzz 
)
inline

Construct given the six components.

Definition at line 74 of file SymmTensorI.H.

◆ SymmTensor() [8/8]

SymmTensor ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 88 of file SymmTensorI.H.

Member Function Documentation

◆ operator=() [1/2]

SymmTensor & operator= ( const SymmTensor< Cmpt > &  )
default

Copy assignment.

◆ xx() [1/2]

◆ xy() [1/2]

const Cmpt & xy
inline

Definition at line 103 of file SymmTensorI.H.

Referenced by turbulentDFSEMInletFvPatchVectorField::checkStresses(), Foam::cof(), Foam::det(), Foam::innerSqr(), Foam::invariantII(), Foam::invTransform(), Foam::magSqr(), Foam::operator&(), Foam::operator&&(), Foam::operator*(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor< Cmpt >::operator=(), Tensor< Cmpt >::Tensor(), and Foam::transform().

Here is the caller graph for this function:

◆ xz() [1/2]

const Cmpt & xz
inline

Definition at line 109 of file SymmTensorI.H.

Referenced by Foam::cof(), Foam::det(), Foam::innerSqr(), Foam::invariantII(), Foam::invTransform(), Foam::magSqr(), Foam::operator&(), Foam::operator&&(), Foam::operator*(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor< Cmpt >::operator=(), Tensor< Cmpt >::Tensor(), and Foam::transform().

Here is the caller graph for this function:

◆ yx() [1/2]

const Cmpt & yx
inline

Definition at line 115 of file SymmTensorI.H.

◆ yy() [1/2]

◆ yz() [1/2]

const Cmpt & yz
inline

Definition at line 127 of file SymmTensorI.H.

Referenced by Foam::cof(), Foam::det(), Foam::innerSqr(), Foam::invariantII(), Foam::invTransform(), Foam::magSqr(), Foam::operator&(), Foam::operator&&(), Foam::operator*(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor< Cmpt >::operator=(), Tensor< Cmpt >::Tensor(), and Foam::transform().

Here is the caller graph for this function:

◆ zx() [1/2]

const Cmpt & zx
inline

Definition at line 133 of file SymmTensorI.H.

◆ zy() [1/2]

const Cmpt & zy
inline

Definition at line 139 of file SymmTensorI.H.

◆ zz() [1/2]

const Cmpt & zz
inline

◆ xx() [2/2]

Cmpt & xx
inline

Definition at line 152 of file SymmTensorI.H.

◆ xy() [2/2]

Cmpt & xy
inline

Definition at line 158 of file SymmTensorI.H.

◆ xz() [2/2]

Cmpt & xz
inline

Definition at line 164 of file SymmTensorI.H.

◆ yx() [2/2]

Cmpt & yx
inline

Definition at line 170 of file SymmTensorI.H.

◆ yy() [2/2]

Cmpt & yy
inline

Definition at line 176 of file SymmTensorI.H.

◆ yz() [2/2]

Cmpt & yz
inline

Definition at line 182 of file SymmTensorI.H.

◆ zx() [2/2]

Cmpt & zx
inline

Definition at line 188 of file SymmTensorI.H.

◆ zy() [2/2]

Cmpt & zy
inline

Definition at line 194 of file SymmTensorI.H.

◆ zz() [2/2]

Cmpt & zz
inline

Definition at line 200 of file SymmTensorI.H.

◆ cx()

Vector< Cmpt > cx ( ) const
inline

Extract vector for column 0.

Definition at line 154 of file SymmTensor.H.

References SymmTensor< Cmpt >::x().

Here is the call graph for this function:

◆ cy()

Vector< Cmpt > cy ( ) const
inline

Extract vector for column 1.

Definition at line 157 of file SymmTensor.H.

References SymmTensor< Cmpt >::y().

Here is the call graph for this function:

◆ cz()

Vector< Cmpt > cz ( ) const
inline

Extract vector for column 2.

Definition at line 160 of file SymmTensor.H.

References SymmTensor< Cmpt >::z().

Here is the call graph for this function:

◆ col() [1/3]

Vector< Cmpt > col ( ) const
inline

Extract vector for given column: compile-time check of index.

Definition at line 164 of file SymmTensor.H.

◆ col() [2/3]

Vector< Cmpt > col ( const direction  c) const
inline

Extract vector for given column (0,1,2): runtime check of index.

Definition at line 167 of file SymmTensor.H.

References SymmTensor< Cmpt >::row().

Here is the call graph for this function:

◆ col() [3/3]

void col ( const direction  c,
const Vector< Cmpt > &  v 
)
inline

Set values of given column (0,1,2): runtime check of index.

Definition at line 170 of file SymmTensor.H.

References SymmTensor< Cmpt >::row().

Here is the call graph for this function:

◆ cols()

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

Set column values.

Definition at line 173 of file SymmTensor.H.

References SymmTensor< Cmpt >::rows(), SymmTensor< Cmpt >::y(), and SymmTensor< Cmpt >::z().

Here is the call graph for this function:

◆ x()

Foam::Vector< Cmpt > x
inline

Extract vector for row 0.

Definition at line 207 of file SymmTensorI.H.

Referenced by SymmTensor< Cmpt >::cx().

Here is the caller graph for this function:

◆ y()

Foam::Vector< Cmpt > y
inline

Extract vector for row 1.

Definition at line 214 of file SymmTensorI.H.

Referenced by SymmTensor< Cmpt >::cols(), and SymmTensor< Cmpt >::cy().

Here is the caller graph for this function:

◆ z()

Foam::Vector< Cmpt > z
inline

Extract vector for row 2.

Definition at line 221 of file SymmTensorI.H.

Referenced by SymmTensor< Cmpt >::cols(), and SymmTensor< Cmpt >::cz().

Here is the caller graph for this function:

◆ row() [1/5]

Vector< Cmpt > row ( ) const
inline

Extract vector for given row: compile-time check of index.

Referenced by SymmTensor< Cmpt >::col().

Here is the caller graph for this function:

◆ row() [2/5]

Foam::Vector< Cmpt > row ( const direction  r) const
inline

Extract vector for given row (0,1,2): runtime check of index.

Definition at line 241 of file SymmTensorI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, x, y, and Foam::Zero.

Here is the call graph for this function:

◆ row() [3/5]

void row ( const Vector< Cmpt > &  v)
inline

Set values of given row: compile-time check of index.

Definition at line 259 of file SymmTensorI.H.

References Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ row() [4/5]

void row ( const direction  r,
const Vector< Cmpt > &  v 
)
inline

Set values of given row (0,1,2): runtime check of row.

Definition at line 293 of file SymmTensorI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ rows()

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

Set row values.

Definition at line 279 of file SymmTensorI.H.

References x, y, and Vector< Cmpt >::z().

Referenced by SymmTensor< Cmpt >::cols().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diag() [1/2]

Foam::Vector< Cmpt > diag
inline

Extract the diagonal as a vector.

Definition at line 312 of file SymmTensorI.H.

◆ diag() [2/2]

void diag ( const Vector< Cmpt > &  v)
inline

Set values of the diagonal.

Definition at line 319 of file SymmTensorI.H.

References Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Here is the call graph for this function:

◆ T()

const Foam::SymmTensor< Cmpt > & T
inline

Return non-Hermitian transpose.

Definition at line 326 of file SymmTensorI.H.

◆ operator=() [2/2]

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

Assign to given SphericalTensor.

Definition at line 335 of file SymmTensorI.H.

References SphericalTensor< Cmpt >::ii(), and Foam::Zero.

Here is the call graph for this function:

◆ row() [5/5]

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

Definition at line 229 of file SymmTensorI.H.

Member Data Documentation

◆ rank

constexpr direction rank = 2
staticconstexpr

Rank of SymmTensor is 2.

Definition at line 69 of file SymmTensor.H.

◆ I

const Foam::labelSymmTensor I
static

Definition at line 74 of file SymmTensor.H.


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