mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: subsetMesh suppress wildcard selection of processor patches (#2947)
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -452,15 +452,31 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const wordRes patchNames(args.getList<wordRe>("patches"));
|
const wordRes patchNames(args.getList<wordRe>("patches"));
|
||||||
|
|
||||||
if (patchNames.size() == 1 && patchNames.first().isLiteral())
|
if (patchNames.size() == 1 && patchNames.front().isLiteral())
|
||||||
{
|
{
|
||||||
exposedPatchIDs.first() =
|
exposedPatchIDs.front() =
|
||||||
getExposedPatchId(mesh, patchNames.first());
|
getExposedPatchId(mesh, patchNames.front());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exposedPatchIDs =
|
// Patches selected
|
||||||
mesh.boundaryMesh().patchSet(patchNames).sortedToc();
|
labelHashSet patchIds
|
||||||
|
(
|
||||||
|
mesh.boundaryMesh().patchSet(patchNames)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Only retain initial, non-processor patches
|
||||||
|
label nNonProcessor
|
||||||
|
(
|
||||||
|
mesh.boundaryMesh().nNonProcessor()
|
||||||
|
);
|
||||||
|
|
||||||
|
patchIds.filterKeys
|
||||||
|
(
|
||||||
|
[=](label patchi) { return (patchi < nNonProcessor); }
|
||||||
|
);
|
||||||
|
|
||||||
|
exposedPatchIDs = patchIds.sortedToc();
|
||||||
|
|
||||||
Info<< "Adding exposed internal faces to nearest of patches "
|
Info<< "Adding exposed internal faces to nearest of patches "
|
||||||
<< flatOutput(patchNames) << nl << endl;
|
<< flatOutput(patchNames) << nl << endl;
|
||||||
@ -469,14 +485,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< nl << "No patches matched. Patches: "
|
<< nl << "No patches matched. Patches: "
|
||||||
<< mesh.boundaryMesh().names() << nl
|
<< flatOutput(mesh.boundaryMesh().names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.found("patch"))
|
else if (args.found("patch"))
|
||||||
{
|
{
|
||||||
exposedPatchIDs.first() =
|
exposedPatchIDs.front() =
|
||||||
getExposedPatchId(mesh, args.get<word>("patch"));
|
getExposedPatchId(mesh, args.get<word>("patch"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -513,7 +529,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Using cellSet " << selectionName << nl << endl;
|
Info<< "Using cellSet " << selectionName << nl << endl;
|
||||||
|
|
||||||
cellSetPtr = autoPtr<cellSet>::New(mesh, selectionName);
|
cellSetPtr.emplace(mesh, selectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -531,7 +547,7 @@ int main(int argc, char *argv[])
|
|||||||
if (exposedPatchIDs.size() == 1)
|
if (exposedPatchIDs.size() == 1)
|
||||||
{
|
{
|
||||||
// Single patch for exposed faces (syncPar)
|
// Single patch for exposed faces (syncPar)
|
||||||
subsetter.reset(selectedCells, exposedPatchIDs.first(), true);
|
subsetter.reset(selectedCells, exposedPatchIDs.front(), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user