Skip to content
Snippets Groups Projects
Commit 9762e026 authored by mark's avatar mark
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 d0732a24
No related branches found
No related tags found
1 merge request!121Merge develop into master for v1706 release
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -32,26 +32,28 @@ License ...@@ -32,26 +32,28 @@ License
template<class Type> template<class Type>
void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field) void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field)
{ {
List<Field<Type>> allValues(Pstream::nProcs()); if (Pstream::parRun())
{
allValues[Pstream::myProcNo()] = field; List<Field<Type>> allValues(Pstream::nProcs());
allValues[Pstream::myProcNo()] = field;
Pstream::gatherList(allValues);
Pstream::scatterList(allValues); Pstream::gatherList(allValues);
Pstream::scatterList(allValues);
field =
ListListOps::combine<Field<Type>> field =
( ListListOps::combine<Field<Type>>
allValues, (
accessOp<Field<Type>>() allValues,
); accessOp<Field<Type>>()
);
}
} }
template<class Type> template<class Type>
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field) void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field)
{ {
combineFields(field()); combineFields(field.ref());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment