diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 3f6fb0b16e..48330b91a7 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -117,6 +117,7 @@ becomes #include "argList.H" #include "polyTopoChange.H" #include "mappedWallPolyPatch.H" +#include "mappedExtrudedWallPolyPatch.H" #include "createShellMesh.H" #include "syncTools.H" #include "cyclicPolyPatch.H" @@ -145,60 +146,6 @@ label findPatchID(const List& newPatches, const word& name) } -template -label addPatch -( - const polyBoundaryMesh& patches, - const word& patchName, - DynamicList& newPatches -) -{ - label patchi = findPatchID(newPatches, patchName); - - if (patchi != -1) - { - if (isA(*newPatches[patchi])) - { - // Already there - return patchi; - } - else - { - FatalErrorInFunction - << "Already have patch " << patchName - << " but of type " << newPatches[patchi]->type() - << exit(FatalError); - } - } - - - patchi = newPatches.size(); - - label startFacei = 0; - if (patchi > 0) - { - const polyPatch& pp = *newPatches.last(); - startFacei = pp.start()+pp.size(); - } - - - newPatches.append - ( - polyPatch::New - ( - PatchType::typeName, - patchName, - 0, // size - startFacei, // nFaces - patchi, - patches - ).ptr() - ); - - return patchi; -} - - template label addPatch ( @@ -214,7 +161,6 @@ label addPatch { if (isA(*newPatches[patchi])) { - // Already there return patchi; } else @@ -226,7 +172,6 @@ label addPatch } } - patchi = newPatches.size(); label startFacei = 0; @@ -338,59 +283,6 @@ void deleteEmptyPatches(fvMesh& mesh) } -void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) -{ - // Create dummy system/fv* - { - typeIOobject io - ( - "fvSchemes", - mesh.time().system(), - regionName, - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ); - - Info<< "Testing:" << io.objectPath() << endl; - - if (!io.headerOk()) - { - Info<< "Writing dummy " << regionName/io.name() << endl; - dictionary dummyDict; - dictionary divDict; - dummyDict.add("divSchemes", divDict); - dictionary gradDict; - dummyDict.add("gradSchemes", gradDict); - dictionary laplDict; - dummyDict.add("laplacianSchemes", laplDict); - - IOdictionary(io, dummyDict).regIOobject::write(); - } - } - { - typeIOobject io - ( - "fvSolution", - mesh.time().system(), - regionName, - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ); - - if (!io.headerOk()) - { - Info<< "Writing dummy " << regionName/io.name() << endl; - dictionary dummyDict; - IOdictionary(io, dummyDict).regIOobject::write(); - } - } -} - - // Check zone either all internal or all external faces void checkZoneInside ( @@ -574,27 +466,36 @@ label findUncoveredCyclicPatchFace } -// Calculate per edge min and max zone -void calcEdgeMinMaxZone +static label edgeNoZoneID = labelMin; + + +static label edgeMultipleZoneID = labelMax; + + +// Calculate per edge the zone +labelList calcEdgeZone ( const fvMesh& mesh, const primitiveFacePatch& extrudePatch, const labelList& extrudeMeshEdges, const labelList& zoneID, const distributionMap& extrudeEdgeFacesMap, - const labelListList& extrudeEdgeGlobalFaces, - - labelList& minZoneID, - labelList& maxZoneID + const labelListList& extrudeEdgeGlobalFaces ) { // Get zoneIDs in extrudeEdgeGlobalFaces order labelList mappedZoneID(zoneID); extrudeEdgeFacesMap.distribute(mappedZoneID); - // Get min and max zone per edge - minZoneID.setSize(extrudeEdgeGlobalFaces.size(), labelMax); - maxZoneID.setSize(extrudeEdgeGlobalFaces.size(), labelMin); + // Zone ID per edge + labelList edgeZoneID(extrudeEdgeGlobalFaces.size(), edgeNoZoneID); + + // Set operator. Set the zone if the same or unset. Set the multiple zone + // ID if the edge already has a different zone. + auto eqOp = [](label& x, const label y) + { + x = x == y || x == edgeNoZoneID ? y : edgeMultipleZoneID; + }; forAll(extrudeEdgeGlobalFaces, edgeI) { @@ -603,129 +504,34 @@ void calcEdgeMinMaxZone { forAll(eFaces, i) { - label zoneI = mappedZoneID[eFaces[i]]; - minZoneID[edgeI] = min(minZoneID[edgeI], zoneI); - maxZoneID[edgeI] = max(maxZoneID[edgeI], zoneI); + eqOp(edgeZoneID[edgeI], mappedZoneID[eFaces[i]]); } } } + syncTools::syncEdgeList ( mesh, extrudeMeshEdges, - minZoneID, - minEqOp