Go to the documentation of this file.
30 template<
class Type,
class DType,
class LUType>
48 template<
class Type,
class DType,
class LUType>
66 template<
class Type,
class DType,
class LUType>
86 template<
class Type,
class DType,
class LUType>
95 if (lowerPtr_ || upperPtr_)
99 Type* __restrict__ HpsiPtr = Hpsi.begin();
101 const Type* __restrict__ psiPtr =
psi.begin();
103 const label* __restrict__ uPtr = lduAddr().upperAddr().begin();
104 const label* __restrict__ lPtr = lduAddr().lowerAddr().begin();
106 const LUType* __restrict__ lowerPtr = lower().begin();
107 const LUType* __restrict__ upperPtr = upper().begin();
109 const label nFaces = upper().size();
113 HpsiPtr[uPtr[
face]] -= lowerPtr[
face]*psiPtr[lPtr[
face]];
114 HpsiPtr[lPtr[
face]] -= upperPtr[
face]*psiPtr[uPtr[
face]];
121 template<
class Type,
class DType,
class LUType>
125 tmp<Field<Type> > tHpsi(H(tpsi()));
131 template<
class Type,
class DType,
class LUType>
135 const Field<LUType>& Lower =
const_cast<const LduMatrix&
>(*this).lower();
136 const Field<LUType>& Upper =
const_cast<const LduMatrix&
>(*this).upper();
142 tmp<Field<Type> > tfaceHpsi(
new Field<Type> (Lower.size()));
143 Field<Type> & faceHpsi = tfaceHpsi();
145 for (
label face=0; face<l.size(); face++)
147 faceHpsi[face] = Upper[face]*
psi[u[face]] - Lower[face]*
psi[l[face]];
154 template<
class Type,
class DType,
class LUType>
158 tmp<Field<Type> > tfaceHpsi(faceH(tpsi()));
166 template<
class Type,
class DType,
class LUType>
172 <<
"attempted assignment to self"
203 source() =
A.source();
206 interfacesUpper_ =
A.interfacesUpper_;
207 interfacesLower_ =
A.interfacesLower_;
211 template<
class Type,
class DType,
class LUType>
231 sourcePtr_->negate();
239 template<
class Type,
class DType,
class LUType>
249 source() +=
A.source();
252 if (symmetric() &&
A.symmetric())
254 upper() +=
A.upper();
256 else if (symmetric() &&
A.asymmetric())
267 upper() +=
A.upper();
268 lower() +=
A.lower();
270 else if (asymmetric() &&
A.symmetric())
274 lower() +=
A.upper();
275 upper() +=
A.upper();
279 lower() +=
A.lower();
280 upper() +=
A.lower();
284 else if (asymmetric() &&
A.asymmetric())
286 lower() +=
A.lower();
287 upper() +=
A.upper();
301 else if (
A.diagonal())
307 <<
"Unknown matrix type combination"
311 interfacesUpper_ +=
A.interfacesUpper_;
312 interfacesLower_ +=
A.interfacesLower_;
316 template<
class Type,
class DType,
class LUType>
326 source() -=
A.source();
329 if (symmetric() &&
A.symmetric())
331 upper() -=
A.upper();
333 else if (symmetric() &&
A.asymmetric())
344 upper() -=
A.upper();
345 lower() -=
A.lower();
347 else if (asymmetric() &&
A.symmetric())
351 lower() -=
A.upper();
352 upper() -=
A.upper();
356 lower() -=
A.lower();
357 upper() -=
A.lower();
361 else if (asymmetric() &&
A.asymmetric())
363 lower() -=
A.lower();
364 upper() -=
A.upper();
370 upper() = -
A.upper();
375 lower() = -
A.lower();
378 else if (
A.diagonal())
384 <<
"Unknown matrix type combination"
388 interfacesUpper_ -=
A.interfacesUpper_;
389 interfacesLower_ -=
A.interfacesLower_;
393 template<
class Type,
class DType,
class LUType>
411 if (symmetric() || asymmetric())
413 Field<LUType>& upper = this->upper();
414 Field<LUType>& lower = this->lower();
419 for (
label face=0; face<upper.size(); face++)
421 upper[face] *=
sf[l[face]];
424 for (
label face=0; face<lower.size(); face++)
426 lower[face] *=
sf[u[face]];
431 <<
"Scaling a matrix by scalarField is not currently supported\n"
432 "because scaling interfacesUpper_ and interfacesLower_ "
433 "require special transfers"
441 template<
class Type,
class DType,
class LUType>
464 interfacesUpper_ *=
s;
465 interfacesLower_ *=
s;
void sumMagOffDiag(Field< LUType > &sumOff) const
void operator=(const LduMatrix< Type, DType, LUType > &)
A class for managing temporary objects.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Field< LUType > & upper()
simpleMatrix< scalar > A(Nc)
void operator-=(const LduMatrix< Type, DType, LUType > &)
UList< label > unallocLabelList
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tmp< Field< Type > > H(const Field< Type > &) const
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
void operator+=(const LduMatrix< Type, DType, LUType > &)
errorManip< error > abort(error &err)
volScalarField sf(fieldObject, mesh)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void operator*=(const scalarField &)
tmp< Field< Type > > faceH(const Field< Type > &) const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const volScalarField & psi
Traits class for primitives.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A face is a list of labels corresponding to mesh vertices.
label size() const
Return the number of elements in the UList.
Field< LUType > & lower()