From 9815d37db36d654aeee6fe29a2d80cd5733a4da7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 16 Aug 2019 01:07:00 +0100 Subject: [PATCH] BUG: corrupt extrudeToRegionMesh boundary patches in parallel (fixes #1295) - new patches were added to the end of existing patches, which placed them _after_ the processor patches. This is incorrect. --- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 83 +++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 8c3ed789dc..54f08f82a0 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -149,7 +149,7 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -label findPatchID(const List& newPatches, const word& name) +label findPatchID(const UList& newPatches, const word& name) { forAll(newPatches, i) { @@ -162,6 +162,20 @@ label findPatchID(const List& newPatches, const word& name) } +#ifdef FULLDEBUG +void printPatches(Ostream& os, const UList& newPatches) +{ + for (const polyPatch* ppPtr : newPatches) + { + const polyPatch& pp = *ppPtr; + os << " name:" << pp.name() << " index:" << pp.index() + << " start:" << pp.start() << " size:" << pp.size() + << " type:" << pp.type() << nl; + } +} +#endif + + template label addPatch ( @@ -198,6 +212,12 @@ label addPatch startFacei = pp.start()+pp.size(); } + #ifdef FULLDEBUG + Pout<< "addPatch : starting newPatches:" + << " patch:" << patchi << " startFace:" << startFacei << nl; + printPatches(Pout, newPatches); + Pout<< "*** end of addPatch:" << endl; + #endif newPatches.append ( @@ -253,6 +273,15 @@ label addPatch startFacei = pp.start()+pp.size(); } + + #ifdef FULLDEBUG + Pout<< "addPatch : starting newPatches:" + << " patch:" << patchi << " startFace:" << startFacei << nl; + printPatches(Pout, newPatches); + Pout<< "*** end of addPatch:" << endl; + #endif + + dictionary patchDict(dict); patchDict.set("type", PatchType::typeName); patchDict.set("nFaces", 0); @@ -300,7 +329,7 @@ void deleteEmptyPatches(fvMesh& mesh) if (isA(patches[patchi])) { // Similar named processor patch? Not 'possible'. - if (patches[patchi].size() == 0) + if (patches[patchi].empty()) { Pout<< "Deleting processor patch " << patchi << " name:" << patches[patchi].name() @@ -315,7 +344,7 @@ void deleteEmptyPatches(fvMesh& mesh) else { // Common patch. - if (returnReduce(patches[patchi].size(), sumOp