mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: createPatch: do not remove added patches. Fixes #2726
This commit is contained in:
@ -42,14 +42,14 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cyclicPolyPatch.H"
|
||||
#include "syncTools.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
#include "faceSet.H"
|
||||
#include "IOPtrList.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
#include "syncTools.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "polyModifyFace.H"
|
||||
#include "polyAddFace.H"
|
||||
@ -942,6 +942,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// Maintain list of added patches so we exclude them from filtering
|
||||
// later on
|
||||
List<DynamicList<word>> allAddedPatches(meshes.size());
|
||||
|
||||
// Loop over all regions
|
||||
|
||||
@ -1036,6 +1039,7 @@ int main(int argc, char *argv[])
|
||||
fvPatchFieldBase::calculatedType(),
|
||||
true
|
||||
);
|
||||
allAddedPatches[meshi].append(ppPtr->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1087,6 +1091,7 @@ int main(int argc, char *argv[])
|
||||
fvPatchFieldBase::calculatedType(),
|
||||
true
|
||||
);
|
||||
allAddedPatches[meshi].append(ppPtr->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1116,6 +1121,7 @@ int main(int argc, char *argv[])
|
||||
fvPatchFieldBase::calculatedType(),
|
||||
true
|
||||
);
|
||||
allAddedPatches[meshi].append(ppPtr->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1453,7 +1459,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Removing patches with no faces in them." << nl << endl;
|
||||
const wordList oldPatchNames(mesh.boundaryMesh().names());
|
||||
const wordList oldPatchTypes(mesh.boundaryMesh().types());
|
||||
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||
fvMeshTools::removeEmptyPatches(mesh, allAddedPatches[meshi], true);
|
||||
forAll(oldPatchNames, patchi)
|
||||
{
|
||||
const word& pName = oldPatchNames[patchi];
|
||||
|
||||
@ -369,6 +369,7 @@ void Foam::fvMeshTools::reorderPatches
|
||||
Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const wordList& keepPatches,
|
||||
const bool validBoundary
|
||||
)
|
||||
{
|
||||
@ -385,6 +386,13 @@ Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
||||
const polyPatch& pp = pbm[patchI];
|
||||
|
||||
if (!isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (keepPatches.found(pp.name()))
|
||||
{
|
||||
newToOld[newI] = patchI;
|
||||
oldToNew[patchI] = newI++;
|
||||
}
|
||||
else
|
||||
{
|
||||
label nFaces = pp.size();
|
||||
if (validBoundary)
|
||||
@ -399,13 +407,21 @@ Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Same for processor patches (but need no reduction)
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
const polyPatch& pp = pbm[patchI];
|
||||
|
||||
if (isA<processorPolyPatch>(pp) && pp.size())
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(pp)
|
||||
&& (
|
||||
pp.size()
|
||||
|| keepPatches.found(pp.name())
|
||||
)
|
||||
)
|
||||
{
|
||||
newToOld[newI] = patchI;
|
||||
oldToNew[patchI] = newI++;
|
||||
@ -429,6 +445,16 @@ Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
||||
(
|
||||
fvMesh& mesh,
|
||||
const bool validBoundary
|
||||
)
|
||||
{
|
||||
return removeEmptyPatches(mesh, wordList::null(), validBoundary);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvMeshTools::setBasicGeometry(fvMesh& mesh)
|
||||
{
|
||||
// Set the fvGeometryScheme to basic since it does not require
|
||||
|
||||
@ -156,6 +156,14 @@ public:
|
||||
// to old patches
|
||||
static labelList removeEmptyPatches(fvMesh&, const bool validBoundary);
|
||||
|
||||
//- Remove zero sized patches unless explicitly forced to preserve.
|
||||
// See above.
|
||||
static labelList removeEmptyPatches
|
||||
(
|
||||
fvMesh&,
|
||||
const wordList& keepPatches,
|
||||
const bool validBoundary
|
||||
);
|
||||
|
||||
//- Set the fvGeometryScheme to basic (to avoid parallel communication)
|
||||
static void setBasicGeometry(fvMesh& mesh);
|
||||
|
||||
Reference in New Issue
Block a user