Skip to content
Snippets Groups Projects
Commit 2049c5c2 authored by Mark Olesen's avatar Mark Olesen
Browse files

BUG: using tmp() instead of tmp.ref() in combineFields (closes #400)

- templated code that is not actually be used yet.

ENH: avoid combineFields for serial case

Note: a 'master-only' variant with combineList only on the master and
without scatter can be pursued later.
parent 0067c9e3
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -32,26 +32,28 @@ License
template<class Type>
void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field)
{
List<Field<Type>> allValues(Pstream::nProcs());
allValues[Pstream::myProcNo()] = field;
Pstream::gatherList(allValues);
Pstream::scatterList(allValues);
field =
ListListOps::combine<Field<Type>>
(
allValues,
accessOp<Field<Type>>()
);
if (Pstream::parRun())
{
List<Field<Type>> allValues(Pstream::nProcs());
allValues[Pstream::myProcNo()] = field;
Pstream::gatherList(allValues);
Pstream::scatterList(allValues);
field =
ListListOps::combine<Field<Type>>
(
allValues,
accessOp<Field<Type>>()
);
}
}
template<class Type>
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field)
{
combineFields(field());
combineFields(field.ref());
}
......
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