From df9e072415ef6b1e09c9878021ba4d04a378d0b6 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Mon, 14 Jan 2013 09:56:59 +0000 Subject: [PATCH] ENH: Updated cloud T min/max functions --- .../Templates/ThermoCloud/ThermoCloudI.H | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index 405eb9bf0e3..6b596966607 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -383,15 +383,25 @@ template<class CloudType> inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const { scalar T = -GREAT; + scalar n = 0; forAllConstIter(typename ThermoCloud<CloudType>, *this, iter) { const parcelType& p = iter(); T = max(T, p.T()); + n++; } reduce(T, maxOp<scalar>()); + reduce(n, sumOp<label>()); - return max(0.0, T); + if (n > 0) + { + return T; + } + else + { + return 0.0; + } } @@ -399,15 +409,25 @@ template<class CloudType> inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const { scalar T = GREAT; + scalar n = 0; forAllConstIter(typename ThermoCloud<CloudType>, *this, iter) { const parcelType& p = iter(); T = min(T, p.T()); + n++; } reduce(T, minOp<scalar>()); + reduce(n, sumOp<label>()); - return min(0.0, T); + if (n > 0) + { + return T; + } + else + { + return 0.0; + } } -- GitLab