mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: mergeMeshes: in parallel make sure to put processor patches last. Fixes #239
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "polyAddPoint.H"
|
#include "polyAddPoint.H"
|
||||||
#include "polyAddCell.H"
|
#include "polyAddCell.H"
|
||||||
#include "polyAddFace.H"
|
#include "polyAddFace.H"
|
||||||
|
#include "processorPolyPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -104,11 +105,11 @@ Foam::label Foam::mergePolyMesh::zoneIndex
|
|||||||
const word& curName
|
const word& curName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(names, zoneI)
|
forAll(names, zonei)
|
||||||
{
|
{
|
||||||
if (names[zoneI] == curName)
|
if (names[zonei] == curName)
|
||||||
{
|
{
|
||||||
return zoneI;
|
return zonei;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +120,84 @@ Foam::label Foam::mergePolyMesh::zoneIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mergePolyMesh::sortProcessorPatches()
|
||||||
|
{
|
||||||
|
Info<< "Reordering processor patches last" << endl;
|
||||||
|
|
||||||
|
// Updates boundaryMesh() and meshMod_ to guarantee processor patches
|
||||||
|
// are last. This could be done inside the merge() but it is far easier
|
||||||
|
// to do separately.
|
||||||
|
|
||||||
|
|
||||||
|
// 1. Shuffle the patches in the boundaryMesh
|
||||||
|
|
||||||
|
const polyBoundaryMesh& oldPatches = boundaryMesh();
|
||||||
|
|
||||||
|
DynamicList<polyPatch*> newPatches(oldPatches.size());
|
||||||
|
|
||||||
|
labelList oldToSorted(oldPatches.size());
|
||||||
|
|
||||||
|
forAll(oldPatches, patchi)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = oldPatches[patchi];
|
||||||
|
|
||||||
|
if (!isA<processorPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
oldToSorted[patchi] = newPatches.size();
|
||||||
|
newPatches.append
|
||||||
|
(
|
||||||
|
pp.clone
|
||||||
|
(
|
||||||
|
oldPatches,
|
||||||
|
oldToSorted[patchi],
|
||||||
|
0,
|
||||||
|
nInternalFaces()
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forAll(oldPatches, patchi)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = oldPatches[patchi];
|
||||||
|
|
||||||
|
if (isA<processorPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
oldToSorted[patchi] = newPatches.size();
|
||||||
|
newPatches.append
|
||||||
|
(
|
||||||
|
pp.clone
|
||||||
|
(
|
||||||
|
oldPatches,
|
||||||
|
oldToSorted[patchi],
|
||||||
|
0,
|
||||||
|
nInternalFaces()
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
removeBoundary();
|
||||||
|
addPatches(newPatches);
|
||||||
|
|
||||||
|
|
||||||
|
// Update the polyTopoChange
|
||||||
|
DynamicList<label>& patchID = const_cast<DynamicList<label>&>
|
||||||
|
(
|
||||||
|
meshMod_.region()
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(patchID, facei)
|
||||||
|
{
|
||||||
|
label patchi = patchID[facei];
|
||||||
|
if (patchi != -1)
|
||||||
|
{
|
||||||
|
patchID[facei] = oldToSorted[patchID[facei]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
|
Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
|
||||||
@ -183,9 +262,6 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::mergePolyMesh::addMesh(const polyMesh& m)
|
void Foam::mergePolyMesh::addMesh(const polyMesh& m)
|
||||||
@ -506,6 +582,10 @@ void Foam::mergePolyMesh::merge()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Shuffle the processor patches to be last
|
||||||
|
sortProcessorPatches();
|
||||||
|
|
||||||
// Change mesh. No inflation
|
// Change mesh. No inflation
|
||||||
meshMod_.changeMesh(*this, false);
|
meshMod_.changeMesh(*this, false);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -89,6 +89,9 @@ class mergePolyMesh
|
|||||||
//- Return zone index given a list of active zones and a name
|
//- Return zone index given a list of active zones and a name
|
||||||
label zoneIndex(DynamicList<word>&, const word&);
|
label zoneIndex(DynamicList<word>&, const word&);
|
||||||
|
|
||||||
|
//- Shuffle processor patches to be last
|
||||||
|
void sortProcessorPatches();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user