ENH: consistency of HashSet setMany(), insertMany() with packed-list version

- this also provides a better separation of the intent
  (ie, inserting a single value, or inserting multiply values)
This commit is contained in:
Mark Olesen
2018-03-14 21:08:29 +01:00
parent 5d1fb23555
commit d17bc72585
64 changed files with 516 additions and 631 deletions

View File

@ -122,10 +122,7 @@ int main(int argc, char *argv[])
const labelList& pCells = mesh.pointCells()[meshPointi];
forAll(pCells, pCelli)
{
cutCells.insert(pCells[pCelli]);
}
cutCells.insertMany(pCells);
}
}

View File

@ -184,11 +184,7 @@ int main(int argc, char *argv[])
const DynamicList<label>& bin = bins[binI];
cellSet cells(mesh, "vol" + name(binI), bin.size());
forAll(bin, i)
{
cells.insert(bin[i]);
}
cells.insertMany(bin);
Info<< " " << lowerLimits[binI] << " .. " << upperLimits[binI]
<< " : writing " << bin.size() << " cells to cellSet "

View File

@ -633,10 +633,7 @@ int main(int argc, char *argv[])
);
cellSet cutSet(mesh, "cutSet", cutCells.size());
forAll(cutCells, i)
{
cutSet.insert(cutCells[i]);
}
cutSet.insertMany(cutCells);
// Gets cuts across cells from cuts through edges.
Info<< "Writing " << cutSet.size() << " cells to cut to cellSet "

View File

@ -956,11 +956,7 @@ int main(int argc, char *argv[])
forAll(dofVertIndices, patchi)
{
const labelList& foamVerts = dofVertIndices[patchi];
forAll(foamVerts, i)
{
dofGroups[patchi].insert(foamVerts[i]);
}
dofGroups[patchi].insertMany(foamVerts);
}
List<DynamicList<face>> dynPatchFaces(dofVertIndices.size());

View File

@ -344,10 +344,7 @@ void writePointCells
{
const labelList& cEdges = mesh.cellEdges()[pCells[i]];
forAll(cEdges, i)
{
allEdges.insert(cEdges[i]);
}
allEdges.insertMany(cEdges);
}

View File

@ -795,10 +795,7 @@ int main(int argc, char *argv[])
forAll(addedCells, facei)
{
const labelList& aCells = addedCells[facei];
forAll(aCells, i)
{
addedCellsSet.insert(aCells[i]);
}
addedCellsSet.insertMany(aCells);
}
}
}

View File

@ -527,10 +527,7 @@ label findUncoveredPatchFace
{
// Make set of extruded faces.
labelHashSet extrudeFaceSet(extrudeMeshFaces.size());
forAll(extrudeMeshFaces, i)
{
extrudeFaceSet.insert(extrudeMeshFaces[i]);
}
extrudeFaceSet.insertMany(extrudeMeshFaces);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelList& eFaces = mesh.edgeFaces()[meshEdgeI];
@ -564,10 +561,7 @@ label findUncoveredCyclicPatchFace
{
// Make set of extruded faces.
labelHashSet extrudeFaceSet(extrudeMeshFaces.size());
forAll(extrudeMeshFaces, i)
{
extrudeFaceSet.insert(extrudeMeshFaces[i]);
}
extrudeFaceSet.insertMany(extrudeMeshFaces);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelList& eFaces = mesh.edgeFaces()[meshEdgeI];

View File

@ -1053,10 +1053,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
nInvalidPolyhedra++;
forAll(cells[cI], cFI)
{
wrongFaces.insert(cells[cI][cFI]);
}
wrongFaces.insertMany(cells[cI]);
}
}
@ -1096,11 +1093,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
if (nInternalFaces[cI] <= 1)
{
oneInternalFaceCells++;
forAll(cells[cI], cFI)
{
wrongFaces.insert(cells[cI][cFI]);
}
wrongFaces.insertMany(cells[cI]);
}
}
@ -1132,13 +1125,8 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// forAll(f, fPtI)
// {
// label ptI = f[fPtI];
// const labelList& pC = ptCells[ptI];
// forAll(pC, pCI)
// {
// limitCells.insert(pC[pCI]);
// }
// limitCells.insertMany(pC);
// }
// }

View File

@ -1366,15 +1366,10 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findRemainingProtrusionSet
mesh.nCells()/1000
);
forAllConstIter(labelHashSet, protrudingBoundaryPoints, iter)
for (const label pointi : protrudingBoundaryPoints)
{
const label pointi = iter.key();
const labelList& pCells = mesh.pointCells()[pointi];
forAll(pCells, pCI)
{
protrudingCells.insert(pCells[pCI]);
}
protrudingCells.insertMany(pCells);
}
label protrudingCellsSize = protrudingCells.size();

View File

@ -349,11 +349,7 @@ int main(int argc, char *argv[])
forAll(oldToNew, oldCelli)
{
const labelList& added = oldToNew[oldCelli];
forAll(added, i)
{
newCells.insert(added[i]);
}
newCells.insertMany(added);
}
Info<< "Writing refined cells ("

View File

@ -301,10 +301,7 @@ void Foam::regionSide::walkAllPointConnectedFaces
const label facei = iter.key();
const labelList& fEdges = mesh.faceEdges()[facei];
forAll(fEdges, fEdgeI)
{
regionEdges.insert(fEdges[fEdgeI]);
}
regionEdges.insertMany(fEdges);
}

View File

@ -311,7 +311,7 @@ int main(int argc, char *argv[])
wordHashSet names;
forAllConstIters(rp, iter)
{
names.insert(iter.object());
names.insertMany(iter.object());
}
regionNames = names.sortedToc();

View File

@ -186,7 +186,7 @@ int main(int argc, char *argv[])
wordHashSet names;
forAllConstIters(rp, iter)
{
names.insert(iter.object());
names.insertMany(iter.object());
}
regionNames = names.sortedToc();

View File

@ -103,9 +103,9 @@ if (timeDirs.size())
fileName::FILE
);
forAll(contents, fileI)
for (const fileName& file : contents)
{
missing.erase(contents[fileI].name());
missing.erase(file.name());
}
volumeFields.erase(missing);

View File

@ -227,7 +227,7 @@ void Foam::vtkPVFoam::updateInfoLagrangian
for (const instant& t : dbPtr_().times())
{
names.insert
names.insertMany
(
readDir
(

View File

@ -123,7 +123,7 @@ Foam::boundaryInfo::boundaryInfo(const Time& runTime, const word& regionName)
if (dict.found("inGroups"))
{
dict.lookup("inGroups") >> groups_[patchI];
allGroupNames_.insert(groups_[patchI]);
allGroupNames_.insertMany(groups_[patchI]);
}
}
}

View File

@ -225,9 +225,9 @@ void syncEdges(const triSurface& p, labelHashSet& markedEdges)
const edgeList& edges = p.edges();
edgeHashSet edgeSet(2*markedEdges.size());
forAllConstIter(labelHashSet, markedEdges, iter)
for (const label edgei : markedEdges)
{
edgeSet.insert(edges[iter.key()]);
edgeSet.insert(edges[edgei]);
}
forAll(edges, edgei)

View File

@ -202,11 +202,7 @@ int main(int argc, char *argv[])
for (const wordRe& zoneName : zoneNames)
{
labelList zoneIDs = findStrings(zoneName, allZoneNames);
forAll(zoneIDs, j)
{
includeFaceZones.insert(zoneIDs[j]);
}
includeFaceZones.insertMany(zoneIDs);
if (zoneIDs.empty())
{