ENH: decompsition: check for mesh dimensions. Fixes #937.

This commit is contained in:
mattijs
2018-07-18 09:29:28 +01:00
parent 64855e8c12
commit 3bb5cef5bf
4 changed files with 33 additions and 3 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,6 +58,25 @@ void Foam::geomDecomp::readCoeffs()
}
void Foam::geomDecomp::checkDecompositionDirections
(
const Vector<label>& meshDirs
) const
{
for (direction dir = 0; dir < Vector<label>::nComponents; dir++)
{
if (n_[dir] > 1 && meshDirs[dir] == -1)
{
FatalErrorInFunction << "Trying to decompose a 1/2D mesh"
<< " into " << n_[dir]
<< " parts in direction "
<< Vector<label>::componentNames[dir]
<< exit(FatalError);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::geomDecomp::geomDecomp

View File

@ -76,6 +76,13 @@ protected:
tensor rotDelta_;
// Protected Member Functions
//- Check that mesh directions are compatible with decomposition
void checkDecompositionDirections(const Vector<label>&) const;
public:
// Constructors

View File

@ -224,6 +224,7 @@ public:
const scalarField& cWeights
) const
{
checkDecompositionDirections(mesh.geometricD());
return decompose(cc, cWeights);
}
@ -236,6 +237,7 @@ public:
const pointField& cc
) const
{
checkDecompositionDirections(mesh.geometricD());
return decompose(cc);
}

View File

@ -128,21 +128,23 @@ public:
//- Decompose with uniform weights.
virtual labelList decompose
(
const polyMesh&,
const polyMesh& mesh,
const pointField& points
) const
{
checkDecompositionDirections(mesh.geometricD());
return decompose(points);
}
//- Return for every coordinate the wanted processor number.
virtual labelList decompose
(
const polyMesh&,
const polyMesh& mesh,
const pointField& points,
const scalarField& weights
) const
{
checkDecompositionDirections(mesh.geometricD());
return decompose(points, weights);
}