Commit 9c26b5ce authored by mattijs's avatar mattijs
Browse files

BUG: subsetMesh: map instead of truncate. See #1558.

This also is to do with redistributePar:
this uses subsetMesh to generate parts to
send to different processors.
2) related to 1558: make sure not to choose 'mapped'
patches to move the processor patches into so
we can use the mapper cloning and correctly
size additional data (e.g. offsets). This should
be generalised to hold for any patch type
holding local data ...
parent f9033cbf
......@@ -47,6 +47,7 @@ License
#include "ListOps.H"
#include "globalIndex.H"
#include "cyclicACMIPolyPatch.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -335,7 +336,12 @@ Foam::label Foam::fvMeshDistribute::findNonEmptyPatch() const
{
const polyPatch& pp = patches[patchi];
if (!isA<emptyPolyPatch>(pp) && !isCoupledPatch(patchi))
if
(
!isA<emptyPolyPatch>(pp)
&& !isCoupledPatch(patchi)
&& !isA<mappedPatchBase>(pp)
)
{
nonEmptyPatchi = patchi;
break;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -1055,14 +1055,37 @@ void Foam::fvMeshSubset::setCellSubset
{
const label newSize = boundaryPatchSizes[globalPatchMap[oldPatchi]];
// Clone (even if 0 size)
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
newSize,
patchStart
).ptr();
if (oldInternalPatchID != oldPatchi)
{
// Pure subset of patch faces (no internal faces added to this
// patch). Can use mapping.
labelList map(newSize);
for (label patchFacei = 0; patchFacei < newSize; patchFacei++)
{
const label facei = patchStart+patchFacei;
const label oldFacei = faceMap_[facei];
map[patchFacei] = oldPatches[oldPatchi].whichFace(oldFacei);
}
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
map,
patchStart
).ptr();
}
else
{
// Clone (even if 0 size)
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
newSize,
patchStart
).ptr();
}
patchStart += newSize;
patchMap_[nNewPatches] = oldPatchi; // compact patchMap
......@@ -1115,14 +1138,37 @@ void Foam::fvMeshSubset::setCellSubset
{
const label newSize = boundaryPatchSizes[globalPatchMap[oldPatchi]];
// Patch still exists. Add it
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
newSize,
patchStart
).ptr();
if (oldInternalPatchID != oldPatchi)
{
// Pure subset of patch faces (no internal faces added to this
// patch). Can use mapping.
labelList map(newSize);
for (label patchFacei = 0; patchFacei < newSize; patchFacei++)
{
const label facei = patchStart+patchFacei;
const label oldFacei = faceMap_[facei];
map[patchFacei] = oldPatches[oldPatchi].whichFace(oldFacei);
}
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
map,
patchStart
).ptr();
}
else
{
// Patch still exists. Add it
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
newSize,
patchStart
).ptr();
}
//Pout<< " " << oldPatches[oldPatchi].name() << " : "
// << newSize << endl;
......
Supports Markdown
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