STYLE: use forAllIter, forAllConstIter in more places

ENH: change some iterator -> const_iterator access

BUG: found some places with forAllIter and ::iterator !
This commit is contained in:
Mark Olesen
2010-04-13 09:10:36 +02:00
parent 5636df2b5a
commit 874120350c
37 changed files with 139 additions and 338 deletions

View File

@ -51,12 +51,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using STL iterator: " << nl << endl; Info<< nl << "And again using STL iterator: " << nl << endl;
for forAllIter(DLList<scalar>, myList, iter)
(
DLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -64,12 +59,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using the same STL iterator: " << nl << endl; Info<< nl << "And again using the same STL iterator: " << nl << endl;
for forAllIter(DLList<scalar>, myList, iter)
(
DLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "Removing " << myList.remove(iter) << endl; Info<< "Removing " << myList.remove(iter) << endl;
} }
@ -82,12 +72,7 @@ int main(int argc, char *argv[])
const DLList<scalar>& const_myList = myList; const DLList<scalar>& const_myList = myList;
for forAllConstIter(DLList<scalar>, const_myList, iter)
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -95,12 +80,7 @@ int main(int argc, char *argv[])
myList.swapUp(myList.DLListBase::first()); myList.swapUp(myList.DLListBase::first());
myList.swapUp(myList.DLListBase::last()); myList.swapUp(myList.DLListBase::last());
for forAllConstIter(DLList<scalar>, const_myList, iter)
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -108,19 +88,14 @@ int main(int argc, char *argv[])
myList.swapDown(myList.DLListBase::first()); myList.swapDown(myList.DLListBase::first());
myList.swapDown(myList.DLListBase::last()); myList.swapDown(myList.DLListBase::last());
for forAllConstIter(DLList<scalar>, const_myList, iter)
(
DLList<scalar>::const_iterator iter = const_myList.begin();
iter != const_myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
Info<< nl << "Testing transfer: " << nl << endl; Info<< nl << "Testing transfer: " << nl << nl
Info<< "original: " << myList << endl; << "original: " << myList << endl;
DLList<scalar> newList; DLList<scalar> newList;
newList.transfer(myList); newList.transfer(myList);

View File

@ -114,12 +114,7 @@ int main(int argc, char *argv[])
dict.swapDown(dict.first()); dict.swapDown(dict.first());
for forAllConstIter(Dictionary<ent>, dict, iter)
(
Dictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
Info<< "element : " << *iter; Info<< "element : " << *iter;
} }
@ -159,12 +154,7 @@ int main(int argc, char *argv[])
} }
Info<< nl << "scalarDict1: " << endl; Info<< nl << "scalarDict1: " << endl;
for forAllConstIter(PtrDictionary<Scalar>, scalarDict, iter)
(
PtrDictionary<Scalar>::const_iterator iter = scalarDict.begin();
iter != scalarDict.end();
++iter
)
{ {
Info<< " = " << iter() << endl; Info<< " = " << iter() << endl;
} }
@ -176,12 +166,7 @@ int main(int argc, char *argv[])
scalarDict2.insert(key, new Scalar(1.3*i)); scalarDict2.insert(key, new Scalar(1.3*i));
} }
Info<< nl << "scalarDict2: " << endl; Info<< nl << "scalarDict2: " << endl;
for forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter)
(
PtrDictionary<Scalar>::const_iterator iter = scalarDict2.begin();
iter != scalarDict2.end();
++iter
)
{ {
Info<< "elem = " << *iter << endl; Info<< "elem = " << *iter << endl;
} }

View File

@ -78,12 +78,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using STL iterator: " << nl << endl; Info<< nl << "And again using STL iterator: " << nl << endl;
for forAllIter(SLList<scalar>, myList, iter)
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -92,14 +87,9 @@ int main(int argc, char *argv[])
const ISLList<Scalar>& const_myList = myList; const ISLList<Scalar>& const_myList = myList;
for forAllConstIter(SLList<scalar>, const_myList, iter)
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{ {
Info<< "element:" << *iter2 << endl; Info<< "element:" << *iter << endl;
} }

View File

@ -188,12 +188,7 @@ int main(int argc, char *argv[])
sum = 0; sum = 0;
for (label iter = 0; iter < nIters; ++iter) for (label iter = 0; iter < nIters; ++iter)
{ {
for forAllIter(PackedBoolList, packed, it)
(
PackedBoolList::iterator it = packed.begin();
it != packed.end();
++it
)
{ {
sum += it; sum += it;
} }
@ -207,12 +202,7 @@ int main(int argc, char *argv[])
sum = 0; sum = 0;
for (label iter = 0; iter < nIters; ++iter) for (label iter = 0; iter < nIters; ++iter)
{ {
for forAllConstIter(PackedBoolList, packed, cit)
(
PackedBoolList::const_iterator cit = packed.cbegin();
cit != packed.cend();
++cit
)
{ {
sum += cit(); sum += cit();
} }
@ -333,12 +323,7 @@ int main(int argc, char *argv[])
// Write packed // Write packed
for (label iter = 0; iter < nIters; ++iter) for (label iter = 0; iter < nIters; ++iter)
{ {
for forAllIter(PackedBoolList, packed, it)
(
PackedBoolList::iterator it = packed.begin();
it != packed.end();
++it
)
{ {
it() = 1; it() = 1;
} }

View File

@ -51,12 +51,7 @@ int main(int argc, char *argv[])
Info<< nl << "And again using STL iterator: " << nl << endl; Info<< nl << "And again using STL iterator: " << nl << endl;
for forAllIter(SLList<scalar>, myList, iter)
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "element:" << *iter << endl; Info<< "element:" << *iter << endl;
} }
@ -65,39 +60,23 @@ int main(int argc, char *argv[])
const SLList<scalar>& const_myList = myList; const SLList<scalar>& const_myList = myList;
for forAllConstIter(SLList<scalar>, const_myList, iter)
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{ {
Info<< "element:" << *iter2 << endl; Info<< "element:" << *iter << endl;
} }
for forAllIter(SLList<scalar>, myList, iter)
(
SLList<scalar>::iterator iter = myList.begin();
iter != myList.end();
++iter
)
{ {
Info<< "Removing element:" << *iter << endl; Info<< "Removing element:" << *iter << endl;
myList.remove(iter); myList.remove(iter);
} }
for forAllConstIter(SLList<scalar>, const_myList, iter)
(
SLList<scalar>::const_iterator iter2 = const_myList.begin();
iter2 != const_myList.end();
++iter2
)
{ {
Info<< "element:" << *iter2 << endl; Info<< "element:" << *iter << endl;
} }
for (int i = 0; i<10; i++) for (int i = 0; i<10; i++)
{ {
myList.append(1.3*i); myList.append(1.3*i);

View File

@ -81,12 +81,7 @@ int main(int argc, char *argv[])
dict.swapDown(dict.first()); dict.swapDown(dict.first());
for forAllConstIter(UDictionary<ent>, dict, iter)
(
UDictionary<ent>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
{ {
Info<< "element : " << *iter; Info<< "element : " << *iter;
} }

View File

@ -441,12 +441,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
{ {
pFaces[CYCLIC].setSize(1); pFaces[CYCLIC].setSize(1);
pFaces[CYCLIC][0] = pFaces[WEDGE][0]; pFaces[CYCLIC][0] = pFaces[WEDGE][0];
for forAllIter(SLList<face>, pFaces[WEDGE][1], iterb)
(
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
iterb != pFaces[WEDGE][1].end();
++iterb
)
{ {
pFaces[CYCLIC][0].append(iterb()); pFaces[CYCLIC][0].append(iterb());
} }

View File

@ -143,12 +143,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -183,12 +178,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -209,12 +199,7 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -1461,7 +1446,7 @@ int main(int argc, char *argv[])
mesh.setInstance(meshInstance); mesh.setInstance(meshInstance);
} }
// Change master and slave boundary conditions on originating mesh // Change master and slave boundary conditions on originating mesh

View File

@ -99,12 +99,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -139,12 +134,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -165,12 +155,7 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();

View File

@ -506,7 +506,7 @@ void Foam::domainDecomposition::decomposeMesh()
// Add internal and boundary faces // Add internal and boundary faces
// Remember to increment the index by one such that the // Remember to increment the index by one such that the
// turning index works properly. // turning index works properly.
forAllIter(SLList<label>, curProcFaces, curProcFacesIter) forAllConstIter(SLList<label>, curProcFaces, curProcFacesIter)
{ {
curProcFaceAddressing[nFaces] = curProcFacesIter() + 1; curProcFaceAddressing[nFaces] = curProcFacesIter() + 1;
nFaces++; nFaces++;
@ -559,7 +559,7 @@ void Foam::domainDecomposition::decomposeMesh()
// add faces for this processor boundary // add faces for this processor boundary
forAllIter forAllConstIter
( (
SLList<label>, SLList<label>,
curInterProcBFacesIter(), curInterProcBFacesIter(),

View File

@ -55,7 +55,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
{ {
SLList<indexedParticle*>& particlePtrs = *cellParticles[celli]; SLList<indexedParticle*>& particlePtrs = *cellParticles[celli];
forAllIter(SLList<indexedParticle*>, particlePtrs, iter) forAllConstIter(SLList<indexedParticle*>, particlePtrs, iter)
{ {
const indexedParticle& ppi = *iter(); const indexedParticle& ppi = *iter();
particleIndices_[pi++] = ppi.index(); particleIndices_[pi++] = ppi.index();

View File

@ -50,7 +50,7 @@ void readFields
label nFields = fields.size(); label nFields = fields.size();
fields.setSize(nFields + fieldObjects.size()); fields.setSize(nFields + fieldObjects.size());
forAllIter(IOobjectList::iterator, fieldObjects, iter) forAllIter(IOobjectList, fieldObjects, iter)
{ {
if (selectedFields.empty() || selectedFields.found(iter()->name())) if (selectedFields.empty() || selectedFields.found(iter()->name()))
{ {

View File

@ -502,7 +502,7 @@ Foam::wordList Foam::dictionary::toc() const
wordList keys(size()); wordList keys(size());
label nKeys = 0; label nKeys = 0;
forAllConstIter(IDLList<entry>::const_iterator, *this, iter) forAllConstIter(IDLList<entry>, *this, iter)
{ {
keys[nKeys++] = iter().keyword(); keys[nKeys++] = iter().keyword();
} }

View File

@ -54,7 +54,7 @@ Foam::dlLibraryTable::readDlLibrary::readDlLibrary
Foam::dlLibraryTable::~dlLibraryTable() Foam::dlLibraryTable::~dlLibraryTable()
{ {
forAllIter(dlLibraryTable, *this, iter) forAllConstIter(dlLibraryTable, *this, iter)
{ {
dlclose(iter.key()); dlclose(iter.key());
} }

View File

@ -49,12 +49,7 @@ inline void mapClouds(const objectRegistry& db, const mapPolyMesh& mapper)
{ {
HashTable<const cloud*> clouds(db.lookupClass<cloud>()); HashTable<const cloud*> clouds(db.lookupClass<cloud>());
for forAllIter(HashTable<const cloud*>, clouds, iter)
(
HashTable<const cloud*>::iterator iter = clouds.begin();
iter != clouds.end();
++iter
)
{ {
cloud& c = const_cast<cloud&>(*iter()); cloud& c = const_cast<cloud&>(*iter());

View File

@ -163,7 +163,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
{ {
faceCells_[nCoarseFaces] = contents[masterI]; faceCells_[nCoarseFaces] = contents[masterI];
forAllIter(SLList<label>, faceFacesIter(), facesIter) forAllConstIter(SLList<label>, faceFacesIter(), facesIter)
{ {
faceRestrictAddressing_[facesIter()] = nCoarseFaces; faceRestrictAddressing_[facesIter()] = nCoarseFaces;
} }
@ -192,7 +192,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
{ {
faceCells_[nCoarseFaces] = nbrsIter(); faceCells_[nCoarseFaces] = nbrsIter();
forAllIter(SLList<label>, faceFacesIter(), facesIter) forAllConstIter(SLList<label>, faceFacesIter(), facesIter)
{ {
faceRestrictAddressing_[facesIter() + sizeBy2] = nCoarseFaces; faceRestrictAddressing_[facesIter() + sizeBy2] = nCoarseFaces;
} }

View File

@ -180,7 +180,7 @@ Foam::processorGAMGInterface::processorGAMGInterface
{ {
faceCells_[nCoarseFaces] = contents[masterI]; faceCells_[nCoarseFaces] = contents[masterI];
forAllIter(SLList<label>, faceFacesIter(), facesIter) forAllConstIter(SLList<label>, faceFacesIter(), facesIter)
{ {
faceRestrictAddressing_[facesIter()] = nCoarseFaces; faceRestrictAddressing_[facesIter()] = nCoarseFaces;
} }
@ -213,7 +213,7 @@ Foam::processorGAMGInterface::processorGAMGInterface
{ {
faceCells_[nCoarseFaces] = nbrsIter(); faceCells_[nCoarseFaces] = nbrsIter();
forAllIter(SLList<label>, faceFacesIter(), facesIter) forAllConstIter(SLList<label>, faceFacesIter(), facesIter)
{ {
faceRestrictAddressing_[facesIter()] = nCoarseFaces; faceRestrictAddressing_[facesIter()] = nCoarseFaces;
} }

View File

@ -1411,7 +1411,7 @@ void Foam::globalPoints::calculateSharedPoints
// Sort procPoints in incremental order. This will make the master the // Sort procPoints in incremental order. This will make the master the
// first element. // first element.
forAllIter(Map<label>, meshToProcPoint_, iter) forAllConstIter(Map<label>, meshToProcPoint_, iter)
{ {
sort(procPoints_[iter()]); sort(procPoints_[iter()]);
} }

View File

@ -371,9 +371,9 @@ Foam::mapDistribute::mapDistribute
label i = 0; label i = 0;
forAllIter(Map<label>, compactMap[procI], iter) forAllIter(Map<label>, compactMap[procI], iter)
{ {
const label compactI = compactStart[procI] + iter();
remoteElem[i] = iter.key(); remoteElem[i] = iter.key();
label compactI = compactStart[procI]+iter(); localElem[i] = compactI;
localElem[i] = compactI;
iter() = compactI; iter() = compactI;
i++; i++;
} }
@ -525,9 +525,9 @@ Foam::mapDistribute::mapDistribute
label i = 0; label i = 0;
forAllIter(Map<label>, compactMap[procI], iter) forAllIter(Map<label>, compactMap[procI], iter)
{ {
const label compactI = compactStart[procI] + iter();
remoteElem[i] = iter.key(); remoteElem[i] = iter.key();
label compactI = compactStart[procI]+iter(); localElem[i] = compactI;
localElem[i] = compactI;
iter() = compactI; iter() = compactI;
i++; i++;
} }

View File

@ -201,12 +201,7 @@ void Foam::syncTools::syncPointMap
// Only update those values which come from neighbour // Only update those values which come from neighbour
forAllConstIter forAllConstIter(typename Map<T>, nbrPatchInfo, nbrIter)
(
typename Map<T>,
nbrPatchInfo,
nbrIter
)
{ {
combine combine
( (
@ -550,12 +545,7 @@ void Foam::syncTools::syncEdgeMap
// Only update those values which come from neighbour // Only update those values which come from neighbour
forAllConstIter forAllConstIter(typename EdgeMap<T>, nbrPatchInfo, nbrIter)
(
typename EdgeMap<T>,
nbrPatchInfo,
nbrIter
)
{ {
const edge& e = nbrIter.key(); const edge& e = nbrIter.key();
const edge meshEdge(meshPts[e[0]], meshPts[e[1]]); const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);

View File

@ -80,12 +80,14 @@ calcPointEdges() const
forAll(pointEdges, pointI) forAll(pointEdges, pointI)
{ {
pe[pointI].setSize(pointEdges[pointI].size()); const SLList<label>& pEdge = pointEdges[pointI];
pe[pointI].setSize(pEdge.size());
label i = 0; label i = 0;
forAllIter(SLList<label>, pointEdges[pointI], curEdgesIter) forAllConstIter(SLList<label>, pEdge, iter)
{ {
pe[pointI][i++] = curEdgesIter(); pe[pointI][i++] = iter();
} }
} }

View File

@ -35,12 +35,7 @@ void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -68,12 +63,7 @@ void Foam::fvMeshDistribute::addPatchFields(const word& patchFieldType)
mesh_.objectRegistry::lookupClass<GeoField>() mesh_.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -108,12 +98,7 @@ void Foam::fvMeshDistribute::deleteTrailingPatchFields()
mesh_.objectRegistry::lookupClass<GeoField>() mesh_.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -147,12 +132,7 @@ void Foam::fvMeshDistribute::saveBoundaryFields
label i = 0; label i = 0;
for forAllConstIter(typename HashTable<const fldType*>, flds, iter)
(
typename HashTable<const fldType*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const fldType& fld = *iter(); const fldType& fld = *iter();
@ -189,12 +169,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields
label fieldI = 0; label fieldI = 0;
for forAllConstIter(typename HashTable<const fldType*>, flds, iter)
(
typename HashTable<const fldType*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const fldType& fld = *iter(); const fldType& fld = *iter();
typename fldType::GeometricBoundaryField& bfld = typename fldType::GeometricBoundaryField& bfld =
@ -245,12 +220,7 @@ void Foam::fvMeshDistribute::initPatchFields
mesh_.objectRegistry::lookupClass<GeoField>() mesh_.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();

View File

@ -36,12 +36,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam defineTypeNameAndDebug(Foam::combineFaces, 0);
{
defineTypeNameAndDebug(combineFaces, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -46,12 +46,7 @@ void setUpdater::updateSets(const mapPolyMesh& morphMap) const
HashTable<const Type*> memSets = HashTable<const Type*> memSets =
morphMap.mesh().objectRegistry::lookupClass<Type>(); morphMap.mesh().objectRegistry::lookupClass<Type>();
for forAllIter(typename HashTable<const Type*>, memSets, iter)
(
typename HashTable<const Type*>::iterator iter = memSets.begin();
iter != memSets.end();
++iter
)
{ {
Type& set = const_cast<Type&>(*iter()); Type& set = const_cast<Type&>(*iter());

View File

@ -461,7 +461,11 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
iter iter
) )
{ {
scalarFields_.insert(iter.key(), new scalarField(*iter(), mapper)); scalarFields_.insert
(
iter.key(),
new scalarField(*iter(), mapper)
);
} }
forAllConstIter forAllConstIter
@ -471,7 +475,11 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
iter iter
) )
{ {
vectorFields_.insert(iter.key(), new vectorField(*iter(), mapper)); vectorFields_.insert
(
iter.key(),
new vectorField(*iter(), mapper)
);
} }
forAllConstIter forAllConstIter
@ -509,7 +517,11 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
iter iter
) )
{ {
tensorFields_.insert(iter.key(), new tensorField(*iter(), mapper)); tensorFields_.insert
(
iter.key(),
new tensorField(*iter(), mapper)
);
} }
} }

View File

@ -352,14 +352,32 @@ genericPointPatchField<Type>::genericPointPatchField
actualTypeName_(ptf.actualTypeName_), actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_) dict_(ptf.dict_)
{ {
forAllConstIter(HashPtrTable<scalarField>, ptf.scalarFields_, iter) forAllConstIter
(
HashPtrTable<scalarField>,
ptf.scalarFields_,
iter
)
{ {
scalarFields_.insert(iter.key(), new scalarField(*iter(), mapper)); scalarFields_.insert
(
iter.key(),
new scalarField(*iter(), mapper)
);
} }
forAllConstIter(HashPtrTable<vectorField>, ptf.vectorFields_, iter) forAllConstIter
(
HashPtrTable<vectorField>,
ptf.vectorFields_,
iter
)
{ {
vectorFields_.insert(iter.key(), new vectorField(*iter(), mapper)); vectorFields_.insert
(
iter.key(),
new vectorField(*iter(), mapper)
);
} }
forAllConstIter forAllConstIter
@ -397,7 +415,11 @@ genericPointPatchField<Type>::genericPointPatchField
iter iter
) )
{ {
tensorFields_.insert(iter.key(), new tensorField(*iter(), mapper)); tensorFields_.insert
(
iter.key(),
new tensorField(*iter(), mapper)
);
} }
} }

View File

@ -227,12 +227,7 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
typename ParticleType::iNew(*this) typename ParticleType::iNew(*this)
); );
forAllIter forAllIter(typename Cloud<ParticleType>, newParticles, newpIter)
(
typename Cloud<ParticleType>,
newParticles,
newpIter
)
{ {
ParticleType& newp = newpIter(); ParticleType& newp = newpIter();
newp.correctAfterParallelTransfer(patchi, td); newp.correctAfterParallelTransfer(patchi, td);

View File

@ -33,12 +33,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam void Foam::spray::evolve()
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void spray::evolve()
{ {
sms_.setSize(rho_.size()); sms_.setSize(rho_.size());
shs_.setSize(rho_.size()); shs_.setSize(rho_.size());
@ -71,7 +66,7 @@ void spray::evolve()
} }
void spray::move() void Foam::spray::move()
{ {
// Reset Spray Source Terms // Reset Spray Source Terms
sms_ = vector::zero; sms_ = vector::zero;
@ -85,9 +80,9 @@ void spray::move()
} }
void spray::breakupLoop() void Foam::spray::breakupLoop()
{ {
forAllIter(spray::iterator, *this, elmnt) forAllIter(spray, *this, elmnt)
{ {
// interpolate... // interpolate...
vector velocity = UInterpolator().interpolate vector velocity = UInterpolator().interpolate
@ -119,9 +114,9 @@ void spray::breakupLoop()
} }
void spray::atomizationLoop() void Foam::spray::atomizationLoop()
{ {
forAllIter(spray::iterator, *this, elmnt) forAllIter(spray, *this, elmnt)
{ {
// interpolate... // interpolate...
vector velocity = UInterpolator().interpolate vector velocity = UInterpolator().interpolate
@ -145,8 +140,4 @@ void spray::atomizationLoop()
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -29,8 +29,7 @@ if (mesh.time().timeIndex() % vacf.sampleSteps() == 0)
label uV = 0; label uV = 0;
// or forAllConstIter forAllConstIter(IDLList<molecule>, molecules, mol)
forAllIter(IDLList<molecule>, molecules, mol)
{ {
uVals[uV++] = mol().U(); uVals[uV++] = mol().U();
} }
@ -42,8 +41,7 @@ if (mesh.time().timeIndex() % pacf.sampleSteps() == 0)
{ {
vector p = vector::zero; vector p = vector::zero;
// or forAllConstIter forAllConstIter(IDLList<molecule>, molecules, mol)
forAllIter(IDLList<molecule>, molecules, mol)
{ {
p.x() += p.x() +=
mol().mass() * mol().U().y() * mol().U().z() mol().mass() * mol().U().y() * mol().U().z()
@ -65,8 +63,7 @@ if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0)
{ {
vector s = vector::zero; vector s = vector::zero;
// or forAllConstIter forAllConstIter(IDLList<molecule>, molecules, mol)
forAllIter(IDLList<molecule>, molecules, mol)
{ {
s += s +=
( (

View File

@ -54,14 +54,9 @@ label singleStepNMols = molecules.size();
label singleStepDOFs = 0; label singleStepDOFs = 0;
{ {
for forAllConstIter(IDLList<molecule>, molecules, mol)
(
IDLList<molecule>::iterator mol = molecules.begin();
mol != molecules.end();
++mol
)
{ {
label molId = mol().id(); const label molId = mol().id();
scalar molMass(molecules.constProps(molId).mass()); scalar molMass(molecules.constProps(molId).mass());
@ -75,14 +70,9 @@ label singleStepDOFs = 0;
// singleStepCentreOfMass /= singleStepTotalMass; // singleStepCentreOfMass /= singleStepTotalMass;
// } // }
for forAllConstIter(IDLList<molecule>, molecules, mol)
(
IDLList<molecule>::iterator mol = molecules.begin();
mol != molecules.end();
++mol
)
{ {
label molId = mol().id(); const label molId = mol().id();
const molecule::constantProperties cP(molecules.constProps(molId)); const molecule::constantProperties cP(molecules.constProps(molId));

View File

@ -72,7 +72,7 @@ void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
c.checkFieldIOobject(c, U); c.checkFieldIOobject(c, U);
label i = 0; label i = 0;
forAllIter(Cloud<solidParticle>::iterator, c, iter) forAllIter(Cloud<solidParticle>, c, iter)
{ {
solidParticle& p = iter(); solidParticle& p = iter();

View File

@ -125,12 +125,7 @@ void meshRefinement::addPatchFields(fvMesh& mesh, const word& patchFieldType)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();
@ -165,12 +160,7 @@ void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
for forAllConstIter(typename HashTable<const GeoField*>, flds, iter)
(
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
iter != flds.end();
++iter
)
{ {
const GeoField& fld = *iter(); const GeoField& fld = *iter();

View File

@ -150,9 +150,9 @@ void Foam::normalToFace::applyToSet
DynamicList<label> toBeRemoved(set.size()/10); DynamicList<label> toBeRemoved(set.size()/10);
forAllIter(topoSet, set, iter) forAllConstIter(topoSet, set, iter)
{ {
label faceI = iter.key(); const label faceI = iter.key();
vector n = mesh_.faceAreas()[faceI]; vector n = mesh_.faceAreas()[faceI];
n /= mag(n) + VSMALL; n /= mag(n) + VSMALL;

View File

@ -329,12 +329,7 @@ Foam::intersectedSurface::calcPointEdgeAddressing
} }
// Shrink it // Shrink it
for forAllIter(Map< DynamicList<label> >, facePointEdges, iter)
(
Map<DynamicList<label> >::iterator iter = facePointEdges.begin();
iter != facePointEdges.end();
++iter
)
{ {
iter().shrink(); iter().shrink();
@ -358,17 +353,13 @@ Foam::intersectedSurface::calcPointEdgeAddressing
{ {
label edgeI = fEdges[i]; label edgeI = fEdges[i];
const edge& e = edges[edgeI]; const edge& e = edges[edgeI];
Pout<< " " << edgeI << ' ' << e << points[e.start()] Pout<< " " << edgeI << ' ' << e
<< points[e.start()]
<< points[e.end()] << endl; << points[e.end()] << endl;
} }
Pout<< " Constructed point-edge adressing:" << endl; Pout<< " Constructed point-edge adressing:" << endl;
for forAllConstIter(Map< DynamicList<label> >, facePointEdges, iter)
(
Map<DynamicList<label> >::iterator iter = facePointEdges.begin();
iter != facePointEdges.end();
++iter
)
{ {
Pout<< " vertex " << iter.key() << " is connected to edges " Pout<< " vertex " << iter.key() << " is connected to edges "
<< iter() << endl; << iter() << endl;

View File

@ -96,7 +96,7 @@ void Foam::reconstructLagrangianFields
const IOobjectList& objects const IOobjectList& objects
) )
{ {
word fieldClassName(IOField<Type>::typeName); const word fieldClassName(IOField<Type>::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName); IOobjectList fields = objects.lookupClass(fieldClassName);
@ -105,7 +105,7 @@ void Foam::reconstructLagrangianFields
Info<< " Reconstructing lagrangian " Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl; << fieldClassName << "s\n" << endl;
forAllIter(IOobjectList, fields, fieldIter) forAllConstIter(IOobjectList, fields, fieldIter)
{ {
Info<< " " << fieldIter()->name() << endl; Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianField<Type> reconstructLagrangianField<Type>

View File

@ -52,7 +52,7 @@ void Foam::reconstructLagrangianPositions
Cloud<passiveParticle> lpi(meshes[i], cloudName, false); Cloud<passiveParticle> lpi(meshes[i], cloudName, false);
forAllIter(Cloud<passiveParticle>, lpi, iter) forAllConstIter(Cloud<passiveParticle>, lpi, iter)
{ {
const passiveParticle& ppi = iter(); const passiveParticle& ppi = iter();

View File

@ -37,14 +37,9 @@ Description
#include "readHexLabel.H" #include "readHexLabel.H"
#include "stringList.H" #include "stringList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool triSurface::readTRI(const fileName& TRIfileName) bool Foam::triSurface::readTRI(const fileName& TRIfileName)
{ {
IFstream TRIfile(TRIfileName); IFstream TRIfile(TRIfileName);
@ -113,12 +108,12 @@ bool triSurface::readTRI(const fileName& TRIfileName)
label region = -1; label region = -1;
HashTable<label, string>::const_iterator findName = HashTable<label, string>::const_iterator fnd =
STLsolidNames.find(solidName); STLsolidNames.find(solidName);
if (findName != STLsolidNames.end()) if (fnd != STLsolidNames.end())
{ {
region = findName(); region = fnd();
} }
else else
{ {
@ -135,16 +130,16 @@ bool triSurface::readTRI(const fileName& TRIfileName)
pointField rawPoints(STLpoints.size()); pointField rawPoints(STLpoints.size());
label i = 0; label pointI = 0;
forAllIter(SLList<STLpoint>, STLpoints, iter) forAllConstIter(SLList<STLpoint>, STLpoints, iter)
{ {
rawPoints[i++] = *iter; rawPoints[pointI++] = *iter;
} }
setSize(STLlabels.size()); setSize(STLlabels.size());
label pointI = 0; pointI = 0;
SLList<label>::iterator iter = STLlabels.begin(); SLList<label>::const_iterator iter = STLlabels.begin();
forAll(*this, i) forAll(*this, i)
{ {
operator[](i)[0] = pointI++; operator[](i)[0] = pointI++;
@ -171,8 +166,4 @@ bool triSurface::readTRI(const fileName& TRIfileName)
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //