30 template<
class Type,
class DType,
class LUType>
33 const word& fieldName,
45 const DType*
const __restrict__ diagPtr = matrix.
diag().
begin();
46 DType* __restrict__ rDPtr = rD_.
begin();
48 for (
label celli=0; celli<nCells; celli++)
50 rDPtr[celli] =
inv(diagPtr[celli]);
57 template<
class Type,
class DType,
class LUType>
60 const word& fieldName_,
67 Type* __restrict__ psiPtr = psi.
begin();
72 Type* __restrict__ bPrimePtr = bPrime.
begin();
74 const DType*
const __restrict__ rDPtr = rD_.
begin();
76 const LUType*
const __restrict__ upperPtr =
79 const LUType*
const __restrict__ lowerPtr =
82 const label*
const __restrict__ uPtr =
83 matrix_.
lduAddr().upperAddr().begin();
85 const label*
const __restrict__ ownStartPtr =
86 matrix_.
lduAddr().ownerStartAddr().begin();
106 bPrime = matrix_.
source();
124 label fEnd = ownStartPtr[0];
126 for (
label celli=0; celli<nCells; celli++)
130 fEnd = ownStartPtr[celli + 1];
133 curPsi = bPrimePtr[celli];
136 for (
label curFace=fStart; curFace<fEnd; curFace++)
138 curPsi -=
dot(upperPtr[curFace], psiPtr[uPtr[curFace]]);
142 curPsi =
dot(rDPtr[celli], curPsi);
145 for (
label curFace=fStart; curFace<fEnd; curFace++)
147 bPrimePtr[uPtr[curFace]] -=
dot(lowerPtr[curFace], curPsi);
150 psiPtr[celli] = curPsi;
156 template<
class Type,
class DType,
class LUType>
163 smooth(this->fieldName_, psi, this->matrix_, rD_, nSweeps);
#define forAll(list, i)
Loop across all elements in list.
static void smooth(const word &fieldName, Field< Type > &psi, const LduMatrix< Type, DType, LUType > &matrix, const Field< DType > &rD, const label nSweeps)
Smooth for the given number of sweeps.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void size(const label)
Override size to be inconsistent with allocated storage.
Field< LUType > & lower()
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void smooth(volScalarField &field, const scalar coeff)
TGaussSeidelSmoother(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix)
Construct from components.
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
void initMatrixInterfaces(const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Initialise the update of interfaced interfaces.
Pre-declare SubField and related Field type.
Abstract base-class for LduMatrix smoothers.
A class for handling words, derived from string.
void updateMatrixInterfaces(const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Update interfaced interfaces for matrix operations.
iterator begin()
Return an iterator to begin traversing the UList.
Field< LUType > & upper()
const lduAddressing & lduAddr() const
Return the LDU addressing.
const LduInterfaceFieldPtrsList< Type > & interfaces() const
Return interfaces.
FieldField< Field, LUType > & interfacesUpper()
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...