STYLE: use List clear() instead of setSize(0), resize(0)

- adds some consistency
This commit is contained in:
Mark Olesen
2023-09-27 17:04:22 +02:00
committed by Andrew Heather
parent 9ac0f03963
commit 524c953af3
15 changed files with 47 additions and 54 deletions

View File

@ -200,7 +200,7 @@ int main(int argc, char *argv[])
)
{
patchMasterBlocks[patchi] = -1;
rawPatches[patchi].setSize(0);
rawPatches[patchi].clear();
}
else
{

View File

@ -1211,7 +1211,7 @@ int main(int argc, char *argv[])
{
meshMod.addPoint(points[pointi], pointi, -1, true);
}
points.setSize(0);
points.clear();
// Add all cells
for (label celli = 0; celli < nCells; celli++)
@ -1411,9 +1411,9 @@ int main(int argc, char *argv[])
}
// Reclaim storage
faces.setSize(0);
owner.setSize(0);
neighbour.setSize(0);
faces.clear();
owner.clear();
neighbour.clear();
// Modify mesh

View File

@ -1059,7 +1059,7 @@ int main(int argc, char *argv[])
}
}
patchFaces.setSize(0); // Assume that this is no patch at all
patchFaces.clear(); // Assume that this is no patch at all
if (cellCorrespondence[faceIndices[0]] >= 0)
{

View File

@ -71,8 +71,8 @@ bool uniform::sizeLocations
scalarField& shapeSizes
) const
{
shapePts.setSize(0);
shapeSizes.setSize(0);
shapePts.clear();
shapeSizes.clear();
return true;
}

View File

@ -245,10 +245,10 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
// Clear the temporary storage for the coarse cell data
cCellnFaces.setSize(0);
cCellFaces.setSize(0);
initCoarseNeighb.setSize(0);
coarseFaceMap.setSize(0);
cCellnFaces.clear();
cCellFaces.clear();
initCoarseNeighb.clear();
coarseFaceMap.clear();
// Create coarse-level interfaces

View File

@ -208,10 +208,10 @@ void Foam::polyMesh::clearPrimitives()
{
resetMotion();
points_.setSize(0);
faces_.setSize(0);
owner_.setSize(0);
neighbour_.setSize(0);
points_.clear();
faces_.clear();
owner_.clear();
neighbour_.clear();
clearedPrimitives_ = true;
}

View File

@ -324,10 +324,10 @@ void Foam::coupledPolyPatch::calcTransformTensors
if (Cf.size() == 0)
{
// Dummy geometry. Assume non-separated, parallel.
separation_.setSize(0);
separation_.clear();
forwardT_.clear();
reverseT_.clear();
collocated_.setSize(0);
collocated_.clear();
}
else
{
@ -352,7 +352,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Assume per-face differing transformation, correct later
separation_.setSize(0);
separation_.clear();
forwardT_.setSize(Cf.size());
reverseT_.setSize(Cf.size());
@ -390,8 +390,8 @@ void Foam::coupledPolyPatch::calcTransformTensors
{
// Translational or (unknown and normals aligned)
forwardT_.setSize(0);
reverseT_.setSize(0);
forwardT_.clear();
reverseT_.clear();
separation_ = Cr - Cf;
@ -443,7 +443,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
<< ". Assuming zero separation." << endl;
}
separation_.setSize(0);
separation_.clear();
collocated_ = boolList(1, true);
}
else

View File

@ -294,7 +294,7 @@ void Foam::cyclicPolyPatch::calcTransforms
const_cast<tensorField&>(forwardT()) = tensorField(1, revT.T());
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
const_cast<vectorField&>(separation()).setSize(0);
const_cast<vectorField&>(separation()).clear();
const_cast<boolList&>(collocated()) = boolList(1, false);
}
else

View File

@ -1229,20 +1229,20 @@ void Foam::polyDualMesh::calcDual
// Create cells.
cellList dualCells(mesh.nPoints());
forAll(dualCells, celli)
{
dualCells[celli].setSize(0);
}
// unnecessary...
// forAll(dualCells, celli)
// {
// dualCells[celli].clear();
// }
forAll(dualOwner, facei)
{
label celli = dualOwner[facei];
labelList& cFaces = dualCells[celli];
label sz = cFaces.size();
cFaces.setSize(sz+1);
cFaces[sz] = facei;
if (celli != -1)
{
dualCells[celli].push_back(facei);
}
}
forAll(dualNeighbour, facei)
{
@ -1250,11 +1250,7 @@ void Foam::polyDualMesh::calcDual
if (celli != -1)
{
labelList& cFaces = dualCells[celli];
label sz = cFaces.size();
cFaces.setSize(sz+1);
cFaces[sz] = facei;
dualCells[celli].push_back(facei);
}
}

View File

@ -1006,7 +1006,7 @@ Foam::label Foam::polyMeshFilter::filterEdges
label nOuterIterations = 0;
minEdgeLen_.resize(mesh_.nEdges(), minLen());
faceFilterFactor_.resize(0);
faceFilterFactor_.clear();
labelList pointErrorCount(mesh_.nPoints(), Zero);

View File

@ -445,7 +445,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
// At this point, wallFaceBbsToExchange does not need to be
// maintained or distributed as it is not longer needed.
wallFaceBbsToExchange.setSize(0);
wallFaceBbsToExchange.clear();
wallFaceMap().reverseDistribute
(
@ -615,9 +615,9 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
List<label>& extendedProcBbsOrigProc
)
{
extendedProcBbsInRange.setSize(0);
extendedProcBbsTransformIndex.setSize(0);
extendedProcBbsOrigProc.setSize(0);
extendedProcBbsInRange.clear();
extendedProcBbsTransformIndex.clear();
extendedProcBbsOrigProc.clear();
DynamicList<treeBoundBox> tmpExtendedProcBbsInRange;
DynamicList<label> tmpExtendedProcBbsTransformIndex;

View File

@ -234,7 +234,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
const_cast<tensorField&>(forwardT()) = tensorField(1, revT.T());
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
const_cast<vectorField&>(separation()).setSize(0);
const_cast<vectorField&>(separation()).clear();
const_cast<boolList&>(collocated()) = boolList(1, false);
break;
@ -269,7 +269,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
const_cast<tensorField&>(forwardT()).clear();
const_cast<tensorField&>(reverseT()).clear();
const_cast<vectorField&>(separation()).setSize(0);
const_cast<vectorField&>(separation()).clear();
const_cast<boolList&>(collocated()) = boolList(1, true);
break;

View File

@ -2890,7 +2890,7 @@ void Foam::polyTopoChange::removeFace
<< abort(FatalError);
}
faces_[facei].setSize(0);
faces_[facei].clear();
region_[facei] = -1;
faceOwner_[facei] = -1;
faceNeighbour_[facei] = -1;

View File

@ -618,7 +618,7 @@ Foam::faceTriangulation::faceTriangulation
if (!valid)
{
setSize(0);
clear();
}
}
@ -639,7 +639,7 @@ Foam::faceTriangulation::faceTriangulation
if (!valid)
{
setSize(0);
clear();
}
}

View File

@ -252,11 +252,9 @@ void Foam::radiation::viewFactor::initialise()
DebugInFunction<< "Number of procBound : " << nbri << endl;
PtrList<const lduPrimitiveProcessorInterface> primitiveInterfaces;
primitiveInterfaces.setSize(nbri);
internalCoeffs_.setSize(0);
boundaryCoeffs_.setSize(nbri);
PtrList<const lduPrimitiveProcessorInterface> primitiveInterfaces(nbri);
internalCoeffs_.clear();
boundaryCoeffs_.resize_null(nbri);
nbri = 0;
@ -368,8 +366,7 @@ void Foam::radiation::viewFactor::initialise()
);
}
lduInterfacePtrsList allInterfaces;
allInterfaces.setSize(primitiveInterfaces.size());
lduInterfacePtrsList allInterfaces(primitiveInterfaces.size());
forAll(primitiveInterfaces, i)
{