Skip to content
Snippets Groups Projects
Commit dced6c58 authored by mattijs's avatar mattijs
Browse files

BUG: regionSplit2D: revert to original code. Fixes #3149.

parent 3e64faf6
1 merge request!695OpenFOAM v2406
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2022,2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -28,7 +28,7 @@ License ...@@ -28,7 +28,7 @@ License
#include "regionSplit2D.H" #include "regionSplit2D.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "PatchEdgeFaceWave.H" #include "PatchEdgeFaceWave.H"
#include "edgeTopoDistanceData.H" #include "patchEdgeFaceRegion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...@@ -51,12 +51,11 @@ Foam::regionSplit2D::regionSplit2D ...@@ -51,12 +51,11 @@ Foam::regionSplit2D::regionSplit2D
nRegions_(0) nRegions_(0)
{ {
globalIndex globalFaces(blockedFaces.size()); globalIndex globalFaces(blockedFaces.size());
label regionI = globalFaces.toGlobal(0); label regioni = globalFaces.toGlobal(0);
List<edgeTopoDistanceData<label>> allEdgeInfo(patch.nEdges()); List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
List<edgeTopoDistanceData<label>> allFaceInfo(patch.size()); List<patchEdgeFaceRegion> allFaceInfo(patch.size());
DynamicList<label> changedEdges; DynamicList<label> changedEdges;
DynamicList<edgeTopoDistanceData<label>> changedRegions; DynamicList<patchEdgeFaceRegion> changedRegions;
label nBlockedFaces = 0; label nBlockedFaces = 0;
forAll(blockedFaces, facei) forAll(blockedFaces, facei)
{ {
...@@ -67,26 +66,15 @@ Foam::regionSplit2D::regionSplit2D ...@@ -67,26 +66,15 @@ Foam::regionSplit2D::regionSplit2D
changedEdges.append(edgei); changedEdges.append(edgei);
// Append globally unique value // Append globally unique value
changedRegions.append changedRegions.append(regioni);
(
edgeTopoDistanceData<label>
(
0, // distance
regionI // passive data
)
);
} }
nBlockedFaces++; nBlockedFaces++;
regionI++; regioni++;
} }
else else
{ {
// Block all non-seeded faces from the walk // Block all non-seeded faces from the walk
allFaceInfo[facei] = edgeTopoDistanceData<label> allFaceInfo[facei] = BLOCKED;
(
0, // distance
BLOCKED // passive data
);
} }
} }
...@@ -99,7 +87,7 @@ Foam::regionSplit2D::regionSplit2D ...@@ -99,7 +87,7 @@ Foam::regionSplit2D::regionSplit2D
PatchEdgeFaceWave PatchEdgeFaceWave
< <
indirectPrimitivePatch, indirectPrimitivePatch,
edgeTopoDistanceData<label> patchEdgeFaceRegion
> >
( (
mesh, mesh,
...@@ -115,23 +103,23 @@ Foam::regionSplit2D::regionSplit2D ...@@ -115,23 +103,23 @@ Foam::regionSplit2D::regionSplit2D
// Map from regions to local compact indexing // Map from regions to local compact indexing
// - only for regions that originate from this processor // - only for regions that originate from this processor
Map<label> regionToCompactAddr(changedRegions.size()); Map<label> regionToCompactAddr(changedRegions.size());
label compactRegionI = 0; label compactRegioni = 0;
forAll(allFaceInfo, faceI) forAll(allFaceInfo, facei)
{ {
label regionI = allFaceInfo[faceI].data(); const label regioni = allFaceInfo[facei].region();
if if
( (
globalFaces.isLocal(regionI) globalFaces.isLocal(regioni)
&& regionToCompactAddr.insert(regionI, compactRegionI) && regionToCompactAddr.insert(regioni, compactRegioni)
) )
{ {
compactRegionI++; compactRegioni++;
} }
} }
// In-place renumber the local regionI to global (compact) regionI // In-place renumber the local regionI to global (compact) regioni
{ {
const label myProcOffset = globalIndex::calcOffset(compactRegionI); const label myProcOffset = globalIndex::calcOffset(compactRegioni);
forAllIters(regionToCompactAddr, iter) forAllIters(regionToCompactAddr, iter)
{ {
iter.val() += myProcOffset; iter.val() += myProcOffset;
...@@ -147,12 +135,12 @@ Foam::regionSplit2D::regionSplit2D ...@@ -147,12 +135,12 @@ Foam::regionSplit2D::regionSplit2D
nRegions_ = regionToCompactAddr.size(); nRegions_ = regionToCompactAddr.size();
// Set the region index per face // Set the region index per face
forAll(allFaceInfo, faceI) forAll(allFaceInfo, facei)
{ {
label regionI = allFaceInfo[faceI].data(); const label regioni = allFaceInfo[facei].region();
if (regionI >= 0) if (regioni >= 0)
{ {
this->operator[](faceI) = regionToCompactAddr[regionI] + offset; this->operator[](facei) = regionToCompactAddr[regioni] + offset;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment