mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated combineFields for fieldValues to avoid assignment to self
This commit is contained in:
@ -2,7 +2,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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -119,14 +119,14 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
|||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
Field<Type> values(combineFields(setFieldValues<Type>(fieldName)));
|
Field<Type> values(setFieldValues<Type>(fieldName));
|
||||||
|
combineFields(values);
|
||||||
|
|
||||||
scalarField V(combineFields(filterField(mesh().V())));
|
scalarField V(filterField(mesh().V()));
|
||||||
|
combineFields(V);
|
||||||
|
|
||||||
scalarField weightField
|
scalarField weightField(setFieldValues<scalar>(weightFieldName_));
|
||||||
(
|
combineFields(weightField);
|
||||||
combineFields(setFieldValues<scalar>(weightFieldName_))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -150,13 +150,13 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get unoriented magSf
|
// Get unoriented magSf
|
||||||
magSf = combineFields(filterField(mesh().magSf(), false));
|
magSf = filterField(mesh().magSf(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine onto master
|
// Combine onto master
|
||||||
values = combineFields(values);
|
combineFields(values);
|
||||||
magSf = combineFields(magSf);
|
combineFields(magSf);
|
||||||
weightField = combineFields(weightField);
|
combineFields(weightField);
|
||||||
|
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
|
|||||||
@ -2,7 +2,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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -166,12 +166,11 @@ public:
|
|||||||
|
|
||||||
//- Combine fields from all processor domains into single field
|
//- Combine fields from all processor domains into single field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > combineFields(const Field<Type>& field) const;
|
void combineFields(Field<Type>& field);
|
||||||
|
|
||||||
//- Combine fields from all processor domains into single field
|
//- Combine fields from all processor domains into single field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > combineFields(const tmp<Field<Type> >&) const;
|
void combineFields(tmp<Field<Type> >&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,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) 2009-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,10 +30,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
void Foam::fieldValue::combineFields(Field<Type>& field)
|
||||||
(
|
|
||||||
const Field<Type>& field
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
List<Field<Type> > allValues(Pstream::nProcs());
|
List<Field<Type> > allValues(Pstream::nProcs());
|
||||||
|
|
||||||
@ -43,32 +40,20 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
return tmp<Field<Type> >
|
field =
|
||||||
(
|
|
||||||
new Field<Type>
|
|
||||||
(
|
|
||||||
ListListOps::combine<Field<Type> >
|
ListListOps::combine<Field<Type> >
|
||||||
(
|
(
|
||||||
allValues,
|
allValues,
|
||||||
accessOp<Field<Type> >()
|
accessOp<Field<Type> >()
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValue::combineFields
|
void Foam::fieldValue::combineFields(tmp<Field<Type> >& field)
|
||||||
(
|
|
||||||
const tmp<Field<Type> >& field
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
return combineFields(field());
|
combineFields(field());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user