32 template<
class Type,
class DType,
class LUType>
39 LduMatrix<Type, DType, LUType>::preconditioner(sol),
40 rD_(sol.matrix().
diag())
48 template<
class Type,
class DType,
class LUType>
55 DType* __restrict__ rDPtr = rD.
begin();
60 const LUType*
const __restrict__ upperPtr = matrix.
upper().
begin();
61 const LUType*
const __restrict__ lowerPtr = matrix.
lower().
begin();
72 label nCells = rD.
size();
74 for (label cell=0; cell<nCells; cell++)
81 template<
class Type,
class DType,
class LUType>
88 Type* __restrict__ wAPtr = wA.begin();
89 const Type* __restrict__ rAPtr = rA.begin();
90 const DType* __restrict__ rDPtr = rD_.begin();
92 const label*
const __restrict__ uPtr =
93 this->solver_.matrix().lduAddr().upperAddr().begin();
94 const label*
const __restrict__ lPtr =
95 this->solver_.matrix().lduAddr().lowerAddr().begin();
96 const label*
const __restrict__ losortPtr =
97 this->solver_.matrix().lduAddr().losortAddr().begin();
99 const LUType*
const __restrict__ upperPtr =
100 this->solver_.matrix().upper().begin();
101 const LUType*
const __restrict__ lowerPtr =
102 this->solver_.matrix().lower().begin();
104 label nCells = wA.size();
105 label nFaces = this->solver_.matrix().upper().
size();
106 label nFacesM1 = nFaces - 1;
108 for (label cell=0; cell<nCells; cell++)
110 wAPtr[cell] =
dot(rDPtr[cell], rAPtr[cell]);
116 for (label face=0; face<nFaces; face++)
118 sface = losortPtr[face];
119 wAPtr[uPtr[sface]] -=
120 dot(rDPtr[uPtr[sface]],
dot(lowerPtr[sface], wAPtr[lPtr[sface]]));
123 for (label face=nFacesM1; face>=0; face--)
131 template<
class Type,
class DType,
class LUType>
135 const Field<Type>& rT
138 Type* __restrict__ wTPtr = wT.begin();
139 const Type* __restrict__ rTPtr = rT.begin();
140 const DType* __restrict__ rDPtr = rD_.begin();
142 const label*
const __restrict__ uPtr =
143 this->solver_.matrix().lduAddr().upperAddr().begin();
144 const label*
const __restrict__ lPtr =
145 this->solver_.matrix().lduAddr().lowerAddr().begin();
146 const label*
const __restrict__ losortPtr =
147 this->solver_.matrix().lduAddr().losortAddr().begin();
149 const LUType*
const __restrict__ upperPtr =
150 this->solver_.matrix().upper().begin();
151 const LUType*
const __restrict__ lowerPtr =
152 this->solver_.matrix().lower().begin();
154 label nCells = wT.size();
155 label nFaces = this->solver_.matrix().upper().size();
156 label nFacesM1 = nFaces - 1;
158 for (label cell=0; cell<nCells; cell++)
160 wTPtr[cell] =
dot(rDPtr[cell], rTPtr[cell]);
163 for (label face=0; face<nFaces; face++)
166 dot(rDPtr[uPtr[face]],
dot(upperPtr[face], wTPtr[lPtr[face]]));
172 for (label face=nFacesM1; face>=0; face--)
174 sface = losortPtr[face];
175 wTPtr[lPtr[sface]] -=
176 dot(rDPtr[lPtr[sface]],
dot(lowerPtr[sface], wTPtr[uPtr[sface]]));
void size(const label n)
Older name for setAddressableSize.
A face is a list of labels corresponding to mesh vertices.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Field< LUType > & lower()
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
virtual void precondition(Field< Type > &wA, const Field< Type > &rA) const
Return wA the preconditioned form of residual rA.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
virtual const labelUList & upperAddr() const =0
Return upper addressing.
Field< LUType > & upper()
virtual void preconditionT(Field< Type > &wT, const Field< Type > &rT) const
Return wT the transpose-matrix preconditioned form of.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
Abstract base-class for LduMatrix solvers.
TDILUPreconditioner(const typename LduMatrix< Type, DType, LUType >::solver &sol, const dictionary &preconditionerDict)
Construct from matrix components and preconditioner data dictionary.
const lduAddressing & lduAddr() const
Return the LDU addressing.
A cell is defined as a list of faces with extra functionality.
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
static void calcInvD(Field< DType > &rD, const LduMatrix< Type, DType, LUType > &matrix)
Calculate the reciprocal of the preconditioned diagonal.