mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
extra checks
This commit is contained in:
@ -41,8 +41,7 @@ extern "C"
|
|||||||
# include "parmetis.h"
|
# include "parmetis.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -57,6 +56,8 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Does prevention of 0 cell domains and calls parmetis.
|
//- Does prevention of 0 cell domains and calls parmetis.
|
||||||
Foam::label Foam::parMetisDecomp::decompose
|
Foam::label Foam::parMetisDecomp::decompose
|
||||||
(
|
(
|
||||||
@ -76,6 +77,16 @@ Foam::label Foam::parMetisDecomp::decompose
|
|||||||
// Number of dimensions
|
// Number of dimensions
|
||||||
int nDims = 3;
|
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
|
// Get number of cells on all processors
|
||||||
List<int> nLocalCells(Pstream::nProcs());
|
List<int> nLocalCells(Pstream::nProcs());
|
||||||
nLocalCells[Pstream::myProcNo()] = xadj.size()-1;
|
nLocalCells[Pstream::myProcNo()] = xadj.size()-1;
|
||||||
@ -106,12 +117,12 @@ Foam::label Foam::parMetisDecomp::decompose
|
|||||||
// Make sure every domain has at least one cell
|
// Make sure every domain has at least one cell
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// (Metis falls over with zero sized domains)
|
// (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.
|
// don't.
|
||||||
|
|
||||||
|
|
||||||
// Number of cells to send down (is same as number of cells next processor
|
// Number of cells to send to the next processor
|
||||||
// has to receive)
|
// (is same as number of cells next processor has to receive)
|
||||||
List<int> nSendCells(Pstream::nProcs(), 0);
|
List<int> nSendCells(Pstream::nProcs(), 0);
|
||||||
|
|
||||||
for (label procI = nLocalCells.size()-1; procI >=1; procI--)
|
for (label procI = nLocalCells.size()-1; procI >=1; procI--)
|
||||||
@ -135,6 +146,15 @@ Foam::label Foam::parMetisDecomp::decompose
|
|||||||
Field<int> prevCellWeights(fromPrevProc);
|
Field<int> prevCellWeights(fromPrevProc);
|
||||||
Field<int> prevFaceWeights(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
|
// Insert adjncy
|
||||||
prepend(prevAdjncy, adjncy);
|
prepend(prevAdjncy, adjncy);
|
||||||
// Adapt offsets and prepend xadj
|
// 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
|
// Weight info
|
||||||
int wgtFlag = 0;
|
int wgtFlag = 0;
|
||||||
int* vwgtPtr = NULL;
|
int* vwgtPtr = NULL;
|
||||||
@ -292,6 +320,15 @@ Foam::label Foam::parMetisDecomp::decompose
|
|||||||
|
|
||||||
List<int> nextFinalDecomp(fromNextProc);
|
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);
|
append(nextFinalDecomp, finalDecomp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user