From f6cc25f5ebb2a96baf41574a66956733c3957ee0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 13 Mar 2017 12:01:05 +0000 Subject: [PATCH] ENH: cellSetOption: suppress printing of excess messages. Fixes #415. --- src/fvOptions/cellSetOption/cellSetOption.C | 56 +++++++++++++++------ src/fvOptions/cellSetOption/cellSetOption.H | 5 +- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/fvOptions/cellSetOption/cellSetOption.C b/src/fvOptions/cellSetOption/cellSetOption.C index 56a664432c..665b98343d 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.C +++ b/src/fvOptions/cellSetOption/cellSetOption.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,6 +89,32 @@ void Foam::fv::cellSetOption::setSelection(const dictionary& dict) } +void Foam::fv::cellSetOption::setVol() +{ + scalar VOld = V_; + + // Set volume information + V_ = 0.0; + forAll(cells_, i) + { + V_ += mesh_.V()[cells_[i]]; + } + reduce(V_, sumOp()); + + + // Convert both volumes to representation using current writeprecision + word VOldName(Time::timeName(VOld, IOstream::defaultPrecision())); + word VName(Time::timeName(V_, IOstream::defaultPrecision())); + + if (VName != VOldName) + { + Info<< indent + << "- selected " << returnReduce(cells_.size(), sumOp