ENH: use back(), pop_back() instead remove()
- adjust looping to resemble LIFO pattern STYLE: adjust some string includes
This commit is contained in:
parent
7c60c80edd
commit
eb8b51b475
@ -94,7 +94,7 @@ if (mesh.changing())
|
||||
{
|
||||
if (refCells[zoneId] != -1)
|
||||
{
|
||||
validCells.append(refCells[zoneId]);
|
||||
validCells.push_back(refCells[zoneId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
||||
{
|
||||
if (refCells[zoneId] != -1)
|
||||
{
|
||||
validCells.append(refCells[zoneId]);
|
||||
validCells.push_back(refCells[zoneId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< nl << "list: " << flatOutput(list) << nl << endl;
|
||||
|
||||
list.remove();
|
||||
list.pop_back();
|
||||
Info<<"remove = " << flatOutput(list) << nl;
|
||||
|
||||
{
|
||||
|
@ -266,11 +266,8 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
|
||||
<< endl;
|
||||
|
||||
// Remove points that have just been added before returning
|
||||
for (label i = 0; i < 2; ++i)
|
||||
{
|
||||
pts.remove();
|
||||
nVert--;
|
||||
}
|
||||
pts.pop_back(2);
|
||||
nVert -= 2;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -702,11 +699,8 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint
|
||||
<< endl;
|
||||
|
||||
// Remove points that have just been added before returning
|
||||
for (label i = 0; i < 2; ++i)
|
||||
{
|
||||
pts.remove();
|
||||
nVert--;
|
||||
}
|
||||
pts.pop_back(2);
|
||||
nVert -= 2;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -456,15 +456,12 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
|
||||
Pout<< "fileMonitor : adding watch on file " << fName << endl;
|
||||
}
|
||||
|
||||
label watchFd;
|
||||
label watchFd = state_.size();
|
||||
|
||||
if (freeWatchFds_.size())
|
||||
if (!freeWatchFds_.empty())
|
||||
{
|
||||
watchFd = freeWatchFds_.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
watchFd = state_.size();
|
||||
watchFd = freeWatchFds_.back();
|
||||
freeWatchFds_.pop_back();
|
||||
}
|
||||
|
||||
watcher_->addWatch(watchFd, fName);
|
||||
|
@ -452,15 +452,12 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
|
||||
Pout<< "fileMonitor : adding watch on file " << fName << endl;
|
||||
}
|
||||
|
||||
label watchFd;
|
||||
label watchFd = state_.size();
|
||||
|
||||
if (freeWatchFds_.size())
|
||||
if (!freeWatchFds_.empty())
|
||||
{
|
||||
watchFd = freeWatchFds_.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
watchFd = state_.size();
|
||||
watchFd = freeWatchFds_.back();
|
||||
freeWatchFds_.pop_back();
|
||||
}
|
||||
|
||||
watcher_->addWatch(watchFd, fName);
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
|
||||
Copyright (C) 2012-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,10 +44,10 @@ bool Foam::expressions::exprResultStack::pushChecked
|
||||
|
||||
if (!resultField.empty())
|
||||
{
|
||||
val = resultField.first();
|
||||
val = resultField.front();
|
||||
}
|
||||
|
||||
this->ref<T>().append(val);
|
||||
this->ref<T>().push_back(val);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -71,8 +71,8 @@ bool Foam::expressions::exprResultStack::popChecked
|
||||
|
||||
if (!oldField.empty())
|
||||
{
|
||||
val = oldField.last();
|
||||
oldField.resize(oldField.size()-1);
|
||||
val = oldField.back();
|
||||
oldField.pop_back();
|
||||
}
|
||||
|
||||
result.setSingleValue(val);
|
||||
|
@ -27,8 +27,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "clock.H"
|
||||
#include "string.H"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
|
@ -51,9 +51,9 @@ Foam::profilingInformation* Foam::profiling::create()
|
||||
|
||||
Information* info = new Information;
|
||||
|
||||
pool_.append(info);
|
||||
pool_.push_back(info);
|
||||
children_.resize(pool_.size());
|
||||
children_.last().clear(); // safety
|
||||
children_.back().clear(); // safety
|
||||
|
||||
return info;
|
||||
}
|
||||
@ -77,10 +77,10 @@ Foam::profilingInformation* Foam::profiling::create
|
||||
|
||||
Information* info = new Information(parent, descr, pool_.size());
|
||||
|
||||
pool_.append(info);
|
||||
pool_.push_back(info);
|
||||
children_.resize(pool_.size());
|
||||
children_.last().clear(); // safety
|
||||
children_[parentId].append(info);
|
||||
children_.back().clear(); // safety
|
||||
children_[parentId].push_back(info);
|
||||
|
||||
return info;
|
||||
}
|
||||
@ -88,16 +88,18 @@ Foam::profilingInformation* Foam::profiling::create
|
||||
|
||||
void Foam::profiling::beginTimer(profilingInformation *info)
|
||||
{
|
||||
stack_.append(info);
|
||||
times_.append(clockValue::now());
|
||||
stack_.push_back(info);
|
||||
times_.push_back(clockValue::now());
|
||||
info->setActive(true); // Mark as on stack
|
||||
}
|
||||
|
||||
|
||||
Foam::profilingInformation* Foam::profiling::endTimer()
|
||||
{
|
||||
Information *info = stack_.remove();
|
||||
clockValue clockval = times_.remove();
|
||||
Information *info = stack_.back();
|
||||
clockValue clockval = times_.back();
|
||||
stack_.pop_back();
|
||||
times_.pop_back();
|
||||
|
||||
info->update(clockval.elapsed()); // Update elapsed time
|
||||
info->setActive(false); // Mark as off stack
|
||||
@ -184,7 +186,7 @@ Foam::profilingInformation* Foam::profiling::New(const string& descr)
|
||||
|
||||
if (active())
|
||||
{
|
||||
Information *parent = singleton_->stack_.last();
|
||||
Information *parent = singleton_->stack_.back();
|
||||
|
||||
info = singleton_->create(parent, descr);
|
||||
singleton_->beginTimer(info);
|
||||
@ -320,7 +322,7 @@ bool Foam::profiling::writeData(Ostream& os) const
|
||||
{
|
||||
elapsed[stacki] = (now - times_[stacki]);
|
||||
}
|
||||
elapsed.last() = 0;
|
||||
elapsed.back() = 0;
|
||||
|
||||
os.beginBlock("profiling");
|
||||
|
||||
|
@ -35,8 +35,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef profilingInformation_H
|
||||
#define profilingInformation_H
|
||||
#ifndef Foam_profilingInformation_H
|
||||
#define Foam_profilingInformation_H
|
||||
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
|
@ -35,8 +35,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef profilingTrigger_H
|
||||
#define profilingTrigger_H
|
||||
#ifndef Foam_profilingTrigger_H
|
||||
#define Foam_profilingTrigger_H
|
||||
|
||||
#include "string.H"
|
||||
|
||||
|
@ -271,15 +271,15 @@ Foam::label Foam::refinementHistory::allocateSplitCell
|
||||
|
||||
if (freeSplitCells_.size())
|
||||
{
|
||||
index = freeSplitCells_.remove();
|
||||
index = freeSplitCells_.back();
|
||||
freeSplitCells_.pop_back();
|
||||
|
||||
splitCells_[index] = splitCell8(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
index = splitCells_.size();
|
||||
|
||||
splitCells_.append(splitCell8(parent));
|
||||
splitCells_.push_back(splitCell8(parent));
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,6 @@ SourceFiles
|
||||
#define FIRECore_H
|
||||
|
||||
#include "point.H"
|
||||
#include "string.H"
|
||||
#include "labelList.H"
|
||||
#include "pointField.H"
|
||||
#include "IOstreams.H"
|
||||
|
@ -38,7 +38,6 @@ SourceFiles
|
||||
#define Foam_fileFormats_NASCore_H
|
||||
|
||||
#include "scalar.H"
|
||||
#include "string.H"
|
||||
#include "Enum.H"
|
||||
#include "face.H"
|
||||
#include "point.H"
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -399,18 +399,17 @@ Foam::label Foam::vtk::vtmWriter::endBlock(const word& blockName)
|
||||
{
|
||||
if (!blocks_.empty())
|
||||
{
|
||||
const word curr(blocks_.remove());
|
||||
|
||||
// Verify expected end tag
|
||||
if (!blockName.empty() && blockName != curr)
|
||||
if (!blockName.empty() && blockName != blocks_.back())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "expecting to end block '" << blockName
|
||||
<< "' but found '" << curr << "' instead"
|
||||
<< "' but found '" << blocks_.back() << "' instead"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
entries_.append(vtmEntry::endblock());
|
||||
blocks_.pop_back();
|
||||
entries_.push_back(vtmEntry::endblock());
|
||||
}
|
||||
|
||||
return blocks_.size();
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -112,7 +112,7 @@ Foam::vtk::formatter& Foam::vtk::formatter::closeTag(const bool isEmpty)
|
||||
if (isEmpty)
|
||||
{
|
||||
// Eg, <tag ... />
|
||||
xmlTags_.remove();
|
||||
xmlTags_.pop_back();
|
||||
os_ << " /";
|
||||
}
|
||||
os_ << '>' << nl;
|
||||
@ -124,7 +124,8 @@ Foam::vtk::formatter& Foam::vtk::formatter::closeTag(const bool isEmpty)
|
||||
|
||||
Foam::vtk::formatter& Foam::vtk::formatter::endTag(const word& tagName)
|
||||
{
|
||||
const word curr(xmlTags_.remove());
|
||||
const word curr(std::move(xmlTags_.back()));
|
||||
xmlTags_.pop_back();
|
||||
indent();
|
||||
|
||||
if (inTag_)
|
||||
|
@ -131,6 +131,7 @@ void Foam::faceAreaWeightAMI::calcAddressing
|
||||
|
||||
bool continueWalk = true;
|
||||
DynamicList<label> nonOverlapFaces;
|
||||
|
||||
do
|
||||
{
|
||||
nbrFaces.clear();
|
||||
@ -212,11 +213,12 @@ bool Foam::faceAreaWeightAMI::processSourceFace
|
||||
|
||||
label maxNeighbourFaces = nbrFaces.size();
|
||||
|
||||
do
|
||||
while (!nbrFaces.empty())
|
||||
{
|
||||
// process new target face
|
||||
label tgtFacei = nbrFaces.remove();
|
||||
visitedFaces.append(tgtFacei);
|
||||
// Process new target face as LIFO
|
||||
label tgtFacei = nbrFaces.back();
|
||||
nbrFaces.pop_back();
|
||||
visitedFaces.push_back(tgtFacei);
|
||||
|
||||
scalar interArea = 0;
|
||||
vector interCentroid(Zero);
|
||||
@ -238,8 +240,7 @@ bool Foam::faceAreaWeightAMI::processSourceFace
|
||||
|
||||
maxNeighbourFaces = max(maxNeighbourFaces, nbrFaces.size());
|
||||
}
|
||||
|
||||
} while (nbrFaces.size() > 0);
|
||||
}
|
||||
|
||||
if (debug > 1)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ void Foam::noiseFFT::octaveBandInfo
|
||||
if (fc.size())
|
||||
{
|
||||
// Remove the last centre frequency (beyond upper frequency limit)
|
||||
fc.remove();
|
||||
fc.pop_back();
|
||||
|
||||
fCentre.transfer(fc);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void Foam::noiseModel::setOctaveBands
|
||||
if (fc.size())
|
||||
{
|
||||
// Remove the last centre frequency (beyond upper frequency limit)
|
||||
fc.remove();
|
||||
fc.pop_back();
|
||||
|
||||
fCentre.transfer(fc);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void Foam::regionModels::regionModel1D::initialise()
|
||||
} while (regionMesh().isInternalFace(facei));
|
||||
|
||||
boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
|
||||
//faceIDs.remove(); //remove boundary face.
|
||||
//faceIDs.pop_back(); //remove boundary face.
|
||||
|
||||
boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
|
||||
boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
|
||||
|
@ -113,11 +113,11 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
List<DynamicList<label>> tgtToSrcAddr(tgt_.nCells());
|
||||
List<DynamicList<scalar>> tgtToSrcWght(tgt_.nCells());
|
||||
|
||||
// list of tgt cell neighbour cells
|
||||
DynamicList<label> nbrTgtCells(10);
|
||||
// List of tgt cell neighbour cells
|
||||
DynamicList<label> queuedCells(10);
|
||||
|
||||
// list of tgt cells currently visited for srcCelli to avoid multiple hits
|
||||
DynamicList<label> visitedTgtCells(10);
|
||||
// List of tgt cells currently visited for srcCellI to avoid multiple hits
|
||||
DynamicList<label> visitedCells(10);
|
||||
|
||||
// list to keep track of tgt cells used to seed src cells
|
||||
labelList seedCells(src_.nCells(), -1);
|
||||
@ -127,17 +127,19 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
|
||||
do
|
||||
{
|
||||
nbrTgtCells.clear();
|
||||
visitedTgtCells.clear();
|
||||
queuedCells.clear();
|
||||
visitedCells.clear();
|
||||
|
||||
// append initial target cell and neighbours
|
||||
nbrTgtCells.append(tgtCelli);
|
||||
appendNbrCells(tgtCelli, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
// Initial target cell and neighbours
|
||||
queuedCells.push_back(tgtCelli);
|
||||
appendNbrCells(tgtCelli, tgt_, visitedCells, queuedCells);
|
||||
|
||||
do
|
||||
while (!queuedCells.empty())
|
||||
{
|
||||
tgtCelli = nbrTgtCells.remove();
|
||||
visitedTgtCells.append(tgtCelli);
|
||||
// Process new target cell as LIFO
|
||||
tgtCelli = queuedCells.back();
|
||||
queuedCells.pop_back();
|
||||
visitedCells.push_back(tgtCelli);
|
||||
|
||||
scalar vol = interVol(srcCelli, tgtCelli);
|
||||
|
||||
@ -151,13 +153,12 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
tgtToSrcAddr[tgtCelli].append(srcCelli);
|
||||
tgtToSrcWght[tgtCelli].append(vol);
|
||||
|
||||
appendNbrCells(tgtCelli, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
appendNbrCells(tgtCelli, tgt_, visitedCells, queuedCells);
|
||||
|
||||
// accumulate intersection volume
|
||||
V_ += vol;
|
||||
}
|
||||
}
|
||||
while (!nbrTgtCells.empty());
|
||||
|
||||
mapFlag[srcCelli] = false;
|
||||
|
||||
@ -169,7 +170,7 @@ void Foam::cellVolumeWeightMethod::calculateAddressing
|
||||
tgtCelli,
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
visitedTgtCells,
|
||||
visitedCells,
|
||||
seedCells
|
||||
);
|
||||
}
|
||||
|
@ -70,13 +70,13 @@ void Foam::correctedCellVolumeWeightMethod::calculateAddressing
|
||||
List<DynamicList<scalar>> tgtToSrcWght(tgt_.nCells());
|
||||
List<DynamicList<point>> tgtToSrcVec(tgt_.nCells());
|
||||
|
||||
// list of tgt cell neighbour cells
|
||||
DynamicList<label> nbrTgtCells(10);
|
||||
// List of tgt cell neighbour cells
|
||||
DynamicList<label> queuedCells(10);
|
||||
|
||||
// list of tgt cells currently visited for srcCellI to avoid multiple hits
|
||||
DynamicList<label> visitedTgtCells(10);
|
||||
// List of tgt cells currently visited for srcCellI to avoid multiple hits
|
||||
DynamicList<label> visitedCells(10);
|
||||
|
||||
// list to keep track of tgt cells used to seed src cells
|
||||
// List to keep track of tgt cells used to seed src cells
|
||||
labelList seedCells(src_.nCells(), -1);
|
||||
seedCells[srcCellI] = tgtCellI;
|
||||
|
||||
@ -86,17 +86,19 @@ void Foam::correctedCellVolumeWeightMethod::calculateAddressing
|
||||
|
||||
do
|
||||
{
|
||||
nbrTgtCells.clear();
|
||||
visitedTgtCells.clear();
|
||||
queuedCells.clear();
|
||||
visitedCells.clear();
|
||||
|
||||
// append initial target cell and neighbours
|
||||
nbrTgtCells.append(tgtCellI);
|
||||
appendNbrCells(tgtCellI, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
// Initial target cell and neighbours
|
||||
queuedCells.push_back(tgtCellI);
|
||||
appendNbrCells(tgtCellI, tgt_, visitedCells, queuedCells);
|
||||
|
||||
do
|
||||
while (!queuedCells.empty())
|
||||
{
|
||||
tgtCellI = nbrTgtCells.remove();
|
||||
visitedTgtCells.append(tgtCellI);
|
||||
// Process new target cell as LIFO
|
||||
tgtCellI = queuedCells.back();
|
||||
queuedCells.pop_back();
|
||||
visitedCells.push_back(tgtCellI);
|
||||
|
||||
Tuple2<scalar, point> vol = interVolAndCentroid
|
||||
(
|
||||
@ -116,13 +118,12 @@ void Foam::correctedCellVolumeWeightMethod::calculateAddressing
|
||||
tgtToSrcWght[tgtCellI].append(vol.first());
|
||||
tgtToSrcVec[tgtCellI].append(vol.second()-srcCc[srcCellI]);
|
||||
|
||||
appendNbrCells(tgtCellI, tgt_, visitedTgtCells, nbrTgtCells);
|
||||
appendNbrCells(tgtCellI, tgt_, visitedCells, queuedCells);
|
||||
|
||||
// accumulate intersection volume
|
||||
V_ += vol.first();
|
||||
}
|
||||
}
|
||||
while (!nbrTgtCells.empty());
|
||||
|
||||
mapFlag[srcCellI] = false;
|
||||
|
||||
@ -134,7 +135,7 @@ void Foam::correctedCellVolumeWeightMethod::calculateAddressing
|
||||
tgtCellI,
|
||||
srcCellIDs,
|
||||
mapFlag,
|
||||
visitedTgtCells,
|
||||
visitedCells,
|
||||
seedCells
|
||||
);
|
||||
}
|
||||
|
@ -174,27 +174,23 @@ void Foam::directMethod::appendToDirectSeeds
|
||||
const labelList& srcNbr = src_.cellCells()[srcSeedI];
|
||||
const labelList& tgtNbr = tgt_.cellCells()[tgtSeedI];
|
||||
|
||||
forAll(srcNbr, i)
|
||||
for (const label srcI : srcNbr)
|
||||
{
|
||||
label srcI = srcNbr[i];
|
||||
|
||||
if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1))
|
||||
{
|
||||
// source cell srcI not yet mapped
|
||||
|
||||
// identify if target cell exists for source cell srcI
|
||||
bool found = false;
|
||||
forAll(tgtNbr, j)
|
||||
for (const label tgtI : tgtNbr)
|
||||
{
|
||||
label tgtI = tgtNbr[j];
|
||||
|
||||
if (intersect(srcI, tgtI))
|
||||
{
|
||||
// new match - append to lists
|
||||
found = true;
|
||||
|
||||
srcTgtSeed[srcI] = tgtI;
|
||||
srcSeeds.append(srcI);
|
||||
srcSeeds.push_back(srcI);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -208,10 +204,11 @@ void Foam::directMethod::appendToDirectSeeds
|
||||
}
|
||||
}
|
||||
|
||||
if (srcSeeds.size())
|
||||
if (!srcSeeds.empty())
|
||||
{
|
||||
srcSeedI = srcSeeds.remove();
|
||||
srcSeedI = srcSeeds.back();
|
||||
tgtSeedI = srcTgtSeed[srcSeedI];
|
||||
srcSeeds.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -217,27 +217,29 @@ void Foam::mapNearestMethod::findNearestCell
|
||||
|
||||
const vector& p1 = Cc1[cell1];
|
||||
|
||||
DynamicList<label> cells2(10);
|
||||
cells2.append(cell2);
|
||||
|
||||
DynamicList<label> queuedCells(10);
|
||||
DynamicList<label> visitedCells(10);
|
||||
|
||||
queuedCells.push_back(cell2);
|
||||
|
||||
scalar d = GREAT;
|
||||
|
||||
do
|
||||
while (!queuedCells.empty())
|
||||
{
|
||||
label c2 = cells2.remove();
|
||||
visitedCells.append(c2);
|
||||
// Process as LIFO
|
||||
const label currCelli = queuedCells.back();
|
||||
queuedCells.pop_back();
|
||||
visitedCells.push_back(currCelli);
|
||||
|
||||
scalar dTest = p1.distSqr(Cc2[currCelli]);
|
||||
|
||||
scalar dTest = magSqr(Cc2[c2] - p1);
|
||||
if (dTest < d)
|
||||
{
|
||||
cell2 = c2;
|
||||
cell2 = currCelli;
|
||||
d = dTest;
|
||||
appendNbrCells(cell2, mesh2, visitedCells, cells2);
|
||||
appendNbrCells(cell2, mesh2, visitedCells, queuedCells);
|
||||
}
|
||||
|
||||
} while (cells2.size() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -290,19 +292,22 @@ Foam::label Foam::mapNearestMethod::findMappedSrcCell
|
||||
const List<DynamicList<label>>& tgtToSrc
|
||||
) const
|
||||
{
|
||||
DynamicList<label> testCells(16);
|
||||
DynamicList<label> queuedCells(16);
|
||||
DynamicList<label> visitedCells(16);
|
||||
|
||||
testCells.append(tgtCelli);
|
||||
queuedCells.push_back(tgtCelli);
|
||||
|
||||
do
|
||||
while (!queuedCells.empty())
|
||||
{
|
||||
// Process as LIFO
|
||||
const label tgtI = queuedCells.back();
|
||||
queuedCells.pop_back();
|
||||
|
||||
// search target tgtCelli neighbours for match with source cell
|
||||
label tgtI = testCells.remove();
|
||||
|
||||
if (!visitedCells.found(tgtI))
|
||||
{
|
||||
visitedCells.append(tgtI);
|
||||
visitedCells.push_back(tgtI);
|
||||
|
||||
if (tgtToSrc[tgtI].size())
|
||||
{
|
||||
@ -316,12 +321,12 @@ Foam::label Foam::mapNearestMethod::findMappedSrcCell
|
||||
{
|
||||
if (!visitedCells.found(nbrCelli))
|
||||
{
|
||||
testCells.append(nbrCelli);
|
||||
queuedCells.push_back(nbrCelli);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (testCells.size());
|
||||
}
|
||||
|
||||
// did not find any match - should not be possible to get here!
|
||||
return -1;
|
||||
|
@ -259,11 +259,11 @@ void Foam::Reaction<ReactionThermo>::setLRhs
|
||||
|
||||
while (is.good())
|
||||
{
|
||||
dlrhs.append(specieCoeffs(species, is, failUnknownSpecie));
|
||||
dlrhs.push_back(specieCoeffs(species, is, failUnknownSpecie));
|
||||
|
||||
if (dlrhs.last().index < 0)
|
||||
if (dlrhs.back().index < 0)
|
||||
{
|
||||
dlrhs.remove();
|
||||
dlrhs.pop_back();
|
||||
}
|
||||
|
||||
if (is.good())
|
||||
|
Loading…
Reference in New Issue
Block a user