mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: for-range, forAllIters() ... in parallel/
- reduced clutter when iterating over containers
This commit is contained in:
committed by
Andrew Heather
parent
45590671ac
commit
655f7d1997
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user