LduMatrix: Sum-diag operations for diagonal matrices

This commit is contained in:
Will Bainbridge
2018-03-22 11:04:30 +00:00
parent 9cf51b0363
commit ea86dc2cf4
2 changed files with 31 additions and 1 deletions

View File

@ -30,6 +30,11 @@ License
template<class Type, class DType, class LUType>
void Foam::LduMatrix<Type, DType, LUType>::sumDiag()
{
if (!lowerPtr_ && !upperPtr_)
{
return;
}
const Field<LUType>& Lower = const_cast<const LduMatrix&>(*this).lower();
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();
Field<DType>& Diag = diag();
@ -48,6 +53,11 @@ void Foam::LduMatrix<Type, DType, LUType>::sumDiag()
template<class Type, class DType, class LUType>
void Foam::LduMatrix<Type, DType, LUType>::negSumDiag()
{
if (!lowerPtr_ && !upperPtr_)
{
return;
}
const Field<LUType>& Lower = const_cast<const LduMatrix&>(*this).lower();
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();
Field<DType>& Diag = diag();
@ -69,6 +79,11 @@ void Foam::LduMatrix<Type, DType, LUType>::sumMagOffDiag
Field<LUType>& sumOff
) const
{
if (!lowerPtr_ && !upperPtr_)
{
return;
}
const Field<LUType>& Lower = const_cast<const LduMatrix&>(*this).lower();
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,6 +32,11 @@ Description
void Foam::lduMatrix::sumDiag()
{
if (!lowerPtr_ && !upperPtr_)
{
return;
}
const scalarField& Lower = const_cast<const lduMatrix&>(*this).lower();
const scalarField& Upper = const_cast<const lduMatrix&>(*this).upper();
scalarField& Diag = diag();
@ -49,6 +54,11 @@ void Foam::lduMatrix::sumDiag()
void Foam::lduMatrix::negSumDiag()
{
if (!lowerPtr_ && !upperPtr_)
{
return;
}
const scalarField& Lower = const_cast<const lduMatrix&>(*this).lower();
const scalarField& Upper = const_cast<const lduMatrix&>(*this).upper();
scalarField& Diag = diag();
@ -69,6 +79,11 @@ void Foam::lduMatrix::sumMagOffDiag
scalarField& sumOff
) const
{
if (!lowerPtr_ && !upperPtr_)
{
return;
}
const scalarField& Lower = const_cast<const lduMatrix&>(*this).lower();
const scalarField& Upper = const_cast<const lduMatrix&>(*this).upper();