lduMatrix Class 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...

Inheritance diagram for lduMatrix:

Classes

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

Public Member Functions

 ClassName ("lduMatrix")
 
 lduMatrix (const lduMesh &)
 Construct given an LDU addressed mesh. More...
 
 lduMatrix (const lduMatrix &)
 Copy constructor. More...
 
 lduMatrix (lduMatrix &, bool reuse)
 Copy constructor or reuse as specified. More...
 
 lduMatrix (const lduMesh &, Istream &)
 Construct given an LDU addressed mesh and an Istream. More...
 
 ~lduMatrix ()
 Destructor. More...
 
const lduMeshmesh () const
 Return the LDU mesh from which the addressing is obtained. More...
 
const lduAddressinglduAddr () const
 Return the LDU addressing. More...
 
const lduSchedulepatchSchedule () const
 Return the patch evaluation schedule. More...
 
scalarFieldlower ()
 
scalarFielddiag ()
 
scalarFieldupper ()
 
scalarFieldlower (const label size)
 
scalarFielddiag (const label nCoeffs)
 
scalarFieldupper (const label nCoeffs)
 
const scalarFieldlower () const
 
const scalarFielddiag () const
 
const scalarFieldupper () const
 
bool hasDiag () const
 
bool hasUpper () const
 
bool hasLower () const
 
bool diagonal () const
 
bool symmetric () const
 
bool asymmetric () const
 
void sumDiag ()
 
void negSumDiag ()
 
void sumMagOffDiag (scalarField &sumOff) const
 
void Amul (scalarField &, const tmp< scalarField > &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &, const direction cmpt) const
 Matrix multiplication with updated interfaces. More...
 
void Tmul (scalarField &, const tmp< scalarField > &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &, const direction cmpt) const
 Matrix transpose multiplication with updated interfaces. More...
 
void sumA (scalarField &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &) const
 Sum the coefficients on each row of the matrix. More...
 
void residual (scalarField &rA, const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
 
tmp< scalarFieldresidual (const scalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
 
void initMatrixInterfaces (const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces, const scalarField &psiif, scalarField &result, const direction cmpt) const
 Initialise the update of interfaced interfaces. More...
 
void updateMatrixInterfaces (const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces, const scalarField &psiif, scalarField &result, const direction cmpt) const
 Update interfaced interfaces for matrix operations. More...
 
template<class Type >
tmp< Field< Type > > H (const Field< Type > &) const
 
template<class Type >
tmp< Field< Type > > H (const tmp< Field< Type >> &) const
 
tmp< scalarFieldH1 () const
 
template<class Type >
tmp< Field< Type > > faceH (const Field< Type > &) const
 
template<class Type >
tmp< Field< Type > > faceH (const tmp< Field< Type >> &) const
 
InfoProxy< lduMatrixinfo () const
 Return info proxy. More...
 
void operator= (const lduMatrix &)
 
void negate ()
 
void operator+= (const lduMatrix &)
 
void operator-= (const lduMatrix &)
 
void operator*= (const scalarField &)
 
void operator*= (scalar)
 
void operator/= (const scalarField &)
 
void operator/= (scalar)
 
template<class Type >
Foam::tmp< Foam::Field< Type > > H (const Field< Type > &psi) const
 
template<class Type >
Foam::tmp< Foam::Field< Type > > H (const tmp< Field< Type >> &tpsi) const
 
template<class Type >
Foam::tmp< Foam::Field< Type > > faceH (const Field< Type > &psi) const
 
template<class Type >
Foam::tmp< Foam::Field< Type > > faceH (const tmp< Field< Type >> &tpsi) const
 

Friends

Ostreamoperator<< (Ostream &, const lduMatrix &)
 
Ostreamoperator<< (Ostream &, const InfoProxy< lduMatrix > &)
 

Detailed Description

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.

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 79 of file lduMatrix.H.

Constructor & Destructor Documentation

◆ lduMatrix() [1/4]

lduMatrix ( const lduMesh mesh)

Construct given an LDU addressed mesh.

The coefficients are initially empty for subsequent setting.

Definition at line 43 of file lduMatrix.C.

◆ lduMatrix() [2/4]

lduMatrix ( const lduMatrix A)

Copy constructor.

Definition at line 52 of file lduMatrix.C.

References A.

◆ lduMatrix() [3/4]

lduMatrix ( lduMatrix A,
bool  reuse 
)

Copy constructor or reuse as specified.

Definition at line 76 of file lduMatrix.C.

References A.

◆ lduMatrix() [4/4]

lduMatrix ( const lduMesh mesh,
Istream is 
)

Construct given an LDU addressed mesh and an Istream.

from which the coefficients are read

Definition at line 123 of file lduMatrix.C.

References lduMatrix::hasDiag().

Here is the call graph for this function:

◆ ~lduMatrix()

~lduMatrix ( )

Destructor.

Definition at line 149 of file lduMatrix.C.

Member Function Documentation

◆ ClassName()

ClassName ( "lduMatrix"  )

◆ mesh()

const lduMesh& mesh ( ) const
inline

Return the LDU mesh from which the addressing is obtained.

Definition at line 544 of file lduMatrix.H.

Referenced by algebraicPairGAMGAgglomeration::algebraicPairGAMGAgglomeration(), GAMGAgglomeration::New(), and fvMatrix< Type >::solveSegregated().

Here is the caller graph for this function:

◆ lduAddr()

◆ patchSchedule()

const lduSchedule& patchSchedule ( ) const
inline

Return the patch evaluation schedule.

Definition at line 556 of file lduMatrix.H.

References lduMatrix::lduAddr(), and lduAddressing::patchSchedule().

Referenced by lduMatrix::initMatrixInterfaces().

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

◆ lower() [1/3]

◆ diag() [1/3]

◆ upper() [1/3]

◆ lower() [2/3]

Foam::scalarField & lower ( const label  size)

Definition at line 215 of file lduMatrix.C.

◆ diag() [2/3]

Foam::scalarField & diag ( const label  nCoeffs)

Definition at line 233 of file lduMatrix.C.

◆ upper() [2/3]

Foam::scalarField & upper ( const label  nCoeffs)

Definition at line 244 of file lduMatrix.C.

◆ lower() [3/3]

const Foam::scalarField & lower ( ) const

Definition at line 262 of file lduMatrix.C.

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

Here is the call graph for this function:

◆ diag() [3/3]

const Foam::scalarField & diag ( ) const

Definition at line 282 of file lduMatrix.C.

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

Here is the call graph for this function:

◆ upper() [3/3]

const Foam::scalarField & upper ( ) const

Definition at line 295 of file lduMatrix.C.

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

Here is the call graph for this function:

◆ hasDiag()

bool hasDiag ( ) const
inline

Definition at line 580 of file lduMatrix.H.

Referenced by lduMatrix::lduMatrix(), Foam::operator<<(), fvMatrix< Type >::setValues(), and compressibleVoF::thermophysicalPredictor().

Here is the caller graph for this function:

◆ hasUpper()

bool hasUpper ( ) const
inline

Definition at line 585 of file lduMatrix.H.

Referenced by Foam::operator<<().

Here is the caller graph for this function:

◆ hasLower()

bool hasLower ( ) const
inline

Definition at line 590 of file lduMatrix.H.

Referenced by algebraicPairGAMGAgglomeration::algebraicPairGAMGAgglomeration(), and Foam::operator<<().

Here is the caller graph for this function:

◆ diagonal()

bool diagonal ( ) const
inline

Definition at line 595 of file lduMatrix.H.

References UPstream::parRun(), and List< T >::size().

Referenced by lduMatrix::solver::New().

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

◆ symmetric()

bool symmetric ( ) const
inline

Definition at line 609 of file lduMatrix.H.

References UPstream::parRun(), and List< T >::size().

Referenced by lduMatrix::preconditioner::New(), lduMatrix::solver::New(), and lduMatrix::smoother::New().

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

◆ asymmetric()

bool asymmetric ( ) const
inline

Definition at line 623 of file lduMatrix.H.

References UPstream::parRun(), and List< T >::size().

Referenced by lduMatrix::preconditioner::New(), lduMatrix::solver::New(), and lduMatrix::smoother::New().

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

◆ sumDiag()

void sumDiag ( )

◆ negSumDiag()

void negSumDiag ( )

Definition at line 55 of file lduMatrixOperations.C.

References Foam::diag(), lduMatrix::lower(), UList< T >::size(), and lduMatrix::upper().

Referenced by gaussConvectionScheme< Type >::fvmDiv(), and gaussLaplacianScheme< Type, GType >::fvmLaplacianUncorrected().

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

◆ sumMagOffDiag()

void sumMagOffDiag ( scalarField sumOff) const

Definition at line 77 of file lduMatrixOperations.C.

References lduMatrix::lower(), Foam::mag(), UList< T >::size(), and lduMatrix::upper().

Here is the call graph for this function:

◆ Amul()

void Amul ( scalarField Apsi,
const tmp< scalarField > &  tpsi,
const FieldField< Field, scalar > &  interfaceBouCoeffs,
const lduInterfaceFieldPtrsList interfaces,
const direction  cmpt 
) const

Matrix multiplication with updated interfaces.

Definition at line 34 of file lduMatrixATmul.C.

References UList< T >::begin(), tmp< T >::clear(), lduMatrix::diag(), lduMatrix::initMatrixInterfaces(), lduMatrix::lduAddr(), lduMatrix::lower(), lduAddressing::lowerAddr(), psi, List< T >::size(), lduMatrix::updateMatrixInterfaces(), lduMatrix::upper(), and lduAddressing::upperAddr().

Referenced by GAMGSolver::solve().

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

◆ Tmul()

void Tmul ( scalarField Tpsi,
const tmp< scalarField > &  tpsi,
const FieldField< Field, scalar > &  interfaceIntCoeffs,
const lduInterfaceFieldPtrsList interfaces,
const direction  cmpt 
) const

Matrix transpose multiplication with updated interfaces.

Definition at line 95 of file lduMatrixATmul.C.

References UList< T >::begin(), tmp< T >::clear(), Foam::diag(), and psi.

Here is the call graph for this function:

◆ sumA()

void sumA ( scalarField sumA,
const FieldField< Field, scalar > &  interfaceBouCoeffs,
const lduInterfaceFieldPtrsList interfaces 
) const

Sum the coefficients on each row of the matrix.

Definition at line 154 of file lduMatrixATmul.C.

References UList< T >::begin(), Foam::diag(), forAll, patchi, and UPtrList< T >::set().

Here is the call graph for this function:

◆ residual() [1/2]

void residual ( scalarField rA,
const scalarField psi,
const scalarField source,
const FieldField< Field, scalar > &  interfaceBouCoeffs,
const lduInterfaceFieldPtrsList interfaces,
const direction  cmpt 
) const

Definition at line 203 of file lduMatrixATmul.C.

References UList< T >::begin(), Foam::diag(), forAll, patchi, psi, PtrList< T >::set(), UPtrList< T >::set(), and UPtrList< T >::size().

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

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

◆ residual() [2/2]

Foam::tmp< Foam::scalarField > residual ( const scalarField psi,
const scalarField source,
const FieldField< Field, scalar > &  interfaceBouCoeffs,
const lduInterfaceFieldPtrsList interfaces,
const direction  cmpt 
) const

Definition at line 283 of file lduMatrixATmul.C.

References psi, tmp< T >::ref(), and List< T >::size().

Here is the call graph for this function:

◆ initMatrixInterfaces()

void initMatrixInterfaces ( const FieldField< Field, scalar > &  interfaceCoeffs,
const lduInterfaceFieldPtrsList interfaces,
const scalarField psiif,
scalarField result,
const direction  cmpt 
) const

◆ updateMatrixInterfaces()

void updateMatrixInterfaces ( const FieldField< Field, scalar > &  interfaceCoeffs,
const lduInterfaceFieldPtrsList interfaces,
const scalarField psiif,
scalarField result,
const direction  cmpt 
) const

◆ H() [1/4]

tmp<Field<Type> > H ( const Field< Type > &  ) const

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

Here is the caller graph for this function:

◆ H() [2/4]

tmp<Field<Type> > H ( const tmp< Field< Type >> &  ) const

◆ H1()

Foam::tmp< Foam::scalarField > H1 ( ) const

Definition at line 298 of file lduMatrixATmul.C.

References UList< T >::begin(), and tmp< T >::ref().

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

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

◆ faceH() [1/4]

tmp<Field<Type> > faceH ( const Field< Type > &  ) const

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

Here is the caller graph for this function:

◆ faceH() [2/4]

tmp<Field<Type> > faceH ( const tmp< Field< Type >> &  ) const

◆ info()

InfoProxy<lduMatrix> info ( ) const
inline

Return info proxy.

Used to print matrix information to a stream

Definition at line 736 of file lduMatrix.H.

◆ operator=()

void operator= ( const lduMatrix A)

Definition at line 103 of file lduMatrixOperations.C.

References A, Foam::abort(), Foam::diag(), and Foam::FatalError.

Referenced by fvMatrix< Type >::operator=().

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

◆ negate()

void negate ( )

Definition at line 140 of file lduMatrixOperations.C.

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

Here is the caller graph for this function:

◆ operator+=()

void operator+= ( const lduMatrix A)

Definition at line 159 of file lduMatrixOperations.C.

References A, Foam::diag(), Foam::endl(), Foam::nl, and WarningInFunction.

Referenced by fvMatrix< Type >::operator+=().

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

◆ operator-=()

void operator-= ( const lduMatrix A)

Definition at line 238 of file lduMatrixOperations.C.

References A, Foam::diag(), Foam::endl(), Foam::nl, and WarningInFunction.

Referenced by fvMatrix< Type >::operator-=().

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

◆ operator*=() [1/2]

void operator*= ( const scalarField sf)

Definition at line 317 of file lduMatrixOperations.C.

References sf(), and List< T >::size().

Referenced by fvMatrix< Type >::operator*=().

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

◆ operator*=() [2/2]

void operator*= ( scalar  s)

Definition at line 347 of file lduMatrixOperations.C.

References s().

Here is the call graph for this function:

◆ operator/=() [1/2]

void operator/= ( const scalarField sf)

Definition at line 366 of file lduMatrixOperations.C.

References sf(), and List< T >::size().

Referenced by fvMatrix< Type >::operator/=().

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

◆ operator/=() [2/2]

void operator/= ( scalar  s)

Definition at line 396 of file lduMatrixOperations.C.

References s().

Here is the call graph for this function:

◆ H() [3/4]

Foam::tmp<Foam::Field<Type> > H ( const Field< Type > &  psi) const

◆ H() [4/4]

Foam::tmp<Foam::Field<Type> > H ( const tmp< Field< Type >> &  tpsi) const

Definition at line 69 of file lduMatrixTemplates.C.

◆ faceH() [3/4]

Foam::tmp<Foam::Field<Type> > faceH ( const Field< Type > &  psi) const

Definition at line 79 of file lduMatrixTemplates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, lduMatrix::lower(), psi, tmp< T >::ref(), UList< T >::size(), List< T >::size(), and lduMatrix::upper().

Here is the call graph for this function:

◆ faceH() [4/4]

Foam::tmp<Foam::Field<Type> > faceH ( const tmp< Field< Type >> &  tpsi) const

Definition at line 115 of file lduMatrixTemplates.C.

Friends And Related Function Documentation

◆ operator<< [1/2]

Ostream& operator<< ( Ostream ,
const lduMatrix  
)
friend

◆ operator<< [2/2]

Ostream& operator<< ( Ostream ,
const InfoProxy< lduMatrix > &   
)
friend

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