From a833a81560d1bf4289747fd6adc6ec6eca96dc64 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 25 Mar 2024 14:32:59 +0000 Subject: [PATCH] polyTopoChange: Removed restrictive faceZone functionality Now faceZones are handled directly by the applications and the new faceZone::topoChange function so that any face can now be in any number of zones, significantly increasing the flexibility and usefulness of faceZones. This completes the generalisation of cellZone, faceZone and pointZone to support multiple zones for each cell, face or point respectively. Next step will be to make zones polymorphic and run-time selectable so that they can alter during the run and adapt to moving meshes for example. --- .../utilities/mesh/advanced/PDRMesh/PDRMesh.C | 85 +---- .../combinePatchFaces/combinePatchFaces.C | 16 +- .../fluent3DMeshToFoam/fluent3DMeshToFoam.L | 37 ++- .../extrude2DMesh/extrude2DMesh.C | 38 +-- .../mesh/generation/extrudeMesh/extrudeMesh.C | 31 +- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 24 +- .../createBaffles/createBaffles.C | 22 +- .../manipulation/createPatch/createPatch.C | 15 +- .../manipulation/mergeBaffles/mergeBaffles.C | 25 +- .../manipulation/mergeMeshes/mergePolyMesh.C | 38 ++- .../manipulation/mergeMeshes/mergePolyMesh.H | 3 + .../manipulation/polyDualMesh/meshDualiser.C | 12 +- .../splitMeshRegions/splitMeshRegions.C | 51 ++- .../surface/surfaceToPatch/surfaceToPatch.C | 22 +- .../polyMesh/zones/MeshZones/MeshZones.C | 35 +-- .../polyMesh/zones/MeshZones/MeshZones.H | 8 +- .../meshes/polyMesh/zones/faceZone/faceZone.C | 32 +- .../mergedCyclic/polyMeshUnMergeCyclics.C | 4 +- .../meshRefinement/meshRefinement.C | 17 +- .../meshRefinement/meshRefinementBaffles.C | 97 ++---- .../createShellMesh/createShellMesh.C | 64 +--- .../fvMeshDistribute/fvMeshDistribute.C | 27 +- .../mergePatchPairs/mergePatchPairs.C | 51 +-- .../meshModifiers/meshCutter/meshCutter.C | 60 +--- .../meshModifiers/meshCutter/meshCutter.H | 10 +- .../perfectInterface/perfectInterface.C | 32 +- .../perfectInterface/perfectInterface.H | 8 +- .../polyTopoChange/addPatchCellLayer.C | 65 +--- .../polyTopoChange/combineFaces.C | 40 +-- .../polyTopoChange/duplicatePoints.C | 18 +- .../polyTopoChange/edgeCollapser.C | 17 +- .../polyTopoChange/hexRef8/hexRef8.C | 53 +--- .../polyTopoChange/hexRef8/hexRef8.H | 10 +- .../polyTopoChange/polyTopoChange.C | 292 +----------------- .../polyTopoChange/polyTopoChange.H | 54 +--- .../polyTopoChange/removeCells.C | 53 +--- .../polyTopoChange/removeFaces.C | 105 +------ .../polyTopoChange/removeFaces.H | 13 +- .../polyTopoChange/removePoints.C | 15 +- src/polyTopoChange/repatcher/repatcher.C | 66 +--- src/polyTopoChange/repatcher/repatcher.H | 10 +- 41 files changed, 296 insertions(+), 1379 deletions(-) diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index a87a8a551a..859a878ba8 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -70,8 +70,6 @@ void modifyOrAddFace const label own, const bool flipFaceFlux, const label newPatchi, - const label zoneID, - const bool zoneFlip, PackedBoolList& modifiedFace ) @@ -86,9 +84,7 @@ void modifyOrAddFace own, // owner -1, // neighbour flipFaceFlux, // face flip - newPatchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + newPatchi // patch for face ); modifiedFace[facei] = 1; } @@ -102,9 +98,7 @@ void modifyOrAddFace -1, // neighbour facei, // master face flipFaceFlux, // face flip - newPatchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + newPatchi // patch for face ); } } @@ -308,21 +302,11 @@ void createCoupledBaffles PackedBoolList& modifiedFace ) { - const meshFaceZones& faceZones = mesh.faceZones(); - forAll(coupledWantedPatch, facei) { if (coupledWantedPatch[facei] != -1) { const face& f = mesh.faces()[facei]; - label zoneID = faceZones.whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } // Use owner side of face modifyOrAddFace @@ -333,21 +317,11 @@ void createCoupledBaffles mesh.faceOwner()[facei], // owner false, // face flip coupledWantedPatch[facei], // patch for face - zoneID, // zone for face - zoneFlip, // face flip in zone modifiedFace // modify or add status ); if (mesh.isInternalFace(facei)) { - label zoneID = faceZones.whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } // Use neighbour side of face modifyOrAddFace ( @@ -357,8 +331,6 @@ void createCoupledBaffles mesh.faceNeighbour()[facei],// owner false, // face flip coupledWantedPatch[facei], // patch for face - zoneID, // zone for face - zoneFlip, // face flip in zone modifiedFace // modify or add status ); } @@ -376,23 +348,12 @@ void createCyclicCoupledBaffles PackedBoolList& modifiedFace ) { - const meshFaceZones& faceZones = mesh.faceZones(); - forAll(cyclicMasterPatch, facei) { if (cyclicMasterPatch[facei] != -1) { const face& f = mesh.faces()[facei]; - label zoneID = faceZones.whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - modifyOrAddFace ( meshMod, @@ -401,8 +362,6 @@ void createCyclicCoupledBaffles mesh.faceNeighbour()[facei], // owner false, // face flip cyclicMasterPatch[facei], // patch for face - zoneID, // zone for face - zoneFlip, // face flip in zone modifiedFace // modify or add ); } @@ -415,15 +374,7 @@ void createCyclicCoupledBaffles const face& f = mesh.faces()[facei]; if (mesh.isInternalFace(facei)) { - label zoneID = faceZones.whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - // Use owner side of face + // Use owner side of face modifyOrAddFace ( meshMod, @@ -432,8 +383,6 @@ void createCyclicCoupledBaffles mesh.faceOwner()[facei], // owner false, // face flip cyclicSlavePatch[facei], // patch for face - zoneID, // zone for face - zoneFlip, // face flip in zone modifiedFace // modify or add status ); } @@ -449,23 +398,12 @@ void createBaffles polyTopoChange& meshMod ) { - const meshFaceZones& faceZones = mesh.faceZones(); - Info << "faceZone:createBaffle " << faceZones << endl; forAll(wantedPatch, facei) { if (wantedPatch[facei] != -1) { const face& f = mesh.faces()[facei]; - label zoneID = faceZones.whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - meshMod.modifyFace ( f, // modified face @@ -473,22 +411,11 @@ void createBaffles mesh.faceOwner()[facei], // owner -1, // neighbour false, // face flip - wantedPatch[facei], // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + wantedPatch[facei] // patch for face ); if (mesh.isInternalFace(facei)) { - label zoneID = faceZones.whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - meshMod.addFace ( f.reverseFace(), // modified face @@ -496,9 +423,7 @@ void createBaffles -1, // neighbour facei, // masterFaceID, false, // face flip - wantedPatch[facei], // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + wantedPatch[facei] // patch for face ); } } diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 7124ca8961..dcb0ade1eb 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -191,13 +191,6 @@ label mergePatchFaces // Restore. Get face properties. label own = mesh.faceOwner()[newMasterI]; - label zoneID = mesh.faceZones().whichZone(newMasterI); - bool zoneFlip = false; - if (zoneID >= 0) - { - const faceZone& fZone = mesh.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)]; - } label patchID = mesh.boundaryMesh().whichPatch(newMasterI); Pout<< "Restoring new master face " << newMasterI @@ -211,12 +204,9 @@ label mergePatchFaces own, // owner -1, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); - // Add the previously removed faces for (label i = 1; i < setFaces.size(); i++) { @@ -230,9 +220,7 @@ label mergePatchFaces -1, // neighbour, newMasterI, // masterFaceID, false, // flipFaceFlux, - patchID, // patchID, - zoneID, // zoneID, - zoneFlip // zoneFlip + patchID // patchID, ); } } diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index af13dd5328..de1d4af487 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -1296,9 +1296,7 @@ int main(int argc, char *argv[]) neighbour[facei], facei, // masterFace false, // flipFaceFlux - -1, // patchID - faceZonei, // zoneID - fm[facei] // zoneFlip + -1 // patchID ); } @@ -1345,9 +1343,7 @@ int main(int argc, char *argv[]) -1, facei, // masterFace false, // flipFaceFlux - patchi, // patchID - -1, // zoneID - false // zoneFlip + patchi // patchID ); // For baffles create the opposite face @@ -1360,9 +1356,7 @@ int main(int argc, char *argv[]) -1, facei, // masterFace false, // flipFaceFlux - patchi, // patchID - -1, // zoneID - false // zoneFlip + patchi // patchID ); } } @@ -1408,9 +1402,7 @@ int main(int argc, char *argv[]) neighbour[facei], facei, // masterFace false, // flipFaceFlux - -1, // patchID - -1, // zoneID - false // zoneFlip + -1 // patchID ); } } @@ -1459,6 +1451,27 @@ int main(int argc, char *argv[]) ); } + // Add the face zones as required + forAll(faceZoneIDs, faceZonei) + { + const label cgi = faceZoneIDs[faceZonei]; + + mesh.faceZones()[faceZonei].resetAddressing + ( + identityMap + ( + faceGroupStartIndex[cgi], + faceGroupEndIndex[cgi] + 1 - faceGroupStartIndex[cgi] + ), + boolList::subList + ( + fm, + faceGroupEndIndex[cgi] + 1 - faceGroupStartIndex[cgi], + faceGroupStartIndex[cgi] + ) + ); + } + mesh.setInstance(runTime.constant()); // Set the precision of the points data to 10 diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C index 31250a3bd3..9848fe6626 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/extrude2DMesh/extrude2DMesh.C @@ -224,14 +224,6 @@ void Foam::extrude2DMesh::setRefinement for (label facei = 0; facei < mesh_.nInternalFaces(); facei++) { - label zoneID = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - if (zoneID != -1) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - face newFace(4); const face& f = faces[facei]; newFace[0] = f[0] + currentLayerOffset; @@ -246,11 +238,9 @@ void Foam::extrude2DMesh::setRefinement newFace, mesh_.faceOwner()[facei] + offset, // own mesh_.faceNeighbour()[facei] + offset, // nei - nFaces++, // masterFaceID + nFaces++, // masterFaceID false, // flipFaceFlux - -1, // patchID - zoneID, // zoneID - zoneFlip // zoneFlip + -1 // patchID ); if (debug) @@ -276,14 +266,6 @@ void Foam::extrude2DMesh::setRefinement for (label facei = startFacei; facei < endFacei; facei++) { - label zoneID = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - if (zoneID != -1) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - face newFace(4); const face& f = faces[facei]; newFace[0] = f[0] + currentLayerOffset; @@ -300,9 +282,7 @@ void Foam::extrude2DMesh::setRefinement -1, // nei nFaces++, // masterFaceID false, // flipFaceFlux - patchi, // patchID - zoneID, // zoneID - zoneFlip // zoneFlip + patchi // patchID ); if (debug) @@ -393,9 +373,7 @@ void Foam::extrude2DMesh::setRefinement nei, // nei nFaces++, // masterFaceID false, // flipFaceFlux - -1, // patchID - -1, // zoneID - false // zoneFlip + -1 // patchID ); if (debug) @@ -472,9 +450,7 @@ void Foam::extrude2DMesh::setRefinement -1, // nei nFaces++, // masterFaceID false, // flipFaceFlux - backPatchi_, // patchID - -1, // zoneID - false // zoneFlip + backPatchi_ // patchID ); if (debug) @@ -500,9 +476,7 @@ void Foam::extrude2DMesh::setRefinement -1, // nei nFaces++, // masterFaceID false, // flipFaceFlux - frontPatchi_, // patchID - -1, // zoneID - false // zoneFlip + frontPatchi_ // patchID ); if (debug) diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C index b351f01e37..cbe3cf55cc 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C @@ -425,14 +425,6 @@ int main(int argc, char *argv[]) nei = mesh.faceNeighbour()[patchFacei]; } - label zoneI = mesh.faceZones().whichZone(patchFacei); - bool zoneFlip = false; - if (zoneI != -1) - { - label index = mesh.faceZones()[zoneI].whichFace(patchFacei); - zoneFlip = mesh.faceZones()[zoneI].flipMap()[index]; - } - meshMod.modifyFace ( mesh.faces()[patchFacei].reverseFace(), // modified face @@ -440,9 +432,7 @@ int main(int argc, char *argv[]) own, // owner nei, // neighbour true, // face flip - patchi, // patch for face - zoneI, // zone for face - zoneFlip // face flip in zone + patchi // patch for face ); } @@ -968,30 +958,11 @@ int main(int argc, char *argv[]) << exit(FatalError); } - - - const word cutZoneName("originalCutFaceZone"); - - List fz - ( - 1, - new faceZone - ( - cutZoneName, - frontPatchFaces, - boolList(frontPatchFaces.size(), false), - mesh.faceZones() - ) - ); - - mesh.addZones(List(0), fz, List(0)); - // Add the perfect interface mesh modifier perfectInterface perfectStitcher ( "couple", mesh, - cutZoneName, word::null, // dummy patch name word::null // dummy patch name ); diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C index 9a9fe9127f..a9952b293e 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1896,9 +1896,7 @@ int main(int argc, char *argv[]) mesh.faceOwner()[meshFacei],// owner -1, // neighbour false, // face flip - interMeshBottomPatch[zonei],// patch for face - zoneMeshZoneID[zonei], // zone for face - false // face flip in zone + interMeshBottomPatch[zonei] // patch for face ); } else if (mesh.isInternalFace(meshFacei)) @@ -1910,9 +1908,7 @@ int main(int argc, char *argv[]) mesh.faceNeighbour()[meshFacei],// owner -1, // neighbour true, // face flip - interMeshBottomPatch[zonei], // patch for face - zoneMeshZoneID[zonei], // zone for face - true // face flip in zone + interMeshBottomPatch[zonei] // patch for face ); } } @@ -1935,9 +1931,7 @@ int main(int argc, char *argv[]) mesh.faceOwner()[meshFacei],// owner -1, // neighbour false, // face flip - interMeshTopPatch[zonei], // patch for face - zoneMeshZoneID[zonei], // zone for face - false // face flip in zone + interMeshTopPatch[zonei] // patch for face ); } else if (mesh.isInternalFace(meshFacei)) @@ -1949,9 +1943,7 @@ int main(int argc, char *argv[]) mesh.faceNeighbour()[meshFacei],// owner -1, // neighbour true, // face flip - interMeshTopPatch[zonei], // patch for face - zoneMeshZoneID[zonei], // zone for face - true // face flip in zone + interMeshTopPatch[zonei] // patch for face ); } } @@ -1973,9 +1965,7 @@ int main(int argc, char *argv[]) -1, // neighbour meshFacei, // master face true, // flip flux - interMeshTopPatch[zonei], // patch for face - -1, // zone for face - false // face flip in zone + interMeshTopPatch[zonei] // patch for face ); } } @@ -1988,9 +1978,7 @@ int main(int argc, char *argv[]) -1, // neighbour meshFacei, // master face false, // flip flux - interMeshTopPatch[zonei], // patch for face - -1, // zone for face - false // zone flip + interMeshTopPatch[zonei] // patch for face ); } } diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 56d0c2d58c..bd0f86d509 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -138,8 +138,6 @@ void modifyOrAddFace const label own, const bool flipFaceFlux, const label newPatchi, - const label zoneID, - const bool zoneFlip, PackedBoolList& modifiedFace ) { @@ -153,9 +151,7 @@ void modifyOrAddFace own, // owner -1, // neighbour flipFaceFlux, // face flip - newPatchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + newPatchi // patch for face ); modifiedFace[facei] = 1; @@ -170,9 +166,7 @@ void modifyOrAddFace -1, // neighbour facei, // master face flipFaceFlux, // face flip - newPatchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + newPatchi // patch for face ); } } @@ -183,7 +177,6 @@ label createFaces const bool internalFacesOnly, const fvMesh& mesh, const faceZone& fZone, - const label fZonei, const label newOwnerPatchi, const label newNeighbourPatchi, polyTopoChange& meshMod, @@ -212,8 +205,6 @@ label createFaces mesh.faceOwner()[facei],// owner false, // face flip newOwnerPatchi, // patch for face - fZonei, // zone for face - false, // face flip in zone modifiedFace // modify or add status ); } @@ -231,8 +222,6 @@ label createFaces mesh.faceNeighbour()[facei],// owner true, // face flip newOwnerPatchi, // patch for face - fZonei, // zone for face - false, // face flip in zone modifiedFace // modify or add status ); } @@ -259,8 +248,6 @@ label createFaces mesh.faceNeighbour()[facei], // owner true, // face flip newNeighbourPatchi, // patch for face - fZonei, // zone for face - true, // face flip in zone modifiedFace // modify or add ); } @@ -275,8 +262,6 @@ label createFaces mesh.faceOwner()[facei],// owner false, // face flip newNeighbourPatchi, // patch for face - fZonei, // zone for face - true, // face flip in zone modifiedFace // modify or add status ); } @@ -323,8 +308,6 @@ label createFaces mesh.faceOwner()[facei], // owner false, // face flip newPp.index(), // patch for face - fZonei, // zone for face - fZone.flipMap()[zoneFacei], // face flip in zone modifiedFace // modify or add ); @@ -632,7 +615,6 @@ int main(int argc, char *argv[]) internalFacesOnly, mesh, fZone, - fZonei, newPatchIDs[0], newPatchIDs[1], meshMod, diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index f7be711104..7ec20ef533 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -61,17 +61,6 @@ void changePatchID polyTopoChange& meshMod ) { - const label zoneID = mesh.faceZones().whichZone(faceID); - - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh.faceZones()[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)]; - } - meshMod.modifyFace ( mesh.faces()[faceID], // face @@ -79,9 +68,7 @@ void changePatchID mesh.faceOwner()[faceID], // owner -1, // neighbour false, // flip flux - patchID, // patch ID - zoneID, // zone ID - zoneFlip // zone flip + patchID // patch ID ); } diff --git a/applications/utilities/mesh/manipulation/mergeBaffles/mergeBaffles.C b/applications/utilities/mesh/manipulation/mergeBaffles/mergeBaffles.C index fa825e1f70..3e15af018c 100644 --- a/applications/utilities/mesh/manipulation/mergeBaffles/mergeBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeBaffles/mergeBaffles.C @@ -88,7 +88,6 @@ void mergeDuplicateBoundaryFaces const faceList& faces = mesh.faces(); const labelList& faceOwner = mesh.faceOwner(); - const meshFaceZones& faceZones = mesh.faceZones(); forAll(duplicates, bFacei) { @@ -107,14 +106,6 @@ void mergeDuplicateBoundaryFaces if (own0 < own1) { // Use face0 as the new internal face. - label zoneID = faceZones.whichZone(face0); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(face0)]; - } meshMod.removeFace(face1, -1); meshMod.modifyFace @@ -124,22 +115,12 @@ void mergeDuplicateBoundaryFaces own0, // owner own1, // neighbour false, // face flip - -1, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + -1 // patch for face ); } else { // Use face1 as the new internal face. - label zoneID = faceZones.whichZone(face1); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(face1)]; - } meshMod.removeFace(face0, -1); meshMod.modifyFace @@ -149,9 +130,7 @@ void mergeDuplicateBoundaryFaces own1, // owner own0, // neighbour false, // face flip - -1, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + -1 // patch for face ); } } diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C index 9590169576..f4dabc8c4d 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C @@ -162,11 +162,14 @@ Foam::mergePolyMesh::mergePolyMesh(polyMesh& mesh) { faceZoneNames_.setCapacity(2*curFaceZoneNames.size()); } + forAll(curFaceZoneNames, zonei) { faceZoneNames_.append(curFaceZoneNames[zonei]); } + faceZonesAddedFaces_.setSize(faceZoneNames_.size()); + // Cell zones wordList curCellZoneNames = mesh_.cellZones().names(); @@ -278,8 +281,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m) const labelList& own = m.faceOwner(); const labelList& nei = m.faceNeighbour(); - label newOwn, newNei, newPatch, newZone; - bool newZoneFlip; + label newOwn, newNei, newPatch; forAll(f, facei) { @@ -326,18 +328,6 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m) newNei = renumberCells[newNei]; } - - newZone = fz.whichZone(facei); - newZoneFlip = false; - - if (newZone >= 0) - { - newZoneFlip = fz[newZone].flipMap()[fz[newZone].whichFace(facei)]; - - // Grab the new zone - newZone = faceZoneIndices[newZone]; - } - renumberFaces[facei] = meshMod_.addFace ( newFace, @@ -345,10 +335,18 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m) newNei, -1, false, - newPatch, - newZone, - newZoneFlip + newPatch ); + + const labelList zones(fz.whichZones(facei)); + forAll(zones, zonei) + { + const faceZone& fzi = fz[zones[zonei]]; + const bool flip = fzi.flipMap()[fzi.whichFace(facei)]; + + faceZonesAddedFaces_[faceZoneIndices[zonei]] + .insert(renumberFaces[facei], flip); + } } } @@ -506,6 +504,12 @@ void Foam::mergePolyMesh::merge() mesh_.pointZones()[zonei].insert(pointZonesAddedPoints_[zonei]); } + // Add the new faces to the faceZones in the merged mesh + forAll(faceZonesAddedFaces_, zonei) + { + mesh_.faceZones()[zonei].insert(faceZonesAddedFaces_[zonei]); + } + // Add the new cells to the cellZones in the merged mesh forAll(cellZonesAddedCells_, zonei) { diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H index b5cf310ac5..1ae74c2436 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.H @@ -72,6 +72,9 @@ class mergePolyMesh //- Face zone names DynamicList faceZoneNames_; + //- Zones of the added faces + List> faceZonesAddedFaces_; + //- Cell zone names DynamicList cellZoneNames_; diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index 1edfce5b9f..6a83faca3f 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -187,9 +187,7 @@ Foam::label Foam::meshDualiser::addInternalFace dualCell1, // nei masterFacei, // masterFaceID false, // flipFaceFlux - -1, // patchID - -1, // zoneID - false // zoneFlip + -1 // patchID ); // pointField dualPoints(meshMod.points()); @@ -212,9 +210,7 @@ Foam::label Foam::meshDualiser::addInternalFace dualCell0, // nei masterFacei, // masterFaceID false, // flipFaceFlux - -1, // patchID - -1, // zoneID - false // zoneFlip + -1 // patchID ); // pointField dualPoints(meshMod.points()); @@ -253,9 +249,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace -1, // nei masterFacei, // masterFaceID false, // flipFaceFlux - patchi, // patchID - -1, // zoneID - false // zoneFlip + patchi // patchID ); // pointField dualPoints(meshMod.points()); diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 3d6dd48f2e..f3f864bd9f 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -293,6 +293,41 @@ void addToInterface } +label whichZone +( + const polyMesh& mesh, + const bool useFaceZones, + const label facei +) +{ + if (useFaceZones) + { + const labelList zones(mesh.faceZones().whichZones(facei)); + + if (zones.size() == 0) + { + return -1; + } + else if (zones.size() == 1) + { + return zones[0]; + } + else + { + FatalErrorInFunction + << "Face " << facei << " is in more than one zone " << zones + << exit(FatalError); + + return -1; + } + } + else + { + return -1; + } +} + + // Get region-region interface name and sizes. // Returns interfaces as straight list for looping in identical order. void getInterfaceSizes @@ -326,7 +361,7 @@ void getInterfaceSizes addToInterface ( mesh, - (useFaceZones ? mesh.faceZones().whichZone(facei) : -1), + whichZone(mesh, useFaceZones, facei), ownRegion, neiRegion, regionsToSize @@ -358,7 +393,7 @@ void getInterfaceSizes addToInterface ( mesh, - (useFaceZones ? mesh.faceZones().whichZone(facei) : -1), + whichZone(mesh, useFaceZones, facei), ownRegion, neiRegion, regionsToSize @@ -517,11 +552,7 @@ void getInterfaceSizes if (ownRegion != neiRegion) { - label zoneID = -1; - if (useFaceZones) - { - zoneID = mesh.faceZones().whichZone(facei); - } + const label zoneID = whichZone(mesh, useFaceZones, facei); edge interface ( @@ -540,11 +571,7 @@ void getInterfaceSizes if (ownRegion != neiRegion) { - label zoneID = -1; - if (useFaceZones) - { - zoneID = mesh.faceZones().whichZone(facei); - } + const label zoneID = whichZone(mesh, useFaceZones, facei); edge interface ( diff --git a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C index ac5c357261..8167b0f503 100644 --- a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C +++ b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C @@ -116,24 +116,13 @@ bool repatchFace if (nearest[bFacei] != -1) { // Use boundary mesh one. - label rMeshPatchID = rMesh.whichPatch(nearest[bFacei]); + const label rMeshPatchID = rMesh.whichPatch(nearest[bFacei]); - label patchID = surfToMeshPatch[rMeshPatchID]; + const label patchID = surfToMeshPatch[rMeshPatchID]; if (patchID != mesh.boundaryMesh().whichPatch(facei)) { - label own = mesh.faceOwner()[facei]; - - label zoneID = mesh.faceZones().whichZone(facei); - - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh.faceZones()[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } + const label own = mesh.faceOwner()[facei]; meshMod.modifyFace ( @@ -142,9 +131,7 @@ bool repatchFace own, // owner -1, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); changed = true; @@ -154,6 +141,7 @@ bool repatchFace { changed = false; } + return changed; } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C index d09aed087f..a298047405 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.C @@ -158,6 +158,21 @@ Foam::MeshZones::~MeshZones() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +bool Foam::MeshZones::found(const label objectIndex) const +{ + forAll(*this, zi) + { + if (this->operator[](zi).localIndex(objectIndex) != -1) + { + return true; + } + } + + return false; +} + + template Foam::labelList Foam::MeshZones::whichZones ( @@ -178,26 +193,6 @@ Foam::labelList Foam::MeshZones::whichZones } -template -Foam::label Foam::MeshZones::whichZone -( - const label objectIndex -) const -{ - label zoneIndex = -1; - - forAll(*this, zi) - { - if (this->operator[](zi).localIndex(objectIndex) != -1) - { - zoneIndex = zi; - } - } - - return zoneIndex; -} - - template Foam::boolList Foam::MeshZones::zonesFlipFace ( diff --git a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H index 477d3ff032..f4cf30f4ae 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/MeshZones/MeshZones.H @@ -127,14 +127,12 @@ public: return mesh_; } + //- Return true if objectIndex is in any zone + bool found(const label objectIndex) const; + //- Given a global object index, return the list of zones it is in labelList whichZones(const label objectIndex) const; - //- Given a global object index, return the zone it is in. - // If object does not belong to any zones, return -1 - // *** This will be replaced by whichZones - label whichZone(const label objectIndex) const; - //- Return the list of flips for the facei // for each of the face zones in faceiZones boolList zonesFlipFace diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C index 2c76ba5e08..f8d07197a3 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C @@ -179,19 +179,18 @@ void Foam::faceZone::checkAddressing() const } -void Foam::faceZone::reset(const Map& indices) +void Foam::faceZone::reset(const Map& newIndices) { clearAddressing(); - labelList::setSize(indices.size()); + labelList& indices = *this; + indices = newIndices.sortedToc(); + flipMap_.setSize(indices.size()); - label i = 0; - forAllConstIter(Map, indices, iter) + forAll(flipMap_, i) { - operator[](i) = iter.key(); - flipMap_[i] = *iter; - i++; + flipMap_[i] = newIndices[indices[i]]; } } @@ -506,17 +505,23 @@ void Foam::faceZone::swap(faceZone& fz) void Foam::faceZone::topoChange(const polyTopoChangeMap& map) { - /* Map indices; const labelList& faceMap = map.faceMap(); const labelList& reverseFaceMap = map.reverseFaceMap(); + const labelHashSet& flipFaceFlux = map.flipFaceFlux(); forAll(faceMap, facei) { const label i = localIndex(faceMap[facei]); if (faceMap[facei] >= 0 && i != -1) { - indices.insert(facei, flipMap_[i]); + indices.insert + ( + facei, + flipFaceFlux.found(facei) + ? !flipMap_[i] + : flipMap_[i] + ); } } @@ -525,12 +530,17 @@ void Foam::faceZone::topoChange(const polyTopoChangeMap& map) const label i = localIndex(facei); if (reverseFaceMap[facei] >= 0 && i != -1) { - indices.insert(reverseFaceMap[facei], flipMap_[i]); + indices.insert + ( + reverseFaceMap[facei], + flipFaceFlux.found(reverseFaceMap[facei]) + ? !flipMap_[i] + : flipMap_[i] + ); } } reset(indices); - */ } diff --git a/src/conversion/mergedCyclic/polyMeshUnMergeCyclics.C b/src/conversion/mergedCyclic/polyMeshUnMergeCyclics.C index 1698a0d29e..26b9a5d5f9 100644 --- a/src/conversion/mergedCyclic/polyMeshUnMergeCyclics.C +++ b/src/conversion/mergedCyclic/polyMeshUnMergeCyclics.C @@ -272,9 +272,7 @@ void Foam::polyMeshUnMergeCyclics(polyMesh& mesh, const scalar includedAngle) false, patchFaceHalves[patchFacei] ? patchHalf0[patchi] - : patchHalf1[patchi], - -1, - false + : patchHalf1[patchi] ); } } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 9c3697b068..318de601a1 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -710,15 +710,6 @@ Foam::autoPtr Foam::meshRefinement::splitFaces nei = mesh_.faceNeighbour()[facei]; } - const label zonei = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - if (zonei != -1) - { - const faceZone& fz = mesh_.faceZones()[zonei]; - zoneFlip = fz.flipMap()[fz.whichFace(facei)]; - } - - if (debug) { Pout<< "face:" << facei << " verts:" << f @@ -734,9 +725,7 @@ Foam::autoPtr Foam::meshRefinement::splitFaces own, // owner nei, // neighbour false, // face flip - patchi, // patch for face - zonei, // zone for face - zoneFlip // face flip in zone + patchi // patch for face ); meshMod.addFace @@ -746,9 +735,7 @@ Foam::autoPtr Foam::meshRefinement::splitFaces nei, // neighbour facei, // master face false, // face flip - patchi, // patch for face - zonei, // zone for face - zoneFlip // face flip in zone + patchi // patch for face ); } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 1469ec0324..f18fff4730 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -27,7 +27,6 @@ License #include "refinementSurfaces.H" #include "faceSet.H" #include "polyTopoChange.H" -#include "meshTools.H" #include "localPointRegion.H" #include "duplicatePoints.H" #include "regionSplit.H" @@ -37,7 +36,6 @@ License #include "patchFaceOrientation.H" #include "PatchEdgeFaceWave.H" #include "patchEdgeFaceRegion.H" -#include "OSspecific.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -50,14 +48,6 @@ Foam::label Foam::meshRefinement::createBaffle ) const { const face& f = mesh_.faces()[facei]; - const label zoneID = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } meshMod.modifyFace ( @@ -66,12 +56,9 @@ Foam::label Foam::meshRefinement::createBaffle mesh_.faceOwner()[facei], // owner -1, // neighbour false, // face flip - ownPatch, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + ownPatch // patch for face ); - label dupFacei = -1; if (mesh_.isInternalFace(facei)) @@ -84,12 +71,6 @@ Foam::label Foam::meshRefinement::createBaffle << " ownPatch:" << ownPatch << abort(FatalError); } - bool reverseFlip = false; - if (zoneID >= 0) - { - reverseFlip = !zoneFlip; - } - dupFacei = meshMod.addFace ( f.reverseFace(), // modified face @@ -97,9 +78,7 @@ Foam::label Foam::meshRefinement::createBaffle -1, // neighbour facei, // masterFaceID, true, // face flip - nbrPatch, // patch for face - zoneID, // zone for face - reverseFlip // face flip in zone + nbrPatch // patch for face ); } return dupFacei; @@ -431,14 +410,17 @@ void Foam::meshRefinement::checkZoneFaces() const forAll(pp, i) { const label facei = pp.start() + i; - const label zonei = fZones.whichZone(facei); + const labelList zones = fZones.whichZones(facei); - if (zonei != -1) + forAll(zones, zonei) { - FatalErrorInFunction - << "face:" << facei << " on patch " << pp.name() - << " is in zone " << fZones[zonei].name() - << exit(FatalError); + if (zones[zonei] != -1) + { + FatalErrorInFunction + << "face:" << facei << " on patch " << pp.name() + << " is in zone " << fZones[zones[zonei]].name() + << exit(FatalError); + } } } } @@ -809,7 +791,6 @@ Foam::autoPtr Foam::meshRefinement::mergeBaffles const faceList& faces = mesh_.faces(); const labelList& faceOwner = mesh_.faceOwner(); - const meshFaceZones& faceZones = mesh_.faceZones(); forAll(couples, i) { @@ -824,15 +805,6 @@ Foam::autoPtr Foam::meshRefinement::mergeBaffles if (face1 < 0 || own0 < own1) { // Use face0 as the new internal face. - const label zoneID = faceZones.whichZone(face0); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(face0)]; - } - const label nei = (face1 < 0 ? -1 : own1); meshMod.removeFace(face1, -1); @@ -843,22 +815,12 @@ Foam::autoPtr Foam::meshRefinement::mergeBaffles own0, // owner nei, // neighbour false, // face flip - -1, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + -1 // patch for face ); } else { // Use face1 as the new internal face. - const label zoneID = faceZones.whichZone(face1); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(face1)]; - } meshMod.removeFace(face0, -1); meshMod.modifyFace @@ -868,9 +830,7 @@ Foam::autoPtr Foam::meshRefinement::mergeBaffles own1, // owner own0, // neighbour false, // face flip - -1, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + -1 // patch for face ); } } @@ -3170,6 +3130,7 @@ Foam::autoPtr Foam::meshRefinement::zonify // Put the faces into the correct zone // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + List> faceZonesAddedFaces(mesh_.faceZones().size()); for (label facei = 0; facei < mesh_.nInternalFaces(); facei++) { @@ -3200,17 +3161,7 @@ Foam::autoPtr Foam::meshRefinement::zonify ); } - meshMod.modifyFace - ( - mesh_.faces()[facei], // modified face - facei, // label of face - faceOwner[facei], // owner - faceNeighbour[facei], // neighbour - false, // face flip - -1, // patch for face - faceZoneI, // zone for face - flip // face flip in zone - ); + faceZonesAddedFaces[faceZoneI].insert(facei, flip); } } @@ -3247,17 +3198,7 @@ Foam::autoPtr Foam::meshRefinement::zonify ); } - meshMod.modifyFace - ( - mesh_.faces()[facei], // modified face - facei, // label of face - faceOwner[facei], // owner - -1, // neighbour - false, // face flip - patchi, // patch for face - faceZoneI, // zone for face - flip // face flip in zone - ); + faceZonesAddedFaces[faceZoneI].insert(facei, flip); } facei++; } @@ -3268,6 +3209,12 @@ Foam::autoPtr Foam::meshRefinement::zonify // Change the mesh without keeping old points, parallel sync autoPtr map = meshMod.changeMesh(mesh_, true); + // Add the new faces to the faceZones in the merged mesh + forAll(faceZonesAddedFaces, zonei) + { + mesh_.faceZones()[zonei].insert(faceZonesAddedFaces[zonei]); + } + // Update fields mesh_.topoChange(map); diff --git a/src/polyTopoChange/createShellMesh/createShellMesh.C b/src/polyTopoChange/createShellMesh/createShellMesh.C index fe6699991a..a1ae6ee250 100644 --- a/src/polyTopoChange/createShellMesh/createShellMesh.C +++ b/src/polyTopoChange/createShellMesh/createShellMesh.C @@ -569,21 +569,11 @@ void Foam::createShellMesh::setRefinement -1, // nei faceToFaceMap.size(), // masterFaceID : current facei true, // flipFaceFlux - bottomPatchID[facei], // patchID - -1, // zoneID - false // zoneFlip + bottomPatchID[facei] // patchID ); + faceToFaceMap.append(-facei-1); // points to flipped original face faceToEdgeMap.append(-1); - - // const face newF(patch_.localFaces()[facei].reverseFace()); - // Pout<< "Added bottom face " - // << newF - // << " coords:" << UIndirectList(meshMod.points(), newF) - // << " own " << addedCells[facei] - // << " patch:" << bottomPatchID[facei] - // << " at " << patch_.faceCentres()[facei] - // << endl; } // Add in between faces and face on top @@ -624,20 +614,11 @@ void Foam::createShellMesh::setRefinement nei, // nei faceToFaceMap.size(), // masterFaceID : current facei false, // flipFaceFlux - patchi, // patchID - -1, // zoneID - false // zoneFlip + patchi // patchID ); + faceToFaceMap.append(facei+1); // unflipped faceToEdgeMap.append(-1); - - // Pout<< "Added in between face " << newF - // << " coords:" << UIndirectList(meshMod.points(), newF) - // << " at layer " << layerI - // << " own " << own - // << " nei " << nei - // << " at " << patch_.faceCentres()[facei] - // << endl; } } @@ -750,21 +731,6 @@ void Foam::createShellMesh::setRefinement patchi = ePatches[0]; } - //{ - // Pout<< "Adding from face:" << patch_.faceCentres()[eFaces[0]] - // << " from edge:" - // << patch_.localPoints()[f[fp0]] - // << patch_.localPoints()[f[fp1]] - // << " at layer:" << layerI - // << " with new points:" << newF - // << " locations:" - // << UIndirectList(meshMod.points(), newF) - // << " own:" << minCelli - // << " nei:" << maxCelli - // << endl; - //} - - // newF already outwards pointing. meshMod.addFace ( @@ -773,10 +739,9 @@ void Foam::createShellMesh::setRefinement maxCelli, // nei faceToFaceMap.size(), // masterFaceID false, // flipFaceFlux - patchi, // patchID - -1, // zoneID - false // zoneFlip + patchi // patchID ); + faceToFaceMap.append(0); faceToEdgeMap.append(edgeI); } @@ -844,19 +809,6 @@ void Foam::createShellMesh::setRefinement } newF.last() = v0; } - ////if (ePatches.size() == 0) - //{ - // Pout<< "Adding from MULTI face:" - // << patch_.faceCentres()[minFacei] - // << " from edge:" - // << patch_.localPoints()[f[fp0]] - // << patch_.localPoints()[f[fp1]] - // << " at layer:" << layerI - // << " with new points:" << newF - // << " locations:" - // << UIndirectList(meshMod.points(), newF) - // << endl; - //} // newF already outwards pointing. meshMod.addFace @@ -866,9 +818,7 @@ void Foam::createShellMesh::setRefinement -1, // nei faceToFaceMap.size(), // masterFaceID false, // flipFaceFlux - ePatches[i], // patchID - -1, // zoneID - false // zoneFlip + ePatches[i] // patchID ); faceToFaceMap.append(0); faceToEdgeMap.append(edgeI); diff --git a/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C b/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C index 3494f97337..978f55cbcd 100644 --- a/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C +++ b/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C @@ -539,16 +539,7 @@ Foam::autoPtr Foam::fvMeshDistribute::repatch { if (newPatchID[bFacei] != -1) { - label facei = mesh_.nInternalFaces() + bFacei; - - label zoneID = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } + const label facei = mesh_.nInternalFaces() + bFacei; meshMod.modifyFace ( @@ -557,9 +548,7 @@ Foam::autoPtr Foam::fvMeshDistribute::repatch mesh_.faceOwner()[facei], // owner -1, // neighbour false, // face flip - newPatchID[bFacei], // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + newPatchID[bFacei] // patch for face ); } } @@ -747,14 +736,6 @@ Foam::autoPtr Foam::fvMeshDistribute::mergeSharedPoints label patchID = mesh_.boundaryMesh().whichPatch(facei); label nei = (patchID == -1 ? mesh_.faceNeighbour()[facei] : -1); - label zoneID = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } meshMod.modifyFace ( @@ -763,9 +744,7 @@ Foam::autoPtr Foam::fvMeshDistribute::mergeSharedPoints mesh_.faceOwner()[facei], // owner nei, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); } } diff --git a/src/polyTopoChange/mergePatchPairs/mergePatchPairs.C b/src/polyTopoChange/mergePatchPairs/mergePatchPairs.C index e64144e7af..4feafae452 100644 --- a/src/polyTopoChange/mergePatchPairs/mergePatchPairs.C +++ b/src/polyTopoChange/mergePatchPairs/mergePatchPairs.C @@ -218,9 +218,7 @@ void Foam::mergePatchPairs::addFaces tgtOwn, // Neighbour cell srcFacei, // Master face index false, // Flip - -1, // Patch index - -1, // Zone index - false // Zone sign + -1 // Patch index ); if (debug) @@ -239,9 +237,7 @@ void Foam::mergePatchPairs::addFaces srcOwn, // Neighbour cell tgtFacei, // Master face index false, // Flip - -1, // Patch index - -1, // Zone index - false // Zone sign + -1 // Patch index ); if (debug) @@ -257,15 +253,6 @@ void Foam::mergePatchPairs::addFaces const label srcFacei = srcPatchStart + faceSrcFaces[fi]; const label srcOwn = mesh_.faceOwner()[srcFacei]; - // Get source face zone info - const label zoneIndex = mesh_.faceZones().whichZone(srcFacei); - bool zoneFlip = false; - if (zoneIndex >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneIndex]; - zoneFlip = fZone.flipMap()[fZone.whichFace(srcFacei)]; - } - meshMod.addFace ( f, // Face to add @@ -273,9 +260,7 @@ void Foam::mergePatchPairs::addFaces -1, // Neighbour cell srcFacei, // Master face index false, // Flip - srcPatchi, // Patch index - zoneIndex, // Zone index - zoneFlip // Zone sign + srcPatchi // Patch index ); if (debug) @@ -290,15 +275,6 @@ void Foam::mergePatchPairs::addFaces const label tgtFacei = tgtPatchStart + faceTgtFaces[fi]; const label tgtOwn = mesh_.faceOwner()[tgtFacei]; - // Get target face zone info - const label zoneIndex = mesh_.faceZones().whichZone(tgtFacei); - bool zoneFlip = false; - if (zoneIndex >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneIndex]; - zoneFlip = fZone.flipMap()[fZone.whichFace(tgtFacei)]; - } - meshMod.addFace ( f.reverseFace(), // Face to add @@ -306,9 +282,7 @@ void Foam::mergePatchPairs::addFaces -1, // Neighbour cell tgtFacei, // Master face index false, // Flip - tgtPatchi, // Patch index - zoneIndex, // Zone index - zoneFlip // Zone sign + tgtPatchi // Patch index ); if (debug) @@ -510,15 +484,6 @@ void Foam::mergePatchPairs::modifyFaces if (modified) { - // Get current zone info - const label zoneIndex = mesh_.faceZones().whichZone(fi); - bool zoneFlip = false; - if (zoneIndex >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneIndex]; - zoneFlip = fZone.flipMap()[fZone.whichFace(fi)]; - } - if (mesh_.isInternalFace(fi)) { if (debug) @@ -539,9 +504,7 @@ void Foam::mergePatchPairs::modifyFaces mesh_.faceOwner()[fi], // Owner cell mesh_.faceNeighbour()[fi], // Neighbour cell false, // Face flip - -1, // Patch index - zoneIndex, // Zone index - zoneFlip // Zone flip + -1 // Patch index ); } else @@ -564,9 +527,7 @@ void Foam::mergePatchPairs::modifyFaces mesh_.faceOwner()[fi], // Owner cell -1, // Neighbour cell false, // Face flip - mesh_.boundaryMesh().whichPatch(fi), // Patch index - zoneIndex, // Zone index - zoneFlip // Zone flip + mesh_.boundaryMesh().whichPatch(fi) // Patch index ); } } diff --git a/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.C b/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.C index 211ce7e5b3..08e64a88cc 100644 --- a/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.C +++ b/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.C @@ -162,31 +162,16 @@ void Foam::meshCutter::faceCells } -void Foam::meshCutter::getFaceInfo -( - const label facei, - label& patchID, - label& zoneID, - label& zoneFlip -) const +Foam::label Foam::meshCutter::getPatchIndex(const label facei) const { - patchID = -1; + label patchID = -1; if (!mesh().isInternalFace(facei)) { patchID = mesh().boundaryMesh().whichPatch(facei); } - zoneID = mesh().faceZones().whichZone(facei); - - zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh().faceZones()[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } + return patchID; } @@ -199,9 +184,7 @@ void Foam::meshCutter::addFace const label nei ) { - label patchID, zoneID, zoneFlip; - - getFaceInfo(facei, patchID, zoneID, zoneFlip); + const label patchID = getPatchIndex(facei); if ((nei == -1) || (own < nei)) { @@ -212,8 +195,6 @@ void Foam::meshCutter::addFace << " with new owner:" << own << " with new neighbour:" << nei << " patchID:" << patchID - << " zoneID:" << zoneID - << " zoneFlip:" << zoneFlip << endl; } @@ -224,9 +205,7 @@ void Foam::meshCutter::addFace nei, // neighbour facei, // master face for addition false, // flux flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face zone flip + patchID // patch for face ); } else @@ -238,8 +217,6 @@ void Foam::meshCutter::addFace << " with new owner:" << nei << " with new neighbour:" << own << " patchID:" << patchID - << " zoneID:" << zoneID - << " zoneFlip:" << zoneFlip << endl; } @@ -250,9 +227,7 @@ void Foam::meshCutter::addFace own, // neighbour facei, // master face for addition false, // flux flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face zone flip + patchID // patch for face ); } } @@ -267,9 +242,7 @@ void Foam::meshCutter::modifyFace const label nei ) { - label patchID, zoneID, zoneFlip; - - getFaceInfo(facei, patchID, zoneID, zoneFlip); + const label patchID = getPatchIndex(facei); if ( @@ -288,8 +261,6 @@ void Foam::meshCutter::modifyFace << " new vertices:" << newFace << " new owner:" << own << " new neighbour:" << nei - << " new zoneID:" << zoneID - << " new zoneFlip:" << zoneFlip << endl; } @@ -302,9 +273,7 @@ void Foam::meshCutter::modifyFace own, // owner nei, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); } else @@ -316,9 +285,7 @@ void Foam::meshCutter::modifyFace nei, // owner own, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); } } @@ -632,19 +599,16 @@ void Foam::meshCutter::setRefinement // Convert loop (=list of cuts) into proper face. // Orientation should already be ok. (done by cellCuts) // - face newFace(loopToFace(celli, loop)); + const face newFace(loopToFace(celli, loop)); - label addedFacei = - meshMod.addFace + const label addedFacei = meshMod.addFace ( newFace, // face celli, // owner addedCells_[celli], // neighbour -1, // master face for addition false, // flux flip - -1, // patch for face - -1, // zone for face - false // face zone flip + -1 // patch for face ); addedFaces_.insert(celli, addedFacei); diff --git a/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.H b/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.H index f2b294ac1c..d8650550e5 100644 --- a/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.H +++ b/src/polyTopoChange/meshCut/meshModifiers/meshCutter/meshCutter.H @@ -172,14 +172,8 @@ class meshCutter label& nei ) const; - //- Get patch information for face. - void getFaceInfo - ( - const label facei, - label& patchID, - label& zoneID, - label& zoneFlip - ) const; + //- Get patch index face + label getPatchIndex(const label facei) const; //- Adds a face on top of existing facei. Flips face // if owner>neighbour diff --git a/src/polyTopoChange/perfectInterface/perfectInterface.C b/src/polyTopoChange/perfectInterface/perfectInterface.C index aaa0b427dd..398a2d2963 100644 --- a/src/polyTopoChange/perfectInterface/perfectInterface.C +++ b/src/polyTopoChange/perfectInterface/perfectInterface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,13 +69,11 @@ Foam::perfectInterface::perfectInterface ( const word& name, const polyMesh& mesh, - const word& faceZoneName, const word& masterPatchName, const word& slavePatchName ) : mesh_(mesh), - faceZoneIndex_(mesh_.faceZones().findIndex(faceZoneName)), masterPatchIndex_(mesh_.boundaryMesh().findIndex(masterPatchName)), slavePatchIndex_(mesh_.boundaryMesh().findIndex(slavePatchName)) {} @@ -250,16 +248,6 @@ void Foam::perfectInterface::setRefinement patchi = patches.whichPatch(facei); } - const label zoneID = mesh_.faceZones().whichZone(facei); - - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - ref.modifyFace ( newFace, // modified face @@ -267,9 +255,7 @@ void Foam::perfectInterface::setRefinement mesh_.faceOwner()[facei], // owner nbr, // neighbour false, // face flip - patchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchi // patch for face ); } @@ -297,9 +283,6 @@ void Foam::perfectInterface::setRefinement // 5. Modify patch0 faces for new points (not really necessary; see // comment above about patch1 and patch0 never sharing points) and // becoming internal. - const boolList& mfFlip = - mesh_.faceZones()[faceZoneIndex_].flipMap(); - forAll(pp0, i) { const label facei = pp0.addressing()[i]; @@ -325,9 +308,7 @@ void Foam::perfectInterface::setRefinement own, // owner nbr, // neighbour false, // face flip - -1, // patch for face - faceZoneIndex_, // zone for face - mfFlip[i] // face flip in zone + -1 // patch for face ); } else @@ -339,9 +320,7 @@ void Foam::perfectInterface::setRefinement nbr, // owner own, // neighbour true, // face flip - -1, // patch for face - faceZoneIndex_, // zone for face - !mfFlip[i] // face flip in zone + -1 // patch for face ); } } @@ -354,8 +333,7 @@ void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const { Pout<< "bool perfectInterface::setRefinement(polyTopoChange&) const : " << "masterPatchIndex_:" << masterPatchIndex_ - << " slavePatchIndex_:" << slavePatchIndex_ - << " faceZoneIndex_:" << faceZoneIndex_ << endl; + << " slavePatchIndex_:" << slavePatchIndex_ << endl; } const polyBoundaryMesh& patches = mesh_.boundaryMesh(); diff --git a/src/polyTopoChange/perfectInterface/perfectInterface.H b/src/polyTopoChange/perfectInterface/perfectInterface.H index 18350295bd..48349ac0b0 100644 --- a/src/polyTopoChange/perfectInterface/perfectInterface.H +++ b/src/polyTopoChange/perfectInterface/perfectInterface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,9 +56,6 @@ class perfectInterface const polyMesh& mesh_; - //- Master face zone ID - label faceZoneIndex_; - //- Master patch ID label masterPatchIndex_; @@ -88,7 +85,6 @@ public: ( const word& name, const polyMesh& mesh, - const word& faceZoneName, const word& masterPatchName, const word& slavePatchName ); @@ -109,7 +105,7 @@ public: //- Insert the layer addition/removal instructions // into the topological change. Uses only mesh, not any of the - // patch and zone indices. Bit of a workaround - used in extruding + // patch indices. Bit of a workaround - used in extruding // a mesh. virtual void setRefinement ( diff --git a/src/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/polyTopoChange/polyTopoChange/addPatchCellLayer.C index 046a20079c..4cf2a15248 100644 --- a/src/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/polyTopoChange/polyTopoChange/addPatchCellLayer.C @@ -228,12 +228,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace ) const { label masterFacei = -1; - - // Zone info comes from any side patch face. Otherwise -1 since we - // don't know what to put it in - inherit from the extruded faces? - label zonei = -1; // mesh_.faceZones().whichZone(meshFacei); - bool flip = false; - label addedFacei = -1; // Is patch edge external edge of indirectPrimitivePatch? @@ -246,7 +240,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace // Loop over all faces connected to edge and see if we can find a face // that is otherPatchID - // Get my mesh face and its zone. + // Get my mesh face label meshFacei = pp.addressing()[ownFacei]; forAll(meshFaces, k) @@ -261,13 +255,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace { // Found the patch face. Use it to map from masterFacei = facei; - - zonei = mesh_.faceZones().whichZone(facei); - if (zonei != -1) - { - label index = mesh_.faceZones()[zonei].whichFace(facei); - flip = mesh_.faceZones()[zonei].flipMap()[index]; - } break; } } @@ -295,12 +282,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace layerOwn = layerI; } - - // Pout<< "Added boundary face:" << newFace - // << " own:" << addedCells[ownFacei][layerOwn] - // << " patch:" << newPatchID - // << endl; - addedFacei = meshMod.addFace ( newFace, // face @@ -308,9 +289,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace -1, // neighbour masterFacei, // master face false, // flux flip - newPatchID, // patch for face - zonei, // zone for face - flip // face zone flip + newPatchID // patch for face ); } else @@ -369,15 +348,8 @@ Foam::label Foam::addPatchCellLayer::addSideFace addedCells[nbrFacei][layerNbr], // neighbour -1, // master face false, // flux flip - -1, // patch for face - zonei, // zone for face - flip // face zone flip + -1 // patch for face ); - - // Pout<< "Added internal face:" << newFace - // << " own:" << addedCells[ownFacei][layerOwn] - // << " nei:" << addedCells[nbrFacei][layerNbr] - // << endl; } return addedFacei; @@ -1158,21 +1130,12 @@ void Foam::addPatchCellLayer::setRefinement // Get new neighbour label nei; label patchi; - label zonei = -1; - bool flip = false; - if (i == addedCells[patchFacei].size()-1) { // Top layer so is patch face. nei = -1; patchi = patchID[patchFacei]; - zonei = mesh_.faceZones().whichZone(meshFacei); - if (zonei != -1) - { - const faceZone& fz = mesh_.faceZones()[zonei]; - flip = fz.flipMap()[fz.whichFace(meshFacei)]; - } } else { @@ -1181,7 +1144,6 @@ void Foam::addPatchCellLayer::setRefinement patchi = -1; } - layerFaces_[patchFacei][i+1] = meshMod.addFace ( newFace, // face @@ -1189,9 +1151,7 @@ void Foam::addPatchCellLayer::setRefinement nei, // neighbour (addToMesh_ ? meshFacei : -1), // master face false, // flux flip - patchi, // patch for face - zonei, // zone for face - flip // face zone flip + patchi // patch for face ); } } @@ -1218,9 +1178,7 @@ void Foam::addPatchCellLayer::setRefinement mesh_.faceOwner()[meshFacei], // owner addedCells[patchFacei][0], // neighbour false, // face flip - -1, // patch for face - -1, // zonei, // zone for face - false // face flip in zone + -1 // patch for face ); } } @@ -1233,15 +1191,6 @@ void Foam::addPatchCellLayer::setRefinement { if (nFaceLayers[patchFacei] > 0) { - label meshFacei = pp.addressing()[patchFacei]; - label zonei = mesh_.faceZones().whichZone(meshFacei); - bool zoneFlip = false; - if (zonei != -1) - { - const faceZone& fz = mesh_.faceZones()[zonei]; - zoneFlip = !fz.flipMap()[fz.whichFace(meshFacei)]; - } - // Reverse and renumber old patch face. face f(pp.localFaces()[patchFacei].reverseFace()); forAll(f, fp) @@ -1256,9 +1205,7 @@ void Foam::addPatchCellLayer::setRefinement -1, // neighbour -1, // masterFace true, // face flip - exposedPatchID[patchFacei], // patch for face - zonei, // zone for face - zoneFlip // face flip in zone + exposedPatchID[patchFacei] // patch for face ); } } diff --git a/src/polyTopoChange/polyTopoChange/combineFaces.C b/src/polyTopoChange/polyTopoChange/combineFaces.C index 8d89506cf5..2237ad26fa 100644 --- a/src/polyTopoChange/polyTopoChange/combineFaces.C +++ b/src/polyTopoChange/polyTopoChange/combineFaces.C @@ -639,23 +639,12 @@ void Foam::combineFaces::setRefinement // Modify master face // ~~~~~~~~~~~~~~~~~~ - label masterFacei = setFaces[0]; + const label masterFacei = setFaces[0]; // Get outside face in mesh vertex labels - face outsideFace(getOutsideFace(bigFace)); + const face outsideFace(getOutsideFace(bigFace)); - label zoneID = mesh_.faceZones().whichZone(masterFacei); - - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(masterFacei)]; - } - - label patchi = mesh_.boundaryMesh().whichPatch(masterFacei); + const label patchi = mesh_.boundaryMesh().whichPatch(masterFacei); meshMod.modifyFace ( @@ -664,9 +653,7 @@ void Foam::combineFaces::setRefinement mesh_.faceOwner()[masterFacei], // owner -1, // neighbour false, // face flip - patchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchi // patch for face ); @@ -922,15 +909,8 @@ void Foam::combineFaces::setUnrefinement // Restore // ~~~~~~~ - label own = mesh_.faceOwner()[masterFacei]; - label zoneID = mesh_.faceZones().whichZone(masterFacei); - bool zoneFlip = false; - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(masterFacei)]; - } - label patchi = mesh_.boundaryMesh().whichPatch(masterFacei); + const label own = mesh_.faceOwner()[masterFacei]; + const label patchi = mesh_.boundaryMesh().whichPatch(masterFacei); if (mesh_.boundaryMesh()[patchi].coupled()) { @@ -951,9 +931,7 @@ void Foam::combineFaces::setUnrefinement own, // owner -1, // neighbour false, // face flip - patchi, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchi // patch for face ); restoredFaces.insert(masterFacei, masterFacei); @@ -970,9 +948,7 @@ void Foam::combineFaces::setUnrefinement -1, // neighbour, masterFacei, // masterFaceID, false, // flipFaceFlux, - patchi, // patchID, - zoneID, // zoneID, - zoneFlip // zoneFlip + patchi // patchID, ); restoredFaces.insert(facei, masterFacei); } diff --git a/src/polyTopoChange/polyTopoChange/duplicatePoints.C b/src/polyTopoChange/polyTopoChange/duplicatePoints.C index b035ad262d..44146f2fcc 100644 --- a/src/polyTopoChange/polyTopoChange/duplicatePoints.C +++ b/src/polyTopoChange/polyTopoChange/duplicatePoints.C @@ -142,16 +142,6 @@ void Foam::duplicatePoints::setRefinement } } - // Get current zone info - label zoneID = mesh_.faceZones().whichZone(facei); - bool zoneFlip = false; - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - - if (mesh_.isInternalFace(facei)) { meshMod.modifyFace @@ -161,9 +151,7 @@ void Foam::duplicatePoints::setRefinement mesh_.faceOwner()[facei], // owner mesh_.faceNeighbour()[facei], // neighbour false, // face flip - -1, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + -1 // patch for face ); } else @@ -175,9 +163,7 @@ void Foam::duplicatePoints::setRefinement mesh_.faceOwner()[facei], // owner -1, // neighbour false, // face flip - patches.whichPatch(facei), // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patches.whichPatch(facei) // patch for face ); } } diff --git a/src/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/polyTopoChange/polyTopoChange/edgeCollapser.C index cf76d0de32..893d135c0c 100644 --- a/src/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -1550,7 +1550,6 @@ bool Foam::edgeCollapser::setRefinement const polyBoundaryMesh& boundaryMesh = mesh_.boundaryMesh(); - const meshFaceZones& faceZones = mesh_.faceZones(); // Renumber faces that use points forAll(allPointInfo, pointi) @@ -1567,18 +1566,6 @@ bool Foam::edgeCollapser::setRefinement { doneFace[facei] = true; - // Get current zone info - label zoneID = faceZones.whichZone(facei); - - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } - // Get current connectivity label own = faceOwner[facei]; label nei = -1; @@ -1600,9 +1587,7 @@ bool Foam::edgeCollapser::setRefinement own, // owner nei, // neighbour false, // flipFaceFlux - patchID, // patch - zoneID, - zoneFlip + patchID // patch ); meshChanged = true; diff --git a/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C index acc8656c2f..67ab92550f 100644 --- a/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C +++ b/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C @@ -90,31 +90,16 @@ void Foam::hexRef8::reorder } -void Foam::hexRef8::getFaceInfo -( - const label facei, - label& patchID, - label& zoneID, - label& zoneFlip -) const +Foam::label Foam::hexRef8::getPatchIndex(const label facei) const { - patchID = -1; + label patchID = -1; if (!mesh_.isInternalFace(facei)) { patchID = mesh_.boundaryMesh().whichPatch(facei); } - zoneID = mesh_.faceZones().whichZone(facei); - - zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = mesh_.faceZones()[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(facei)]; - } + return patchID; } @@ -127,9 +112,7 @@ Foam::label Foam::hexRef8::addFace const label nei ) const { - label patchID, zoneID, zoneFlip; - - getFaceInfo(facei, patchID, zoneID, zoneFlip); + const label patchID = getPatchIndex(facei); label newFacei = -1; @@ -143,9 +126,7 @@ Foam::label Foam::hexRef8::addFace nei, // neighbour facei, // master face for addition false, // flux flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face zone flip + patchID // patch for face ); } else @@ -158,9 +139,7 @@ Foam::label Foam::hexRef8::addFace own, // neighbour facei, // master face for addition false, // flux flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face zone flip + patchID // patch for face ); } return newFacei; @@ -186,9 +165,7 @@ Foam::label Foam::hexRef8::addInternalFace nei, // neighbour meshFacei, // master face for addition false, // flux flip - -1, // patch for face - -1, // zone for face - false // face zone flip + -1 // patch for face ); } else @@ -202,9 +179,7 @@ Foam::label Foam::hexRef8::addInternalFace nei, // neighbour -1, // master face for addition false, // flux flip - -1, // patch for face - -1, // zone for face - false // face zone flip + -1 // patch for face ); } } @@ -219,9 +194,7 @@ void Foam::hexRef8::modifyFace const label nei ) const { - label patchID, zoneID, zoneFlip; - - getFaceInfo(facei, patchID, zoneID, zoneFlip); + const label patchID = getPatchIndex(facei); if ( @@ -242,9 +215,7 @@ void Foam::hexRef8::modifyFace own, // owner nei, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); } else @@ -256,9 +227,7 @@ void Foam::hexRef8::modifyFace nei, // owner own, // neighbour false, // face flip - patchID, // patch for face - zoneID, // zone for face - zoneFlip // face flip in zone + patchID // patch for face ); } } diff --git a/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H b/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H index 4d793ee783..826c69e4cd 100644 --- a/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H +++ b/src/polyTopoChange/polyTopoChange/hexRef8/hexRef8.H @@ -105,14 +105,8 @@ class hexRef8 labelList& elems ); - //- Get patch and zone info - void getFaceInfo - ( - const label facei, - label& patchID, - label& zoneID, - label& zoneFlip - ) const; + //- Get patch index + label getPatchIndex(const label facei) const; //- Adds a face on top of existing facei. Reverses if necessary. label addFace diff --git a/src/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/polyTopoChange/polyTopoChange/polyTopoChange.C index ea4970cb67..7faff37f17 100644 --- a/src/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -327,13 +327,12 @@ void Foam::polyTopoChange::checkFace const label facei, const label own, const label nei, - const label patchi, - const label zoneI + const label patchi ) const { if (nei == -1) { - if (own == -1 && zoneI != -1) + if (own == -1) { // retired face } @@ -865,9 +864,6 @@ void Foam::polyTopoChange::reorderCompactFaces inplaceReorder(oldToNew, flipFaceFlux_); flipFaceFlux_.setCapacity(newSize); - renumberKey(oldToNew, faceZone_); - inplaceReorder(oldToNew, faceZoneFlip_); - faceZoneFlip_.setCapacity(newSize); } @@ -1174,12 +1170,6 @@ void Foam::polyTopoChange::compact ? 0 : 1 ); - faceZoneFlip_[facei] = - ( - faceZoneFlip_[facei] - ? 0 - : 1 - ); } } } @@ -1313,150 +1303,6 @@ void Foam::polyTopoChange::calcPatchPointMap } -void Foam::polyTopoChange::resetZones -( - const polyMesh& mesh, - polyMesh& newMesh -) const -{ - // faceZones - // ~~~~~~~~~ - - { - const meshFaceZones& faceZones = mesh.faceZones(); - - labelList nFaces(faceZones.size(), 0); - - forAllConstIter(Map