From b87703bd461116555f28eb9dba8888a117b264d4 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 8 Jul 2016 11:54:30 +0100 Subject: [PATCH] fvcCellReduce: Add support for optional initial value Patch contributed by Mattijs Janssens Resolves bug-report http://bugs.openfoam.org/view.php?id=2143 --- .../finiteVolume/fvc/fvcCellReduce.C | 18 ++++++++++++++---- .../finiteVolume/fvc/fvcCellReduce.H | 6 ++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C index de0119fe46..4c60b68844 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C @@ -36,7 +36,8 @@ Foam::tmp> Foam::fvc::cellReduce ( const GeometricField& ssf, - const CombineOp& cop + const CombineOp& cop, + const Type& nullValue ) { typedef GeometricField volFieldType; @@ -56,7 +57,7 @@ Foam::fvc::cellReduce IOobject::NO_WRITE ), mesh, - dimensioned("0", ssf.dimensions(), Zero), + dimensioned("initialValue", ssf.dimensions(), nullValue), extrapolatedCalculatedFvPatchField::typeName ) ); @@ -88,10 +89,19 @@ Foam::tmp> Foam::fvc::cellReduce ( const tmp>& tssf, - const CombineOp& cop + const CombineOp& cop, + const Type& nullValue ) { - tmp> tvf(cellReduce(tssf, cop)); + tmp> tvf + ( + cellReduce + ( + tssf, + cop, + nullValue + ) + ); tssf.clear(); diff --git a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H index 5c03792629..58f31d20a0 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.H @@ -53,14 +53,16 @@ namespace fvc tmp> cellReduce ( const GeometricField&, - const CombineOp& cop + const CombineOp& cop, + const Type& nullValue = pTraits::zero ); template tmp> cellReduce ( const tmp>&, - const CombineOp& cop + const CombineOp& cop, + const Type& nullValue = pTraits::zero ); }