Commit a50f01b0 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use forAllIter, forAllConstIter instead of long-hand version

STYLE: use 'forAll(' NOT 'forAll (', as per coding guide
parent 0f58ac5a
......@@ -84,7 +84,7 @@
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll (Y, i)
forAll(Y, i)
{
fields.add(Y[i]);
}
......
......@@ -292,20 +292,14 @@ void addCutNeighbours
labelHashSet addCutFaces(cutCells.size());
for
(
labelHashSet::const_iterator iter = cutCells.begin();
iter != cutCells.end();
++iter
)
forAllConstIter(labelHashSet, cutCells, iter)
{
label cellI = iter.key();
const label cellI = iter.key();
const labelList& cFaces = mesh.cells()[cellI];
forAll(cFaces, i)
{
label faceI = cFaces[i];
const label faceI = cFaces[i];
if (mesh.isInternalFace(faceI))
{
......@@ -331,12 +325,7 @@ void addCutNeighbours
Info<< " Selected an additional " << addCutFaces.size()
<< " neighbours of cutCells to refine" << endl;
for
(
labelHashSet::const_iterator iter = addCutFaces.begin();
iter != addCutFaces.end();
++iter
)
forAllConstIter(labelHashSet, addCutFaces, iter)
{
cutCells.insert(iter.key());
}
......@@ -386,21 +375,15 @@ bool limitRefinementLevel
labelHashSet addCutCells(cutCells.size());
for
(
labelHashSet::const_iterator iter = cutCells.begin();
iter != cutCells.end();
++iter
)
forAllConstIter(labelHashSet, cutCells, iter)
{
// cellI will be refined.
label cellI = iter.key();
const label cellI = iter.key();
const labelList& cCells = mesh.cellCells()[cellI];
forAll(cCells, i)
{
label nbr = cCells[i];
const label nbr = cCells[i];
if (!excludeCells.found(nbr) && !cutCells.found(nbr))
{
......@@ -419,12 +402,8 @@ bool limitRefinementLevel
Info<< "Added an additional " << addCutCells.size() << " cells"
<< " to satisfy 1:" << limitDiff << " refinement level"
<< endl;
for
(
labelHashSet::const_iterator iter = addCutCells.begin();
iter != addCutCells.end();
++iter
)
forAllConstIter(labelHashSet, addCutCells, iter)
{
cutCells.insert(iter.key());
}
......
......@@ -112,12 +112,7 @@ int main(int argc, char *argv[])
<< cells.instance()/cells.local()/cells.name()
<< nl << endl;
for
(
cellSet::const_iterator iter = cells.begin();
iter != cells.end();
++iter
)
forAllConstIter(cellSet, cells, iter)
{
cutCells.erase(iter.key());
}
......@@ -131,7 +126,7 @@ int main(int argc, char *argv[])
forAll(meshPoints, pointI)
{
label meshPointI = meshPoints[pointI];
const label meshPointI = meshPoints[pointI];
vertOnPatch[meshPointI] = true;
}
......@@ -151,8 +146,7 @@ int main(int argc, char *argv[])
forAll(pEdges, pEdgeI)
{
label edgeI = pEdges[pEdgeI];
const label edgeI = pEdges[pEdgeI];
const edge& e = mesh.edges()[edgeI];
label otherPointI = e.otherVertex(meshPointI);
......
......@@ -392,15 +392,9 @@ void collectCuts
boolList edgeIsCut(mesh.nEdges(), false);
scalarField edgeWeight(mesh.nEdges(), -GREAT);
for
(
cellSet::const_iterator iter = cellsToCut.begin();
iter != cellsToCut.end();
++iter
)
forAllConstIter(cellSet, cellsToCut, iter)
{
label cellI = iter.key();
const label cellI = iter.key();
const labelList& cEdges = cellEdges[cellI];
forAll(cEdges, i)
......
......@@ -268,13 +268,8 @@ int main(int argc, char *argv[])
pointField points(slPoints.size());
label i=0;
for
(
SLList<point>::iterator pointIter = slPoints.begin();
pointIter != slPoints.end();
++pointIter
)
label i = 0;
forAllConstIter(SLList<point>, slPoints, pointIter)
{
// Scale points for the given scale factor
points[i++] = scaleFactor * pointIter();
......@@ -283,13 +278,8 @@ int main(int argc, char *argv[])
labelList pointMap(maxNodei+1);
i=0;
for
(
SLList<label>::iterator pointMapIter = slPointMap.begin();
pointMapIter != slPointMap.end();
++pointMapIter
)
i = 0;
forAllConstIter(SLList<label>, slPointMap, pointMapIter)
{
pointMap[pointMapIter()] = i++;
}
......@@ -298,13 +288,8 @@ int main(int argc, char *argv[])
labelList cellMap(maxCelli+1);
i=0;
for
(
SLList<label>::iterator cellMapIter = slCellMap.begin();
cellMapIter != slCellMap.end();
++cellMapIter
)
i = 0;
forAllConstIter(SLList<label>, slCellMap, cellMapIter)
{
cellMap[cellMapIter()] = i++;
}
......@@ -323,12 +308,7 @@ int main(int argc, char *argv[])
cellShapeList cellShapes(slCellLabels.size());
label nCells = 0;
for
(
SLPtrList<labelList>::iterator cellIter = slCellLabels.begin();
cellIter != slCellLabels.end();
++cellIter
)
forAllConstIter(SLPtrList<labelList>, slCellLabels, cellIter)
{
if // Tetrahedron
(
......
......@@ -327,12 +327,7 @@ if
{
scalar minz = GREAT;
for
(
SLList<face>::iterator iter = pFaces[CYLINDERHEAD][0].begin();
iter != pFaces[CYLINDERHEAD][0].end();
++iter
)
forAllConstIter(SLList<face>, pFaces[CYLINDERHEAD][0], iter)
{
const face& pf = iter();
......@@ -346,12 +341,7 @@ if
SLList<face> newLinerFaces;
for
(
SLList<face>::iterator iter = pFaces[LINER][0].begin();
iter != pFaces[LINER][0].end();
++iter
)
forAllConstIter(SLList<face>, pFaces[LINER][0], iter)
{
const face& pf = iter();
......@@ -380,12 +370,7 @@ if
SLList<face> newCylinderHeadFaces;
for
(
SLList<face>::iterator iter = pFaces[CYLINDERHEAD][0].begin();
iter != pFaces[CYLINDERHEAD][0].end();
++iter
)
forAllConstIter(SLList<face>, pFaces[CYLINDERHEAD][0], iter)
{
const face& pf = iter();
......
......@@ -468,12 +468,7 @@ int main(int argc, char *argv[])
// Print region to patch mapping
Info<< "Regions:" << endl;
for
(
Map<label>::const_iterator iter = regionToPatch.begin();
iter != regionToPatch.end();
++iter
)
forAllConstIter(Map<label>, regionToPatch, iter)
{
Info<< " region:" << iter.key() << '\t' << "patch:"
<< iter() << endl;
......
......@@ -356,12 +356,7 @@ void writePointCells
label vertI = 0;
for
(
labelHashSet::const_iterator iter = allEdges.begin();
iter != allEdges.end();
++iter
)
forAllConstIter(labelHashSet, allEdges, iter)
{
const edge& e = mesh.edges()[iter.key()];
......
......@@ -100,12 +100,7 @@ int main(int argc, char *argv[])
//Pout<< "pointSets:" << pointObjects.names() << endl;
for
(
IOobjectList::const_iterator iter = pointObjects.begin();
iter != pointObjects.end();
++iter
)
forAllConstIter(IOobjectList, pointObjects, iter)
{
// Not in memory. Load it.
pointSet set(*iter());
......@@ -149,12 +144,7 @@ int main(int argc, char *argv[])
//Pout<< "faceSets:" << faceObjects.names() << endl;
for
(
IOobjectList::const_iterator iter = faceObjects.begin();
iter != faceObjects.end();
++iter
)
forAllConstIter(IOobjectList, faceObjects, iter)
{
// Not in memory. Load it.
faceSet set(*iter());
......@@ -288,12 +278,7 @@ int main(int argc, char *argv[])
//Pout<< "cellSets:" << cellObjects.names() << endl;
for
(
IOobjectList::const_iterator iter = cellObjects.begin();
iter != cellObjects.end();
++iter
)
forAllConstIter(IOobjectList, cellObjects, iter)
{
if (!slaveCellSets.found(iter.key()))
{
......
......@@ -81,8 +81,7 @@ Foam::label Foam::regionSide::otherEdge
forAll(fEdges, fEdgeI)
{
label otherEdgeI = fEdges[fEdgeI];
const label otherEdgeI = fEdges[fEdgeI];
const edge& otherE = mesh.edges()[otherEdgeI];
if
......@@ -300,15 +299,9 @@ void Foam::regionSide::walkAllPointConnectedFaces
//
labelHashSet regionEdges(4*regionFaces.size());
for
(
labelHashSet::const_iterator iter = regionFaces.begin();
iter != regionFaces.end();
++iter
)
forAllConstIter(labelHashSet, regionFaces, iter)
{
label faceI = iter.key();
const label faceI = iter.key();
const labelList& fEdges = mesh.faceEdges()[faceI];
forAll(fEdges, fEdgeI)
......@@ -326,12 +319,7 @@ void Foam::regionSide::walkAllPointConnectedFaces
labelHashSet visitedPoint(4*regionFaces.size());
// Insert fence points so we don't visit them
for
(
labelHashSet::const_iterator iter = fencePoints.begin();
iter != fencePoints.end();
++iter
)
forAllConstIter(labelHashSet, fencePoints, iter)
{
visitedPoint.insert(iter.key());
}
......@@ -344,14 +332,9 @@ void Foam::regionSide::walkAllPointConnectedFaces
Info<< "Excluding visit of points:" << visitedPoint << endl;
}
for
(
labelHashSet::const_iterator iter = regionFaces.begin();
iter != regionFaces.end();
++iter
)
forAllConstIter(labelHashSet, regionFaces, iter)
{
label faceI = iter.key();
const label faceI = iter.key();
// Get side of face.
label cellI;
......@@ -459,12 +442,7 @@ Foam::regionSide::regionSide
labelHashSet fencePoints(fenceEdges.size());
for
(
labelHashSet::const_iterator iter = fenceEdges.begin();
iter != fenceEdges.end();
++iter
)
forAllConstIter(labelHashSet, fenceEdges, iter)
{
const edge& e = mesh.edges()[iter.key()];
......
......@@ -360,7 +360,7 @@ int main(int argc, char *argv[])
labelList osf(slavePatch.size());
forAll (osf, i)
forAll(osf, i)
{
osf[i] = slavePatch.start() + i;
}
......
......@@ -76,12 +76,7 @@ int main(int argc, char *argv[])
if (args.optionFound("keywords") && !args.optionFound("entry"))
{
for
(
IDLList<entry>::iterator iter = dict.begin();
iter != dict.end();
++iter
)
forAllConstIter(dictionary, dict, iter)
{
Info<< iter().keyword() << endl;
}
......@@ -137,13 +132,8 @@ int main(int argc, char *argv[])
}
*/
const dictionary& dict(entPtr->dict());
for
(
IDLList<entry>::const_iterator iter = dict.begin();
iter != dict.end();
++iter
)
const dictionary& dict = entPtr->dict();
forAllConstIter(dictionary, dict, iter)
{
Info<< iter().keyword() << endl;
}
......
......@@ -506,12 +506,7 @@ void Foam::domainDecomposition::decomposeMesh()
// Add internal and boundary faces
// Remember to increment the index by one such that the
// turning index works properly.
for
(
SLList<label>::iterator curProcFacesIter = curProcFaces.begin();
curProcFacesIter != curProcFaces.end();
++curProcFacesIter
)
forAllIter(SLList<label>, curProcFaces, curProcFacesIter)
{
curProcFaceAddressing[nFaces] = curProcFacesIter() + 1;
nFaces++;
......@@ -564,12 +559,11 @@ void Foam::domainDecomposition::decomposeMesh()
// add faces for this processor boundary
for
forAllIter
(
SLList<label>::iterator curFacesIter =
curInterProcBFacesIter().begin();
curFacesIter != curInterProcBFacesIter().end();
++curFacesIter
SLList<label>,
curInterProcBFacesIter(),
curFacesIter
)
{
// add the face
......
......@@ -48,22 +48,13 @@ void Foam::readFields
// Construct the vol scalar fields
fields.setSize(fieldObjects.size());
label fieldi=0;
for
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
label fieldI = 0;
forAllIter(IOobjectList, fieldObjects, iter)
{
fields.set
(
fieldi++,
new GeoField
(
*iter(),
mesh
)
fieldI++,
new GeoField(*iter(), mesh)
);
}
}
......
......@@ -110,34 +110,21 @@ int main(int argc, char *argv[])
// Search list of objects for volScalarFields
IOobjectList scalarFields(objects.lookupClass("volScalarField"));
for
(
IOobjectList::iterator scalarFieldIter = scalarFields.begin();
scalarFieldIter != scalarFields.end();
++scalarFieldIter
)
forAllIter(IOobjectList, scalarFields, iter)
{
// Read field
volScalarField field
(
*scalarFieldIter(),
mesh
);
volScalarField field(*iter(), mesh);
// lookup field from dictionary
if (foamDataToFluentDict.found(field.name()))
// lookup field from dictionary and convert field
label unitNumber;
if
(
foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
&& unitNumber > 0
)
{
label unitNumber
(
readLabel(foamDataToFluentDict.lookup(field.name()))
);
// Convert field
if (unitNumber > 0)
{
Info<< " Converting field " << field.name() << endl;
writeFluentField(field, unitNumber, fluentDataFile);
}
Info<< " Converting field " << field.name() << endl;
writeFluentField(field, unitNumber, fluentDataFile);
}
}
......@@ -148,34 +135,21 @@ int main(int argc, char *argv[])
// Search list of objects for volVectorFields
IOobjectList vectorFields(objects.lookupClass("volVectorField"));
for
(
IOobjectList::iterator vectorFieldIter = vectorFields.begin();
vectorFieldIter != vectorFields.end();
++vectorFieldIter
)
forAllIter(IOobjectList, vectorFields, iter)
{
// Read field
volVectorField field
(
*vectorFieldIter(),
mesh
);
volVectorField field(*iter(), mesh);
// lookup field from dictionary
if (foamDataToFluentDict.found(field.name()))
// lookup field from dictionary and convert field
label unitNumber;
if
(
foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
&& unitNumber > 0
)
{
label unitNumber
(
readLabel(foamDataToFluentDict.lookup(field.name()))
);
// Convert field
if (unitNumber > 0)
{
Info<< " Converting field " << field.name() << endl;
writeFluentField(field, unitNumber, fluentDataFile);
}
Info<< " Converting field " << field.name() << endl;
writeFluentField(field, unitNumber, fluentDataFile);
}
}
......
......@@ -22,11 +22,11 @@ for (label i=0; i < nTypes; i++)
if (fieldTypes[i] == "volScalarField")
{
volScalarField gmvScalarField(fieldObject, mesh);
volScalarField fld(fieldObject, mesh);
gmvFile << fieldName << " 0" << nl;
for (label indx=0;indx<mesh.nCells();indx++)
{
gmvFile << gmvScalarField[indx] << " ";
gmvFile << fld[indx] << " ";
}
gmvFile << nl;