33template<
class Type,
class DType,
class LUType>
36 const word& fieldName,
45 rD_(matrix.
diag().size())
47 const label nCells =
matrix.diag().size();
48 const DType*
const __restrict__ diagPtr =
matrix.diag().begin();
49 DType* __restrict__ rDPtr = rD_.
begin();
51 for (label celli=0; celli<nCells; celli++)
53 rDPtr[celli] =
inv(diagPtr[celli]);
60template<
class Type,
class DType,
class LUType>
63 const word& fieldName_,
70 Type* __restrict__ psiPtr =
psi.
begin();
72 const label nCells =
psi.
size();
75 Type* __restrict__ bPrimePtr = bPrime.
begin();
77 const DType*
const __restrict__ rDPtr = rD_.
begin();
79 const LUType*
const __restrict__ upperPtr =
82 const LUType*
const __restrict__ lowerPtr =
85 const label*
const __restrict__ uPtr =
88 const label*
const __restrict__ ownStartPtr =
97 for (label sweep=0; sweep<nSweeps; sweep++)
119 label fEnd = ownStartPtr[0];
121 for (label celli=0; celli<nCells; celli++)
125 fEnd = ownStartPtr[celli + 1];
128 curPsi = bPrimePtr[celli];
131 for (label curFace=fStart; curFace<fEnd; curFace++)
133 curPsi -=
dot(upperPtr[curFace], psiPtr[uPtr[curFace]]);
137 curPsi =
dot(rDPtr[celli], curPsi);
140 for (label curFace=fStart; curFace<fEnd; curFace++)
142 bPrimePtr[uPtr[curFace]] -=
dot(lowerPtr[curFace], curPsi);
145 psiPtr[celli] = curPsi;
151template<
class Type,
class DType,
class LUType>
158 smooth(this->fieldName_,
psi, this->matrix_, rD_, nSweeps);
Generic templated field type.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
FieldField< Field, LUType > & interfacesUpper()
const lduAddressing & lduAddr() const
Return the LDU addressing.
void updateMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Update interfaced interfaces for matrix operations.
Field< LUType > & upper()
void initMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Initialise the update of interfaced interfaces.
Field< LUType > & lower()
Foam::TGaussSeidelSmoother.
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.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
void size(const label n)
Older name for setAddressableSize.
const labelUList & ownerStartAddr() const
Return owner start addressing.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
A class for handling words, derived from Foam::string.
const volScalarField & psi
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)