From 14b2302b3815235c6aee0da2fd0b8525b2f850cf Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Thu, 20 Feb 2025 13:54:40 +0100
Subject: [PATCH] COMP: remove 'special purpose' minMaxOp (#3326)

- replace with plusOp for reductions. The old use didn't necessarily work
  well with compiler resolution in all cases.
  Simplify to use plusOp (and removed the old version).
  [Does not affect very much code...]

COMP: incorrect include ordering for GeometricFieldFunctions

- header was included after the template code

REGRESSION: combineAllGather mapped to incorrect method (81fa7d08eec)

STYLE: use UPstream::commWarn(...) setter method
---
 applications/test/minMax1/Make/files          |   2 +-
 .../{Test-minMax1.C => Test-minMax1.cxx}      |   5 +-
 .../mesh/manipulation/checkMesh/checkTools.C  |   2 +-
 .../PDR/pdrFields/PDRutilsOverlap.C           |   4 +-
 src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H  |   2 +-
 .../GeometricField/GeometricField.H           |   5 +-
 .../GeometricField/GeometricFieldFunctions.C  |  26 ++-
 .../GeometricField/GeometricFieldFunctions.H  |  15 +-
 .../primitives/ranges/MinMax/MinMax.H         |  14 +-
 .../primitives/ranges/MinMax/MinMaxOps.H      | 184 ++++++++----------
 .../faMesh/faMeshTools/faMeshToolsChecks.C    |   8 +-
 .../singleDirectionUniformBin.C               |   2 +-
 src/mesh/blockMesh/PDRblockMesh/PDRblock.H    |   8 +-
 src/mesh/blockMesh/PDRblockMesh/PDRblockI.H   |   2 +-
 .../cyclicAMIGAMGInterface.C                  |  10 +-
 15 files changed, 141 insertions(+), 148 deletions(-)
 rename applications/test/minMax1/{Test-minMax1.C => Test-minMax1.cxx} (98%)

diff --git a/applications/test/minMax1/Make/files b/applications/test/minMax1/Make/files
index 3b5fddb9fcf..eb933b6ea46 100644
--- a/applications/test/minMax1/Make/files
+++ b/applications/test/minMax1/Make/files
@@ -1,3 +1,3 @@
-Test-minMax1.C
+Test-minMax1.cxx
 
 EXE = $(FOAM_USER_APPBIN)/Test-minMax1
diff --git a/applications/test/minMax1/Test-minMax1.C b/applications/test/minMax1/Test-minMax1.cxx
similarity index 98%
rename from applications/test/minMax1/Test-minMax1.C
rename to applications/test/minMax1/Test-minMax1.cxx
index 86ff65d720a..327ca27dc6d 100644
--- a/applications/test/minMax1/Test-minMax1.C
+++ b/applications/test/minMax1/Test-minMax1.cxx
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -182,10 +182,7 @@ int main(int argc, char *argv[])
 
     minmax1 += values1;
     Pout<<"range: " << minmax1 << endl;
-
-
     Info<< "Reduced: "<< returnReduce(minmax1, plusOp<scalarMinMax>()) << nl;
-    Info<< "Reduced: "<< returnReduce(minmax1, minMaxOp<scalar>()) << nl;
 
     // Info<< "gMinMax: "<< gMinMax(values1v) << nl;
 
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C
index e13ef311335..8b6b0d3195d 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C
@@ -123,7 +123,7 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
     {
         // Number of global patches and min-max range of total patches
         Info<< mesh.boundaryMesh().nNonProcessor() << ' '
-            << returnReduce(labelMinMax(nPatches), minMaxOp<label>()) << nl;
+            << returnReduce(labelMinMax(nPatches), sumOp<labelMinMax>{}) << nl;
     }
     else
     {
diff --git a/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C b/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C
index e2874cdc9e4..1c27f536cfe 100644
--- a/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C
+++ b/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C
@@ -124,8 +124,8 @@ void Foam::PDRutils::one_d_overlap
     }
 
     // Ensure search is within the (point) bounds
-    xmin = grid.clip(xmin);
-    xmax = grid.clip(xmax);
+    xmin = grid.clamp(xmin);
+    xmax = grid.clamp(xmax);
 
     // The begin/end of the obstacle
     *cmin = grid.findCell(xmin);
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H
index 0f7a17e3a33..a43808ed462 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.H
@@ -208,7 +208,7 @@ public:
             const label comm = UPstream::worldComm
         )
         {
-            Pstream::listCombineReduce(value, cop, tag, comm);
+            Pstream::combineReduce(value, cop, tag, comm);
         }
 
 
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H
index 8cb500f580c..077c34149d6 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H
@@ -1037,6 +1037,7 @@ public:
 
         //- Clamp field values (in-place) to the specified range.
         //  \deprecated(2023-01) prefer clamp_range() naming
+        FOAM_DEPRECATED_FOR(2023-01, "clamp_range() method")
         void clip(const dimensioned<MinMax<Type>>& range)
         {
             this->clamp_range(range);
@@ -1044,6 +1045,7 @@ public:
 
         //- Clamp field values (in-place) to the specified range.
         //  \deprecated(2023-01) prefer clamp_range() naming
+        FOAM_DEPRECATED_FOR(2023-01, "clamp_range() method")
         void clip(const dimensioned<Type>& lo, const dimensioned<Type>& hi)
         {
             this->clamp_range(lo.value(), hi.value());
@@ -1076,13 +1078,12 @@ public:
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #include "GeometricFieldI.H"
+#include "GeometricFieldFunctions.H"
 
 #ifdef NoRepository
     #include "GeometricField.C"
 #endif
 
-#include "GeometricFieldFunctions.H"
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #endif
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C
index 40ab6e76461..8048be9d6d7 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2023 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -461,13 +461,14 @@ dimensioned<ReturnType> Func                                                   \
 
 UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, maxOp)
 UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, minOp)
-UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(MinMax<Type>, minMax, minMaxOp)
-UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(scalarMinMax, minMaxMag, minMaxMagOp)
+UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(MinMax<Type>, minMax, plusOp)
+UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(scalarMinMax, minMaxMag, plusOp)
 
 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
 
 
-#define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc)                      \
+// Forward to DimensionedField directly (same name)
+#define UNARY_REDUCTION_FUNCTION(ReturnType, Func)                             \
                                                                                \
 template<class Type, template<class> class PatchField, class GeoMesh>          \
 dimensioned<ReturnType> Func                                                   \
@@ -475,12 +476,7 @@ dimensioned<ReturnType> Func                                                   \
     const GeometricField<Type, PatchField, GeoMesh>& f1                        \
 )                                                                              \
 {                                                                              \
-    return dimensioned<ReturnType>                                             \
-    (                                                                          \
-        #Func "(" + f1.name() + ')',                                           \
-        f1.dimensions(),                                                       \
-        gFunc(f1.primitiveField())                                             \
-    );                                                                         \
+    return Func(f1.internalField());                                           \
 }                                                                              \
                                                                                \
 template<class Type, template<class> class PatchField, class GeoMesh>          \
@@ -489,14 +485,14 @@ dimensioned<ReturnType> Func                                                   \
     const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1                  \
 )                                                                              \
 {                                                                              \
-    dimensioned<ReturnType> res = Func(tf1());                                 \
+    auto result = Func(tf1());                                                 \
     tf1.clear();                                                               \
-    return res;                                                                \
+    return result;                                                             \
 }
 
-UNARY_REDUCTION_FUNCTION(Type, sum, gSum)
-UNARY_REDUCTION_FUNCTION(Type, average, gAverage)
-UNARY_REDUCTION_FUNCTION(typename typeOfMag<Type>::type, sumMag, gSumMag)
+UNARY_REDUCTION_FUNCTION(Type, sum)
+UNARY_REDUCTION_FUNCTION(Type, average)
+UNARY_REDUCTION_FUNCTION(typename typeOfMag<Type>::type, sumMag)
 
 #undef UNARY_REDUCTION_FUNCTION
 
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H
index 65863a90c02..93339f2688c 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2023 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -236,14 +236,15 @@ dimensioned<ReturnType> Func                                                   \
 
 UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, maxOp)
 UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, minOp)
-UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(MinMax<Type>, minMax, minMaxOp)
-UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(scalarMinMax, minMaxMag, minMaxMagOp)
+UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(MinMax<Type>, minMax, plusOp)
+UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(scalarMinMax, minMaxMag, plusOp)
 
 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
 
 
-#define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc)                      \
+#define UNARY_REDUCTION_FUNCTION(ReturnType, Func)                             \
                                                                                \
+/*! \brief Forwards to Func on internalField */                                \
 template<class Type, template<class> class PatchField, class GeoMesh>          \
 dimensioned<ReturnType> Func                                                   \
 (                                                                              \
@@ -256,9 +257,9 @@ dimensioned<ReturnType> Func                                                   \
     const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1                  \
 );
 
-UNARY_REDUCTION_FUNCTION(Type, sum, gSum)
-UNARY_REDUCTION_FUNCTION(Type, average, gAverage)
-UNARY_REDUCTION_FUNCTION(typename typeOfMag<Type>::type, sumMag, gSumMag)
+UNARY_REDUCTION_FUNCTION(Type, sum)
+UNARY_REDUCTION_FUNCTION(Type, average)
+UNARY_REDUCTION_FUNCTION(typename typeOfMag<Type>::type, sumMag)
 
 #undef UNARY_REDUCTION_FUNCTION
 
diff --git a/src/OpenFOAM/primitives/ranges/MinMax/MinMax.H b/src/OpenFOAM/primitives/ranges/MinMax/MinMax.H
index 377cb6d3e6b..abe625765df 100644
--- a/src/OpenFOAM/primitives/ranges/MinMax/MinMax.H
+++ b/src/OpenFOAM/primitives/ranges/MinMax/MinMax.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -280,7 +280,17 @@ public:
 };
 
 
-// Global Functions
+// * * * * * * * * * * * * * * * * * Traits  * * * * * * * * * * * * * * * * //
+
+//- Declare MinMax as non-contiguous (similar to Tuple2).
+//  Output remains separate (even in binary) and, since the defined
+//  \c operator+ is somewhat non-standard, also avoid false matching with
+//  any MPI intrinsic operation.
+template<class T>
+struct is_contiguous<MinMax<T>> : std::false_type {};
+
+
+// * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
 //- Min/max range as a string
 template<class T>
diff --git a/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H b/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H
index 5bad8452ec1..70ea46674b8 100644
--- a/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H
+++ b/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H
@@ -134,53 +134,6 @@ inline MinMax<T> minMax(const MinMax<T>& x, const MinMax<T>& y)
 }
 
 
-//- Combine values and/or MinMax ranges
-template<class T>
-struct minMaxOp
-{
-    MinMax<T> operator()(const T& x, const T& y) const
-    {
-        return MinMax<T>(x).add(y);
-    }
-
-    MinMax<T> operator()(const MinMax<T>& x, const T& y) const
-    {
-        return MinMax<T>(x).add(y);
-    }
-
-    MinMax<T> operator()(const T& x, const MinMax<T>& y) const
-    {
-        return MinMax<T>(y).add(x);
-    }
-
-    MinMax<T> operator()(const MinMax<T>& x, const MinMax<T>& y) const
-    {
-        return MinMax<T>(x).add(y);  // Same as (x + y)
-    }
-};
-
-
-//- Combine assignment for MinMax range
-template<class T>
-struct minMaxEqOp
-{
-    MinMax<T>& operator()(MinMax<T>& x, const T& y) const
-    {
-        return x.add(y);
-    }
-
-    MinMax<T>& operator()(MinMax<T>& x, const UList<T>& y) const
-    {
-        return x.add(y);
-    }
-
-    MinMax<T>& operator()(MinMax<T>& x, const MinMax<T>& y) const
-    {
-        return x.add(y);
-    }
-};
-
-
 //- The magnitude of a single value.
 inline scalarMinMax minMaxMag(const scalar val)
 {
@@ -256,57 +209,92 @@ inline scalarMinMax minMaxMag(const MinMax<T1>& x, const MinMax<T2>& y)
 }
 
 
-//- Scalar combine the magitude of a value.
-template<class T>
-struct minMaxMagOp
-{
-    scalarMinMax operator()(const scalarMinMax& x, const T& y) const
-    {
-        return minMaxMag(x).add(Foam::mag(y));
-    }
-
-    template<class T1, class T2>
-    scalarMinMax operator()(const MinMax<T1>& x, const MinMax<T2>& y) const
-    {
-        return minMaxMag(x, y);
-    }
-};
-
-
-//- Combine assignment for MinMax range
-template<class T>
-struct minMaxMagEqOp
-{
-    scalarMinMax& operator()(scalarMinMax& x, const T& y) const
-    {
-        x = minMaxMag(x);
-        return x.add(Foam::mag(y));
-    }
-
-    scalarMinMax& operator()(scalarMinMax& x, const MinMax<T>& y) const
-    {
-        x = minMaxMag(x);
-
-        return
-        (
-            x
-            .add(Foam::mag(y.min()))
-            .add(Foam::mag(y.max()))
-        );
-    }
-
-    scalarMinMax& operator()(scalarMinMax& x, const UList<T>& y) const
-    {
-        x = minMaxMag(x);
-
-        for (const T& val : y)
-        {
-            x.add(Foam::mag(val));
-        }
-
-        return x;
-    }
-};
+// Mark as unused (2025-02)
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// //- Combine values and/or MinMax ranges
+// template<class T>
+// struct minMaxOp
+// {
+//     MinMax<T> operator()(const T& x, const T& y) const
+//     {
+//         return MinMax<T>(x).add(y);
+//     }
+//
+//     MinMax<T> operator()(const MinMax<T>& x, const T& y) const
+//     {
+//         return MinMax<T>(x).add(y);
+//     }
+//
+//     MinMax<T> operator()(const T& x, const MinMax<T>& y) const
+//     {
+//         return MinMax<T>(y).add(x);
+//     }
+// };
+//
+//
+// //- Combine assignment for MinMax range
+// template<class T>
+// struct minMaxEqOp
+// {
+//     MinMax<T>& operator()(MinMax<T>& x, const T& y) const
+//     {
+//         return x.add(y);
+//     }
+//
+//     MinMax<T>& operator()(MinMax<T>& x, const UList<T>& y) const
+//     {
+//         return x.add(y);
+//     }
+// };
+//
+//
+// //- Scalar combine the magitude of a value.
+// template<class T>
+// struct minMaxMagOp
+// {
+//     scalarMinMax operator()(const scalarMinMax& x, const T& y) const
+//     {
+//         return minMaxMag(x).add(Foam::mag(y));
+//     }
+//
+//     template<class T1, class T2>
+//     scalarMinMax operator()(const MinMax<T1>& x, const MinMax<T2>& y) const
+//     {
+//         return minMaxMag(x).add(Foam::mag(y.min()), Foam::mag(y.max()));
+//     }
+// };
+//
+//
+// //- Combine assignment for MinMax range
+// template<class T>
+// struct minMaxMagEqOp
+// {
+//     scalarMinMax& operator()(scalarMinMax& x, const T& y) const
+//     {
+//         x = minMaxMag(x);
+//         return x.add(Foam::mag(y));
+//     }
+//
+//     scalarMinMax& operator()(scalarMinMax& x, const MinMax<T>& y) const
+//     {
+//         x = minMaxMag(x);
+//
+//         return x.add(Foam::mag(y.min()), Foam::mag(y.max()));
+//     }
+//
+//     scalarMinMax& operator()(scalarMinMax& x, const UList<T>& y) const
+//     {
+//         x = minMaxMag(x);
+//
+//         for (const T& val : y)
+//         {
+//             x.add(Foam::mag(val));
+//         }
+//
+//         return x;
+//     }
+// };
 
 
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
diff --git a/src/finiteArea/faMesh/faMeshTools/faMeshToolsChecks.C b/src/finiteArea/faMesh/faMeshTools/faMeshToolsChecks.C
index 7664356be93..e166a0bdd25 100644
--- a/src/finiteArea/faMesh/faMeshTools/faMeshToolsChecks.C
+++ b/src/finiteArea/faMesh/faMeshTools/faMeshToolsChecks.C
@@ -161,14 +161,14 @@ void Foam::faMeshTools::printMeshChecks
         scalarMinMax limit(minMax(mesh.magLe().primitiveField()));
 
         // Include processor boundaries into 'internal' edges
-        if (Pstream::parRun())
+        if (UPstream::parRun())
         {
             for (label patchi = nNonProcessor; patchi < nPatches; ++patchi)
             {
                 limit.add(minMax(mesh.magLe().boundaryField()[patchi]));
             }
 
-            reduce(limit, minMaxOp<scalar>());
+            reduce(limit, plusOp<scalarMinMax>{});
         }
 
         Info<< "Edge length (internal):" << nl
@@ -181,9 +181,9 @@ void Foam::faMeshTools::printMeshChecks
             limit.add(minMax(mesh.magLe().boundaryField()[patchi]));
         }
 
-        if (Pstream::parRun())
+        if (UPstream::parRun())
         {
-            reduce(limit, minMaxOp<scalar>());
+            reduce(limit, plusOp<scalarMinMax>{});
         }
 
         Info<< "Edge length:" << nl
diff --git a/src/functionObjects/field/binField/binModels/singleDirectionUniformBin/singleDirectionUniformBin.C b/src/functionObjects/field/binField/binModels/singleDirectionUniformBin/singleDirectionUniformBin.C
index 4d66960b97f..6b39e51995b 100644
--- a/src/functionObjects/field/binField/binModels/singleDirectionUniformBin/singleDirectionUniformBin.C
+++ b/src/functionObjects/field/binField/binModels/singleDirectionUniformBin/singleDirectionUniformBin.C
@@ -75,7 +75,7 @@ void Foam::binModels::singleDirectionUniformBin::initialise()
         }
 
         // Globally consistent
-        reduce(geomLimits, minMaxOp<scalar>());
+        reduce(geomLimits, sumOp<scalarMinMax>());
 
         if (!geomLimits.good())
         {
diff --git a/src/mesh/blockMesh/PDRblockMesh/PDRblock.H b/src/mesh/blockMesh/PDRblockMesh/PDRblock.H
index d0302b075b5..22bc3316339 100644
--- a/src/mesh/blockMesh/PDRblockMesh/PDRblock.H
+++ b/src/mesh/blockMesh/PDRblockMesh/PDRblock.H
@@ -175,10 +175,12 @@ public:
             //  within bounds, but not aligned with a grid point.
             label findIndex(const scalar p, const scalar tol) const;
 
-            //- If out of range, return the respective min/max limits,
-            //- otherwise return the value itself.
+            //- Return value clamped to min/max limits.
             //  If the range is invalid, always return the value.
-            inline const scalar& clip(const scalar& val) const;
+            inline const scalar& clamp(const scalar& val) const;
+
+            //- Return value clamped to min/max limits.
+            const scalar& clip(const scalar& val) const { return clamp(val); }
         };
 
 
diff --git a/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H b/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H
index 8e34c6ddd4d..7999f86d29b 100644
--- a/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H
+++ b/src/mesh/blockMesh/PDRblockMesh/PDRblockI.H
@@ -124,7 +124,7 @@ inline Foam::scalar Foam::PDRblock::location::C(const label i) const
 
 
 inline const Foam::scalar&
-Foam::PDRblock::location::clip(const scalar& val) const
+Foam::PDRblock::location::clamp(const scalar& val) const
 {
     if (scalarList::size())
     {
diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
index 69dd64b6380..f2a2d0ebe4d 100644
--- a/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
+++ b/src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
@@ -180,8 +180,7 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
         const auto& AMI = amiPtr_();
         if (debug & 2)
         {
-            const auto oldWarnComm = UPstream::warnComm;
-            UPstream::warnComm = AMI.comm();
+            const auto oldWarnComm = UPstream::commWarn(AMI.comm());
 
             const label myRank = UPstream::myProcNo(AMI.comm());
             Pout<< "At level:" << fineLevelIndex
@@ -297,7 +296,7 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
             }
             Pout<< "DONE agglomerating at level:" << fineLevelIndex << endl;
 
-            UPstream::warnComm = oldWarnComm;
+            UPstream::commWarn(oldWarnComm);
         }
     }
 }
@@ -820,8 +819,7 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
         {
             const auto& AMI = amiPtr_();
 
-            const auto oldWarnComm = UPstream::warnComm;
-            UPstream::warnComm = AMI.comm();
+            const auto oldWarnComm = UPstream::commWarn(AMI.comm());
 
             const label myRank = UPstream::myProcNo(AMI.comm());
             Pout<< "PROCAGGLOMERATED :"
@@ -930,7 +928,7 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
                 }
             }
             Pout<< "DONE PROCAGGLOMERATED" << endl;
-            UPstream::warnComm = oldWarnComm;
+            UPstream::commWarn(oldWarnComm);
         }
     }
 }
-- 
GitLab