diff --git a/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C b/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C index cee8014f09..93edcef5dc 100644 --- a/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C +++ b/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C @@ -45,17 +45,6 @@ Foam::Distribution::Distribution(const Type& binWidth) {} -// template -// Foam::Distribution::Distribution -// ( -// const cmptType& binWidth -// ) -// : -// List< Map >(pTraits::nComponents), -// binWidth_(binWidth*pTraits::one) -// {} - - template Foam::Distribution::Distribution(const Distribution& d) : @@ -71,10 +60,6 @@ Foam::Distribution::~Distribution() {} -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // template @@ -131,9 +116,7 @@ inline Type Foam::Distribution::median() for (direction cmpt = 0; cmpt < pTraits::nComponents; cmpt++) { - List >& normDist = normDistribution[cmpt]; - - scalar cumulative = 0.0; + List< Pair >& normDist = normDistribution[cmpt]; if (normDist.size()) { @@ -164,6 +147,8 @@ inline Type Foam::Distribution::median() { label lastNonZeroIndex = 0; + scalar cumulative = 0.0; + forAll(normDist,nD) { if @@ -188,7 +173,7 @@ inline Type Foam::Distribution::median() break; } - else if (normDist[nD].second() > 0.0) + else if (mag(normDist[nD].second()) > VSMALL) { cumulative += normDist[nD].second()*component(binWidth_, cmpt); @@ -232,17 +217,6 @@ void Foam::Distribution::add { cmptDistribution[n] += component(weight, cmpt); } - - // if (cmptDistribution[n] < 0) - // { - // FatalErrorIn("Distribution::add(const scalar valueToAdd)") - // << "Accumulated Distribution value has become negative: " - // << "bin = " << (0.5 + scalar(n))*component(binWidth_, cmpt) - // << ", value = " << cmptDistribution[n] - // << ". This is most likely to be because too many samples " - // << "have been added to a bin and the weight has 'rolled round'" - // << abort(FatalError); - // } } } @@ -290,7 +264,7 @@ Distribution::normalised() List