34 void 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];
94 void 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;
130 void 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();
171 void Foam::lduAddressing::calcLoCSR()
const 173 if (lowerCSRAddrPtr_)
176 <<
"lowerCSRAddr already calculated" 180 lowerCSRAddrPtr_ = std::make_unique<labelList>(lowerAddr().size());
181 map(lowerAddr(), *lowerCSRAddrPtr_);
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];
297 return Tuple2<label, scalar>(bandwidth, profile);
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
label triIndex(const label a, const label b) const
Return off-diagonal index given owner and neighbour label.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const labelUList & losortStartAddr() const
Return losort start addressing.
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.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
label size() const noexcept
Return number of equations.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
virtual const labelUList & upperAddr() const =0
Return upper addressing.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
Tuple2< label, scalar > band() const
Calculate bandwidth and profile of addressing.
const labelUList & lowerCSRAddr() const
Return CSR addressing.
const labelUList & losortAddr() const
Return losort addressing.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
List< label > labelList
A List of labels.
void clearOut()
Clear additional addressing.
const labelUList & ownerStartAddr() const
Return owner start addressing.