34void Foam::lduAddressing::calcLosort()
const
39 <<
"losort already calculated"
52 nNbrOfFace[nbr[nbrI]]++;
58 forAll(cellNbrFaces, celli)
60 cellNbrFaces[celli].setSize(nNbrOfFace[celli]);
69 cellNbrFaces[nbr[nbrI]][nNbrOfFace[nbr[nbrI]]] = nbrI;
71 nNbrOfFace[nbr[nbrI]]++;
75 losortPtr_ = std::make_unique<labelList>(nbr.size(), -1);
76 auto& lst = *losortPtr_;
81 forAll(cellNbrFaces, celli)
83 const labelUList& curNbr = cellNbrFaces[celli];
87 lst[lstI] = curNbr[curNbrI];
94void Foam::lduAddressing::calcOwnerStart()
const
99 <<
"owner start already calculated"
105 ownerStartPtr_ = std::make_unique<labelList>(size() + 1, own.size());
106 auto& ownStart = *ownerStartPtr_;
115 label curOwn = own[facei];
117 if (curOwn > nOwnStart)
121 ownStart[i++] = facei;
130void Foam::lduAddressing::calcLosortStart()
const
135 <<
"losort start already calculated"
140 losortStartPtr_ = std::make_unique<labelList>(size() + 1, nbr.size());
141 auto& lsrtStart = *losortStartPtr_;
147 label nLsrtStart = 0;
153 const label curNbr = nbr[lsrt[facei]];
155 if (curNbr > nLsrtStart)
159 lsrtStart[i++] = facei;
167 lsrtStart[size()] = nbr.size();
171void Foam::lduAddressing::calcLoCSR()
const
173 if (lowerCSRAddrPtr_)
176 <<
"lowerCSRAddr already calculated"
205 return *ownerStartPtr_;
211 if (!losortStartPtr_)
216 return *losortStartPtr_;
222 if (!lowerCSRAddrPtr_)
227 return *lowerCSRAddrPtr_;
233 losortPtr_.reset(
nullptr);
234 ownerStartPtr_.reset(
nullptr);
235 losortStartPtr_.reset(
nullptr);
236 lowerCSRAddrPtr_.reset(
nullptr);
242 label own =
min(a,
b);
244 label nbr =
max(a,
b);
246 label startLabel = ownerStartAddr()[own];
248 label endLabel = ownerStartAddr()[own + 1];
252 for (label i=startLabel; i<endLabel; i++)
254 if (neighbour[i] == nbr)
263 <<
"neighbour " << nbr <<
" not found for owner " << own <<
". "
264 <<
"Problem with addressing"
280 label own = owner[facei];
281 label nei = neighbour[facei];
284 label
diff = nei-own;
285 cellBandwidth[nei] =
max(cellBandwidth[nei],
diff);
288 label bandwidth =
max(cellBandwidth);
291 scalar profile = 0.0;
292 forAll(cellBandwidth, celli)
294 profile += 1.0*cellBandwidth[celli];
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
void map(const UList< Type > &faceVals, List< Type > &vals) const
Helper to convert lower addressing & data into CSR format.
const labelUList & ownerStartAddr() const
Return owner start addressing.
const labelUList & losortStartAddr() const
Return losort start addressing.
Tuple2< label, scalar > band() const
Calculate bandwidth and profile of addressing.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
const labelUList & lowerCSRAddr() const
Return CSR addressing.
label size() const noexcept
Return number of equations.
const labelUList & losortAddr() const
Return losort addressing.
void clearOut()
Clear additional addressing.
label triIndex(const label a, const label b) const
Return off-diagonal index given owner and neighbour label.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.