Loading...
Searching...
No Matches
DiagTensor< Cmpt > Class Template Reference

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

#include <DiagTensor.H>

Inheritance diagram for DiagTensor< Cmpt >:
Collaboration diagram for DiagTensor< Cmpt >:

Public Types

enum  components { XX , YY , ZZ }
 Component labeling enumeration. More...
typedef DiagTensor< label > labelType
 Equivalent type of labels used for valid component indexing.
Public Types inherited from VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >
typedef VectorSpace< DiagTensor< Cmpt >, Cmpt, Ncmpts > vsType
 VectorSpace type.
typedef Cmpt cmptType
 Component type.
typedef Cmpt magType
 Magnitude type.
typedef direction size_type
 The type to represent the size of a VectorSpace.
typedef Cmpt * iterator
 Random access iterator for traversing VectorSpace.
typedef const Cmpt * const_iterator
 Random access iterator for traversing VectorSpace.

Public Member Functions

 DiagTensor ()=default
 Default construct.
 DiagTensor (const DiagTensor &)=default
 Copy construct.
DiagTensoroperator= (const DiagTensor &)=default
 Copy assignment.
 DiagTensor (Foam::zero)
 Construct initialized to zero.
template<class Cmpt2>
 DiagTensor (const VectorSpace< DiagTensor< Cmpt2 >, Cmpt2, 3 > &)
 Construct given VectorSpace.
 DiagTensor (const SphericalTensor< Cmpt > &)
 Construct given SphericalTensor.
 DiagTensor (const Cmpt &txx, const Cmpt &tyy, const Cmpt &tzz)
 Construct given three components.
 DiagTensor (Istream &is)
 Construct from Istream.
const Cmpt & xx () const noexcept
const Cmpt & yy () const noexcept
const Cmpt & zz () const noexcept
Cmpt & xx () noexcept
Cmpt & yy () noexcept
Cmpt & zz () noexcept
Vector< Cmpt > diag () const
 Extract the diagonal as a vector.
scalar diagSqr () const
 The L2-norm squared of the diagonal.
Public Member Functions inherited from VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >
const Foam::VectorSpace< DiagTensor< Cmpt >, Cmpt, Ncmpts >::template ConstBlock< SubVector, BStart > block () const
 VectorSpace ()=default
 Default construct.
const Cmpt & component (const direction) const
void replace (const direction, const Cmpt &)
const Cmpt * cdata () const noexcept
 Return const pointer to the first data element.
Cmpt * data () noexcept
 Return pointer to the first data element.
void fill (const Cmpt &s)
 Assign all components to given value.
const Cmpt & operator[] (const direction) const
void operator= (const VectorSpace< DiagTensor< Cmpt >, Cmpt, Ncmpts > &)
void operator+= (const VectorSpace< DiagTensor< Cmpt >, Cmpt, Ncmpts > &)
void operator-= (const VectorSpace< DiagTensor< Cmpt >, Cmpt, Ncmpts > &)
void operator*= (const scalar)
void operator/= (const scalar)
iterator begin () noexcept
 Return an iterator (pointer) to begin of VectorSpace.
const_iterator cbegin () const noexcept
 Return const_iterator (const pointer) to begin of VectorSpace.
iterator end () noexcept
 Return an iterator (pointer) to end of VectorSpace.
const_iterator cend () const noexcept
 Return const_iterator (const pointer) to end of VectorSpace.

Static Public Attributes

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

Additional Inherited Members

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

Detailed Description

template<class Cmpt>
class Foam::DiagTensor< Cmpt >

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

See also
Test-DiagTensor.C
Source files

Definition at line 53 of file DiagTensor.H.

Member Typedef Documentation

◆ labelType

template<class Cmpt>
typedef DiagTensor<label> labelType

Equivalent type of labels used for valid component indexing.

Definition at line 64 of file DiagTensor.H.

Member Enumeration Documentation

◆ components

template<class Cmpt>
enum components

Component labeling enumeration.

Enumerator
XX 
YY 
ZZ 

Definition at line 78 of file DiagTensor.H.

Constructor & Destructor Documentation

◆ DiagTensor() [1/7]

template<class Cmpt>
DiagTensor ( )
default

Default construct.

Referenced by DiagTensor(), DiagTensor(), and DiagTensor().

Here is the caller graph for this function:

◆ DiagTensor() [2/7]

template<class Cmpt>
DiagTensor ( const DiagTensor< Cmpt > & )
default

Copy construct.

◆ DiagTensor() [3/7]

template<class Cmpt>
DiagTensor ( Foam::zero )
inline

Construct initialized to zero.

Definition at line 28 of file DiagTensorI.H.

References DiagTensor(), VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >::VectorSpace(), and VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >::zero.

Here is the call graph for this function:

◆ DiagTensor() [4/7]

template<class Cmpt>
template<class Cmpt2>
DiagTensor ( const VectorSpace< DiagTensor< Cmpt2 >, Cmpt2, 3 > & vs)
inline

Construct given VectorSpace.

Definition at line 36 of file DiagTensorI.H.

References DiagTensor(), and VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >::VectorSpace().

Here is the call graph for this function:

◆ DiagTensor() [5/7]

template<class Cmpt>
DiagTensor ( const SphericalTensor< Cmpt > & st)
inline

Construct given SphericalTensor.

Definition at line 46 of file DiagTensorI.H.

References SphericalTensor< Cmpt >::ii(), VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >::v_, XX, YY, and ZZ.

Here is the call graph for this function:

◆ DiagTensor() [6/7]

template<class Cmpt>
DiagTensor ( const Cmpt & txx,
const Cmpt & tyy,
const Cmpt & tzz )
inline

Construct given three components.

Definition at line 55 of file DiagTensorI.H.

References VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >::v_, XX, YY, and ZZ.

◆ DiagTensor() [7/7]

template<class Cmpt>
DiagTensor ( Istream & is)
inlineexplicit

Construct from Istream.

Definition at line 69 of file DiagTensorI.H.

References DiagTensor(), and VectorSpace< DiagTensor< Cmpt >, Cmpt, 3 >::VectorSpace().

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

template<class Cmpt>
DiagTensor & operator= ( const DiagTensor< Cmpt > & )
default

Copy assignment.

◆ xx() [1/2]

template<class Cmpt>
const Cmpt & xx ( ) const
inlinenoexcept

◆ yy() [1/2]

◆ zz() [1/2]

◆ xx() [2/2]

template<class Cmpt>
Cmpt & xx ( )
inlinenoexcept

Definition at line 136 of file DiagTensor.H.

◆ yy() [2/2]

template<class Cmpt>
Cmpt & yy ( )
inlinenoexcept

Definition at line 137 of file DiagTensor.H.

◆ zz() [2/2]

template<class Cmpt>
Cmpt & zz ( )
inlinenoexcept

Definition at line 138 of file DiagTensor.H.

◆ diag()

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

Extract the diagonal as a vector.

Definition at line 78 of file DiagTensorI.H.

References xx(), yy(), and zz().

Here is the call graph for this function:

◆ diagSqr()

template<class Cmpt>
Foam::scalar diagSqr ( ) const
inline

The L2-norm squared of the diagonal.

Definition at line 85 of file DiagTensorI.H.

References Foam::magSqr(), xx(), yy(), and zz().

Referenced by Foam::magSqr().

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

Member Data Documentation

◆ rank

template<class Cmpt>
direction rank = 2
staticconstexpr

Rank of DiagTensor is 2.

Definition at line 72 of file DiagTensor.H.


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