metisDecomp: Use floatScalar rather than scalar for processorWeights

Resolved bug-report http://bugs.openfoam.org/view.php?id=2085
This commit is contained in:
Henry Weller 2016-05-09 08:42:52 +01:00
parent 4c4f68c283
commit a7640fcdc4

View file

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -61,18 +61,18 @@ Foam::label Foam::metisDecomp::decompose
label numCells = xadj.size()-1; label numCells = xadj.size()-1;
// decomposition options // Decomposition options
List<label> options(METIS_NOPTIONS); List<label> options(METIS_NOPTIONS);
METIS_SetDefaultOptions(options.begin()); METIS_SetDefaultOptions(options.begin());
// processor weights initialised with no size, only used if specified in // Processor weights initialised with no size, only used if specified in
// a file // a file
Field<scalar> processorWeights; Field<floatScalar> processorWeights;
// cell weights (so on the vertices of the dual) // Cell weights (so on the vertices of the dual)
List<label> cellWeights; List<label> cellWeights;
// face weights (so on the edges of the dual) // Face weights (so on the edges of the dual)
List<label> faceWeights; List<label> faceWeights;
@ -94,6 +94,7 @@ Foam::label Foam::metisDecomp::decompose
<< " does not equal number of cells " << numCells << " does not equal number of cells " << numCells
<< exit(FatalError); << exit(FatalError);
} }
// Convert to integers. // Convert to integers.
cellWeights.setSize(cWeights.size()); cellWeights.setSize(cWeights.size());
forAll(cellWeights, i) forAll(cellWeights, i)
@ -108,6 +109,7 @@ Foam::label Foam::metisDecomp::decompose
{ {
const dictionary& metisCoeffs = const dictionary& metisCoeffs =
decompositionDict_.subDict("metisCoeffs"); decompositionDict_.subDict("metisCoeffs");
word weightsFile; word weightsFile;
if (metisCoeffs.readIfPresent("method", method)) if (metisCoeffs.readIfPresent("method", method))
@ -153,42 +155,15 @@ Foam::label Foam::metisDecomp::decompose
<< exit(FatalError); << exit(FatalError);
} }
} }
//if (metisCoeffs.readIfPresent("cellWeightsFile", weightsFile))
//{
// Info<< "metisDecomp : Using cell-based weights." << endl;
//
// IOList<label> cellIOWeights
// (
// IOobject
// (
// weightsFile,
// mesh_.time().timeName(),
// mesh_,
// IOobject::MUST_READ,
// IOobject::AUTO_WRITE
// )
// );
// cellWeights.transfer(cellIOWeights);
//
// if (cellWeights.size() != xadj.size()-1)
// {
// FatalErrorInFunction
// << "Number of cell weights " << cellWeights.size()
// << " does not equal number of cells " << xadj.size()-1
// << exit(FatalError);
// }
//}
} }
label ncon = 1; label ncon = 1;
label nProcs = nProcessors_; label nProcs = nProcessors_;
// output: cell -> processor addressing // Output: cell -> processor addressing
finalDecomp.setSize(numCells); finalDecomp.setSize(numCells);
// output: number of cut edges // Output: number of cut edges
label edgeCut = 0; label edgeCut = 0;
if (method == "recursive") if (method == "recursive")
@ -214,7 +189,7 @@ Foam::label Foam::metisDecomp::decompose
{ {
METIS_PartGraphKway METIS_PartGraphKway
( (
&numCells, // num vertices in graph &numCells, // num vertices in graph
&ncon, // num balancing constraints &ncon, // num balancing constraints
const_cast<List<label>&>(xadj).begin(), // indexing into adjncy const_cast<List<label>&>(xadj).begin(), // indexing into adjncy
const_cast<List<label>&>(adjncy).begin(), // neighbour info const_cast<List<label>&>(adjncy).begin(), // neighbour info