ENH: avoid xfer on simple data types

- in many places can use move construcors or rely on RVO
This commit is contained in:
Mark Olesen
2018-01-26 12:50:06 +01:00
parent fa3acc9955
commit db1c1e89be
18 changed files with 134 additions and 152 deletions

View File

@ -172,7 +172,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
{
offsets[i] = mesh().nFaces();
}
const globalIndex globalRegions(offsets.xfer());
const globalIndex globalRegions(std::move(offsets));
// Minimise regions across connected cells
// Note: still uses global decisions so all processors are running
@ -215,7 +215,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
compactOffsets[i] = globalToCompact.size();
}
return autoPtr<globalIndex>(new globalIndex(compactOffsets.xfer()));
return autoPtr<globalIndex>(new globalIndex(std::move(compactOffsets)));
}

View File

@ -285,7 +285,7 @@ Foam::searchableSurfaceCollection::~searchableSurfaceCollection()
const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
{
if (regions_.size() == 0)
if (regions_.empty())
{
regionOffset_.setSize(subGeom_.size());
@ -309,7 +309,7 @@ const Foam::wordList& Foam::searchableSurfaceCollection::regions() const
}
}
}
regions_.transfer(allRegions.shrink());
regions_.transfer(allRegions);
}
return regions_;
}