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 labelList& 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" 139 losortStartPtr_ = std::make_unique<labelList>(size() + 1,
Foam::zero{});
140 auto& lsrtStart = *losortStartPtr_;
148 label nLsrtStart = 0;
154 const label curNbr = nbr[lsrt[facei]];
156 if (curNbr > nLsrtStart)
160 lsrtStart[i++] = facei;
168 lsrtStart[size()] = nbr.size();
192 return *ownerStartPtr_;
198 if (!losortStartPtr_)
203 return *losortStartPtr_;
209 losortPtr_.reset(
nullptr);
210 ownerStartPtr_.reset(
nullptr);
211 losortStartPtr_.reset(
nullptr);
217 label own =
min(a,
b);
219 label nbr =
max(a,
b);
221 label startLabel = ownerStartAddr()[own];
223 label endLabel = ownerStartAddr()[own + 1];
227 for (label i=startLabel; i<endLabel; i++)
229 if (neighbour[i] == nbr)
238 <<
"neighbour " << nbr <<
" not found for owner " << own <<
". " 239 <<
"Problem with addressing" 255 label own = owner[facei];
256 label nei = neighbour[facei];
259 label
diff = nei-own;
260 cellBandwidth[nei] =
max(cellBandwidth[nei],
diff);
263 label bandwidth =
max(cellBandwidth);
266 scalar profile = 0.0;
267 forAll(cellBandwidth, celli)
269 profile += 1.0*cellBandwidth[celli];
272 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 & 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.