fvcCellReduce: Add support for optional initial value

Patch contributed by Mattijs Janssens
Resolves bug-report http://bugs.openfoam.org/view.php?id=2143
This commit is contained in:
Henry Weller
2016-07-08 11:54:30 +01:00
parent c4390f7059
commit b87703bd46
2 changed files with 18 additions and 6 deletions

View File

@ -36,7 +36,8 @@ Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::fvc::cellReduce
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf,
const CombineOp& cop
const CombineOp& cop,
const Type& nullValue
)
{
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
@ -56,7 +57,7 @@ Foam::fvc::cellReduce
IOobject::NO_WRITE
),
mesh,
dimensioned<Type>("0", ssf.dimensions(), Zero),
dimensioned<Type>("initialValue", ssf.dimensions(), nullValue),
extrapolatedCalculatedFvPatchField<Type>::typeName
)
);
@ -88,10 +89,19 @@ Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::fvc::cellReduce
(
const tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>& tssf,
const CombineOp& cop
const CombineOp& cop,
const Type& nullValue
)
{
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf(cellReduce(tssf, cop));
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
(
cellReduce
(
tssf,
cop,
nullValue
)
);
tssf.clear();

View File

@ -53,14 +53,16 @@ namespace fvc
tmp<GeometricField<Type, fvPatchField, volMesh>> cellReduce
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
const CombineOp& cop
const CombineOp& cop,
const Type& nullValue = pTraits<Type>::zero
);
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> cellReduce
(
const tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>&,
const CombineOp& cop
const CombineOp& cop,
const Type& nullValue = pTraits<Type>::zero
);
}