Skip to content

createPatch removes newly added patches

I am using CfdOf to which in my use-case creates an empty patch using createPatch before extruding it with extrudeMesh. This approach appears to have broken between v2106 and v2206. I think the commit ad6d3a08 changed the behaviour, specifically with the removal of

void filterPatches(polyMesh& mesh, const wordHashSet& addedPatchNames)

Where addPatchNames was there to make sure that createPatch doesn't remove newly created patches when they have no faces.

The system/createPatchDict to reproduce this is simple:

pointSync false;

patches
(
    {
        name patch_0_1_back;
        patchInfo
        {
            type patch;
        }
        constructFrom patches;
        patches ();
    }
);

The newer versions of createPatch (since v2206) add then remove this patch:

Removed zero-sized patch patch_0_1_back type patch at position 9

It is possible that this use-case isn't supported and/or there is a Better Way to do it. Is there a good reason this feature should not be added back into createPatch (before I look at doing that)?