Loading...
Searching...
No Matches
LduMatrix< Type, DType, LUType > Class Template Reference

LduMatrix is a general matrix class in which the coefficients are stored as three arrays, one for the upper triangle, one for the lower triangle and a third for the diagonal. More...

#include <LduMatrix.H>

Inheritance diagram for LduMatrix< Type, DType, LUType >:

Classes

class  solver
 Abstract base-class for LduMatrix solvers. More...
class  smoother
 Abstract base-class for LduMatrix smoothers. More...
class  preconditioner
 Abstract base-class for LduMatrix preconditioners. More...

Public Member Functions

 ClassName ("LduMatrix")
 LduMatrix (const lduMesh &mesh)
 Construct given an LDU addressed mesh.
 LduMatrix (const LduMatrix< Type, DType, LUType > &)
 Copy construct.
 LduMatrix (LduMatrix< Type, DType, LUType > &&)
 Move construct.
 LduMatrix (LduMatrix< Type, DType, LUType > &, bool reuse)
 Construct as copy or re-use as specified.
 LduMatrix (const lduMesh &mesh, Istream &is)
 Construct given an LDU addressed mesh and an Istream from which the coefficients are read.
 ~LduMatrix ()=default
 Destructor.
const lduMeshmesh () const noexcept
 Return the LDU mesh from which the addressing is obtained.
const lduAddressinglduAddr () const
 Return the LDU addressing.
const lduSchedulepatchSchedule () const
 Return the patch evaluation schedule.
const LduInterfaceFieldPtrsList< Type > & interfaces () const noexcept
 Const access to the interfaces.
LduInterfaceFieldPtrsList< Type > & interfaces () noexcept
 Non-const access to the interfaces.
const Field< DType > & diag () const
const Field< LUType > & upper () const
const Field< LUType > & lower () const
const Field< Type > & source () const
Field< DType > & diag ()
Field< LUType > & upper ()
Field< LUType > & lower ()
Field< Type > & source ()
const FieldField< Field, LUType > & interfacesUpper () const noexcept
const FieldField< Field, LUType > & interfacesLower () const noexcept
FieldField< Field, LUType > & interfacesUpper () noexcept
FieldField< Field, LUType > & interfacesLower () noexcept
word matrixTypeName () const
 The matrix type (empty, diagonal, symmetric, ...).
bool hasDiag () const noexcept
bool hasUpper () const noexcept
bool hasLower () const noexcept
bool hasSource () const noexcept
bool diagonal () const noexcept
 Matrix has diagonal only.
bool symmetric () const noexcept
 Matrix is symmetric.
bool asymmetric () const noexcept
 Matrix is asymmetric (ie, full).
void sumDiag ()
void negSumDiag ()
void sumMagOffDiag (Field< LUType > &sumOff) const
void Amul (Field< Type > &, const tmp< Field< Type > > &) const
 Matrix multiplication.
void Tmul (Field< Type > &, const tmp< Field< Type > > &) const
 Matrix transpose multiplication.
void sumA (Field< Type > &) const
 Sum the coefficients on each row of the matrix.
void residual (Field< Type > &rA, const Field< Type > &psi) const
tmp< Field< Type > > residual (const Field< Type > &psi) const
void initMatrixInterfaces (const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
 Initialise the update of interfaced interfaces.
void updateMatrixInterfaces (const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result, const label startRequest) const
 Update interfaced interfaces for matrix operations.
tmp< Field< Type > > H (const Field< Type > &) const
tmp< Field< Type > > H (const tmp< Field< Type > > &) const
tmp< Field< Type > > faceH (const Field< Type > &) const
tmp< Field< Type > > faceH (const tmp< Field< Type > > &) const
void operator= (const LduMatrix< Type, DType, LUType > &)
 Copy assignment.
void operator= (LduMatrix< Type, DType, LUType > &&)
 Move assignment.
void negate ()
void operator+= (const LduMatrix< Type, DType, LUType > &)
void operator-= (const LduMatrix< Type, DType, LUType > &)
void operator*= (const scalarField &)
void operator*= (scalar)

Friends

class SolverPerformance< Type >
Ostreamoperator (Ostream &, const LduMatrix< Type, DType, LUType > &)

Detailed Description

template<class Type, class DType, class LUType>
class Foam::LduMatrix< Type, DType, LUType >

LduMatrix is a general matrix class in which the coefficients are stored as three arrays, one for the upper triangle, one for the lower triangle and a third for the diagonal.

Addressing arrays must be supplied for the upper and lower triangles.

Note
It might be better if this class were organised as a hierarchy starting from an empty matrix, then deriving diagonal, symmetric and asymmetric matrices.
Source files

Definition at line 83 of file LduMatrix.H.

Constructor & Destructor Documentation

◆ LduMatrix() [1/5]

◆ LduMatrix() [2/5]

template<class Type, class DType, class LUType>
LduMatrix ( const LduMatrix< Type, DType, LUType > & )

Copy construct.

◆ LduMatrix() [3/5]

template<class Type, class DType, class LUType>
LduMatrix ( LduMatrix< Type, DType, LUType > && )

Move construct.

◆ LduMatrix() [4/5]

template<class Type, class DType, class LUType>
LduMatrix ( LduMatrix< Type, DType, LUType > & ,
bool reuse )

Construct as copy or re-use as specified.

◆ LduMatrix() [5/5]

template<class Type, class DType, class LUType>
LduMatrix ( const lduMesh & mesh,
Istream & is )

Construct given an LDU addressed mesh and an Istream from which the coefficients are read.

Definition at line 116 of file LduMatrix.C.

References mesh().

Here is the call graph for this function:

◆ ~LduMatrix()

template<class Type, class DType, class LUType>
~LduMatrix ( )
default

Destructor.

Member Function Documentation

◆ ClassName()

template<class Type, class DType, class LUType>
ClassName ( "LduMatrix< Type, DType, LUType >" )

◆ mesh()

template<class Type, class DType, class LUType>
const lduMesh & mesh ( ) const
inlinenoexcept

Return the LDU mesh from which the addressing is obtained.

Definition at line 608 of file LduMatrix.H.

Referenced by LduMatrix(), and LduMatrix().

Here is the caller graph for this function:

◆ lduAddr()

template<class Type, class DType, class LUType>
const lduAddressing & lduAddr ( ) const
inline

Return the LDU addressing.

Definition at line 616 of file LduMatrix.H.

Referenced by Amul(), TDILUPreconditioner< Type, DType, LUType >::calcInvD(), diag(), faceH(), H(), lower(), negSumDiag(), operator*=(), residual(), source(), sumA(), sumDiag(), sumMagOffDiag(), Tmul(), and upper().

Here is the caller graph for this function:

◆ patchSchedule()

template<class Type, class DType, class LUType>
const lduSchedule & patchSchedule ( ) const
inline

Return the patch evaluation schedule.

Definition at line 624 of file LduMatrix.H.

Referenced by initMatrixInterfaces(), and updateMatrixInterfaces().

Here is the caller graph for this function:

◆ interfaces() [1/2]

template<class Type, class DType, class LUType>
const LduInterfaceFieldPtrsList< Type > & interfaces ( ) const
inlinenoexcept

Const access to the interfaces.

Definition at line 632 of file LduMatrix.H.

Referenced by fvMatrix< Type >::solveCoupled().

Here is the caller graph for this function:

◆ interfaces() [2/2]

template<class Type, class DType, class LUType>
LduInterfaceFieldPtrsList< Type > & interfaces ( )
inlinenoexcept

Non-const access to the interfaces.

Definition at line 640 of file LduMatrix.H.

◆ diag() [1/2]

template<class Type, class DType, class LUType>
const Foam::Field< DType > & diag ( ) const

Definition at line 151 of file LduMatrix.C.

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

Referenced by Amul(), negSumDiag(), operator+=(), operator-=(), residual(), fvMatrix< Type >::solveCoupled(), sumA(), sumDiag(), and Tmul().

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

◆ upper() [1/2]

template<class Type, class DType, class LUType>
const Foam::Field< LUType > & upper ( ) const

Definition at line 178 of file LduMatrix.C.

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

Referenced by Amul(), TDILUPreconditioner< Type, DType, LUType >::calcInvD(), H(), operator*=(), operator+=(), operator-=(), residual(), fvMatrix< Type >::solveCoupled(), sumA(), and Tmul().

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

◆ lower() [1/2]

template<class Type, class DType, class LUType>
const Foam::Field< LUType > & lower ( ) const

Definition at line 223 of file LduMatrix.C.

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

Referenced by Amul(), TDILUPreconditioner< Type, DType, LUType >::calcInvD(), H(), operator*=(), operator+=(), operator-=(), residual(), fvMatrix< Type >::solveCoupled(), sumA(), and Tmul().

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

◆ source() [1/2]

template<class Type, class DType, class LUType>
const Foam::Field< Type > & source ( ) const

Definition at line 267 of file LduMatrix.C.

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

Referenced by operator+=(), operator-=(), residual(), and fvMatrix< Type >::solveCoupled().

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

◆ diag() [2/2]

template<class Type, class DType, class LUType>
Foam::Field< DType > & diag ( )

Definition at line 165 of file LduMatrix.C.

References lduAddr().

Here is the call graph for this function:

◆ upper() [2/2]

template<class Type, class DType, class LUType>
Foam::Field< LUType > & upper ( )

Definition at line 199 of file LduMatrix.C.

References lduAddr().

Here is the call graph for this function:

◆ lower() [2/2]

template<class Type, class DType, class LUType>
Foam::Field< LUType > & lower ( )

Definition at line 244 of file LduMatrix.C.

References lduAddr().

Here is the call graph for this function:

◆ source() [2/2]

template<class Type, class DType, class LUType>
Foam::Field< Type > & source ( )

Definition at line 281 of file LduMatrix.C.

References lduAddr().

Here is the call graph for this function:

◆ interfacesUpper() [1/2]

template<class Type, class DType, class LUType>
const FieldField< Field, LUType > & interfacesUpper ( ) const
inlinenoexcept

Definition at line 661 of file LduMatrix.H.

Referenced by fvMatrix< Type >::solveCoupled().

Here is the caller graph for this function:

◆ interfacesLower() [1/2]

template<class Type, class DType, class LUType>
const FieldField< Field, LUType > & interfacesLower ( ) const
inlinenoexcept

Definition at line 666 of file LduMatrix.H.

Referenced by fvMatrix< Type >::solveCoupled().

Here is the caller graph for this function:

◆ interfacesUpper() [2/2]

template<class Type, class DType, class LUType>
FieldField< Field, LUType > & interfacesUpper ( )
inlinenoexcept

Definition at line 671 of file LduMatrix.H.

◆ interfacesLower() [2/2]

template<class Type, class DType, class LUType>
FieldField< Field, LUType > & interfacesLower ( )
inlinenoexcept

Definition at line 676 of file LduMatrix.H.

◆ matrixTypeName()

template<class Type, class DType, class LUType>
Foam::word matrixTypeName ( ) const

The matrix type (empty, diagonal, symmetric, ...).

Definition at line 133 of file LduMatrix.C.

◆ hasDiag()

template<class Type, class DType, class LUType>
bool hasDiag ( ) const
inlinenoexcept

Definition at line 689 of file LduMatrix.H.

◆ hasUpper()

template<class Type, class DType, class LUType>
bool hasUpper ( ) const
inlinenoexcept

Definition at line 690 of file LduMatrix.H.

Referenced by H().

Here is the caller graph for this function:

◆ hasLower()

template<class Type, class DType, class LUType>
bool hasLower ( ) const
inlinenoexcept

Definition at line 691 of file LduMatrix.H.

Referenced by H().

Here is the caller graph for this function:

◆ hasSource()

template<class Type, class DType, class LUType>
bool hasSource ( ) const
inlinenoexcept

Definition at line 692 of file LduMatrix.H.

◆ diagonal()

template<class Type, class DType, class LUType>
bool diagonal ( ) const
inlinenoexcept

Matrix has diagonal only.

Definition at line 697 of file LduMatrix.H.

Referenced by operator+=(), and operator-=().

Here is the caller graph for this function:

◆ symmetric()

template<class Type, class DType, class LUType>
bool symmetric ( ) const
inlinenoexcept

Matrix is symmetric.

Definition at line 705 of file LduMatrix.H.

Referenced by operator*=(), operator+=(), and operator-=().

Here is the caller graph for this function:

◆ asymmetric()

template<class Type, class DType, class LUType>
bool asymmetric ( ) const
inlinenoexcept

Matrix is asymmetric (ie, full).

Definition at line 713 of file LduMatrix.H.

Referenced by operator*=(), operator+=(), and operator-=().

Here is the caller graph for this function:

◆ sumDiag()

template<class Type, class DType, class LUType>
void sumDiag ( )

Definition at line 27 of file LduMatrixOperations.C.

References diag(), lduAddr(), LduMatrix(), and UList< T >::size().

Here is the call graph for this function:

◆ negSumDiag()

template<class Type, class DType, class LUType>
void negSumDiag ( )

Definition at line 45 of file LduMatrixOperations.C.

References diag(), lduAddr(), LduMatrix(), and UList< T >::size().

Here is the call graph for this function:

◆ sumMagOffDiag()

template<class Type, class DType, class LUType>
void sumMagOffDiag ( Field< LUType > & sumOff) const

Definition at line 63 of file LduMatrixOperations.C.

References Foam::cmptMag(), lduAddr(), LduMatrix(), and UList< T >::size().

Here is the call graph for this function:

◆ Amul()

template<class Type, class DType, class LUType>
void Amul ( Field< Type > & Apsi,
const tmp< Field< Type > > & tpsi ) const

Matrix multiplication.

Definition at line 27 of file LduMatrixATmul.C.

References UList< T >::begin(), diag(), Foam::dot(), initMatrixInterfaces(), lduAddr(), lower(), UPstream::nRequests(), psi, updateMatrixInterfaces(), and upper().

Here is the call graph for this function:

◆ Tmul()

template<class Type, class DType, class LUType>
void Tmul ( Field< Type > & Tpsi,
const tmp< Field< Type > > & tpsi ) const

Matrix transpose multiplication.

Definition at line 86 of file LduMatrixATmul.C.

References UList< T >::begin(), diag(), Foam::dot(), initMatrixInterfaces(), lduAddr(), lower(), UPstream::nRequests(), psi, updateMatrixInterfaces(), and upper().

Here is the call graph for this function:

◆ sumA()

template<class Type, class DType, class LUType>
void sumA ( Field< Type > & sumA) const

Sum the coefficients on each row of the matrix.

Definition at line 144 of file LduMatrixATmul.C.

References diag(), Foam::dot(), forAll, lduAddr(), lower(), sumA(), and upper().

Referenced by sumA().

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

◆ residual() [1/2]

template<class Type, class DType, class LUType>
void residual ( Field< Type > & rA,
const Field< Type > & psi ) const

Definition at line 192 of file LduMatrixATmul.C.

References UList< T >::begin(), diag(), Foam::dot(), initMatrixInterfaces(), lduAddr(), lower(), UPstream::nRequests(), psi, source(), updateMatrixInterfaces(), and upper().

Referenced by residual().

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

◆ residual() [2/2]

template<class Type, class DType, class LUType>
Foam::tmp< Foam::Field< Type > > residual ( const Field< Type > & psi) const

Definition at line 252 of file LduMatrixATmul.C.

References Foam::New(), psi, and residual().

Here is the call graph for this function:

◆ initMatrixInterfaces()

template<class Type, class DType, class LUType>
void initMatrixInterfaces ( const bool add,
const FieldField< Field, LUType > & interfaceCoeffs,
const Field< Type > & psiif,
Field< Type > & result ) const

Initialise the update of interfaced interfaces.

for matrix operations

Definition at line 28 of file LduMatrixUpdateMatrixInterfaces.C.

References Foam::add(), UPstream::buffered, UPstream::commsTypeNames, UPstream::defaultCommsType, Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, UPstream::nonBlocking, patchSchedule(), and UPstream::scheduled.

Referenced by Amul(), residual(), and Tmul().

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

◆ updateMatrixInterfaces()

template<class Type, class DType, class LUType>
void updateMatrixInterfaces ( const bool add,
const FieldField< Field, LUType > & interfaceCoeffs,
const Field< Type > & psiif,
Field< Type > & result,
const label startRequest ) const

Update interfaced interfaces for matrix operations.

Definition at line 100 of file LduMatrixUpdateMatrixInterfaces.C.

References Foam::add(), UPstream::buffered, UPstream::commsTypeNames, UPstream::defaultCommsType, Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, UPstream::nonBlocking, UPstream::nPollProcInterfaces, patchSchedule(), UPstream::scheduled, UPstream::waitRequests(), and UPstream::waitSomeRequests().

Referenced by Amul(), residual(), and Tmul().

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

◆ H() [1/2]

template<class Type, class DType, class LUType>
Foam::tmp< Foam::Field< Type > > H ( const Field< Type > & psi) const

Definition at line 84 of file LduMatrixOperations.C.

References hasLower(), hasUpper(), lduAddr(), lower(), Foam::New(), psi, and upper().

Here is the call graph for this function:

◆ H() [2/2]

template<class Type, class DType, class LUType>
Foam::tmp< Foam::Field< Type > > H ( const tmp< Field< Type > > & tpsi) const

Definition at line 114 of file LduMatrixOperations.C.

References H().

Here is the call graph for this function:

◆ faceH() [1/2]

template<class Type, class DType, class LUType>
Foam::tmp< Foam::Field< Type > > faceH ( const Field< Type > & psi) const

Definition at line 124 of file LduMatrixOperations.C.

References lduAddr(), LduMatrix(), Foam::New(), psi, and UList< T >::size().

Referenced by faceH().

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

◆ faceH() [2/2]

template<class Type, class DType, class LUType>
Foam::tmp< Foam::Field< Type > > faceH ( const tmp< Field< Type > > & tpsi) const

Definition at line 147 of file LduMatrixOperations.C.

References faceH().

Here is the call graph for this function:

◆ operator=() [1/2]

template<class Type, class DType, class LUType>
void operator= ( const LduMatrix< Type, DType, LUType > & )

Copy assignment.

◆ operator=() [2/2]

template<class Type, class DType, class LUType>
void operator= ( LduMatrix< Type, DType, LUType > && )

Move assignment.

◆ negate()

template<class Type, class DType, class LUType>
void negate ( )

Definition at line 217 of file LduMatrixOperations.C.

References negate().

Referenced by negate().

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

◆ operator+=()

template<class Type, class DType, class LUType>
void operator+= ( const LduMatrix< Type, DType, LUType > & )

Definition at line 245 of file LduMatrixOperations.C.

References A, Foam::abort(), asymmetric(), diag(), diagonal(), Foam::FatalError, FatalErrorInFunction, LduMatrix(), lower(), source(), symmetric(), and upper().

Here is the call graph for this function:

◆ operator-=()

template<class Type, class DType, class LUType>
void operator-= ( const LduMatrix< Type, DType, LUType > & )

Definition at line 322 of file LduMatrixOperations.C.

References A, Foam::abort(), asymmetric(), diag(), diagonal(), Foam::FatalError, FatalErrorInFunction, LduMatrix(), lower(), source(), symmetric(), and upper().

Here is the call graph for this function:

◆ operator*=() [1/2]

template<class Type, class DType, class LUType>
void operator*= ( const scalarField & sf)

Definition at line 399 of file LduMatrixOperations.C.

References Foam::abort(), asymmetric(), Foam::FatalError, FatalErrorInFunction, lduAddr(), lower(), operator, symmetric(), and upper().

Here is the call graph for this function:

◆ operator*=() [2/2]

template<class Type, class DType, class LUType>
void operator*= ( scalar s)

Definition at line 447 of file LduMatrixOperations.C.

References s().

Here is the call graph for this function:

◆ SolverPerformance< Type >

template<class Type, class DType, class LUType>
friend class SolverPerformance< Type >
friend

Definition at line 125 of file LduMatrix.H.

◆ operator

template<class Type, class DType, class LUType>
Ostream & operator ( Ostream & ,
const LduMatrix< Type, DType, LUType > &  )
friend

Referenced by operator*=().


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