extra checks
This commit is contained in:
parent
084473cc0c
commit
05e733ce3a
@ -41,8 +41,7 @@ extern "C"
|
||||
# include "parmetis.h"
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -57,6 +56,8 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
//- Does prevention of 0 cell domains and calls parmetis.
|
||||
Foam::label Foam::parMetisDecomp::decompose
|
||||
(
|
||||
@ -76,6 +77,16 @@ Foam::label Foam::parMetisDecomp::decompose
|
||||
// Number of dimensions
|
||||
int nDims = 3;
|
||||
|
||||
|
||||
if (cellCentres.size() != xadj.size()-1)
|
||||
{
|
||||
FatalErrorIn("parMetisDecomp::decompose(..)")
|
||||
<< "cellCentres:" << cellCentres.size()
|
||||
<< " xadj:" << xadj.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// Get number of cells on all processors
|
||||
List<int> nLocalCells(Pstream::nProcs());
|
||||
nLocalCells[Pstream::myProcNo()] = xadj.size()-1;
|
||||
@ -106,12 +117,12 @@ Foam::label Foam::parMetisDecomp::decompose
|
||||
// Make sure every domain has at least one cell
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// (Metis falls over with zero sized domains)
|
||||
// Trickle cells from processors that have them down to those that
|
||||
// Trickle cells from processors that have them up to those that
|
||||
// don't.
|
||||
|
||||
|
||||
// Number of cells to send down (is same as number of cells next processor
|
||||
// has to receive)
|
||||
// Number of cells to send to the next processor
|
||||
// (is same as number of cells next processor has to receive)
|
||||
List<int> nSendCells(Pstream::nProcs(), 0);
|
||||
|
||||
for (label procI = nLocalCells.size()-1; procI >=1; procI--)
|
||||
@ -135,6 +146,15 @@ Foam::label Foam::parMetisDecomp::decompose
|
||||
Field<int> prevCellWeights(fromPrevProc);
|
||||
Field<int> prevFaceWeights(fromPrevProc);
|
||||
|
||||
if (prevXadj.size() != nSendCells[Pstream::myProcNo()-1])
|
||||
{
|
||||
FatalErrorIn("parMetisDecomp::decompose(..)")
|
||||
<< "Expected from processor " << Pstream::myProcNo()-1
|
||||
<< " connectivity for " << nSendCells[Pstream::myProcNo()-1]
|
||||
<< " nCells but only received " << prevXadj.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Insert adjncy
|
||||
prepend(prevAdjncy, adjncy);
|
||||
// Adapt offsets and prepend xadj
|
||||
@ -222,6 +242,14 @@ Foam::label Foam::parMetisDecomp::decompose
|
||||
}
|
||||
|
||||
|
||||
if (nLocalCells[Pstream::myProcNo()] != (xadj.size()-1))
|
||||
{
|
||||
FatalErrorIn("parMetisDecomp::decompose(..)")
|
||||
<< "Have connectivity for " << xadj.size()-1
|
||||
<< " cells but nLocalCells:" << nLocalCells[Pstream::myProcNo()]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Weight info
|
||||
int wgtFlag = 0;
|
||||
int* vwgtPtr = NULL;
|
||||
@ -292,6 +320,15 @@ Foam::label Foam::parMetisDecomp::decompose
|
||||
|
||||
List<int> nextFinalDecomp(fromNextProc);
|
||||
|
||||
if (nextFinalDecomp.size() != nSendCells[Pstream::myProcNo()])
|
||||
{
|
||||
FatalErrorIn("parMetisDecomp::decompose(..)")
|
||||
<< "Expected from processor " << Pstream::myProcNo()+1
|
||||
<< " decomposition for " << nSendCells[Pstream::myProcNo()]
|
||||
<< " nCells but only received " << nextFinalDecomp.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
append(nextFinalDecomp, finalDecomp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user