Remove empty patches after conversion

Empty defaultFaces should not be in the list of boundaries.
This commit is contained in:
Alexey Matveichev 2015-05-08 10:11:30 +02:00 committed by Dominik Christ
parent 4608dddc89
commit 478fdb60e8

View file

@ -713,6 +713,48 @@ void readCells
Info<< endl;
}
// Simplified version of the function from createPatch utility.
void removeEmptyPatches(polyMesh& mesh)
{
Info<< "\n";
const polyBoundaryMesh& patches = mesh.boundaryMesh();
DynamicList<polyPatch*> nonEmptyPatches(patches.size());
forAll(patches, idx)
{
const polyPatch& pp = patches[idx];
if (pp.size() > 0)
{
nonEmptyPatches.append
(
pp.clone
(
patches,
nonEmptyPatches.size(),
pp.size(),
pp.start()
).ptr()
);
}
else
{
Info<< "Removing empty patch " << pp.name() << endl;
}
}
if (patches.size() != nonEmptyPatches.size())
{
nonEmptyPatches.shrink();
mesh.removeBoundary();
mesh.addPatches(nonEmptyPatches);
}
Info<< "\n";
}
// Main program:
@ -1054,6 +1096,8 @@ int main(int argc, char *argv[])
mesh.addZones(List<pointZone*>(0), fz, cz);
}
removeEmptyPatches(mesh);
mesh.write();
Info<< "End\n" << endl;