ENH: additional protection against zero-sized graph offset lists

- for metis-like graphs there is no guarantee that a zero-sized graph
  has an offsets list with size 1 or size 0, so always use

     numCells = max(0, xadj.size()-1)

  this was already done in most places, but missed in the
  decomposeGeneral method

STYLE: use sumOp<label>() instead of plusOp<label>()
This commit is contained in:
Mark Olesen
2022-03-03 21:17:35 +01:00
committed by Andrew Heather
parent e11fde900c
commit 0867816490
6 changed files with 21 additions and 17 deletions

View File

@ -253,11 +253,11 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
labelList& cutConnections
) const
{
const globalIndex globalCells(cellCells.size());
// Determine new index for cells by inverting subset
labelList oldToNew(invert(cellCells.size(), set));
globalIndex globalCells(cellCells.size());
// Subset locally the elements for which I have data
subCellCells = UIndirectList<labelList>(cellCells, set);
@ -275,7 +275,7 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
// subCellCells : indexes into oldToNew and allDist
// Globally compact numbering for cells in set.
globalIndex globalSubCells(set.size());
const globalIndex globalSubCells(set.size());
// Now subCellCells contains indices into oldToNew which are the
// new locations of the neighbouring cells.
@ -417,7 +417,7 @@ void Foam::multiLevelDecomp::decompose
nOutsideConnections
);
label nPoints = returnReduce(domainPoints.size(), plusOp<label>());
label nPoints = returnReduce(domainPoints.size(), sumOp<label>());
Pstream::listCombineGather(nOutsideConnections, plusEqOp<label>());
Pstream::listCombineScatter(nOutsideConnections);
label nPatches = 0;
@ -525,7 +525,7 @@ void Foam::multiLevelDecomp::decompose
}
}
reduce(nPoints, plusOp<label>());
reduce(nPoints, sumOp<label>());
Pstream::listCombineGather
(
nOutsideConnections,