mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: decompsition: check for mesh dimensions. Fixes #937.
This commit is contained in:
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user