ENH: createPatch: do not remove zero-sized patches
This commit is contained in:
parent
2c973f081d
commit
10e8490d21
@ -94,7 +94,7 @@ void changePatchID
|
||||
|
||||
|
||||
// Filter out the empty patches.
|
||||
void filterPatches(polyMesh& mesh)
|
||||
void filterPatches(polyMesh& mesh, const HashSet<word>& addedPatchNames)
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
@ -111,7 +111,11 @@ void filterPatches(polyMesh& mesh)
|
||||
// Note: reduce possible since non-proc patches guaranteed in same order
|
||||
if (!isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (returnReduce(pp.size(), sumOp<label>()) > 0)
|
||||
if
|
||||
(
|
||||
addedPatchNames.found(pp.name())
|
||||
|| returnReduce(pp.size(), sumOp<label>()) > 0
|
||||
)
|
||||
{
|
||||
allPatches.append
|
||||
(
|
||||
@ -126,8 +130,8 @@ void filterPatches(polyMesh& mesh)
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Removing empty patch " << pp.name() << " at position "
|
||||
<< patchI << endl;
|
||||
Info<< "Removing zero-sized patch " << pp.name()
|
||||
<< " at position " << patchI << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -552,6 +556,12 @@ int main(int argc, char *argv[])
|
||||
// Read patch construct info from dictionary
|
||||
PtrList<dictionary> patchSources(dict.lookup("patches"));
|
||||
|
||||
HashSet<word> addedPatchNames;
|
||||
forAll(patchSources, addedI)
|
||||
{
|
||||
const dictionary& dict = patchSources[addedI];
|
||||
addedPatchNames.insert(dict.lookup("name"));
|
||||
}
|
||||
|
||||
|
||||
// 1. Add all new patches
|
||||
@ -868,7 +878,7 @@ int main(int argc, char *argv[])
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Info<< "Removing patches with no faces in them." << nl<< endl;
|
||||
filterPatches(mesh);
|
||||
filterPatches(mesh, addedPatchNames);
|
||||
|
||||
|
||||
dumpCyclicMatch("final_", mesh);
|
||||
|
Loading…
Reference in New Issue
Block a user