From 0ba3a91e0c06bce23c351e0a70fdc2348a27042d Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 16 Oct 2025 09:42:16 +0100 Subject: [PATCH] WIP: removed initialisation to zero - not applicable to all use cases --- .../AMIInterpolationTemplates.C | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationTemplates.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationTemplates.C index c3a3ac5847..9be83618c1 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationTemplates.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationTemplates.C @@ -115,7 +115,10 @@ void Foam::AMIInterpolation::interpolate const UList& defaultValues ) const { - // Note: behaves as old AMIInterpolation::interpolateToSource if toSource=true + // Note + // - behaves as old AMIInterpolation::interpolateToSource if toSource=true + // - `result` should be preallocated to correct size and initialized to + // an appropriate value (e.g. Zero) // Get data locally and do a weighted sum @@ -187,10 +190,10 @@ void Foam::AMIInterpolation::interpolate map.distribute(work); } - if constexpr (is_contiguous_scalar::value) - { - result0 = Zero; - } + // if constexpr (is_contiguous_scalar::value) + // { + // result0 = Zero; + // } weightedSum ( @@ -231,10 +234,10 @@ void Foam::AMIInterpolation::interpolate map.distribute(work); } - if constexpr (is_contiguous_scalar::value) - { - result1 = Zero; - } + // if constexpr (is_contiguous_scalar::value) + // { + // result1 = Zero; + // } weightedSum ( @@ -295,12 +298,12 @@ void Foam::AMIInterpolation::interpolate map.distribute(work); } - result.resize_nocopy(srcAddress.size()); + // result.resize_nocopy(srcAddress.size()); - if constexpr (is_contiguous_scalar::value) - { - result = Zero; - } + // if constexpr (is_contiguous_scalar::value) + // { + // result = Zero; + // } weightedSum (