diff --git a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H index 21e68709f6701b6ce120d36367152f01455a22fc..8d8021b08f28a573567ebcc5767d9ebb8aa5103b 100644 --- a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H +++ b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.H @@ -11,67 +11,80 @@ { Info<< "Creating merge patch pairs" << nl << endl; - // Create and add point and face zones and mesh modifiers - List<pointZone*> pz(mergePatchPairs.size()); - List<faceZone*> fz(3*mergePatchPairs.size()); - List<cellZone*> cz; - - forAll(mergePatchPairs, pairi) + Info<< "Adding point and face zones" << endl; { - const word mergeName - ( - mergePatchPairs[pairi].first() - + mergePatchPairs[pairi].second() - + name(pairi) - ); + auto& pzs = mesh.pointZones(); + pzs.clearAddressing(); + auto& fzs = mesh.faceZones(); + fzs.clearAddressing(); - // An empty zone for cut points - pz[pairi] = new pointZone - ( - mergeName + "CutPointZone", - 0, - mesh.pointZones() - ); + forAll(mergePatchPairs, pairi) + { + const word mergeName + ( + mergePatchPairs[pairi].first() + + mergePatchPairs[pairi].second() + + name(pairi) + ); - // Master patch - const word masterPatchName(mergePatchPairs[pairi].first()); - const polyPatch& masterPatch = - mesh.boundaryMesh()[masterPatchName]; + // An empty zone for cut points + pzs.append + ( + new pointZone + ( + mergeName + "CutPointZone", + pzs.size(), + pzs + ) + ); - fz[3*pairi] = new faceZone - ( - mergeName + "MasterZone", - identity(masterPatch.range()), - false, // none are flipped - 0, - mesh.faceZones() - ); + // Master patch + const word masterPatchName(mergePatchPairs[pairi].first()); + const polyPatch& masterPatch = + mesh.boundaryMesh()[masterPatchName]; - // Slave patch - const word slavePatchName(mergePatchPairs[pairi].second()); - const polyPatch& slavePatch = - mesh.boundaryMesh()[slavePatchName]; + fzs.append + ( + new faceZone + ( + mergeName + "MasterZone", + identity(masterPatch.range()), + false, // none are flipped + fzs.size(), + fzs + ) + ); - fz[3*pairi + 1] = new faceZone - ( - mergeName + "SlaveZone", - identity(slavePatch.range()), - false, // none are flipped - 1, - mesh.faceZones() - ); + // Slave patch + const word slavePatchName(mergePatchPairs[pairi].second()); + const polyPatch& slavePatch = + mesh.boundaryMesh()[slavePatchName]; - // An empty zone for cut faces - fz[3*pairi + 2] = new faceZone - ( - mergeName + "CutFaceZone", - 2, - mesh.faceZones() - ); - } // end of all merge pairs + fzs.append + ( + new faceZone + ( + mergeName + "SlaveZone", + identity(slavePatch.range()), + false, // none are flipped + fzs.size(), + fzs + ) + ); + + // An empty zone for cut faces + fzs.append + ( + new faceZone + ( + mergeName + "CutFaceZone", + fzs.size(), + fzs + ) + ); + } // end of all merge pairs + } - Info<< "Adding point and face zones" << endl; - mesh.addZones(pz, fz, cz); Info<< "Creating attachPolyTopoChanger" << endl;