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
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -290,8 +290,8 @@ Foam::label Foam::mapNearestMethod::findMappedSrcCell
|
||||
const List<DynamicList<label>>& tgtToSrc
|
||||
) const
|
||||
{
|
||||
DynamicList<label> testCells(10);
|
||||
DynamicList<label> visitedCells(10);
|
||||
DynamicList<label> testCells(16);
|
||||
DynamicList<label> visitedCells(16);
|
||||
|
||||
testCells.append(tgtCelli);
|
||||
|
||||
@ -312,11 +312,11 @@ Foam::label Foam::mapNearestMethod::findMappedSrcCell
|
||||
{
|
||||
const labelList& nbrCells = tgt_.cellCells()[tgtI];
|
||||
|
||||
forAll(nbrCells, i)
|
||||
for (const label nbrCelli : nbrCells)
|
||||
{
|
||||
if (!visitedCells.found(nbrCells[i]))
|
||||
if (!visitedCells.found(nbrCelli))
|
||||
{
|
||||
testCells.append(nbrCells[i]);
|
||||
testCells.append(nbrCelli);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -194,13 +194,9 @@ void Foam::meshToMeshMethod::appendNbrCells
|
||||
// filter out cells already visited from cell neighbours
|
||||
for (const label nbrCelli : nbrCells)
|
||||
{
|
||||
if
|
||||
(
|
||||
!visitedCells.found(nbrCelli)
|
||||
&& !nbrCellIDs.found(nbrCelli)
|
||||
)
|
||||
if (!visitedCells.found(nbrCelli))
|
||||
{
|
||||
nbrCellIDs.append(nbrCelli);
|
||||
nbrCellIDs.appendUniq(nbrCelli);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user