33 template<
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]);
60 template<
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 =
80 matrix_.
upper().begin();
82 const LUType*
const __restrict__ lowerPtr =
83 matrix_.
lower().begin();
85 const label*
const __restrict__ uPtr =
88 const label*
const __restrict__ ownStartPtr =
122 label fEnd = ownStartPtr[0];
124 for (label celli=0; celli<nCells; celli++)
128 fEnd = ownStartPtr[celli + 1];
131 curPsi = bPrimePtr[celli];
134 for (label curFace=fStart; curFace<fEnd; curFace++)
136 curPsi -=
dot(upperPtr[curFace], psiPtr[uPtr[curFace]]);
140 curPsi =
dot(rDPtr[celli], curPsi);
143 for (label curFace=fStart; curFace<fEnd; curFace++)
145 bPrimePtr[uPtr[curFace]] -=
dot(lowerPtr[curFace], curPsi);
148 psiPtr[celli] = curPsi;
154 template<
class Type,
class DType,
class LUType>
161 smooth(this->fieldName_,
psi, this->matrix_, rD_, nSweeps);
void initMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Initialise the update of interfaced interfaces.
void size(const label n)
Older name for setAddressableSize.
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.
static label nRequests() noexcept
Number of outstanding requests (on the internal list of requests)
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
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 diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
Generic templated field type.
A class for handling words, derived from Foam::string.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
void updateMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result, const label startRequest) const
Update interfaced interfaces for matrix operations.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
const lduAddressing & lduAddr() const
Return the LDU addressing.
const Field< LUType > & upper() const
const Field< LUType > & lower() const
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
const volScalarField & psi
const FieldField< Field, LUType > & interfacesUpper() const noexcept
const Field< Type > & source() const
const labelUList & ownerStartAddr() const
Return owner start addressing.