Commit a2b73a1c authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use X.last() method instead of X[X.size()-1]

parent f367ee2e
......@@ -260,7 +260,7 @@ cellShape create3DCellShape
meshFaceLabels[i - 1] = meshFaceLabels[i];
}
meshFaceLabels[meshFaceLabels.size() - 1] = firstLabel;
meshFaceLabels.last() = firstLabel;
}
}
......
......@@ -80,7 +80,7 @@ Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p)
<< pName << " in mesh " << caseName
<< " already exists, but patch types "
<< " do not match.\nCreating a composite name as "
<< patchNames_[patchNames_.size() - 1] << endl;
<< patchNames_.last() << endl;
}
else
{
......
......@@ -150,7 +150,7 @@ void Foam::processorLduInterface::compressedSend
fArray[i] = sArray[i] - slast[i%nCmpts];
}
reinterpret_cast<Type&>(fArray[nm1]) = f[f.size() - 1];
reinterpret_cast<Type&>(fArray[nm1]) = f.last();
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{
......@@ -235,7 +235,7 @@ void Foam::processorLduInterface::compressedReceive
const float *fArray =
reinterpret_cast<const float*>(receiveBuf_.begin());
f[f.size() - 1] = reinterpret_cast<const Type&>(fArray[nm1]);
f.last() = reinterpret_cast<const Type&>(fArray[nm1]);
scalar *sArray = reinterpret_cast<scalar*>(f.begin());
const scalar *slast = &sArray[nm1];
......
......@@ -750,7 +750,7 @@ Foam::edgeList Foam::face::edges() const
}
// add last edge
e[points.size() - 1] = edge(points[points.size() - 1], points[0]);
e.last() = edge(points.last(), points[0]);
return e;
}
......
......@@ -305,7 +305,7 @@ void Foam::meshReader::createPolyBoundary()
if (nMissingFaces > 0)
{
patchSizes_[patchSizes_.size() - 1] = nMissingFaces;
patchSizes_.last() = nMissingFaces;
}
else
{
......
......@@ -127,7 +127,7 @@ Foam::label Foam::polyMeshAdder::patchIndex
<< pName << " in mesh " << caseName
<< " already exists, but patch types"
<< " do not match.\nCreating a composite name as "
<< allPatchNames[allPatchNames.size() - 1] << endl;
<< allPatchNames.last() << endl;
return allPatchNames.size() - 1;
}
......
......@@ -519,7 +519,7 @@ void Foam::enrichedPatch::calcCutFaces() const
// Reverse the face such that it
// points out of the master patch
cf[cf.size() - 1].flip();
cf.last().flip();
if (debug)
{
......
......@@ -101,8 +101,8 @@ Foam::swirlInjector::swirlInjector
(
mag
(
massFlowRateProfile_[massFlowRateProfile_.size() - 1][0]
- injectionPressureProfile_[injectionPressureProfile_.size() - 1][0]
massFlowRateProfile_.last()[0]
- injectionPressureProfile_.last()[0]
) > SMALL
)
{
......
......@@ -447,9 +447,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
point startPoint = Points[unorderedEdge[0]];
dist[0] = 0;
vector dir =
Points[unorderedEdge[unorderedEdge.size() - 1]]
- startPoint;
vector dir = Points[unorderedEdge.last()] - startPoint;
for (label i = 1; i < dist.size(); i++)
{
......@@ -509,7 +507,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
edge testEdge
(
orderedEdge[0],
orderedEdge[orderedEdge.size() - 1]
orderedEdge.last()
);
// In order to avoid edge-to-edge comparison, get faces using
......
......@@ -292,7 +292,7 @@ const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
Foam::label Foam::searchableSurfaceCollection::size() const
{
return indexOffset_[indexOffset_.size()-1];
return indexOffset_.last();
}
......
......@@ -238,7 +238,7 @@ void Foam::triSurfaceMesh::getNextIntersections
while (true)
{
// Start tracking from last hit.
point pt = hits[hits.size()-1].hitPoint() + perturbVec;
point pt = hits.last().hitPoint() + perturbVec;
if (((pt-start)&dirVec) > magSqrDirVec)
{
......
......@@ -514,7 +514,7 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
maxRegion = max
(
maxRegion,
operator[](faceMap[faceMap.size() - 1]).region()
operator[](faceMap.last()).region()
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment