mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: List/DynamicList appendUniq() method
- affords some code reduction. STYLE: use HashSet insert() without found() check in more places
This commit is contained in:
committed by
Andrew Heather
parent
6dc6d7ca9a
commit
cdbc3e2de6
@ -100,10 +100,7 @@ int main(int argc, char *argv[])
|
||||
const wordList& regions = iter();
|
||||
forAll(regions, i)
|
||||
{
|
||||
if (!regionNames.found(regions[i]))
|
||||
{
|
||||
regionNames.append(regions[i]);
|
||||
}
|
||||
regionNames.appendUniq(regions[i]);
|
||||
}
|
||||
}
|
||||
regionDirs = regionNames;
|
||||
|
||||
@ -894,15 +894,8 @@ void Foam::conformalVoronoiMesh::checkCellSizing()
|
||||
const label faceOwner = pMesh.faceOwner()[facei];
|
||||
const label faceNeighbour = pMesh.faceNeighbour()[facei];
|
||||
|
||||
if (!cellsToResizeMap.found(faceOwner))
|
||||
{
|
||||
cellsToResizeMap.insert(faceOwner);
|
||||
}
|
||||
|
||||
if (!cellsToResizeMap.found(faceNeighbour))
|
||||
{
|
||||
cellsToResizeMap.insert(faceNeighbour);
|
||||
}
|
||||
cellsToResizeMap.insert(faceOwner);
|
||||
cellsToResizeMap.insert(faceNeighbour);
|
||||
}
|
||||
|
||||
cellsToResizeMap += protrudingCells;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -727,11 +727,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
|
||||
if (nearest.hit() || nearestEdge.hit())
|
||||
{
|
||||
nStoppedInsertion++;
|
||||
|
||||
if (!hits[proci].found(peI))
|
||||
{
|
||||
hits[proci].insert(peI);
|
||||
}
|
||||
hits[proci].insert(peI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -822,11 +818,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
|
||||
// << endl;
|
||||
|
||||
nStoppedInsertion++;
|
||||
|
||||
if (!hits[proci].found(peI))
|
||||
{
|
||||
hits[proci].insert(peI);
|
||||
}
|
||||
hits[proci].insert(peI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -467,15 +468,8 @@ inline Foam::List<Foam::label> Foam::conformalVoronoiMesh::processorsAttached
|
||||
|
||||
forAll(c1Procs, aPI)
|
||||
{
|
||||
if (!procsAttached.found(c1Procs[aPI]))
|
||||
{
|
||||
procsAttached.append(c1Procs[aPI]);
|
||||
}
|
||||
|
||||
if (!procsAttached.found(c2Procs[aPI]))
|
||||
{
|
||||
procsAttached.append(c2Procs[aPI]);
|
||||
}
|
||||
procsAttached.appendUniq(c1Procs[aPI]);
|
||||
procsAttached.appendUniq(c2Procs[aPI]);
|
||||
}
|
||||
|
||||
return List<label>(procsAttached);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,23 +36,6 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::shortEdgeFilter2D::addRegion
|
||||
(
|
||||
const label regionI,
|
||||
DynamicList<label>& bPointRegions
|
||||
) const
|
||||
{
|
||||
if (bPointRegions.empty())
|
||||
{
|
||||
bPointRegions.append(regionI);
|
||||
}
|
||||
else if (!bPointRegions.found(regionI))
|
||||
{
|
||||
bPointRegions.append(regionI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::shortEdgeFilter2D::assignBoundaryPointRegions
|
||||
(
|
||||
List<DynamicList<label>>& boundaryPointRegions
|
||||
@ -61,13 +44,10 @@ void Foam::shortEdgeFilter2D::assignBoundaryPointRegions
|
||||
forAllConstIters(mapEdgesRegion_, iter)
|
||||
{
|
||||
const edge& e = iter.key();
|
||||
const label& regionI = iter();
|
||||
const label regi = iter.val();
|
||||
|
||||
const label startI = e.start();
|
||||
const label endI = e.end();
|
||||
|
||||
addRegion(regionI, boundaryPointRegions[startI]);
|
||||
addRegion(regionI, boundaryPointRegions[endI]);
|
||||
boundaryPointRegions[e.start()].appendUniq(regi);
|
||||
boundaryPointRegions[e.end()].appendUniq(regi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Foam
|
||||
|
||||
class shortEdgeFilter2D
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
const CV2D& cv2Dmesh_;
|
||||
|
||||
@ -72,12 +72,6 @@ class shortEdgeFilter2D
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void addRegion
|
||||
(
|
||||
const label regionI,
|
||||
DynamicList<label>& bPointRegions
|
||||
) const;
|
||||
|
||||
void assignBoundaryPointRegions
|
||||
(
|
||||
List<DynamicList<label>>& boundaryPointRegions
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -516,9 +516,9 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
{
|
||||
label startDual = faceToDualPoint_[startFaceLabel];
|
||||
|
||||
if (startDual != -1 && !verts.found(startDual))
|
||||
if (startDual != -1)
|
||||
{
|
||||
verts.append(startDual);
|
||||
verts.appendUniq(startDual);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user