Commit f7b851b3 authored by Henry Weller's avatar Henry Weller
Browse files

fvcCellReduce: Add support for optional initial value

Patch contributed by Mattijs Janssens
Resolves bug-report http://bugs.openfoam.org/view.php?id=2143
parent 6230ca26
......@@ -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();
......
......@@ -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
);
}
......
Supports Markdown
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