mirrorFvMesh: Corrected parallel operation

Patch provided by Bruno Santos
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1494
This commit is contained in:
Henry Weller
2015-11-29 21:40:37 +00:00
parent a09fc00ae4
commit a24eec402c

View File

@ -243,8 +243,8 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
// Mirror boundary faces patch by patch // Mirror boundary faces patch by patch
wordList newPatchTypes(boundary().size());
wordList newPatchNames(boundary().size()); labelList newToOldPatch(boundary().size(), -1);
labelList newPatchSizes(boundary().size(), -1); labelList newPatchSizes(boundary().size(), -1);
labelList newPatchStarts(boundary().size(), -1); labelList newPatchStarts(boundary().size(), -1);
label nNewPatches = 0; label nNewPatches = 0;
@ -303,8 +303,8 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
// If patch exists, grab the name and type of the original patch // If patch exists, grab the name and type of the original patch
if (nNewFaces > newPatchStarts[nNewPatches]) if (nNewFaces > newPatchStarts[nNewPatches])
{ {
newPatchTypes[nNewPatches] = boundaryMesh()[patchI].type(); newToOldPatch[nNewPatches] = patchI;
newPatchNames[nNewPatches] = boundaryMesh()[patchI].name();
newPatchSizes[nNewPatches] = newPatchSizes[nNewPatches] =
nNewFaces - newPatchStarts[nNewPatches]; nNewFaces - newPatchStarts[nNewPatches];
@ -316,8 +316,7 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
newFaces.setSize(nNewFaces); newFaces.setSize(nNewFaces);
Info<< " New faces: " << nNewFaces << endl; Info<< " New faces: " << nNewFaces << endl;
newPatchTypes.setSize(nNewPatches); newToOldPatch.setSize(nNewPatches);
newPatchNames.setSize(nNewPatches);
newPatchSizes.setSize(nNewPatches); newPatchSizes.setSize(nNewPatches);
newPatchStarts.setSize(nNewPatches); newPatchStarts.setSize(nNewPatches);
@ -377,18 +376,16 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
fvMesh& pMesh = *mirrorMeshPtr_; fvMesh& pMesh = *mirrorMeshPtr_;
// Add the boundary patches // Add the boundary patches
List<polyPatch*> p(newPatchTypes.size()); List<polyPatch*> p(newPatchSizes.size());
forAll(p, patchI) forAll(p, patchI)
{ {
p[patchI] = polyPatch::New p[patchI] = boundaryMesh()[newToOldPatch[patchI]].clone
( (
newPatchTypes[patchI], pMesh.boundaryMesh(),
newPatchNames[patchI],
newPatchSizes[patchI],
newPatchStarts[patchI],
patchI, patchI,
pMesh.boundaryMesh() newPatchSizes[patchI],
newPatchStarts[patchI]
).ptr(); ).ptr();
} }