From 332cf3345ac284e1dd42d587c17be7df227ee1a1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 4 Apr 2019 16:23:41 +0200 Subject: [PATCH] ENH: emit "constant" for uniform constant field (#1269) - this improves overall consistency and makes re-reading as a generic patch field behave properly when the underlying patch has zero size. --- .../PatchFunction1/ConstantField/ConstantField.C | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/meshTools/PatchFunction1/ConstantField/ConstantField.C b/src/meshTools/PatchFunction1/ConstantField/ConstantField.C index 5ef4d1d974..0650943323 100644 --- a/src/meshTools/PatchFunction1/ConstantField/ConstantField.C +++ b/src/meshTools/PatchFunction1/ConstantField/ConstantField.C @@ -253,8 +253,17 @@ void Foam::PatchFunction1Types::ConstantField::writeData ) const { PatchFunction1::writeData(os); - //os << token::SPACE << value_ << token::END_STATEMENT << nl; - value_.writeEntry(this->name_, os); + + if (isUniform_) + { + os.writeKeyword(this->name_) + << "constant " << uniformValue_ + << token::END_STATEMENT << nl; + } + else + { + value_.writeEntry(this->name_, os); + } }