Tensor< Cmpt > Class Template Reference

A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace. More...

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

Public Types

enum  components {
  XX, XY, XZ, YX,
  YY, YZ, ZX, ZY,
  ZZ
}
 Component labeling enumeration. More...
 
typedef Tensor< label > labelType
 Equivalent type of labels used for valid component indexing. More...
 

Public Member Functions

 Tensor ()=default
 Default construct. More...
 
 Tensor (const Tensor &)=default
 Copy construct. More...
 
Tensoroperator= (const Tensor &)=default
 Copy assignment. More...
 
 Tensor (const Foam::zero)
 Construct initialized to zero. More...
 
template<class Cmpt2 >
 Tensor (const MatrixSpace< Tensor< Cmpt2 >, Cmpt2, 3, 3 > &vs)
 Construct given MatrixSpace of the same rank. More...
 
template<class Cmpt2 >
 Tensor (const VectorSpace< Tensor< Cmpt2 >, Cmpt2, 9 > &vs)
 Construct given VectorSpace of the same rank. More...
 
 Tensor (const SphericalTensor< Cmpt > &st)
 Construct given SphericalTensor. More...
 
 Tensor (const SymmTensor< Cmpt > &st)
 Construct given SymmTensor. More...
 
 Tensor (const Vector< Vector< Cmpt >> &vecs, const bool transposed=false)
 
 Tensor (const Vector< Cmpt > &x, const Vector< Cmpt > &y, const Vector< Cmpt > &z, const bool transposed=false)
 
 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 &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 Col>
Vector< Cmpt > col () const
 Extract vector for given column. More...
 
Vector< Cmpt > col (const direction c) const
 Extract vector for given column (0,1,2). More...
 
template<direction Col>
void col (const Vector< Cmpt > &v)
 Set values of given column. More...
 
void col (const direction c, const Vector< Cmpt > &v)
 Set values of given column (0,1,2) 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. More...
 
Vector< Cmpt > row (const direction r) const
 Extract vector for given row (0,1,2) More...
 
template<direction Row>
void row (const Vector< Cmpt > &v)
 Set values of given row. More...
 
void row (const direction r, const Vector< Cmpt > &v)
 Set values of given row (0,1,2) 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...
 
Tensor< Cmpt > T () const
 Return non-Hermitian transpose. More...
 
Tensor< Cmpt > inv () const
 Return inverse. More...
 
Tensor< Cmpt > inner (const Tensor< Cmpt > &t2) const
 Inner-product of this with another Tensor. More...
 
Tensor< Cmpt > schur (const Tensor< Cmpt > &t2) const
 Schur-product of this with another Tensor. More...
 
void operator&= (const Tensor< Cmpt > &t)
 Assign inner-product of this with another 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 of row vectors. More...
 
Vector< Cmpt > vectorComponent (const direction cmpt) const
 Deprecated(2018-12) Return vector for given row (0,1) More...
 
template<Foam::direction Col>
Foam::Vector< Cmpt > col () const
 
template<Foam::direction Row>
Foam::Vector< Cmpt > row () const
 

Static Public Attributes

static constexpr direction rank = 2
 Rank of Tensor is 2. More...
 
static const Tensor I
 

Detailed Description

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

A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.

See also
Test-Tensor.C
Source files
See also
Foam::MatrixSpace Foam::Vector

Definition at line 275 of file complexI.H.

Member Typedef Documentation

◆ labelType

typedef Tensor<label> labelType

Equivalent type of labels used for valid component indexing.

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

Constructor & Destructor Documentation

◆ Tensor() [1/12]

Tensor ( )
default

Default construct.

◆ Tensor() [2/12]

Tensor ( const Tensor< Cmpt > &  )
default

Copy construct.

◆ Tensor() [3/12]

Tensor ( const Foam::zero  )
inline

Construct initialized to zero.

Definition at line 35 of file TensorI.H.

◆ Tensor() [4/12]

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

Construct given MatrixSpace of the same rank.

Definition at line 44 of file TensorI.H.

◆ Tensor() [5/12]

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

Construct given VectorSpace of the same rank.

Definition at line 55 of file TensorI.H.

◆ Tensor() [6/12]

Tensor ( const SphericalTensor< Cmpt > &  st)
inline

Construct given SphericalTensor.

Definition at line 64 of file TensorI.H.

◆ Tensor() [7/12]

Tensor ( const SymmTensor< Cmpt > &  st)
inline

Construct given SymmTensor.

Definition at line 73 of file TensorI.H.

◆ Tensor() [8/12]

Tensor ( const Vector< Vector< Cmpt >> &  vecs,
const bool  transposed = false 
)
inline

Construct given triad of row vectors, optionally treated as transposed (ie, column vectors)

Definition at line 83 of file TensorI.H.

◆ Tensor() [9/12]

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

Construct given the three row vectors, optionally treated as transposed (ie, column vectors)

Definition at line 94 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 114 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 134 of file TensorI.H.

◆ Tensor() [12/12]

Tensor ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 143 of file TensorI.H.

Member Function Documentation

◆ operator=() [1/5]

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

Copy assignment.

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

◆ xy() [2/2]

Cmpt & xy ( )
inline

Definition at line 222 of file TensorI.H.

◆ xz() [2/2]

Cmpt & xz ( )
inline

Definition at line 229 of file TensorI.H.

◆ yx() [2/2]

Cmpt & yx ( )
inline

Definition at line 236 of file TensorI.H.

◆ yy() [2/2]

Cmpt & yy ( )
inline

Definition at line 243 of file TensorI.H.

◆ yz() [2/2]

Cmpt & yz ( )
inline

Definition at line 250 of file TensorI.H.

◆ zx() [2/2]

Cmpt & zx ( )
inline

Definition at line 257 of file TensorI.H.

◆ zy() [2/2]

Cmpt & zy ( )
inline

Definition at line 264 of file TensorI.H.

◆ zz() [2/2]

Cmpt & zz ( )
inline

Definition at line 271 of file TensorI.H.

◆ cx()

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

Extract vector for column 0.

Definition at line 299 of file TensorI.H.

Referenced by coordinateSystem::e1(), and lumpedPointState::writeVTP().

Here is the caller graph for this function:

◆ cy()

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

Extract vector for column 1.

Definition at line 306 of file TensorI.H.

Referenced by coordinateSystem::e2(), and lumpedPointState::writeVTP().

Here is the caller graph for this function:

◆ cz()

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

Extract vector for column 2.

Definition at line 313 of file TensorI.H.

Referenced by coordinateSystem::e3().

Here is the caller graph for this function:

◆ col() [1/5]

Vector<Cmpt> col ( ) const
inline

Extract vector for given column.

Compile-time check of column index.

Referenced by cylindrical::R(), and axes::rotation().

Here is the caller graph for this function:

◆ col() [2/5]

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

Extract vector for given column (0,1,2).

Runtime check of column index.

Definition at line 333 of file TensorI.H.

◆ col() [3/5]

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

Set values of given column.

Compile-time check of column index.

Definition at line 381 of file TensorI.H.

◆ col() [4/5]

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

Set values of given column (0,1,2)

Runtime check of column index.

Definition at line 456 of file TensorI.H.

◆ cols()

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

Set column values.

Definition at line 429 of file TensorI.H.

◆ x()

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

Extract vector for row 0.

Definition at line 278 of file TensorI.H.

Referenced by Bezier::facePoints_d(), and triad::operator=().

Here is the caller graph for this function:

◆ y()

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

Extract vector for row 1.

Definition at line 285 of file TensorI.H.

Referenced by Bezier::facePoints_d(), and triad::operator=().

Here is the caller graph for this function:

◆ z()

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

Extract vector for row 2.

Definition at line 292 of file TensorI.H.

Referenced by Bezier::facePoints_d(), and triad::operator=().

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 row index.

◆ row() [2/5]

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

Extract vector for given row (0,1,2)

Runtime check of row index.

Definition at line 363 of file TensorI.H.

◆ row() [3/5]

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

Set values of given row.

Compile-time check of row index.

Definition at line 408 of file TensorI.H.

◆ 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 index.

Definition at line 472 of file TensorI.H.

◆ rows()

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

Set row values.

Definition at line 443 of file TensorI.H.

◆ diag() [1/2]

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

Extract the diagonal as a vector.

Definition at line 488 of file TensorI.H.

◆ diag() [2/2]

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

Set values of the diagonal.

Definition at line 495 of file TensorI.H.

◆ T()

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

Return non-Hermitian transpose.

Definition at line 504 of file TensorI.H.

Referenced by edgeInterpolationScheme< scalar >::interpolate(), spatialTransform::inv(), mapDistribute::transform::operator()(), transformOp< PrimitivePatchType, Type, TrackingData >::operator()(), Foam::RBD::transform(), and triad::triad().

Here is the caller graph for this function:

◆ inv()

Tensor< Cmpt > inv ( ) const
inline

Return inverse.

Return the inverse of this Tensor.

Definition at line 760 of file TensorI.H.

◆ inner()

Foam::Tensor< Cmpt > inner ( const Tensor< Cmpt > &  t2) const
inline

Inner-product of this with another Tensor.

Definition at line 517 of file TensorI.H.

Referenced by Foam::operator&().

Here is the caller graph for this function:

◆ schur()

Foam::Tensor< Cmpt > schur ( const Tensor< Cmpt > &  t2) const
inline

Schur-product of this with another Tensor.

Definition at line 540 of file TensorI.H.

◆ operator&=()

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

Assign inner-product of this with another Tensor.

Definition at line 556 of file TensorI.H.

◆ operator=() [2/5]

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

Assign to an equivalent vector space.

Definition at line 565 of file TensorI.H.

◆ operator=() [3/5]

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

Assign to a SphericalTensor.

Definition at line 574 of file TensorI.H.

◆ operator=() [4/5]

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

Assign to a SymmTensor.

Definition at line 583 of file TensorI.H.

◆ operator=() [5/5]

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

Assign to a triad of row vectors.

Definition at line 592 of file TensorI.H.

◆ vectorComponent()

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

Deprecated(2018-12) Return vector for given row (0,1)

Deprecated:
(2018-12) use row() method

Definition at line 316 of file Tensor.H.

Referenced by eddy::writeSurfaceOBJ().

Here is the caller graph for this function:

◆ col() [5/5]

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

Definition at line 321 of file TensorI.H.

◆ row() [5/5]

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

Definition at line 351 of file TensorI.H.

Member Data Documentation

◆ rank

constexpr direction rank = 2
staticconstexpr

Rank of Tensor is 2.

Definition at line 80 of file Tensor.H.

◆ I


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