135 nCells += lduMatrices[i].
size();
140 convert(lduMatrices);
148 convert(ldum, interfaceCoeffs, interfaces);
158 Pout<<
"LUscalarMatrix : size:" << mRows <<
endl;
159 for (
label rowI = 0; rowI < mRows; rowI++)
163 Pout<<
"cell:" << rowI <<
" diagCoeff:" << row[rowI] <<
endl;
165 Pout<<
" connects to upper cells :";
166 for (
label columnI = rowI+1; columnI < nColumns; columnI++)
168 if (
mag(row[columnI]) > small)
170 Pout<<
' ' << columnI <<
" (coeff:" << row[columnI]
175 Pout<<
" connects to lower cells :";
176 for (
label columnI = 0; columnI < rowI; columnI++)
178 if (
mag(row[columnI]) > small)
180 Pout<<
' ' << columnI <<
" (coeff:" << row[columnI]
197 void Foam::LUscalarMatrix::convert
207 const scalar* __restrict__ diagPtr = ldum.
diag().
begin();
208 const scalar* __restrict__ upperPtr = ldum.
upper().
begin();
209 const scalar* __restrict__ lowerPtr = ldum.
lower().
begin();
230 if (interfaces.
set(inti))
232 const lduInterface&
interface = interfaces[inti].interface();
236 const label* __restrict__ lPtr = interface.faceCells().
begin();
239 refCast<const cyclicLduInterface>(interface);
241 const label* __restrict__ uPtr =
242 interfaces[nbrInt].interface().faceCells().
begin();
244 const scalar* __restrict__ nbrUpperLowerPtr =
245 interfaceCoeffs[nbrInt].
begin();
247 label inFaces = interface.faceCells().size();
261 void Foam::LUscalarMatrix::convert
269 forAll(lduMatrices, ldumi)
271 procOffsets_[ldumi+1] = procOffsets_[ldumi] + lduMatrices[ldumi].
size();
274 forAll(lduMatrices, ldumi)
277 label offset = procOffsets_[ldumi];
279 const label* __restrict__ uPtr = lduMatrixi.upperAddr_.
begin();
280 const label* __restrict__ lPtr = lduMatrixi.lowerAddr_.
begin();
282 const scalar* __restrict__ diagPtr = lduMatrixi.diag_.
begin();
283 const scalar* __restrict__ upperPtr = lduMatrixi.upper_.
begin();
284 const scalar* __restrict__ lowerPtr = lduMatrixi.lower_.
begin();
287 const label nFaces = lduMatrixi.upper_.
size();
305 lduMatrixi.interfaces_;
311 if (interface.myProcNo_ == interface.neighbProcNo_)
313 const label* __restrict__ ulPtr = interface.faceCells_.
begin();
315 const scalar* __restrict__ upperLowerPtr =
316 interface.coeffs_.begin();
318 label inFaces = interface.faceCells_.size()/2;
323 label lCell = ulPtr[
face + inFaces] + offset;
329 else if (interface.myProcNo_ < interface.neighbProcNo_)
337 lduMatrices[interface.neighbProcNo_].interfaces_;
339 label neiInterfacei = -1;
341 forAll(neiInterfaces, ninti)
346 neiInterfaces[ninti].neighbProcNo_
347 == interface.myProcNo_
349 && (neiInterfaces[ninti].tag_ == interface.tag_)
352 neiInterfacei = ninti;
357 if (neiInterfacei == -1)
363 neiInterfaces[neiInterfacei];
365 const label* __restrict__ uPtr = interface.faceCells_.
begin();
366 const label* __restrict__ lPtr =
367 neiInterface.faceCells_.
begin();
369 const scalar* __restrict__ upperPtr = interface.coeffs_.begin();
370 const scalar* __restrict__ lowerPtr =
371 neiInterface.coeffs_.
begin();
373 label inFaces = interface.faceCells_.size();
374 label neiOffset = procOffsets_[interface.neighbProcNo_];
390 void Foam::LUscalarMatrix::printDiagonalDominance()
const 392 for (
label i=0; i<
m(); i++)
395 for (
label j=0; j<
m(); j++)
419 for (
label j=0; j<
m(); j++)
424 for (
label i=0; i<
m(); i++)
IO interface for processorLduInterface.
label n() const
Return the number of columns.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int masterNo()
Process index of the master.
bool set(const label) const
Is element set.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual label nbrPatchID() const =0
Return neighbour.
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
static int firstSlave()
Process index of first slave.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
An abstract base class for cyclic coupled interfaces.
static bool master(const label communicator=0)
Am I the master process.
static int & msgType()
Message tag of standard messages.
void operator=(const zero)
Assignment of all elements to zero.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Input inter-processor communications stream.
void decompose(const scalarSquareMatrix &M)
Perform the LU decomposition of the matrix M.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
Inter-processor communications stream.
iterator begin()
Return an iterator to begin traversing the UList.
LUscalarMatrix()
Construct null.
scalar * operator[](const label)
Return subscript-checked row of Matrix.
bool set(const label) const
Is element set.
defineTypeNameAndDebug(combustionModel, 0)
Output inter-processor communications stream.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
iterator begin()
Return an iterator to begin traversing the UPtrList.
const lduAddressing & lduAddr() const
Return the LDU addressing.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A cell is defined as a list of faces with extra functionality.
prefixOSstream Pout(cout, "Pout")
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
label m() const
Return the number of rows.
dimensioned< scalar > mag(const dimensioned< Type > &)
I/O for lduMatrix and interface values.
void transfer(mType &)
Transfer the contents of the argument Matrix into this Matrix.
const lduMesh & mesh() const
Return the LDU mesh from which the addressing is obtained.
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
LU back-substitution with given source, returning the solution.
label size() const
Return number of equations.
static int lastSlave(const label communicator=0)
Process index of last slave.
void inv(scalarSquareMatrix &M) const
Set M to the inverse of this square matrix.