mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use newer forAll macros
This commit is contained in:
@ -57,6 +57,7 @@ public:
|
||||
//- The second boundary
|
||||
label bnd1;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -194,7 +195,7 @@ public:
|
||||
//- Scan available interface entries for one matching this boundary id
|
||||
bool isInterface(label bndId)
|
||||
{
|
||||
forAllConstIter(Map<interfaceEntry>, *this, iter)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
if (iter().inInterface(bndId))
|
||||
{
|
||||
@ -210,7 +211,7 @@ public:
|
||||
word interfaceName(label bndId)
|
||||
{
|
||||
word ifname;
|
||||
forAllConstIter(Map<interfaceEntry>, *this, iter)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
ifname = iter().canonicalName(bndId);
|
||||
if (!ifname.empty())
|
||||
@ -231,7 +232,7 @@ public:
|
||||
const interfaceDefinitions& defs
|
||||
)
|
||||
{
|
||||
os << static_cast<const Map<interfaceEntry>& >(defs)
|
||||
os << static_cast<const Map<interfaceEntry>&>(defs)
|
||||
<< nl;
|
||||
|
||||
return os;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,7 +44,7 @@ Foam::Map<Foam::word> Foam::ccm::reader::selectPorous
|
||||
{
|
||||
Map<word> lookup;
|
||||
|
||||
forAllConstIter(Map<dictionary>, table, iter)
|
||||
forAllConstIters(table, iter)
|
||||
{
|
||||
if (iter().lookupOrDefault<label>("PorosityId", 0) != 0)
|
||||
{
|
||||
@ -70,21 +70,21 @@ void Foam::ccm::reader::warnDuplicates
|
||||
const wordList& lst
|
||||
)
|
||||
{
|
||||
HashTable<label> hashed(lst.size());
|
||||
HashTable<label> hashed(2*lst.size());
|
||||
bool duplicates = false;
|
||||
|
||||
forAll(lst, elemI)
|
||||
for (const word& item : lst)
|
||||
{
|
||||
// Check duplicate name
|
||||
HashTable<label>::iterator iter = hashed.find(lst[elemI]);
|
||||
if (iter != hashed.end())
|
||||
// Check duplicate names
|
||||
auto iter = hashed.find(item);
|
||||
if (iter.found())
|
||||
{
|
||||
(*iter)++;
|
||||
duplicates = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hashed.insert(lst[elemI], 1);
|
||||
hashed.insert(item, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,9 +92,9 @@ void Foam::ccm::reader::warnDuplicates
|
||||
if (duplicates)
|
||||
{
|
||||
Info << nl << "WARNING: " << context << " with identical names:";
|
||||
forAllConstIter(HashTable<label>, hashed, iter)
|
||||
forAllConstIters(hashed, iter)
|
||||
{
|
||||
if (*iter > 1)
|
||||
if (iter.object() > 1)
|
||||
{
|
||||
Info << " " << iter.key();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -479,8 +479,8 @@ void Foam::ccm::reader::readCells
|
||||
info.setPatchName(ccmReadOptstr("Label", nodeId));
|
||||
|
||||
// Lookup the name, type from boundary region info:
|
||||
Map<dictionary>::iterator dictIter = boundaryRegion_.find(info.ccmIndex);
|
||||
if (dictIter != boundaryRegion_.end())
|
||||
auto dictIter = boundaryRegion_.find(info.ccmIndex);
|
||||
if (dictIter.found())
|
||||
{
|
||||
word patchName(dictIter()["Label"]);
|
||||
word patchType(dictIter()["BoundaryType"]);
|
||||
@ -576,8 +576,8 @@ void Foam::ccm::reader::readCells
|
||||
if (option().combineBoundaries())
|
||||
{
|
||||
// Check if patch name was already seen
|
||||
HashTable<label, std::string>::const_iterator citer = hashedNames.find(info.patchName);
|
||||
if (citer != hashedNames.end())
|
||||
auto citer = hashedNames.cfind(info.patchName);
|
||||
if (citer.found())
|
||||
{
|
||||
info.patchId = bndInfo[citer()].patchId;
|
||||
}
|
||||
@ -775,7 +775,11 @@ void Foam::ccm::reader::readCells
|
||||
kCCMIOStart,
|
||||
kCCMIOEnd
|
||||
);
|
||||
assertNoError("Error reading boundary face cells - index " + ::Foam::name(info.ccmIndex));
|
||||
assertNoError
|
||||
(
|
||||
"Error reading boundary face cells - index "
|
||||
+ ::Foam::name(info.ccmIndex)
|
||||
);
|
||||
|
||||
// Copy into Foam list
|
||||
// ccmFaces are organized as [nVert vrt1 .. vrtN]
|
||||
@ -797,7 +801,11 @@ void Foam::ccm::reader::readCells
|
||||
}
|
||||
else
|
||||
{
|
||||
assertNoError("Error reading boundary faces - index " + ::Foam::name(info.ccmIndex));
|
||||
assertNoError
|
||||
(
|
||||
"Error reading boundary faces - index "
|
||||
+ ::Foam::name(info.ccmIndex)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1106,11 +1114,10 @@ void Foam::ccm::reader::readMonitoring
|
||||
<< "ccmRegionId: " << ccmRegionId << endl;
|
||||
#endif
|
||||
|
||||
Map<dictionary>::const_iterator
|
||||
iter = boundaryRegion_.find(ccmRegionId);
|
||||
auto iter = boundaryRegion_.cfind(ccmRegionId);
|
||||
|
||||
word zoneName;
|
||||
if (iter != boundaryRegion_.end())
|
||||
if (iter.found())
|
||||
{
|
||||
iter().lookup("Label") >> zoneName;
|
||||
}
|
||||
@ -1314,7 +1321,7 @@ void Foam::ccm::reader::removeUnwanted()
|
||||
{
|
||||
Map<word> keepMap;
|
||||
|
||||
forAllConstIter(Map<dictionary>, cellTable_, iter)
|
||||
forAllConstIters(cellTable_, iter)
|
||||
{
|
||||
const label tableId = iter.key();
|
||||
if (!removeMap.found(tableId))
|
||||
@ -1326,17 +1333,19 @@ void Foam::ccm::reader::removeUnwanted()
|
||||
Info<<"remove "<< nRemove << " cells in "
|
||||
<< removeMap.size() << " unwanted cellZone(s)" << nl;
|
||||
|
||||
forAllConstIter(Map<word>, removeMap, iter)
|
||||
forAllConstIters(removeMap, iter)
|
||||
{
|
||||
Info<< " zone " << iter.key() << " : "<< iter() << nl;
|
||||
Info<< " zone "
|
||||
<< iter.key() << " : " << iter.object() << nl;
|
||||
}
|
||||
|
||||
Info<<"retain "<< (nCells_ - nRemove) << " cells in "
|
||||
<< keepMap.size() << " cellZone(s)" << nl;
|
||||
|
||||
forAllConstIter(Map<word>, keepMap, iter)
|
||||
forAllConstIters(keepMap, iter)
|
||||
{
|
||||
Info<< " zone " << iter.key() << " : "<< iter() << nl;
|
||||
Info<< " zone "
|
||||
<< iter.key() << " : " << iter.object() << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1821,7 +1830,7 @@ void Foam::ccm::reader::cleanupInterfaces()
|
||||
// << SubList<label>(oldToNew, nFaces_ - nInternalFaces_, nInternalFaces_)
|
||||
// << endl;
|
||||
|
||||
forAllIter(HashTable<labelList>, monitoringSets_, iter)
|
||||
forAllIters(monitoringSets_, iter)
|
||||
{
|
||||
inplaceRenumber(oldToNew, iter());
|
||||
}
|
||||
@ -1903,7 +1912,12 @@ void Foam::ccm::reader::mergeInplaceInterfaces()
|
||||
findIndex(origBndId_, ifentry.bnd1)
|
||||
);
|
||||
|
||||
if (patchPair[0] == patchPair[1] || patchPair[0] < 0 || patchPair[1] < 0)
|
||||
if
|
||||
(
|
||||
patchPair[0] == patchPair[1]
|
||||
|| patchPair[0] < 0
|
||||
|| patchPair[1] < 0
|
||||
)
|
||||
{
|
||||
// This should not happen
|
||||
Info<<"Warning : bad interface " << interI << " " << ifentry
|
||||
@ -1985,7 +1999,7 @@ void Foam::ccm::reader::mergeInplaceInterfaces()
|
||||
|
||||
const UIndirectList<point> pointsToMerge(points_, addr);
|
||||
|
||||
Info<< " patch " << patch0 << ", " << patch1 << ": ("
|
||||
Info<< " patch " << patch0 << "," << patch1 << ": ("
|
||||
<< nPatch0Faces << " and " << nPatch1Faces << " faces) " << flush;
|
||||
|
||||
label nMerged = mergePoints
|
||||
@ -2175,11 +2189,11 @@ void Foam::ccm::reader::mergeInplaceInterfaces()
|
||||
// Note which one were successful
|
||||
labelHashSet done(failed0.size());
|
||||
|
||||
forAllConstIter(labelHashSet, failed0, iter0)
|
||||
forAllConstIters(failed0, iter0)
|
||||
{
|
||||
const label face0I = iter0.key();
|
||||
|
||||
forAllConstIter(labelHashSet, failed1, iter1)
|
||||
forAllConstIters(failed1, iter1)
|
||||
{
|
||||
const label face1I = iter1.key();
|
||||
|
||||
@ -2421,10 +2435,10 @@ void Foam::ccm::reader::reorderMesh()
|
||||
inplaceReorder(oldToNew, faceNeighbour_);
|
||||
inplaceReorder(oldToNew, origFaceId_);
|
||||
|
||||
forAllIter(HashTable<labelList>, monitoringSets_, iter)
|
||||
forAllIters(monitoringSets_, iter)
|
||||
{
|
||||
inplaceRenumber(oldToNew, iter());
|
||||
labelList &lst = iter();
|
||||
labelList& lst = iter.object();
|
||||
inplaceRenumber(oldToNew, lst);
|
||||
|
||||
// disallow monitoring on boundaries
|
||||
label nElem = 0;
|
||||
@ -2436,7 +2450,7 @@ void Foam::ccm::reader::reorderMesh()
|
||||
{
|
||||
lst[nElem] = lst[i];
|
||||
}
|
||||
nElem++;
|
||||
++nElem;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2478,10 +2492,9 @@ void Foam::ccm::reader::addPatches
|
||||
word patchName;
|
||||
word patchType;
|
||||
|
||||
Map<dictionary>::const_iterator
|
||||
citer = boundaryRegion_.find(origBndId_[patchI]);
|
||||
auto citer = boundaryRegion_.cfind(origBndId_[patchI]);
|
||||
|
||||
if (citer != boundaryRegion_.end())
|
||||
if (citer.found())
|
||||
{
|
||||
citer().lookup("Label") >> patchName;
|
||||
citer().lookup("BoundaryType") >> patchType;
|
||||
@ -2593,7 +2606,7 @@ void Foam::ccm::reader::addFaceZones
|
||||
}
|
||||
|
||||
nZone = 0;
|
||||
forAllConstIter(HashTable<labelList>, monitoringSets_, iter)
|
||||
forAllConstIters(monitoringSets_, iter)
|
||||
{
|
||||
Info<< "faceZone " << nZone
|
||||
<< " (size: " << iter().size() << ") name: "
|
||||
@ -2612,7 +2625,7 @@ void Foam::ccm::reader::addFaceZones
|
||||
)
|
||||
);
|
||||
|
||||
nZone++;
|
||||
++nZone;
|
||||
}
|
||||
|
||||
mesh.faceZones().writeOpt() = IOobject::AUTO_WRITE;
|
||||
|
||||
@ -622,7 +622,7 @@ Foam::ccm::reader::readField
|
||||
// transcribe to output list
|
||||
forAll(mapData, i)
|
||||
{
|
||||
label cellId = mapData[i];
|
||||
const label cellId = mapData[i];
|
||||
scalarData[cellId] = rawData[i];
|
||||
}
|
||||
|
||||
|
||||
@ -50,8 +50,8 @@ class namesList
|
||||
public SLList<T>
|
||||
{
|
||||
public:
|
||||
typedef typename SLList<T>::const_iterator const_iterator;
|
||||
typedef typename SLList<T>::iterator iterator;
|
||||
using const_iterator = typename SLList<T>::const_iterator;
|
||||
using iterator = typename SLList<T>::iterator;
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -65,12 +65,7 @@ public:
|
||||
//- Return true if a list element has a name that matches key
|
||||
bool found(const word& key) const
|
||||
{
|
||||
for
|
||||
(
|
||||
const_iterator iter = SLList<T>::begin();
|
||||
iter != SLList<T>::end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
if (iter().name() == key)
|
||||
{
|
||||
@ -85,12 +80,7 @@ public:
|
||||
//- Find a list element has a name matching key
|
||||
iterator find(const word& key)
|
||||
{
|
||||
for
|
||||
(
|
||||
iterator iter = SLList<T>::begin();
|
||||
iter != SLList<T>::end();
|
||||
++iter
|
||||
)
|
||||
forAllIters(*this, iter)
|
||||
{
|
||||
if (iter().name() == key)
|
||||
{
|
||||
@ -112,12 +102,7 @@ public:
|
||||
List<word> matched(SLList<T>::size());
|
||||
|
||||
label matchI = 0;
|
||||
for
|
||||
(
|
||||
const_iterator iter = SLList<T>::begin();
|
||||
iter != SLList<T>::end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
const word& name = iter().name();
|
||||
|
||||
@ -382,15 +367,16 @@ public:
|
||||
namesList<fieldEntry>()
|
||||
{}
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- The maximum cell Id referenced in the list
|
||||
label maxCellId() const
|
||||
{
|
||||
label maxId = 0;
|
||||
forAllConstIter(namesList<fieldEntry>, *this, iter)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
label currMax = (iter()).maxCellId();
|
||||
const label currMax = iter().maxCellId();
|
||||
|
||||
if (maxId < currMax)
|
||||
{
|
||||
@ -407,9 +393,9 @@ public:
|
||||
{
|
||||
label maxId = 0;
|
||||
|
||||
forAllConstIter(namesList<fieldEntry>, *this, iter)
|
||||
forAllConstIters(*this, iter)
|
||||
{
|
||||
label currMax = (iter()).maxFaceId();
|
||||
const label currMax = iter().maxFaceId();
|
||||
|
||||
if (maxId < currMax)
|
||||
{
|
||||
|
||||
@ -95,7 +95,7 @@ void Foam::ccm::writer::writeBoundaryRegion
|
||||
// Create dictionary lookup for constant/boundaryRegion
|
||||
dictionary typeDict;
|
||||
|
||||
forAllConstIter(Map<dictionary>, boundaryRegion_, iter)
|
||||
forAllConstIters(boundaryRegion_, iter)
|
||||
{
|
||||
const dictionary& dict = iter();
|
||||
if
|
||||
@ -207,7 +207,7 @@ void Foam::ccm::writer::writeCellTable
|
||||
|
||||
ccmID nodeId;
|
||||
|
||||
forAllConstIter(Map<dictionary>, cellTable_, iter)
|
||||
forAllConstIters(cellTable_, iter)
|
||||
{
|
||||
label intVal = iter.key();
|
||||
const dictionary& dict = iter();
|
||||
|
||||
@ -567,9 +567,9 @@ void Foam::ccm::writer::writeCells
|
||||
tableId = cellTable_.append(dict);
|
||||
}
|
||||
|
||||
forAll(cZone, i)
|
||||
for (auto id : cZone)
|
||||
{
|
||||
mapData[cZone[i]] = tableId;
|
||||
mapData[id] = tableId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -582,11 +582,11 @@ void Foam::ccm::writer::writeCells
|
||||
dict.add("MaterialType", "fluid");
|
||||
label tableId = cellTable_.append(dict);
|
||||
|
||||
forAll(mapData, i)
|
||||
for (auto& id : mapData)
|
||||
{
|
||||
if (mapData[i] < 0)
|
||||
if (id < 0)
|
||||
{
|
||||
mapData[i] = tableId;
|
||||
id = tableId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,8 +463,6 @@ void Foam::ccm::writer::writeSolution
|
||||
&phaseNode
|
||||
);
|
||||
|
||||
|
||||
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
{
|
||||
word fieldName = (*iter()).name();
|
||||
|
||||
Reference in New Issue
Block a user