From 64deb4e4b869a9aff06f727206ac45ff699f61e3 Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Fri, 2 Jul 2021 13:12:45 +0100 Subject: [PATCH] BUG: state error in volRegion::calculateCache() (fixes #2121) - need to change requireUpdate_ at the beginning of calculateCache otherwise it is not updated for "ALL" selection (causing unnecessary repeated calculations). For other modes, it would have tripped an error in FULLDEBUG. --- .../functionObjects/volRegion/volRegion.C | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/finiteVolume/functionObjects/volRegion/volRegion.C b/src/finiteVolume/functionObjects/volRegion/volRegion.C index a8f1c4c8a8..035160f7f1 100644 --- a/src/finiteVolume/functionObjects/volRegion/volRegion.C +++ b/src/finiteVolume/functionObjects/volRegion/volRegion.C @@ -61,6 +61,9 @@ void Foam::functionObjects::volRegion::calculateCache() regionID_ = -1; cellIds_.clear(); + // Update now. Need a valid state for the cellIDs() call + requireUpdate_ = false; + switch (regionType_) { case vrtAll: @@ -93,15 +96,18 @@ void Foam::functionObjects::volRegion::calculateCache() } } - // Cached value for nCells() - nCells_ = returnReduce(cellIDs().size(), sumOp