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

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< Type, DType, LUType > &)
 Construct as copy. More...
 
 LduMatrix (LduMatrix< Type, DType, LUType > &, bool reuse)
 Construct as copy or re-use as specified. More...
 
 LduMatrix (const lduMesh &, Istream &)
 Construct given an LDU addressed mesh and an Istream. More...
 
 ~LduMatrix ()
 
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...
 
const LduInterfaceFieldPtrsList< Type > & interfaces () const
 Return interfaces. More...
 
LduInterfaceFieldPtrsList< Type > & interfaces ()
 Return interfaces. More...
 
Field< DType > & diag ()
 
Field< LUType > & upper ()
 
Field< LUType > & lower ()
 
Field< Type > & source ()
 
FieldField< Field, LUType > & interfacesUpper ()
 
FieldField< Field, LUType > & interfacesLower ()
 
const Field< DType > & diag () const
 
const Field< LUType > & upper () const
 
const Field< LUType > & lower () const
 
const Field< Type > & source () const
 
const FieldField< Field, LUType > & interfacesUpper () const
 
const FieldField< Field, LUType > & interfacesLower () const
 
bool hasDiag () const
 
bool hasUpper () const
 
bool hasLower () const
 
bool hasSource () const
 
bool diagonal () const
 
bool symmetric () const
 
bool asymmetric () const
 
void sumDiag ()
 
void negSumDiag ()
 
void sumMagOffDiag (Field< LUType > &sumOff) const
 
void Amul (Field< Type > &, const tmp< Field< Type > > &) const
 Matrix multiplication. More...
 
void Tmul (Field< Type > &, const tmp< Field< Type > > &) const
 Matrix transpose multiplication. More...
 
void sumA (Field< Type > &) const
 Sum the coefficients on each row of the matrix. More...
 
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. More...
 
void updateMatrixInterfaces (const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
 Update interfaced interfaces for matrix operations. More...
 
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 > &)
 
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 87 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 34 of file LduMatrix.C.

◆ LduMatrix() [2/4]

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

Construct as copy.

◆ LduMatrix() [3/4]

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

Construct as copy or re-use as specified.

◆ 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 145 of file LduMatrix.C.

◆ ~LduMatrix()

Definition at line 165 of file LduMatrix.C.

Member Function Documentation

◆ ClassName()

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

◆ mesh()

const lduMesh & mesh ( ) const
inline

Return the LDU mesh from which the addressing is obtained.

Definition at line 492 of file LduMatrix.H.

◆ lduAddr()

const lduAddressing & lduAddr ( ) const
inline

Return the LDU addressing.

Definition at line 498 of file LduMatrix.H.

References lduMesh::lduAddr().

Referenced by TDILUPreconditioner< Type, DType, LUType >::calcInvD(), LduMatrix< Type, DType, LUType >::patchSchedule(), and TGaussSeidelSmoother< Type, DType, LUType >::smooth().

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

◆ patchSchedule()

const lduSchedule & patchSchedule ( ) const
inline

Return the patch evaluation schedule.

Definition at line 504 of file LduMatrix.H.

References LduMatrix< Type, DType, LUType >::lduAddr(), and lduAddressing::patchSchedule().

Here is the call graph for this function:

◆ interfaces() [1/2]

const LduInterfaceFieldPtrsList< Type > & interfaces ( ) const
inline

Return interfaces.

Definition at line 510 of file LduMatrix.H.

◆ interfaces() [2/2]

LduInterfaceFieldPtrsList< Type > & interfaces ( )
inline

Return interfaces.

Definition at line 516 of file LduMatrix.H.

◆ diag() [1/2]

Foam::Field< DType > & diag

Definition at line 192 of file LduMatrix.C.

References Foam::Zero.

◆ upper() [1/2]

Foam::Field< LUType > & upper

Definition at line 204 of file LduMatrix.C.

References Foam::Zero.

Referenced by TDILUPreconditioner< Type, DType, LUType >::calcInvD(), LduMatrix< Type, DType, LUType >::faceH(), LduMatrix< Type, DType, LUType >::negSumDiag(), TGaussSeidelSmoother< Type, DType, LUType >::smooth(), LduMatrix< Type, DType, LUType >::sumDiag(), and LduMatrix< Type, DType, LUType >::sumMagOffDiag().

Here is the caller graph for this function:

◆ lower() [1/2]

Foam::Field< LUType > & lower

Definition at line 227 of file LduMatrix.C.

References Foam::Zero.

Referenced by TDILUPreconditioner< Type, DType, LUType >::calcInvD(), LduMatrix< Type, DType, LUType >::faceH(), LduMatrix< Type, DType, LUType >::negSumDiag(), TGaussSeidelSmoother< Type, DType, LUType >::smooth(), LduMatrix< Type, DType, LUType >::sumDiag(), and LduMatrix< Type, DType, LUType >::sumMagOffDiag().

Here is the caller graph for this function:

◆ source() [1/2]

Foam::Field< Type > & source

Definition at line 250 of file LduMatrix.C.

References Foam::Zero.

Referenced by TGaussSeidelSmoother< Type, DType, LUType >::smooth().

Here is the caller graph for this function:

◆ interfacesUpper() [1/2]

FieldField< Field, LUType > & interfacesUpper ( )
inline

Definition at line 529 of file LduMatrix.H.

Referenced by TGaussSeidelSmoother< Type, DType, LUType >::smooth().

Here is the caller graph for this function:

◆ interfacesLower() [1/2]

FieldField< Field, LUType > & interfacesLower ( )
inline

Definition at line 534 of file LduMatrix.H.

◆ diag() [2/2]

const Foam::Field< DType > & diag

Definition at line 262 of file LduMatrix.C.

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

Here is the call graph for this function:

◆ upper() [2/2]

const Foam::Field< LUType > & upper

Definition at line 276 of file LduMatrix.C.

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

Here is the call graph for this function:

◆ lower() [2/2]

const Foam::Field< LUType > & lower

Definition at line 297 of file LduMatrix.C.

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

Here is the call graph for this function:

◆ source() [2/2]

const Foam::Field< Type > & source

Definition at line 318 of file LduMatrix.C.

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

Here is the call graph for this function:

◆ interfacesUpper() [2/2]

const FieldField< Field, LUType > & interfacesUpper ( ) const
inline

Definition at line 545 of file LduMatrix.H.

◆ interfacesLower() [2/2]

const FieldField< Field, LUType > & interfacesLower ( ) const
inline

Definition at line 550 of file LduMatrix.H.

◆ hasDiag()

bool hasDiag ( ) const
inline

Definition at line 556 of file LduMatrix.H.

◆ hasUpper()

bool hasUpper ( ) const
inline

Definition at line 561 of file LduMatrix.H.

◆ hasLower()

bool hasLower ( ) const
inline

Definition at line 566 of file LduMatrix.H.

◆ hasSource()

bool hasSource ( ) const
inline

Definition at line 571 of file LduMatrix.H.

◆ diagonal()

bool diagonal ( ) const
inline

Definition at line 576 of file LduMatrix.H.

◆ symmetric()

bool symmetric ( ) const
inline

Definition at line 581 of file LduMatrix.H.

◆ asymmetric()

bool asymmetric ( ) const
inline

Definition at line 586 of file LduMatrix.H.

◆ sumDiag()

void sumDiag

Definition at line 34 of file LduMatrixOperations.C.

References Foam::diag(), LduMatrix< Type, DType, LUType >::lower(), UList< T >::size(), and LduMatrix< Type, DType, LUType >::upper().

Here is the call graph for this function:

◆ negSumDiag()

void negSumDiag

Definition at line 52 of file LduMatrixOperations.C.

References Foam::diag(), LduMatrix< Type, DType, LUType >::lower(), UList< T >::size(), and LduMatrix< Type, DType, LUType >::upper().

Here is the call graph for this function:

◆ sumMagOffDiag()

void sumMagOffDiag ( Field< LUType > &  sumOff) const

Definition at line 70 of file LduMatrixOperations.C.

References Foam::cmptMag(), LduMatrix< Type, DType, LUType >::lower(), UList< T >::size(), and LduMatrix< Type, DType, LUType >::upper().

Here is the call graph for this function:

◆ Amul()

void Amul ( Field< Type > &  Apsi,
const tmp< Field< Type > > &  tpsi 
) const

Matrix multiplication.

Definition at line 64 of file LduMatrixATmul.C.

References UList< T >::begin(), Foam::diag(), Foam::dot(), nFaces(), and psi.

Here is the call graph for this function:

◆ Tmul()

void Tmul ( Field< Type > &  Tpsi,
const tmp< Field< Type > > &  tpsi 
) const

Matrix transpose multiplication.

Definition at line 120 of file LduMatrixATmul.C.

References UList< T >::begin(), Foam::diag(), Foam::dot(), nFaces(), and psi.

Here is the call graph for this function:

◆ sumA()

void sumA ( Field< Type > &  sumA) const

Sum the coefficients on each row of the matrix.

Definition at line 175 of file LduMatrixATmul.C.

References UList< T >::begin(), Foam::diag(), Foam::dot(), forAll, and nFaces().

Here is the call graph for this function:

◆ residual() [1/2]

void residual ( Field< Type > &  rA,
const Field< Type > &  psi 
) const

Definition at line 223 of file LduMatrixATmul.C.

References UList< T >::begin(), Foam::diag(), Foam::dot(), nFaces(), and psi.

Here is the call graph for this function:

◆ residual() [2/2]

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

Definition at line 280 of file LduMatrixATmul.C.

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

Here is the call graph for this function:

◆ initMatrixInterfaces()

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 35 of file LduMatrixUpdateMatrixInterfaces.C.

References add(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, and UList< T >::size().

Referenced by TGaussSeidelSmoother< Type, DType, LUType >::smooth().

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

◆ updateMatrixInterfaces()

void updateMatrixInterfaces ( const bool  add,
const FieldField< Field, LUType > &  interfaceCoeffs,
const Field< Type > &  psiif,
Field< Type > &  result 
) const

Update interfaced interfaces for matrix operations.

Definition at line 107 of file LduMatrixUpdateMatrixInterfaces.C.

References add(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, and UList< T >::size().

Referenced by TGaussSeidelSmoother< Type, DType, LUType >::smooth().

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

◆ H() [1/2]

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

Definition at line 91 of file LduMatrixOperations.C.

References UList< T >::begin(), nFaces(), and psi.

Here is the call graph for this function:

◆ H() [2/2]

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

Definition at line 126 of file LduMatrixOperations.C.

References H().

Here is the call graph for this function:

◆ faceH() [1/2]

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

Definition at line 136 of file LduMatrixOperations.C.

References LduMatrix< Type, DType, LUType >::lower(), psi, UList< T >::size(), and LduMatrix< Type, DType, LUType >::upper().

Here is the call graph for this function:

◆ faceH() [2/2]

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

Definition at line 159 of file LduMatrixOperations.C.

◆ operator=()

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

Definition at line 170 of file LduMatrixOperations.C.

References A, and Foam::diag().

Here is the call graph for this function:

◆ negate()

void negate

Definition at line 213 of file LduMatrixOperations.C.

References Foam::negate().

Here is the call graph for this function:

◆ operator+=()

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

Definition at line 241 of file LduMatrixOperations.C.

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

Here is the call graph for this function:

◆ operator-=()

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

Definition at line 318 of file LduMatrixOperations.C.

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

Here is the call graph for this function:

◆ operator*=() [1/2]

void operator*= ( const scalarField sf)

Definition at line 395 of file LduMatrixOperations.C.

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

Here is the call graph for this function:

◆ operator*=() [2/2]

void operator*= ( scalar  s)

Definition at line 443 of file LduMatrixOperations.C.

References s().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ SolverPerformance< Type >

friend class SolverPerformance< Type >
friend

Definition at line 107 of file LduMatrix.H.

◆ operator

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

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