diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index b219c65bcb..b9f55ec82d 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -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::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. diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C index f03667084e..2573c9ec78 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -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)