mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'cvm'
This commit is contained in:
@ -483,8 +483,10 @@ if (debug)
|
||||
|
||||
|
||||
// Check for externally provided cellweights and if so initialise weights
|
||||
|
||||
scalar minWeights = gMin(cWeights);
|
||||
if (cWeights.size() > 0)
|
||||
|
||||
if (!cWeights.empty())
|
||||
{
|
||||
if (minWeights <= 0)
|
||||
{
|
||||
@ -504,12 +506,39 @@ if (debug)
|
||||
<< " does not equal number of cells " << xadj.size()-1
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
scalar velotabSum = gSum(cWeights)/minWeights;
|
||||
|
||||
scalar rangeScale(1.0);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (velotabSum > scalar(INT_MAX - 1))
|
||||
{
|
||||
// 0.9 factor of safety to avoid floating point round-off in
|
||||
// rangeScale tipping the subsequent sum over the integer limit.
|
||||
rangeScale = 0.9*scalar(INT_MAX - 1)/velotabSum;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"ptscotchDecomp::decompose(...)"
|
||||
) << "Sum of weights has overflowed integer: " << velotabSum
|
||||
<< ", compressing weight scale by a factor of " << rangeScale
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::scatter(rangeScale);
|
||||
|
||||
if (!cWeights.empty())
|
||||
{
|
||||
// Convert to integers.
|
||||
velotab.setSize(cWeights.size());
|
||||
|
||||
forAll(velotab, i)
|
||||
{
|
||||
velotab[i] = int(cWeights[i]/minWeights);
|
||||
velotab[i] = int((cWeights[i]/minWeights - 1)*rangeScale) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -386,14 +386,13 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
|
||||
// Check for externally provided cellweights and if so initialise weights
|
||||
// Note: min, not gMin since routine runs on master only.
|
||||
scalar minWeights = min(cWeights);
|
||||
if (cWeights.size() > 0)
|
||||
if (!cWeights.empty())
|
||||
{
|
||||
if (minWeights <= 0)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"scotchDecomp::decompose"
|
||||
"(const pointField&, const scalarField&)"
|
||||
"scotchDecomp::decompose(...)"
|
||||
) << "Illegal minimum weight " << minWeights
|
||||
<< endl;
|
||||
}
|
||||
@ -402,8 +401,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"scotchDecomp::decompose"
|
||||
"(const pointField&, const scalarField&)"
|
||||
"scotchDecomp::decompose(...)"
|
||||
) << "Number of cell weights " << cWeights.size()
|
||||
<< " does not equal number of cells " << xadj.size()-1
|
||||
<< exit(FatalError);
|
||||
@ -421,8 +419,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"scotchDecomp::decompose"
|
||||
"(const pointField&, const scalarField&)"
|
||||
"scotchDecomp::decompose(...)"
|
||||
) << "Sum of weights has overflowed integer: " << velotabSum
|
||||
<< ", compressing weight scale by a factor of " << rangeScale
|
||||
<< endl;
|
||||
@ -433,8 +430,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
|
||||
|
||||
forAll(velotab, i)
|
||||
{
|
||||
velotab[i] =
|
||||
int((cWeights[i]/minWeights - 1)*rangeScale) + 1;
|
||||
velotab[i] = int((cWeights[i]/minWeights - 1)*rangeScale) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1300,6 +1300,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
|
||||
{
|
||||
read();
|
||||
|
||||
reduce(bounds().min(), minOp<point>());
|
||||
reduce(bounds().max(), maxOp<point>());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Constructed from triSurface:" << endl;
|
||||
@ -1353,6 +1356,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh(const IOobject& io)
|
||||
{
|
||||
read();
|
||||
|
||||
reduce(bounds().min(), minOp<point>());
|
||||
reduce(bounds().max(), maxOp<point>());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Read distributedTriSurface from " << io.objectPath()
|
||||
@ -1412,6 +1418,9 @@ Foam::distributedTriSurfaceMesh::distributedTriSurfaceMesh
|
||||
{
|
||||
read();
|
||||
|
||||
reduce(bounds().min(), minOp<point>());
|
||||
reduce(bounds().max(), maxOp<point>());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Read distributedTriSurface from " << io.objectPath()
|
||||
@ -2289,6 +2298,12 @@ void Foam::distributedTriSurfaceMesh::distribute
|
||||
|
||||
clearOut();
|
||||
|
||||
// Set the bounds() value to the boundBox of the undecomposed surface
|
||||
triSurfaceMesh::bounds() = boundBox(points());
|
||||
|
||||
reduce(bounds().min(), minOp<point>());
|
||||
reduce(bounds().max(), maxOp<point>());
|
||||
|
||||
// Regions stays same
|
||||
// Volume type stays same.
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ inline bool contiguous<segment>() {return contiguous<point>();}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class distributedTriSurfaceMesh Declaration
|
||||
Class distributedTriSurfaceMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class distributedTriSurfaceMesh
|
||||
|
||||
Reference in New Issue
Block a user