Commit b056202e authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: simplify bitSet use in Foam::PatchTools::subsetMap

parent bafddd77
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -166,40 +166,30 @@ Foam::PatchTools::subsetMap ...@@ -166,40 +166,30 @@ Foam::PatchTools::subsetMap
labelList& faceMap labelList& faceMap
) )
{ {
label facei = 0;
label pointi = 0;
const List<Face>& localFaces = p.localFaces(); const List<Face>& localFaces = p.localFaces();
faceMap.setSize(localFaces.size()); faceMap.resize(localFaces.size());
pointMap.setSize(p.nPoints()); pointMap.clear();
bitSet pointHad(pointMap.size(), false); bitSet pointUsed(p.nPoints());
forAll(p, oldFacei) label facei = 0;
forAll(localFaces, oldFacei)
{ {
if (includeFaces[oldFacei]) if (includeFaces[oldFacei])
{ {
// Store new faces compact // Compact storage for new faces
faceMap[facei++] = oldFacei; faceMap[facei++] = oldFacei;
// Renumber labels for face // Local points used by face
const Face& f = localFaces[oldFacei]; pointUsed.set(localFaces[oldFacei]);
forAll(f, fp)
{
const label ptLabel = f[fp];
if (pointHad.set(ptLabel))
{
pointMap[pointi++] = ptLabel;
}
}
} }
} }
// Trim // The newToOld mappings
faceMap.setSize(facei); faceMap.resize(facei);
pointMap.setSize(pointi); pointMap = pointUsed.sortedToc();
} }
...@@ -221,19 +211,16 @@ void Foam::PatchTools::calcBounds ...@@ -221,19 +211,16 @@ void Foam::PatchTools::calcBounds
// ourselves // ourselves
const PointField& points = p.points(); const PointField& points = p.points();
bitSet pointIsUsed(points.size()); bitSet pointUsed(points.size());
nPoints = 0; nPoints = 0;
bb = boundBox::invertedBox; bb = boundBox::invertedBox;
forAll(p, facei) for (const Face& f : p)
{ {
const Face& f = p[facei]; for (const label pointi : f)
forAll(f, fp)
{ {
label pointi = f[fp]; if (pointUsed.set(pointi))
if (pointIsUsed.set(pointi))
{ {
bb.add(points[pointi]); bb.add(points[pointi]);
++nPoints; ++nPoints;
......
Markdown is supported
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