Commit 655f7d19 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: for-range, forAllIters() ... in parallel/

- reduced clutter when iterating over containers
parent 45590671
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2015-2016 OpenFOAM Foundation
......@@ -159,9 +159,9 @@ void Foam::decompositionConstraints::singleProcessorFaceSets::add
// Check that it does not overlap with existing specifiedProcessorFaces
labelList nMatch(specifiedProcessorFaces.size(), Zero);
forAllConstIter(faceSet, fz, iter)
for (const label facei : fz)
{
label seti = faceToSet[iter.key()];
const label seti = faceToSet[facei];
if (seti != -1)
{
++nMatch[seti];
......@@ -191,7 +191,6 @@ void Foam::decompositionConstraints::singleProcessorFaceSets::add
reduce(store, andOp<bool>());
if (store)
{
specifiedProcessorFaces.append(new labelList(fz.sortedToc()));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2013 OpenFOAM Foundation
......@@ -39,8 +39,7 @@ License
// List<Type>& values
//) const
//{
// typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField;
//
// typedef DimensionedField<Type, triSurfaceGeoMesh> fieldType;
//
// // Get query data (= local index of triangle)
// // ~~~~~~~~~~~~~~
......@@ -60,10 +59,8 @@ License
// // Do my tests
// // ~~~~~~~~~~~
//
// const DimensionedSurfField& fld = lookupObject<DimensionedSurfField>
// (
// fieldName
// );
// const auto& fld = lookupObject<fieldType>(fieldName);
//
// const triSurface& s = static_cast<const triSurface&>(*this);
//
// values.setSize(triangleIndex.size());
......@@ -88,33 +85,24 @@ void Foam::distributedTriSurfaceMesh::distributeFields
const mapDistribute& map
)
{
typedef DimensionedField<Type, triSurfaceGeoMesh> DimensionedSurfField;
typedef DimensionedField<Type, triSurfaceGeoMesh> fieldType;
HashTable<DimensionedSurfField*> fields
HashTable<fieldType*> fields
(
objectRegistry::lookupClass<DimensionedSurfField>()
objectRegistry::lookupClass<fieldType>()
);
for
(
typename HashTable<DimensionedSurfField*>::iterator fieldIter =
fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllIters(fields, fieldIter)
{
DimensionedSurfField& field = *fieldIter();
fieldType& field = *fieldIter();
label oldSize = field.size();
const label oldSize = field.size();
map.distribute(field);
if (debug)
{
Info<< "Mapped " << field.typeName << ' ' << field.name()
<< " from size " << oldSize << " to size " << field.size()
<< endl;
}
DebugInfo
<< "Mapped " << field.typeName << ' ' << field.name()
<< " from size " << oldSize << " to size " << field.size() << endl;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment