Skip to content
Snippets Groups Projects
Commit 6fd6610b authored by mattijs's avatar mattijs
Browse files

ENH: redistributePar: create dummy sets on non-existing processors

parent 9a7c236a
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -29,6 +29,10 @@ License
#include "Time.H"
//#include "IOPtrList.H"
#include "polyBoundaryMeshEntries.H"
#include "IOobjectList.H"
#include "pointSet.H"
#include "faceSet.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
......@@ -375,6 +379,41 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
}
// Determine sets
// ~~~~~~~~~~~~~~
wordList pointSetNames;
wordList faceSetNames;
wordList cellSetNames;
if (Pstream::master())
{
// Read sets
IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
pointSetNames = objects.sortedNames(pointSet::typeName);
faceSetNames = objects.sortedNames(faceSet::typeName);
cellSetNames = objects.sortedNames(cellSet::typeName);
}
Pstream::scatter(pointSetNames);
Pstream::scatter(faceSetNames);
Pstream::scatter(cellSetNames);
if (!haveMesh)
{
forAll(pointSetNames, i)
{
pointSet(mesh, pointSetNames[i], 0).write();
}
forAll(faceSetNames, i)
{
faceSet(mesh, faceSetNames[i], 0).write();
}
forAll(cellSetNames, i)
{
cellSet(mesh, cellSetNames[i], 0).write();
}
}
// if (!haveMesh)
// {
// // We created a dummy mesh file above. Delete it.
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -1348,7 +1348,15 @@ Foam::labelList Foam::decompositionMethod::decompose
{
// If no processor specified use the one from the
// 0th element
proci = finalDecomp[mesh.faceOwner()[set[0]]];
if (set.size())
{
proci = finalDecomp[mesh.faceOwner()[set[0]]];
}
else
{
// Zero-sized processor (e.g. from redistributePar)
proci = 0;
}
}
forAll(set, fI)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment