Tensor2D< Cmpt > Class Template Reference

A templated (2 x 2) tensor of objects of <T> derived from VectorSpace. More...

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

Public Types

enum  components { XX, XY, YX, YY }
 Component labeling enumeration. More...
 
typedef Tensor2D< label > labelType
 Equivalent type of labels used for valid component indexing. More...
 
- Public Types inherited from VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 >
typedef VectorSpace< Tensor2D< 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...
 

Public Member Functions

 Tensor2D ()=default
 Default construct. More...
 
 Tensor2D (const Tensor2D &)=default
 Copy construct. More...
 
Tensor2Doperator= (const Tensor2D &)=default
 Copy assignment. More...
 
 Tensor2D (const Foam::zero)
 Construct initialized to zero. More...
 
 Tensor2D (const VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 > &vs)
 Construct given VectorSpace. More...
 
 Tensor2D (const SymmTensor2D< Cmpt > &st)
 Construct given SymmTensor2D. More...
 
 Tensor2D (const SphericalTensor2D< Cmpt > &st)
 Construct given SphericalTensor2D. More...
 
 Tensor2D (const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
 Construct given the two row vectors. More...
 
 Tensor2D (const Cmpt txx, const Cmpt txy, const Cmpt tyx, const Cmpt tyy)
 Construct given the four components. More...
 
 Tensor2D (Istream &is)
 Construct from Istream. More...
 
const Cmpt & xx () const
 
const Cmpt & xy () const
 
const Cmpt & yx () const
 
const Cmpt & yy () const
 
Cmpt & xx ()
 
Cmpt & xy ()
 
Cmpt & yx ()
 
Cmpt & yy ()
 
Vector2D< Cmpt > cx () const
 Extract vector for column 0. More...
 
Vector2D< Cmpt > cy () const
 Extract vector for column 1. More...
 
template<direction Col>
Vector2D< Cmpt > col () const
 Extract vector for given column. More...
 
Vector2D< Cmpt > col (const direction c) const
 Extract vector for given column (0,1). More...
 
template<direction Col>
void col (const Vector2D< Cmpt > &v)
 Set values of given column. More...
 
void col (const direction c, const Vector2D< Cmpt > &v)
 Set values of given column (0,1) More...
 
void cols (const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
 Set column values. More...
 
Vector2D< Cmpt > x () const
 Extract vector for row 0. More...
 
Vector2D< Cmpt > y () const
 Extract vector for row 1. More...
 
template<direction Row>
Vector2D< Cmpt > row () const
 Extract vector for given row. More...
 
Vector2D< Cmpt > row (const direction r) const
 Extract vector for given row (0,1) More...
 
template<direction Row>
void row (const Vector2D< Cmpt > &v)
 Set values of given row. More...
 
void row (const direction r, const Vector2D< Cmpt > &v)
 Set values of given row (0,1) More...
 
void rows (const Vector2D< Cmpt > &x, const Vector2D< Cmpt > &y)
 Set row values. More...
 
Vector2D< Cmpt > diag () const
 Extract the diagonal as a vector. More...
 
void diag (const Vector2D< Cmpt > &v)
 Set values of the diagonal. More...
 
Tensor2D< Cmpt > T () const
 Return non-Hermitian transpose. More...
 
Tensor2D< Cmpt > inner (const Tensor2D< Cmpt > &t2) const
 Inner-product of this with another Tensor2D. More...
 
Tensor2D< Cmpt > schur (const Tensor2D< Cmpt > &t2) const
 Schur-product of this with another Tensor2D. More...
 
void operator= (const SymmTensor2D< Cmpt > &)
 Copy assign from SymmTensor2D. More...
 
void operator= (const SphericalTensor2D< Cmpt > &)
 Copy assign from SphericalTensor2D. More...
 
Vector2D< Cmpt > vectorComponent (const direction cmpt) const
 Deprecated(2018-12) Return vector for given row (0,1) More...
 
template<Foam::direction Col>
Foam::Vector2D< Cmpt > col () const
 
template<Foam::direction Row>
Foam::Vector2D< Cmpt > row () const
 
- Public Member Functions inherited from VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 >
 VectorSpace ()=default
 Default construct. More...
 
 VectorSpace (const Foam::zero)
 Construct initialized to zero. More...
 
 VectorSpace (const VectorSpace< Tensor2D< 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< Tensor2D< Cmpt >, Cmpt, Ncmpts >::template ConstBlock< SubVector, BStart > block () const
 
const Cmpt & operator[] (const direction) const
 
Cmpt & operator[] (const direction)
 
void operator= (const VectorSpace< Tensor2D< Cmpt >, Cmpt, Ncmpts > &)
 
void operator= (const Foam::zero)
 
void operator+= (const VectorSpace< Tensor2D< Cmpt >, Cmpt, Ncmpts > &)
 
void operator-= (const VectorSpace< Tensor2D< 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 Tensor2D is 2. More...
 
static const Tensor2D I
 
- Static Public Attributes inherited from VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 >
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 Tensor2D< Cmpt > zero
 
static const Tensor2D< Cmpt > one
 
static const Tensor2D< Cmpt > max
 
static const Tensor2D< Cmpt > min
 
static const Tensor2D< Cmpt > rootMax
 
static const Tensor2D< Cmpt > rootMin
 

Additional Inherited Members

- Static Public Member Functions inherited from VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 >
static constexpr direction size () noexcept
 The number of elements in the VectorSpace = Ncmpts. More...
 
static Tensor2D< Cmpt > uniform (const Cmpt &s)
 Return a VectorSpace with all elements = s. More...
 
- Public Attributes inherited from VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 >
const typedef Cmpt * const_iterator
 Random access iterator for traversing VectorSpace. More...
 
Cmpt v_ [Ncmpts]
 The components of this vector space. More...
 

Detailed Description

template<class Cmpt>
class Foam::Tensor2D< Cmpt >

A templated (2 x 2) tensor of objects of <T> derived from VectorSpace.

See also
Test-Tensor2D.C
Source files

Definition at line 59 of file Tensor2D.H.

Member Typedef Documentation

◆ labelType

typedef Tensor2D<label> labelType

Equivalent type of labels used for valid component indexing.

Definition at line 68 of file Tensor2D.H.

Member Enumeration Documentation

◆ components

enum components

Component labeling enumeration.

Enumerator
XX 
XY 
YX 
YY 

Definition at line 83 of file Tensor2D.H.

Constructor & Destructor Documentation

◆ Tensor2D() [1/9]

Tensor2D ( )
default

Default construct.

◆ Tensor2D() [2/9]

Tensor2D ( const Tensor2D< Cmpt > &  )
default

Copy construct.

◆ Tensor2D() [3/9]

Tensor2D ( const Foam::zero  )
inline

Construct initialized to zero.

Definition at line 32 of file Tensor2DI.H.

◆ Tensor2D() [4/9]

Tensor2D ( const VectorSpace< Tensor2D< Cmpt >, Cmpt, 4 > &  vs)
inline

Construct given VectorSpace.

Definition at line 40 of file Tensor2DI.H.

◆ Tensor2D() [5/9]

Tensor2D ( const SymmTensor2D< Cmpt > &  st)
inline

Construct given SymmTensor2D.

Definition at line 49 of file Tensor2DI.H.

References SymmTensor2D< Cmpt >::xx(), SymmTensor2D< Cmpt >::xy(), and SymmTensor2D< Cmpt >::yy().

Here is the call graph for this function:

◆ Tensor2D() [6/9]

Tensor2D ( const SphericalTensor2D< Cmpt > &  st)
inline

Construct given SphericalTensor2D.

Definition at line 57 of file Tensor2DI.H.

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

Here is the call graph for this function:

◆ Tensor2D() [7/9]

Tensor2D ( const Vector2D< Cmpt > &  x,
const Vector2D< Cmpt > &  y 
)
inline

Construct given the two row vectors.

Definition at line 66 of file Tensor2DI.H.

References x, and y.

◆ Tensor2D() [8/9]

Tensor2D ( const Cmpt  txx,
const Cmpt  txy,
const Cmpt  tyx,
const Cmpt  tyy 
)
inline

Construct given the four components.

Definition at line 78 of file Tensor2DI.H.

◆ Tensor2D() [9/9]

Tensor2D ( Istream is)
inlineexplicit

Construct from Istream.

Definition at line 89 of file Tensor2DI.H.

Member Function Documentation

◆ operator=() [1/3]

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

Copy assignment.

◆ xx() [1/2]

const Cmpt & xx ( ) const
inline

Definition at line 98 of file Tensor2DI.H.

Referenced by Foam::cof(), Foam::det(), Tensor2D< Cmpt >::inner(), Foam::operator&(), Foam::operator&&(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor2D< Cmpt >::schur(), Foam::symm(), Foam::tr(), and Foam::twoSymm().

Here is the caller graph for this function:

◆ xy() [1/2]

const Cmpt & xy ( ) const
inline

Definition at line 104 of file Tensor2DI.H.

Referenced by Foam::cof(), Foam::det(), Tensor2D< Cmpt >::inner(), Foam::operator&(), Foam::operator&&(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor2D< Cmpt >::schur(), Foam::skew(), Foam::symm(), and Foam::twoSymm().

Here is the caller graph for this function:

◆ yx() [1/2]

const Cmpt & yx ( ) const
inline

Definition at line 110 of file Tensor2DI.H.

Referenced by Foam::cof(), Foam::det(), Tensor2D< Cmpt >::inner(), Foam::operator&(), Foam::operator&&(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor2D< Cmpt >::schur(), Foam::skew(), Foam::symm(), and Foam::twoSymm().

Here is the caller graph for this function:

◆ yy() [1/2]

const Cmpt & yy ( ) const
inline

Definition at line 116 of file Tensor2DI.H.

Referenced by Foam::cof(), Foam::det(), Tensor2D< Cmpt >::inner(), Foam::operator&(), Foam::operator&&(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Tensor2D< Cmpt >::schur(), Foam::symm(), Foam::tr(), and Foam::twoSymm().

Here is the caller graph for this function:

◆ xx() [2/2]

Cmpt & xx ( )
inline

Definition at line 123 of file Tensor2DI.H.

◆ xy() [2/2]

Cmpt & xy ( )
inline

Definition at line 129 of file Tensor2DI.H.

◆ yx() [2/2]

Cmpt & yx ( )
inline

Definition at line 135 of file Tensor2DI.H.

◆ yy() [2/2]

Cmpt & yy ( )
inline

Definition at line 141 of file Tensor2DI.H.

◆ cx()

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

Extract vector for column 0.

Definition at line 161 of file Tensor2DI.H.

◆ cy()

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

Extract vector for column 1.

Definition at line 167 of file Tensor2DI.H.

◆ col() [1/5]

Vector2D<Cmpt> col ( ) const
inline

Extract vector for given column.

Compile-time check of column index.

◆ col() [2/5]

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

Extract vector for given column (0,1).

Runtime check of column index.

Definition at line 186 of file Tensor2DI.H.

References Foam::abort(), Foam::constant::universal::c, Foam::FatalError, FatalErrorInFunction, and Foam::Zero.

Here is the call graph for this function:

◆ col() [3/5]

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

Set values of given column.

Compile-time check of column index.

Definition at line 231 of file Tensor2DI.H.

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

Here is the call graph for this function:

◆ col() [4/5]

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

Set values of given column (0,1)

Runtime check of column index.

Definition at line 291 of file Tensor2DI.H.

References Foam::abort(), Foam::constant::universal::c, Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ cols()

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

Set column values.

Definition at line 267 of file Tensor2DI.H.

References x, and y.

◆ x()

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

Extract vector for row 0.

Definition at line 148 of file Tensor2DI.H.

Referenced by triSurfaceTools::curvatures().

Here is the caller graph for this function:

◆ y()

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

Extract vector for row 1.

Definition at line 154 of file Tensor2DI.H.

Referenced by triSurfaceTools::curvatures().

Here is the caller graph for this function:

◆ row() [1/5]

Vector2D<Cmpt> row ( ) const
inline

Extract vector for given row.

Compile-time check of row index.

◆ row() [2/5]

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

Extract vector for given row (0,1)

Runtime check of row index.

Definition at line 214 of file Tensor2DI.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 Vector2D< Cmpt > &  v)
inline

Set values of given row.

Compile-time check of row index.

Definition at line 250 of file Tensor2DI.H.

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

Here is the call graph for this function:

◆ row() [4/5]

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

Set values of given row (0,1)

Runtime check of row index.

Definition at line 310 of file Tensor2DI.H.

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

Here is the call graph for this function:

◆ rows()

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

Set row values.

Definition at line 279 of file Tensor2DI.H.

References x, and y.

◆ diag() [1/2]

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

Extract the diagonal as a vector.

Definition at line 328 of file Tensor2DI.H.

◆ diag() [2/2]

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

Set values of the diagonal.

Definition at line 335 of file Tensor2DI.H.

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

Here is the call graph for this function:

◆ T()

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

Return non-Hermitian transpose.

Definition at line 344 of file Tensor2DI.H.

◆ inner()

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

Inner-product of this with another Tensor2D.

Definition at line 356 of file Tensor2DI.H.

References Tensor2D< Cmpt >::xx(), Tensor2D< Cmpt >::xy(), Tensor2D< Cmpt >::yx(), and Tensor2D< Cmpt >::yy().

Referenced by Foam::operator&().

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

◆ schur()

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

Schur-product of this with another Tensor2D.

Definition at line 373 of file Tensor2DI.H.

References Tensor2D< Cmpt >::xx(), Tensor2D< Cmpt >::xy(), Tensor2D< Cmpt >::yx(), and Tensor2D< Cmpt >::yy().

Here is the call graph for this function:

◆ operator=() [2/3]

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

Copy assign from SymmTensor2D.

Definition at line 388 of file Tensor2DI.H.

References SymmTensor2D< Cmpt >::xx(), SymmTensor2D< Cmpt >::xy(), and SymmTensor2D< Cmpt >::yy().

Here is the call graph for this function:

◆ operator=() [3/3]

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

Copy assign from SphericalTensor2D.

Definition at line 396 of file Tensor2DI.H.

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

Here is the call graph for this function:

◆ vectorComponent()

Vector2D<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 239 of file Tensor2D.H.

◆ col() [5/5]

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

Definition at line 175 of file Tensor2DI.H.

References Foam::Zero.

◆ row() [5/5]

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

Definition at line 203 of file Tensor2DI.H.

References x, y, and Foam::Zero.

Member Data Documentation

◆ rank

constexpr direction rank = 2
staticconstexpr

Rank of Tensor2D is 2.

Definition at line 74 of file Tensor2D.H.

◆ I

const Foam::tensor2D I
static

Definition at line 79 of file Tensor2D.H.


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