STYLE: prefer push_uniq() to appendUniq

- more consistency with push_back etc.
This commit is contained in:
Mark Olesen
2023-08-21 16:56:35 +02:00
parent 2395e493d1
commit 698e05eeb3
20 changed files with 42 additions and 78 deletions

View File

@ -468,8 +468,8 @@ inline Foam::List<Foam::label> Foam::conformalVoronoiMesh::processorsAttached
forAll(c1Procs, aPI)
{
procsAttached.appendUniq(c1Procs[aPI]);
procsAttached.appendUniq(c2Procs[aPI]);
procsAttached.push_uniq(c1Procs[aPI]);
procsAttached.push_uniq(c2Procs[aPI]);
}
return List<label>(procsAttached);

View File

@ -46,8 +46,8 @@ void Foam::shortEdgeFilter2D::assignBoundaryPointRegions
const edge& e = iter.key();
const label regi = iter.val();
boundaryPointRegions[e.start()].appendUniq(regi);
boundaryPointRegions[e.end()].appendUniq(regi);
boundaryPointRegions[e.first()].push_uniq(regi);
boundaryPointRegions[e.second()].push_uniq(regi);
}
}
@ -66,7 +66,7 @@ void Foam::shortEdgeFilter2D::updateEdgeRegionMap
const edgeList& edges = surfMesh.edges();
const labelList& meshPoints = surfMesh.meshPoints();
patchSizes.setSize(patchNames_.size(), 0);
patchSizes.resize_nocopy(patchNames_.size());
patchSizes = 0;
forAll(edges, edgeI)
@ -78,15 +78,13 @@ void Foam::shortEdgeFilter2D::updateEdgeRegionMap
const edge& e = edges[edgeI];
const label startI = meshPoints[e[0]];
const label endI = meshPoints[e[1]];
label region = -1;
const DynamicList<label> startPtRegions =
boundaryPtRegions[surfPtToBoundaryPt[startI]];
const DynamicList<label> endPtRegions =
boundaryPtRegions[surfPtToBoundaryPt[endI]];
const DynamicList<label>& startPtRegions =
boundaryPtRegions[surfPtToBoundaryPt[meshPoints[e.first()]]];
const DynamicList<label>& endPtRegions =
boundaryPtRegions[surfPtToBoundaryPt[meshPoints[e.second()]]];
if (startPtRegions.size() > 1 && endPtRegions.size() > 1)
{

View File

@ -518,7 +518,7 @@ void Foam::meshDualiser::createFacesAroundEdge
if (startDual != -1)
{
verts.appendUniq(startDual);
verts.push_uniq(startDual);
}
}
break;

View File

@ -497,7 +497,7 @@ bool Foam::fileMonitor::removeWatch(const label watchFd)
<< watchFile_[watchFd] << endl;
}
freeWatchFds_.appendUniq(watchFd);
freeWatchFds_.push_uniq(watchFd);
return watcher_->removeWatch(watchFd);
}

View File

@ -493,7 +493,7 @@ bool Foam::fileMonitor::removeWatch(const label watchFd)
<< watchFile_[watchFd] << endl;
}
freeWatchFds_.appendUniq(watchFd);
freeWatchFds_.push_uniq(watchFd);
return watcher_->removeWatch(watchFd);
}

View File

@ -524,8 +524,8 @@ public:
//FOAM_DEPRECATED_FOR(2022-10, "push_back()")
void append(const UList<T>& list) { this->push_back(list); }
//- Append an element if not already in the buffer.
//FOAM_DEPRECATED_FOR(2022-10, "push_uniq()")
//- Same as push_uniq()
FOAM_DEPRECATED_STRICT(2022-10, "push_uniq()")
label appendUniq(const T& val) { return this->push_uniq(val); }
};

View File

@ -443,8 +443,8 @@ public:
this->push_back(std::move(list));
}
//- Append an element if not already in the list.
//FOAM_DEPRECATED_FOR(2022-10, "push_uniq()")
//- Same as push_uniq()
FOAM_DEPRECATED_STRICT(2022-10, "push_uniq()")
label appendUniq(const T& val) { return this->push_uniq(val); }
};

View File

@ -395,8 +395,8 @@ public:
this->push_back(list);
}
//- Append an element if not already in the list.
//FOAM_DEPRECATED_FOR(2022-10, "push_uniq()")
//- Same as push_uniq()
FOAM_DEPRECATED_STRICT(2022-10, "push_uniq()")
label appendUniq(const T& val) { return this->push_uniq(val); }

View File

@ -1065,14 +1065,9 @@ void Foam::ListOps::appendEqOp<T>::operator()
{
if (y.size())
{
label len = x.size();
if (len)
if (x.size())
{
x.resize(len + y.size());
for (const T& val : y)
{
x[len++] = val;
}
x.push_back(y);
}
else
{
@ -1095,11 +1090,7 @@ void Foam::ListOps::uniqueEqOp<T>::operator()
{
for (const T& val : y)
{
// --> x.push_uniq(val)
if (!x.contains(val))
{
x.push_back(val);
}
x.push_uniq(val);
}
}
else

View File

@ -239,7 +239,7 @@ Foam::List<Foam::labelPair> Foam::mapDistributeBase::schedule
for (const labelPair& connection : nbrData)
{
allComms.appendUniq(connection);
allComms.push_uniq(connection);
}
}
}

View File

@ -184,16 +184,16 @@ public:
//- Same as contains(), searches the hash.
bool found(const word& val) const { return this->contains(val); }
//- Append an element if not already in the list.
//- Same as push_uniq()
FOAM_DEPRECATED_FOR(2022-05, "push_uniq method")
void append(const word& val) { this->push_uniq(val); }
//- Append an element if not already in the list.
//- Same as push_uniq()
FOAM_DEPRECATED_FOR(2022-10, "push_uniq method")
void push_back(const word& val) { this->push_uniq(val); }
//- Append an element if not already in the list.
//FOAM_DEPRECATED_FOR(2022-10, "push_uniq method")
//- Same as push_uniq()
FOAM_DEPRECATED_STRICT(2022-10, "push_uniq method")
label appendUniq(const word& val) { return this->push_uniq(val); }
};

View File

@ -212,7 +212,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames)
{
for (const word& name : names)
{
mergedNames.appendUniq(name);
mergedNames.push_uniq(name);
}
}
}

View File

@ -262,7 +262,7 @@ bool Foam::combineFaces::faceNeighboursValid
}
else
{
neighbourFaces.appendUniq(nbrI);
neighbourFaces.push_uniq(nbrI);
}
}

View File

@ -1837,26 +1837,11 @@ bool Foam::hexRef8::matchHexShape
{
// Add to pointFaces for any level+1 point (this might be
// a midpoint of a split face)
forAll(f, fp)
for (const label pointi : f)
{
label pointi = f[fp];
if (pointLevel_[pointi] == cellLevel+1)
{
auto iter = pointFaces.find(pointi);
if (iter.good())
{
labelList& pFaces = iter.val();
pFaces.appendUniq(facei);
}
else
{
pointFaces.insert
(
pointi,
labelList(one{}, facei)
);
}
pointFaces(pointi).push_uniq(facei);
}
}
}

View File

@ -57,12 +57,10 @@ void Foam::enrichedPatch::calcPointPoints() const
DynamicList<label>& curPp = pp[curFace[pointi]];
// Do next label
const label next = curFace.nextLabel(pointi);
curPp.appendUniq(next);
curPp.push_uniq(curFace.nextLabel(pointi));
// Do previous label
const label prev = curFace.prevLabel(pointi);
curPp.appendUniq(prev);
curPp.push_uniq(curFace.prevLabel(pointi));
}
}

View File

@ -176,7 +176,7 @@ void Foam::CFCFaceToCellStencil::calcCellStencil
label nbrGlobali = globalNumbering().toGlobal(nbrFacei);
// Note:should use hashset?
allGlobalFaces.appendUniq(nbrGlobali);
allGlobalFaces.push_uniq(nbrGlobali);
}
}
}
@ -188,7 +188,7 @@ void Foam::CFCFaceToCellStencil::calcCellStencil
for (const label nbrGlobali : nbrGlobalFaces)
{
// Note:should use hashset?
allGlobalFaces.appendUniq(nbrGlobali);
allGlobalFaces.push_uniq(nbrGlobali);
}
}
}

View File

@ -1967,16 +1967,8 @@ void Foam::snappyLayerDriver::getPatchDisplacement
// const label patchFacei = pFaces[pFacei];
// const label meshFacei = pp.addressing()[patchFacei];
// const label celli = mesh.faceOwner()[meshFacei];
// Map<labelList>::iterator faceFnd = cellToFaces.find(celli);
// if (faceFnd.good())
// {
// labelList& faces = faceFnd();
// faces.appendUniq(patchFacei);
// }
// else
// {
// cellToFaces.insert(celli, labelList(one{}, patchFacei));
// }
//
// cellToFaces(celli).push_uniq(patchFacei);
// }
//
// forAllConstIters(cellToFaces, iter)

View File

@ -107,7 +107,7 @@ void Foam::cellDistFuncs::getPointNeighbours
for (const label nbr : faceNeighbours)
{
neighbours.appendUniq(nbr);
neighbours.push_uniq(nbr);
}
// Add all point-only neighbours by linear searching in edge neighbours.
@ -125,7 +125,7 @@ void Foam::cellDistFuncs::getPointNeighbours
for (const label facei : pointNbs)
{
// Check for facei in edge-neighbours part of neighbours
neighbours.appendUniq(facei);
neighbours.push_uniq(facei);
}
}

View File

@ -166,9 +166,9 @@ void Foam::meshToMeshMethod::appendNbrCells
// filter out cells already visited from cell neighbours
for (const label nbrCelli : nbrCells)
{
if (!visitedCells.found(nbrCelli))
if (!visitedCells.contains(nbrCelli))
{
nbrCellIDs.appendUniq(nbrCelli);
nbrCellIDs.push_uniq(nbrCelli);
}
}
}

View File

@ -93,7 +93,7 @@ Foam::solidReaction<ReactionThermo>::solidReaction
speciesTable allSpecies(species);
for (const word& gasName : pyrolisisGases_)
{
allSpecies.appendUniq(gasName);
allSpecies.push_uniq(gasName);
}
List<specieCoeffs> dummyLhs;
List<specieCoeffs> dummyRhs;