STYLE: adjust globalIndex/CompactListList overflow reporting

- report location with previous good offset and the new count that
  would cause overflow. Simpler to report and the (very long) list
  of input sizes is not particularly useful for diagnostics either.

ENH: add globalIndex comparison operators

- for outputting lists of globalIndex
This commit is contained in:
Mark Olesen
2023-11-18 11:48:08 +01:00
parent 5e0cafa637
commit ef201ecfea
6 changed files with 134 additions and 63 deletions

View File

@ -49,12 +49,14 @@ Foam::globalIndex::calcListOffsets
label start = 0;
for (label i = 0; i < len; ++i)
{
const label count = lists[i].size();
values[i] = start;
start += lists[i].size();
start += count;
if (checkOverflow && start < values[i])
{
reportOverflowAndExit(i);
reportOverflowAndExit(i, values[i], count);
}
}
values[len] = start;
@ -1005,12 +1007,12 @@ OutputContainer Foam::globalIndex::scatter
// The globalIndex might be correct on master only,
// so scatter local sizes to ensure consistency
const label localLen
const label count
(
UPstream::listScatterValues<label>(this->localSizes(), comm)
);
OutputContainer localData(localLen);
OutputContainer localData(count);
this->scatter(allData, localData, tag, commsType, comm);
return localData;