mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use updated HashTable methods
This commit is contained in:
committed by
Andrew Heather
parent
5dcced7b86
commit
d9727fad1c
@ -148,7 +148,7 @@ void Foam::cellSplitter::setRefinement
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
addedPoints_.clear();
|
addedPoints_.clear();
|
||||||
addedPoints_.resize(cellToMidPoint.size());
|
addedPoints_.reserve(cellToMidPoint.size());
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -184,7 +184,7 @@ void Foam::cellSplitter::setRefinement
|
|||||||
// Add cells (first one is modified original cell)
|
// Add cells (first one is modified original cell)
|
||||||
//
|
//
|
||||||
|
|
||||||
Map<labelList> cellToCells(cellToMidPoint.size());
|
Map<labelList> cellToCells(2*cellToMidPoint.size());
|
||||||
|
|
||||||
forAllConstIters(cellToMidPoint, iter)
|
forAllConstIters(cellToMidPoint, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -102,7 +102,7 @@ void Foam::fileFormats::ensightMeshReader::readIDs
|
|||||||
foamToElem.resize(sz+nShapes);
|
foamToElem.resize(sz+nShapes);
|
||||||
if (doRead)
|
if (doRead)
|
||||||
{
|
{
|
||||||
elemToFoam.resize(sz+nShapes);
|
elemToFoam.reserve(elemToFoam.size()+nShapes);
|
||||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||||
{
|
{
|
||||||
label elemi;
|
label elemi;
|
||||||
|
|||||||
@ -76,14 +76,14 @@ label nCells = 0;
|
|||||||
|
|
||||||
bool hangingNodes = false;
|
bool hangingNodes = false;
|
||||||
|
|
||||||
pointField points(0);
|
pointField points;
|
||||||
faceList faces(0);
|
faceList faces;
|
||||||
labelList owner(0);
|
labelList owner;
|
||||||
labelList neighbour(0);
|
labelList neighbour;
|
||||||
|
|
||||||
// Group type and name
|
// Group type and name
|
||||||
Map<word> groupType(128);
|
Map<word> groupType;
|
||||||
Map<word> groupName(128);
|
Map<word> groupName;
|
||||||
|
|
||||||
// Point groups
|
// Point groups
|
||||||
DynamicList<label> pointGroupZoneID;
|
DynamicList<label> pointGroupZoneID;
|
||||||
|
|||||||
@ -357,7 +357,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
|||||||
List<DynamicList<face>> patchFaces(1, DynamicList<face>());
|
List<DynamicList<face>> patchFaces(1, DynamicList<face>());
|
||||||
List<DynamicList<label>> patchOwners(1, DynamicList<label>());
|
List<DynamicList<label>> patchOwners(1, DynamicList<label>());
|
||||||
|
|
||||||
vertexMap.resize(vertexCount());
|
vertexMap.reserve(vertexCount());
|
||||||
cellMap.setSize(Triangulation::number_of_finite_cells(), -1);
|
cellMap.setSize(Triangulation::number_of_finite_cells(), -1);
|
||||||
|
|
||||||
// Calculate pts and a map of point index to location in pts.
|
// Calculate pts and a map of point index to location in pts.
|
||||||
|
|||||||
@ -240,13 +240,13 @@ bool Foam::checkWedges
|
|||||||
|
|
||||||
if (setPtr)
|
if (setPtr)
|
||||||
{
|
{
|
||||||
setPtr->resize(2*nEdgesInError);
|
setPtr->reserve(2*nEdgesInError);
|
||||||
forAllConstIters(edgesInError, iter)
|
forAllConstIters(edgesInError, iter)
|
||||||
{
|
{
|
||||||
if (iter() >= 0)
|
if (iter.val() >= 0)
|
||||||
{
|
{
|
||||||
setPtr->insert(iter.key()[0]);
|
setPtr->insert(iter.key().first());
|
||||||
setPtr->insert(iter.key()[1]);
|
setPtr->insert(iter.key().second());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -375,7 +375,7 @@ bool doCommand
|
|||||||
|
|
||||||
topoSet& currentSet = currentSetPtr();
|
topoSet& currentSet = currentSetPtr();
|
||||||
// Presize it according to current mesh data.
|
// Presize it according to current mesh data.
|
||||||
currentSet.resize(max(currentSet.size(), typSize));
|
currentSet.reserve(max(currentSet.size(), typSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2164,12 +2164,9 @@ Foam::label Foam::dynamicIndexedOctree<Type>::findBox
|
|||||||
|
|
||||||
if (!nodes_.empty())
|
if (!nodes_.empty())
|
||||||
{
|
{
|
||||||
if (!elements.capacity())
|
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
||||||
{
|
label estimatedCount(max(128, (shapes_.size() / 100)));
|
||||||
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
elements.reserve(estimatedCount);
|
||||||
label estimatedCapacity(max(256, 2*(shapes_.size() / 100)));
|
|
||||||
elements.resize(estimatedCapacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start node=0, store results
|
// start node=0, store results
|
||||||
findBox(0, searchBox, &elements);
|
findBox(0, searchBox, &elements);
|
||||||
@ -2223,12 +2220,9 @@ Foam::label Foam::dynamicIndexedOctree<Type>::findSphere
|
|||||||
|
|
||||||
if (!nodes_.empty())
|
if (!nodes_.empty())
|
||||||
{
|
{
|
||||||
if (!elements.capacity())
|
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
||||||
{
|
label estimatedCount(max(128, (shapes_.size() / 100)));
|
||||||
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
elements.reserve(estimatedCount);
|
||||||
label estimatedCapacity(max(256, 2*(shapes_.size()/100)));
|
|
||||||
elements.resize(estimatedCapacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start node=0, store results
|
// start node=0, store results
|
||||||
findSphere(0, centre, radiusSqr, &elements);
|
findSphere(0, centre, radiusSqr, &elements);
|
||||||
|
|||||||
@ -2517,12 +2517,9 @@ Foam::label Foam::indexedOctree<Type>::findBox
|
|||||||
|
|
||||||
if (!nodes_.empty())
|
if (!nodes_.empty())
|
||||||
{
|
{
|
||||||
if (!elements.capacity())
|
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
||||||
{
|
label estimatedCount(max(128, (shapes_.size() / 100)));
|
||||||
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
elements.reserve(estimatedCount);
|
||||||
label estimatedCapacity(max(256, 2*(shapes_.size() / 100)));
|
|
||||||
elements.resize(estimatedCapacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start node=0, store results
|
// start node=0, store results
|
||||||
findBox(0, searchBox, &elements);
|
findBox(0, searchBox, &elements);
|
||||||
@ -2576,12 +2573,9 @@ Foam::label Foam::indexedOctree<Type>::findSphere
|
|||||||
|
|
||||||
if (!nodes_.empty())
|
if (!nodes_.empty())
|
||||||
{
|
{
|
||||||
if (!elements.capacity())
|
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
||||||
{
|
label estimatedCount(max(128, (shapes_.size() / 100)));
|
||||||
// Some arbitrary minimal size estimate (eg, 1/100 are found)
|
elements.reserve(estimatedCount);
|
||||||
label estimatedCapacity(max(256, 2*(shapes_.size() / 100)));
|
|
||||||
elements.resize(estimatedCapacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start node=0, store results
|
// start node=0, store results
|
||||||
findSphere(0, centre, radiusSqr, &elements);
|
findSphere(0, centre, radiusSqr, &elements);
|
||||||
|
|||||||
@ -43,6 +43,7 @@ static wordHashSet getAcceptableFunctionKeys
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
wordHashSet acceptKeys(0);
|
wordHashSet acceptKeys(0);
|
||||||
|
wordHashSet rejectKeys(0);
|
||||||
|
|
||||||
if (!dictPtr)
|
if (!dictPtr)
|
||||||
{
|
{
|
||||||
@ -51,8 +52,8 @@ static wordHashSet getAcceptableFunctionKeys
|
|||||||
|
|
||||||
const dictionary& dict = *dictPtr;
|
const dictionary& dict = *dictPtr;
|
||||||
|
|
||||||
acceptKeys.resize(2*dict.size());
|
acceptKeys.reserve(dict.size());
|
||||||
wordHashSet rejectKeys(2*dict.size());
|
rejectKeys.reserve(dict.size());
|
||||||
|
|
||||||
for (const entry& dEntry : dict)
|
for (const entry& dEntry : dict)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -768,7 +768,7 @@ void Foam::globalPoints::remove
|
|||||||
|
|
||||||
// Save old ones.
|
// Save old ones.
|
||||||
Map<label> oldMeshToProcPoint(std::move(meshToProcPoint_));
|
Map<label> oldMeshToProcPoint(std::move(meshToProcPoint_));
|
||||||
meshToProcPoint_.resize(oldMeshToProcPoint.size());
|
meshToProcPoint_.reserve(oldMeshToProcPoint.size());
|
||||||
DynamicList<labelPairList> oldProcPoints(std::move(procPoints_));
|
DynamicList<labelPairList> oldProcPoints(std::move(procPoints_));
|
||||||
procPoints_.setCapacity(oldProcPoints.size());
|
procPoints_.setCapacity(oldProcPoints.size());
|
||||||
|
|
||||||
@ -867,7 +867,7 @@ void Foam::globalPoints::remove
|
|||||||
}
|
}
|
||||||
|
|
||||||
procPoints_.shrink();
|
procPoints_.shrink();
|
||||||
meshToProcPoint_.resize(2*procPoints_.size());
|
meshToProcPoint_.reserve(procPoints_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -413,7 +413,7 @@ void Foam::mapDistributeBase::calcCompactAddressing
|
|||||||
compactMap[proci].clear();
|
compactMap[proci].clear();
|
||||||
if (proci != myRank)
|
if (proci != myRank)
|
||||||
{
|
{
|
||||||
compactMap[proci].resize(2*nNonLocal[proci]);
|
compactMap[proci].reserve(nNonLocal[proci]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +464,7 @@ void Foam::mapDistributeBase::calcCompactAddressing
|
|||||||
compactMap[proci].clear();
|
compactMap[proci].clear();
|
||||||
if (proci != myRank)
|
if (proci != myRank)
|
||||||
{
|
{
|
||||||
compactMap[proci].resize(2*nNonLocal[proci]);
|
compactMap[proci].reserve(nNonLocal[proci]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -742,7 +742,7 @@ Foam::labelList Foam::polyBoundaryMesh::indices
|
|||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
if (useGroups && this->hasGroupIDs())
|
if (useGroups && this->hasGroupIDs())
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupPatchIDs();
|
const auto& groupLookup = groupPatchIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
@ -787,7 +787,7 @@ Foam::labelList Foam::polyBoundaryMesh::indices
|
|||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
if (useGroups && this->hasGroupIDs())
|
if (useGroups && this->hasGroupIDs())
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupPatchIDs();
|
const auto& groupLookup = groupPatchIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
@ -958,7 +958,7 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
|
|||||||
|
|
||||||
const label len = patches.size();
|
const label len = patches.size();
|
||||||
|
|
||||||
ids.resize(2*len);
|
ids.reserve(len);
|
||||||
|
|
||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
const bool checkGroups = (useGroups && this->hasGroupIDs());
|
const bool checkGroups = (useGroups && this->hasGroupIDs());
|
||||||
|
|||||||
@ -373,11 +373,11 @@ bool Foam::polyMesh::checkEdgeAlignment
|
|||||||
|
|
||||||
if (setPtr)
|
if (setPtr)
|
||||||
{
|
{
|
||||||
setPtr->resize(2*edgesInError.size());
|
setPtr->reserve(2*edgesInError.size());
|
||||||
forAllConstIters(edgesInError, iter)
|
forAllConstIters(edgesInError, iter)
|
||||||
{
|
{
|
||||||
setPtr->insert(iter.key()[0]);
|
setPtr->insert(iter.key().first());
|
||||||
setPtr->insert(iter.key()[1]);
|
setPtr->insert(iter.key().second());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ void Foam::syncTools::syncPointMap
|
|||||||
// global shared index per local index
|
// global shared index per local index
|
||||||
const labelList& sharedPtAddr = pd.sharedPointAddr();
|
const labelList& sharedPtAddr = pd.sharedPointAddr();
|
||||||
|
|
||||||
sharedPointValues.resize(sharedPtAddr.size());
|
sharedPointValues.reserve(sharedPtAddr.size());
|
||||||
|
|
||||||
// Fill my entries in the shared points
|
// Fill my entries in the shared points
|
||||||
forAll(sharedPtLabels, i)
|
forAll(sharedPtLabels, i)
|
||||||
|
|||||||
@ -384,7 +384,7 @@ Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
|
|||||||
|
|
||||||
if (checkGroups)
|
if (checkGroups)
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matcher.isPattern())
|
if (matcher.isPattern())
|
||||||
@ -459,7 +459,7 @@ Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
|
|||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
if (useGroups && this->hasGroupIDs())
|
if (useGroups && this->hasGroupIDs())
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupZoneIDs();
|
const auto& groupLookup = groupZoneIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
@ -505,7 +505,7 @@ Foam::labelList Foam::ZoneMesh<ZoneType, MeshType>::indices
|
|||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
if (useGroups && this->hasGroupIDs())
|
if (useGroups && this->hasGroupIDs())
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupZoneIDs();
|
const auto& groupLookup = groupZoneIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcBdryPoints() const
|
|||||||
<< "Calculating boundary points from existing addressing"
|
<< "Calculating boundary points from existing addressing"
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
bp.resize(4*nBoundaryEdges());
|
bp.reserve(2*nBoundaryEdges());
|
||||||
|
|
||||||
for (const edge& e : boundaryEdges())
|
for (const edge& e : boundaryEdges())
|
||||||
{
|
{
|
||||||
@ -103,7 +103,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcBdryPoints() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bp.resize(4*edgeCount);
|
bp.reserve(2*edgeCount);
|
||||||
|
|
||||||
forAllConstIters(knownEdges, iter)
|
forAllConstIters(knownEdges, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1512,7 +1512,7 @@ bool Foam::primitiveMesh::checkFaceFaces
|
|||||||
label nBaffleFaces = 0;
|
label nBaffleFaces = 0;
|
||||||
label nErrorDuplicate = 0;
|
label nErrorDuplicate = 0;
|
||||||
label nErrorOrder = 0;
|
label nErrorOrder = 0;
|
||||||
Map<label> nCommonPoints(128);
|
Map<label> nCommonPoints;
|
||||||
|
|
||||||
for (label facei = 0; facei < nFaces(); facei++)
|
for (label facei = 0; facei < nFaces(); facei++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -95,7 +95,7 @@ Foam::processorTopology Foam::processorTopology::New
|
|||||||
// - assumes single connections between processors
|
// - assumes single connections between processors
|
||||||
|
|
||||||
auto& patchMap = topo.procPatchMap_;
|
auto& patchMap = topo.procPatchMap_;
|
||||||
patchMap.resize(2*numProcPatches);
|
patchMap.reserve(numProcPatches);
|
||||||
|
|
||||||
forAll(patches, patchi)
|
forAll(patches, patchi)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,7 +35,7 @@ void Foam::hashedWordList::rehash() const
|
|||||||
const label len = list.size();
|
const label len = list.size();
|
||||||
|
|
||||||
lookup_.clear();
|
lookup_.clear();
|
||||||
lookup_.resize(2*len);
|
lookup_.reserve(len);
|
||||||
|
|
||||||
for (label i = 0; i < len; ++i)
|
for (label i = 0; i < len; ++i)
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ void Foam::hashedWordList::uniq()
|
|||||||
const label len = list.size();
|
const label len = list.size();
|
||||||
|
|
||||||
lookup_.clear();
|
lookup_.clear();
|
||||||
lookup_.resize(2*len);
|
lookup_.reserve(len);
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,7 @@ void Foam::dynamicRefineFvMesh::readDict()
|
|||||||
auto fluxVelocities = refineDict.get<List<Pair<word>>>("correctFluxes");
|
auto fluxVelocities = refineDict.get<List<Pair<word>>>("correctFluxes");
|
||||||
|
|
||||||
// Rework into hashtable.
|
// Rework into hashtable.
|
||||||
correctFluxes_.resize(fluxVelocities.size());
|
correctFluxes_.reserve(fluxVelocities.size());
|
||||||
for (const auto& pr : fluxVelocities)
|
for (const auto& pr : fluxVelocities)
|
||||||
{
|
{
|
||||||
correctFluxes_.insert(pr.first(), pr.second());
|
correctFluxes_.insert(pr.first(), pr.second());
|
||||||
|
|||||||
@ -408,7 +408,7 @@ void Foam::boundaryCutter::setRefinement
|
|||||||
edgeAddedPoints_.clear();
|
edgeAddedPoints_.clear();
|
||||||
|
|
||||||
faceAddedPoint_.clear();
|
faceAddedPoint_.clear();
|
||||||
faceAddedPoint_.resize(faceToFeaturePoint.size());
|
faceAddedPoint_.reserve(faceToFeaturePoint.size());
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -813,7 +813,7 @@ void Foam::boundaryCutter::setRefinement
|
|||||||
|
|
||||||
// Convert edge to points storage from edge labels (not preserved)
|
// Convert edge to points storage from edge labels (not preserved)
|
||||||
// to point labels
|
// to point labels
|
||||||
edgeAddedPoints_.resize(edgeToCuts.size());
|
edgeAddedPoints_.reserve(edgeToAddedPoints.size());
|
||||||
|
|
||||||
forAllConstIters(edgeToAddedPoints, iter)
|
forAllConstIters(edgeToAddedPoints, iter)
|
||||||
{
|
{
|
||||||
@ -832,7 +832,7 @@ void Foam::boundaryCutter::updateMesh(const mapPolyMesh& morphMap)
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Create copy since we're deleting entries.
|
// Create copy since we're deleting entries.
|
||||||
Map<label> newAddedPoints(faceAddedPoint_.size());
|
Map<label> newAddedPoints(faceAddedPoint_.capacity());
|
||||||
|
|
||||||
forAllConstIters(faceAddedPoint_, iter)
|
forAllConstIters(faceAddedPoint_, iter)
|
||||||
{
|
{
|
||||||
@ -860,7 +860,7 @@ void Foam::boundaryCutter::updateMesh(const mapPolyMesh& morphMap)
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Create copy since we're deleting entries
|
// Create copy since we're deleting entries
|
||||||
EdgeMap<labelList> newEdgeAddedPoints(edgeAddedPoints_.size());
|
EdgeMap<labelList> newEdgeAddedPoints(edgeAddedPoints_.capacity());
|
||||||
|
|
||||||
forAllConstIters(edgeAddedPoints_, iter)
|
forAllConstIters(edgeAddedPoints_, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -583,10 +583,10 @@ void Foam::meshCutAndRemove::setRefinement
|
|||||||
{
|
{
|
||||||
// Clear and size maps here since mesh size will change.
|
// Clear and size maps here since mesh size will change.
|
||||||
addedFaces_.clear();
|
addedFaces_.clear();
|
||||||
addedFaces_.resize(cuts.nLoops());
|
addedFaces_.reserve(cuts.nLoops());
|
||||||
|
|
||||||
addedPoints_.clear();
|
addedPoints_.clear();
|
||||||
addedPoints_.resize(cuts.nLoops());
|
addedPoints_.reserve(cuts.nLoops());
|
||||||
|
|
||||||
if (cuts.nLoops() == 0)
|
if (cuts.nLoops() == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -526,13 +526,13 @@ void Foam::meshCutter::setRefinement
|
|||||||
{
|
{
|
||||||
// Clear and size maps here since mesh size will change.
|
// Clear and size maps here since mesh size will change.
|
||||||
addedCells_.clear();
|
addedCells_.clear();
|
||||||
addedCells_.resize(cuts.nLoops());
|
addedCells_.reserve(cuts.nLoops());
|
||||||
|
|
||||||
addedFaces_.clear();
|
addedFaces_.clear();
|
||||||
addedFaces_.resize(cuts.nLoops());
|
addedFaces_.reserve(cuts.nLoops());
|
||||||
|
|
||||||
addedPoints_.clear();
|
addedPoints_.clear();
|
||||||
addedPoints_.resize(cuts.nLoops());
|
addedPoints_.reserve(cuts.nLoops());
|
||||||
|
|
||||||
if (!returnReduceOr(cuts.nLoops()))
|
if (!returnReduceOr(cuts.nLoops()))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -514,7 +514,7 @@ void Foam::faceCoupleInfo::setCutEdgeToPoints(const labelList& cutToMasterEdges)
|
|||||||
const edgeList& cutEdges = cutFaces().edges();
|
const edgeList& cutEdges = cutFaces().edges();
|
||||||
|
|
||||||
// Size extra big so searching is faster
|
// Size extra big so searching is faster
|
||||||
cutEdgeToPoints_.resize
|
cutEdgeToPoints_.reserve
|
||||||
(
|
(
|
||||||
masterPatch().nEdges()
|
masterPatch().nEdges()
|
||||||
+ slavePatch().nEdges()
|
+ slavePatch().nEdges()
|
||||||
@ -1254,7 +1254,7 @@ Foam::label Foam::faceCoupleInfo::matchEdgeFaces
|
|||||||
|
|
||||||
// For every unassigned cutFacei the possible list of master faces.
|
// For every unassigned cutFacei the possible list of master faces.
|
||||||
candidates.clear();
|
candidates.clear();
|
||||||
candidates.resize(cutFaces().size());
|
candidates.reserve(cutFaces().size());
|
||||||
|
|
||||||
label nChanged = 0;
|
label nChanged = 0;
|
||||||
|
|
||||||
|
|||||||
@ -1884,7 +1884,7 @@ void Foam::addPatchCellLayer::setRefinement
|
|||||||
// For now just keep it connected to the original.
|
// For now just keep it connected to the original.
|
||||||
{
|
{
|
||||||
// Work space
|
// Work space
|
||||||
Map<label> minPointValue(128);
|
Map<label> minPointValue;
|
||||||
faceList oldBoundaryFaces(mesh_.nBoundaryFaces());
|
faceList oldBoundaryFaces(mesh_.nBoundaryFaces());
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@ -1316,7 +1316,7 @@ bool Foam::edgeCollapser::setRefinement
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. Size
|
// 2. Size
|
||||||
collapseStrings.resize(2*nPerIndex.size());
|
collapseStrings.reserve(nPerIndex.size());
|
||||||
forAllConstIters(nPerIndex, iter)
|
forAllConstIters(nPerIndex, iter)
|
||||||
{
|
{
|
||||||
collapseStrings.insert(iter.key(), DynamicList<label>(iter.val()));
|
collapseStrings.insert(iter.key(), DynamicList<label>(iter.val()));
|
||||||
|
|||||||
@ -4163,7 +4163,7 @@ void Foam::hexRef8::storeData
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
savedPointLevel_.clear();
|
savedPointLevel_.clear();
|
||||||
savedPointLevel_.resize(2*pointsToStore.size());
|
savedPointLevel_.reserve(pointsToStore.size());
|
||||||
forAll(pointsToStore, i)
|
forAll(pointsToStore, i)
|
||||||
{
|
{
|
||||||
label pointi = pointsToStore[i];
|
label pointi = pointsToStore[i];
|
||||||
@ -4171,7 +4171,7 @@ void Foam::hexRef8::storeData
|
|||||||
}
|
}
|
||||||
|
|
||||||
savedCellLevel_.clear();
|
savedCellLevel_.clear();
|
||||||
savedCellLevel_.resize(2*cellsToStore.size());
|
savedCellLevel_.reserve(cellsToStore.size());
|
||||||
forAll(cellsToStore, i)
|
forAll(cellsToStore, i)
|
||||||
{
|
{
|
||||||
label celli = cellsToStore[i];
|
label celli = cellsToStore[i];
|
||||||
|
|||||||
@ -319,8 +319,8 @@ void Foam::removePoints::setRefinement
|
|||||||
// Size undo storage
|
// Size undo storage
|
||||||
if (undoable_)
|
if (undoable_)
|
||||||
{
|
{
|
||||||
savedPoints_.setSize(nDeleted);
|
savedPoints_.resize(nDeleted);
|
||||||
pointToSaved.resize(2*nDeleted);
|
pointToSaved.reserve(nDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -490,7 +490,7 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
|||||||
{
|
{
|
||||||
if (checkGroups)
|
if (checkGroups)
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupPatchIDs();
|
const auto& groupLookup = groupPatchIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
@ -559,7 +559,7 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
|||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
if (useGroups && this->hasGroupIDs())
|
if (useGroups && this->hasGroupIDs())
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupPatchIDs();
|
const auto& groupLookup = groupPatchIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
@ -604,7 +604,7 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
|||||||
// Only check groups if requested and they exist
|
// Only check groups if requested and they exist
|
||||||
if (useGroups && this->hasGroupIDs())
|
if (useGroups && this->hasGroupIDs())
|
||||||
{
|
{
|
||||||
ids.resize(2*this->size());
|
ids.reserve(this->size());
|
||||||
|
|
||||||
const auto& groupLookup = groupPatchIDs();
|
const auto& groupLookup = groupPatchIDs();
|
||||||
forAllConstIters(groupLookup, iter)
|
forAllConstIters(groupLookup, iter)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ void Foam::CECCellToCellStencil::calcEdgeBoundaryData
|
|||||||
EdgeMap<labelList>& neiGlobal
|
EdgeMap<labelList>& neiGlobal
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
neiGlobal.resize(2*boundaryEdges.size());
|
neiGlobal.reserve(boundaryEdges.size());
|
||||||
|
|
||||||
labelHashSet edgeGlobals;
|
labelHashSet edgeGlobals;
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ void Foam::CPCCellToCellStencil::calcPointBoundaryData
|
|||||||
Map<labelList>& neiGlobal
|
Map<labelList>& neiGlobal
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
neiGlobal.resize(2*boundaryPoints.size());
|
neiGlobal.reserve(boundaryPoints.size());
|
||||||
|
|
||||||
labelHashSet pointGlobals;
|
labelHashSet pointGlobals;
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ void Foam::FECCellToFaceStencil::calcEdgeBoundaryData
|
|||||||
EdgeMap<labelList>& neiGlobal
|
EdgeMap<labelList>& neiGlobal
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
neiGlobal.resize(2*boundaryEdges.size());
|
neiGlobal.reserve(boundaryEdges.size());
|
||||||
|
|
||||||
labelHashSet edgeGlobals;
|
labelHashSet edgeGlobals;
|
||||||
|
|
||||||
|
|||||||
@ -222,7 +222,7 @@ void Foam::wallDistAddressing::correct(volScalarField& y)
|
|||||||
Map<label> cellToWallFace;
|
Map<label> cellToWallFace;
|
||||||
if (correctWalls_)
|
if (correctWalls_)
|
||||||
{
|
{
|
||||||
cellToWallFace.resize(2*nWalls);
|
cellToWallFace.reserve(nWalls);
|
||||||
correctBoundaryFaceCells
|
correctBoundaryFaceCells
|
||||||
(
|
(
|
||||||
patchSet,
|
patchSet,
|
||||||
|
|||||||
@ -91,7 +91,7 @@ void Foam::zoneCPCStencil::calcPointBoundaryData
|
|||||||
Map<labelList>& neiGlobal
|
Map<labelList>& neiGlobal
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
neiGlobal.resize(2*boundaryPoints.size());
|
neiGlobal.reserve(boundaryPoints.size());
|
||||||
|
|
||||||
labelHashSet pointGlobals;
|
labelHashSet pointGlobals;
|
||||||
|
|
||||||
|
|||||||
@ -284,8 +284,8 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
|||||||
// Generate fields with mappedField boundary condition
|
// Generate fields with mappedField boundary condition
|
||||||
|
|
||||||
// Convert field to map
|
// Convert field to map
|
||||||
fieldMap_.resize(2*fieldSet_.size());
|
fieldMap_.reserve(fieldSet_.size());
|
||||||
reverseFieldMap_.resize(2*fieldSet_.size());
|
reverseFieldMap_.reserve(fieldSet_.size());
|
||||||
forAll(fieldSet_, seti)
|
forAll(fieldSet_, seti)
|
||||||
{
|
{
|
||||||
const word& fldName = fieldSet_[seti].first();
|
const word& fldName = fieldSet_[seti].first();
|
||||||
|
|||||||
@ -147,7 +147,7 @@ void Foam::MGridGenGAMGAgglomeration::detectSharedFaces
|
|||||||
const labelUList& upper = addr.upperAddr();
|
const labelUList& upper = addr.upperAddr();
|
||||||
|
|
||||||
sharedFaces.clear();
|
sharedFaces.clear();
|
||||||
sharedFaces.resize(addr.lowerAddr().size()/100);
|
sharedFaces.reserve(addr.lowerAddr().size()/100);
|
||||||
|
|
||||||
// Detect any faces inbetween same value
|
// Detect any faces inbetween same value
|
||||||
forAll(lower, facei)
|
forAll(lower, facei)
|
||||||
|
|||||||
@ -175,7 +175,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
|
|||||||
|
|
||||||
// Clean old weights
|
// Clean old weights
|
||||||
facePairWeight_.clear();
|
facePairWeight_.clear();
|
||||||
facePairWeight_.resize(coarsePatch.nEdges());
|
facePairWeight_.reserve(coarsePatch.nEdges());
|
||||||
|
|
||||||
for (label i = 0; i < coarsePatch.nInternalEdges(); i++)
|
for (label i = 0; i < coarsePatch.nInternalEdges(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,18 +63,18 @@ void Foam::fv::SemiImplicitSource<Type>::setFieldCoeffs
|
|||||||
|
|
||||||
Su_.clear();
|
Su_.clear();
|
||||||
Sp_.clear();
|
Sp_.clear();
|
||||||
Su_.resize(2*count);
|
Su_.reserve(count);
|
||||||
Sp_.resize(2*count);
|
Sp_.reserve(count);
|
||||||
|
|
||||||
driverSu_.clear();
|
driverSu_.clear();
|
||||||
driverSp_.clear();
|
driverSp_.clear();
|
||||||
driverSu_.resize(2*count);
|
driverSu_.reserve(count);
|
||||||
driverSp_.resize(2*count);
|
driverSp_.reserve(count);
|
||||||
|
|
||||||
valueExprSu_.clear();
|
valueExprSu_.clear();
|
||||||
valueExprSp_.clear();
|
valueExprSp_.clear();
|
||||||
valueExprSu_.resize(2*count);
|
valueExprSu_.reserve(count);
|
||||||
valueExprSp_.resize(2*count);
|
valueExprSp_.reserve(count);
|
||||||
|
|
||||||
fv::option::resetApplied();
|
fv::option::resetApplied();
|
||||||
|
|
||||||
|
|||||||
@ -684,7 +684,7 @@ Foam::List<Foam::labelPair> Foam::localPointRegion::findDuplicateFacePairs
|
|||||||
void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
|
void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Map<label> newMap(meshFaceMap_.size());
|
Map<label> newMap(2*meshFaceMap_.size());
|
||||||
|
|
||||||
forAllConstIters(meshFaceMap_, iter)
|
forAllConstIters(meshFaceMap_, iter)
|
||||||
{
|
{
|
||||||
@ -698,7 +698,7 @@ void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
|
|||||||
meshFaceMap_.transfer(newMap);
|
meshFaceMap_.transfer(newMap);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Map<label> newMap(meshPointMap_.size());
|
Map<label> newMap(2*meshPointMap_.size());
|
||||||
|
|
||||||
forAllConstIters(meshPointMap_, iter)
|
forAllConstIters(meshPointMap_, iter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -721,17 +721,16 @@ Foam::regionSplit::reduceRegionsImpl
|
|||||||
labelListList sendNonLocal(Pstream::nProcs());
|
labelListList sendNonLocal(Pstream::nProcs());
|
||||||
|
|
||||||
{
|
{
|
||||||
List<labelHashSet> nonLocal(Pstream::nProcs(), labelHashSet(0));
|
List<labelHashSet> nonLocal(Pstream::nProcs());
|
||||||
|
|
||||||
// Use estimate of sizing for non-local regions
|
// Use estimate of sizing for non-local regions
|
||||||
|
label estimatedCount((nLocalRegions-nCompact)/Pstream::nProcs());
|
||||||
|
|
||||||
forAll(nonLocal, proci)
|
forAll(nonLocal, proci)
|
||||||
{
|
{
|
||||||
if (proci != Pstream::myProcNo())
|
if (proci != Pstream::myProcNo())
|
||||||
{
|
{
|
||||||
nonLocal[proci].resize
|
nonLocal[proci].reserve(estimatedCount);
|
||||||
(
|
|
||||||
2*((nLocalRegions-nCompact)/Pstream::nProcs())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,7 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
|
|||||||
// Every edge should be used by two faces exactly.
|
// Every edge should be used by two faces exactly.
|
||||||
// To prevent doing work twice per edge only look at edges to higher
|
// To prevent doing work twice per edge only look at edges to higher
|
||||||
// point
|
// point
|
||||||
EdgeMap<label> facesPerEdge(128);
|
EdgeMap<label> facesPerEdge;
|
||||||
forAll(pointFaces, pointi)
|
forAll(pointFaces, pointi)
|
||||||
{
|
{
|
||||||
const labelList& pFaces = pointFaces[pointi];
|
const labelList& pFaces = pointFaces[pointi];
|
||||||
|
|||||||
@ -220,7 +220,7 @@ void Foam::cellSet::distribute(const mapDistributePolyMesh& map)
|
|||||||
// Update labelHashSet
|
// Update labelHashSet
|
||||||
|
|
||||||
labels.clear();
|
labels.clear();
|
||||||
labels.resize(2*n);
|
labels.reserve(n);
|
||||||
|
|
||||||
for (label i=0; i < len; ++i)
|
for (label i=0; i < len; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void Foam::cellZoneSet::updateSet()
|
|||||||
inplaceReorder(order, addressing_);
|
inplaceReorder(order, addressing_);
|
||||||
|
|
||||||
cellSet::clearStorage();
|
cellSet::clearStorage();
|
||||||
cellSet::resize(2*addressing_.size());
|
cellSet::reserve(addressing_.size());
|
||||||
cellSet::set(addressing_);
|
cellSet::set(addressing_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -199,7 +199,7 @@ void Foam::faceSet::distribute(const mapDistributePolyMesh& map)
|
|||||||
// Update labelHashSet
|
// Update labelHashSet
|
||||||
|
|
||||||
labels.clear();
|
labels.clear();
|
||||||
labels.resize(2*n);
|
labels.reserve(n);
|
||||||
|
|
||||||
for (label i=0; i < len; ++i)
|
for (label i=0; i < len; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -55,7 +55,7 @@ void Foam::faceZoneSet::updateSet()
|
|||||||
flipMap_ = boolUIndList(flipMap_, order)();
|
flipMap_ = boolUIndList(flipMap_, order)();
|
||||||
|
|
||||||
faceSet::clearStorage();
|
faceSet::clearStorage();
|
||||||
faceSet::resize(2*addressing_.size());
|
faceSet::reserve(addressing_.size());
|
||||||
faceSet::set(addressing_);
|
faceSet::set(addressing_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -201,7 +201,7 @@ void Foam::pointSet::distribute(const mapDistributePolyMesh& map)
|
|||||||
// Update labelHashSet
|
// Update labelHashSet
|
||||||
|
|
||||||
labels.clear();
|
labels.clear();
|
||||||
labels.resize(2*n);
|
labels.reserve(n);
|
||||||
|
|
||||||
for (label i=0; i < len; ++i)
|
for (label i=0; i < len; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,7 +51,7 @@ void Foam::pointZoneSet::updateSet()
|
|||||||
inplaceReorder(order, addressing_);
|
inplaceReorder(order, addressing_);
|
||||||
|
|
||||||
pointSet::clearStorage();
|
pointSet::clearStorage();
|
||||||
pointSet::resize(2*addressing_.size());
|
pointSet::reserve(addressing_.size());
|
||||||
pointSet::set(addressing_);
|
pointSet::set(addressing_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -534,7 +534,7 @@ void Foam::topoSet::invert(const label maxLen)
|
|||||||
);
|
);
|
||||||
|
|
||||||
clear(); // Maybe don't trust the previous move operation
|
clear(); // Maybe don't trust the previous move operation
|
||||||
resize(2*max(64, (maxLen - original.size())));
|
reserve(max(64, (maxLen - original.size())));
|
||||||
|
|
||||||
for (label id=0; id < maxLen; ++id)
|
for (label id=0; id < maxLen; ++id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -801,7 +801,7 @@ void Foam::cellCellStencils::inverseDistance::markDonors
|
|||||||
// {
|
// {
|
||||||
// if (proci != Pstream::myProcNo())
|
// if (proci != Pstream::myProcNo())
|
||||||
// {
|
// {
|
||||||
// nonLocal[proci].resize(2*nOriginating[proci]);
|
// nonLocal[proci].reserve(nOriginating[proci]);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|||||||
@ -275,7 +275,7 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
ioAddr.rename("faceProcAddressing");
|
ioAddr.rename("faceProcAddressing");
|
||||||
labelIOList fvFaceProcAddressing(ioAddr);
|
labelIOList fvFaceProcAddressing(ioAddr);
|
||||||
|
|
||||||
fvFaceProcAddressingHash.resize(2*fvFaceProcAddressing.size());
|
fvFaceProcAddressingHash.reserve(fvFaceProcAddressing.size());
|
||||||
|
|
||||||
forAll(fvFaceProcAddressing, facei)
|
forAll(fvFaceProcAddressing, facei)
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
|
|
||||||
Map<label>& curMap = procMeshEdgesMap_[procI];
|
Map<label>& curMap = procMeshEdgesMap_[procI];
|
||||||
curMap.clear();
|
curMap.clear();
|
||||||
curMap.resize(2*procEdges.size());
|
curMap.reserve(procEdges.size());
|
||||||
|
|
||||||
forAll(procEdges, edgeI)
|
forAll(procEdges, edgeI)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,10 +67,10 @@ void Foam::cuttingSurfaceBase::walkCellCuts
|
|||||||
DynamicList<label> localFaceLoop(16);
|
DynamicList<label> localFaceLoop(16);
|
||||||
|
|
||||||
// Local scratch space for edge to pointId
|
// Local scratch space for edge to pointId
|
||||||
EdgeMap<label> localEdges(128);
|
EdgeMap<label> localEdges;
|
||||||
|
|
||||||
// Local scratch space for edge to faceId
|
// Local scratch space for edge to faceId
|
||||||
EdgeMap<edge> localFaces(128);
|
EdgeMap<edge> localFaces;
|
||||||
|
|
||||||
// Avoid duplicates for cuts exactly through a mesh point.
|
// Avoid duplicates for cuts exactly through a mesh point.
|
||||||
// No other way to distinguish them, since there is no single edge
|
// No other way to distinguish them, since there is no single edge
|
||||||
|
|||||||
@ -206,7 +206,7 @@ Foam::isoSurfaceTopo::tetCutAddressing::tetCutAddressing
|
|||||||
if (useSnap)
|
if (useSnap)
|
||||||
{
|
{
|
||||||
// Some, but not all, cells may have point snapping
|
// Some, but not all, cells may have point snapping
|
||||||
snapVertsLookup_.resize(4*nCutCells);
|
snapVertsLookup_.reserve(2*nCutCells);
|
||||||
}
|
}
|
||||||
if (debugCutTetsOn_)
|
if (debugCutTetsOn_)
|
||||||
{
|
{
|
||||||
@ -1390,7 +1390,7 @@ Foam::isoSurfaceTopo::isoSurfaceTopo
|
|||||||
const labelList& mp = s.meshPoints();
|
const labelList& mp = s.meshPoints();
|
||||||
const edgeList& surfEdges = s.edges();
|
const edgeList& surfEdges = s.edges();
|
||||||
const labelListList& edgeFaces = s.edgeFaces();
|
const labelListList& edgeFaces = s.edgeFaces();
|
||||||
openEdgeIds.resize(2*s.size());
|
openEdgeIds.reserve(s.size());
|
||||||
|
|
||||||
forAll(edgeFaces, edgei)
|
forAll(edgeFaces, edgei)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user