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