Skip to content
Snippets Groups Projects
Commit a3c239af authored by mattijs's avatar mattijs Committed by Andrew Heather
Browse files

BUG: snappyHexMesh: deal with non-compact regions. Fixes #1221.

parent b675d134
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015,2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -74,15 +74,20 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
{
if (treeByRegion_.empty())
{
Map<label> regionSizes;
label maxRegion = -1;
forAll(surface(), fI)
{
const label regionI = surface()[fI].region();
regionSizes(regionI)++;
maxRegion = max(maxRegion, regionI);
}
const label nRegions = maxRegion+1;
label nRegions = regionSizes.size();
labelList nFacesInRegions(nRegions, 0);
forAll(surface(), fI)
{
const label regionI = surface()[fI].region();
nFacesInRegions[regionI]++;
}
indirectRegionPatches_.setSize(nRegions);
treeByRegion_.setSize(nRegions);
......@@ -91,15 +96,12 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
forAll(regionsAddressing, regionI)
{
regionsAddressing[regionI] = labelList(regionSizes[regionI], -1);
regionsAddressing[regionI].setSize(nFacesInRegions[regionI]);
}
labelList nFacesInRegions(nRegions, Zero);
nFacesInRegions = Zero;
forAll(surface(), fI)
{
const label regionI = surface()[fI].region();
regionsAddressing[regionI][nFacesInRegions[regionI]++] = fI;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment