From dfb652bcac6178fed5cec344f4c40a85f06b536c Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 5 Nov 2018 12:12:25 +0000 Subject: [PATCH] ENH: findRefCell: initialise to -1 if not needed. Fixes #988. --- .../general/findRefCell/findRefCell.C | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C index f5cc8f48c6..e5e6ea9a7e 100644 --- a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C +++ b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -111,6 +111,10 @@ bool Foam::setRefCell return true; } + else + { + refCelli = -1; + } return false; } @@ -141,25 +145,14 @@ Foam::scalar Foam::getRefCellValue FatalErrorInFunction << "Illegal reference cellID " << refCelli << ". Mesh has " << field.mesh().nCells() << ". cells." - << exit(FatalIOError); + << exit(FatalError); } - - // Catch duplicates - label hasRef = - (refCelli >= 0 && refCelli < field.mesh().nCells() ? 1 : 0); - - if (1 != returnReduce