ENH: createPatch: do not remove zero-sized patches

This commit is contained in:
mattijs
2012-02-17 17:25:48 +00:00
parent 2c973f081d
commit 10e8490d21

View File

@ -94,7 +94,7 @@ void changePatchID
// Filter out the empty patches. // Filter out the empty patches.
void filterPatches(polyMesh& mesh) void filterPatches(polyMesh& mesh, const HashSet<word>& addedPatchNames)
{ {
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -111,7 +111,11 @@ void filterPatches(polyMesh& mesh)
// Note: reduce possible since non-proc patches guaranteed in same order // Note: reduce possible since non-proc patches guaranteed in same order
if (!isA<processorPolyPatch>(pp)) if (!isA<processorPolyPatch>(pp))
{ {
if (returnReduce(pp.size(), sumOp<label>()) > 0) if
(
addedPatchNames.found(pp.name())
|| returnReduce(pp.size(), sumOp<label>()) > 0
)
{ {
allPatches.append allPatches.append
( (
@ -126,8 +130,8 @@ void filterPatches(polyMesh& mesh)
} }
else else
{ {
Info<< "Removing empty patch " << pp.name() << " at position " Info<< "Removing zero-sized patch " << pp.name()
<< patchI << endl; << " at position " << patchI << endl;
} }
} }
} }
@ -552,6 +556,12 @@ int main(int argc, char *argv[])
// Read patch construct info from dictionary // Read patch construct info from dictionary
PtrList<dictionary> patchSources(dict.lookup("patches")); 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 // 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; Info<< "Removing patches with no faces in them." << nl<< endl;
filterPatches(mesh); filterPatches(mesh, addedPatchNames);
dumpCyclicMatch("final_", mesh); dumpCyclicMatch("final_", mesh);