33template<
class Type,
class DType,
class LUType>
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_,
65 const LduMatrix<Type, DType, LUType>& matrix_,
66 const Field<DType>& rD_,
70 Type* __restrict__ psiPtr =
psi.begin();
72 const label nCells =
psi.size();
74 Field<Type> bPrime(nCells);
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 =
86 matrix_.lduAddr().upperAddr().begin();
88 const label*
const __restrict__ ownStartPtr =
89 matrix_.lduAddr().ownerStartAddr().begin();
97 for (label sweep=0; sweep<nSweeps; sweep++)
99 bPrime = matrix_.source();
103 matrix_.initMatrixInterfaces
106 matrix_.interfacesUpper(),
111 matrix_.updateMatrixInterfaces
114 matrix_.interfacesUpper(),
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;
154template<
class Type,
class DType,
class LUType>
161 smooth(this->fieldName_,
psi, this->matrix_, rD_, nSweeps);
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
smoother(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix)
Construct for given field name and matrix.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
const LduMatrix< Type, DType, LUType > & matrix_
const word & fieldName() const noexcept
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
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.
TGaussSeidelSmoother(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix)
Construct from components.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
static label nRequests() noexcept
Number of outstanding requests (on the internal list of requests).
A class for handling words, derived from Foam::string.
const volScalarField & psi
void smooth(volScalarField &field, const scalar coeff)
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 > &)