From cf2b305b4f62966bab6fb994b4357f3c2b091c55 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 27 Jan 2025 14:53:36 +0100
Subject: [PATCH] ENH: upgrade to use some C++17 constructs

- 'if constexpr (...)'
   * instead of std::enable_if
   * terminate template recursion
   * compile-time elimination of code

- use C++14 '_t', '_v' versions,
  eg, std::is_integral_v<T> instead of std::is_integral<T>::value

- std::begin, std::end, std::void_t instead of prev stdFoam versions

- provide is_contiguous_v<..> as short form of is_contiguous<..>::value
  with the additional benefit of removing any cv qualifiers.

ENH: include is_rotational_vectorspace trait

- tests for vector-space and nComponents > 1 (ie, not sphericalTensor)

ENH: improve robustness of pTraits_.. tests by removing cv qualifiers
---
 .../test/DiagTensor/Test-DiagTensor.C         | 101 ++++-----
 .../test/Dictionary/Test-Dictionary.C         |   2 +-
 applications/test/FixedList/Test-FixedList.C  |   7 +-
 applications/test/Hashing1/HashFunction.H     | 115 ++++------
 applications/test/Hashing2/Test-Hashing2.C    |  18 +-
 applications/test/IOField/Test-IOField.cxx    |   5 +-
 .../test/IOobject-type/Test-IOobject-type.cxx |   2 +-
 applications/test/List/Test-List.C            |   4 +-
 .../test/MathFunctions/Test-MathFunctions.C   |  21 +-
 .../SphericalTensor/Test-SphericalTensor.C    | 103 ++++-----
 .../Test-SphericalTensor2D.C                  |  99 ++++-----
 .../test/SymmTensor/Test-SymmTensor.C         | 107 ++++------
 .../test/SymmTensor2D/Test-SymmTensor2D.C     | 101 ++++-----
 applications/test/Tensor/Test-Tensor.C        | 101 ++++-----
 applications/test/Tensor2D/Test-Tensor2D.C    | 104 ++++------
 applications/test/TestTools/TestTools.H       | 183 +++++-----------
 .../test/boolVector/Test-boolVector.C         |   4 +-
 .../test/contiguous/Test-contiguous.C         |  12 +-
 .../test/exprValue1/Test-exprValue1.cxx       |   4 +-
 .../test/extendedStencil/Make/options         |   3 +-
 .../test/fieldDependency/Make/options         |   3 +-
 .../test/fileOperation1/Test-fileOperation1.C |   2 +-
 applications/test/invTensor/Test-invTensor.C  |   3 +-
 applications/test/mappedPatch/Make/options    |   3 +-
 .../DiagonalMatrix/Test-DiagonalMatrix.C      |  36 ++--
 .../matrices/EigenMatrix/Test-EigenMatrix.C   |  42 ++--
 .../test/matrices/QRMatrix/Test-QRMatrix.C    |  31 ++-
 .../Test-RectangularMatrix.C                  |  49 ++---
 .../matrices/SquareMatrix/Test-SquareMatrix.C |  48 ++---
 .../Test-SymmetricSquareMatrix.C              |  48 ++---
 applications/test/pTraits/Test-pTraits.C      |  73 ++++---
 .../Test-parallel-broadcast.C                 |   6 +-
 .../parallel-chunks/Test-parallel-chunks.C    |  50 +----
 .../test/parallelOverset/Make/options         |   1 +
 applications/test/refPtr/Test-refPtr.C        |  10 +-
 applications/test/regex1/Test-regex1.C        |   6 +-
 applications/test/sizeof/Test-sizeof.C        |  21 ++
 applications/test/spline/Make/options         |   2 +-
 applications/test/surfaceReading/Make/options |   1 +
 applications/test/tmp/Test-tmp.C              |  10 +-
 applications/test/volField/Test-volField.C    |   2 +-
 .../dataConversion/foamToVTK/foamToVTK.C      |   4 +-
 doc/BuildIssues.md                            |  12 +-
 .../containers/Bits/PackedList/PackedList.C   |  14 +-
 .../containers/Bits/PackedList/PackedListI.H  |   4 +-
 .../containers/Buffers/CircularBufferIO.C     |  10 +-
 .../containers/Circulators/Circulator.H       |  10 +-
 .../CompactListList/CompactListList.C         |   6 +-
 .../HashTables/HashTable/HashTable.H          |  20 +-
 .../HashTables/HashTable/HashTableDetail.H    |  47 ++---
 .../IndirectListBase/IndirectListBaseIO.C     |  12 +-
 .../Lists/DynamicList/DynamicListIO.C         |   6 +-
 .../containers/Lists/FixedList/FixedList.C    |   6 +-
 .../containers/Lists/FixedList/FixedList.H    |  16 +-
 .../containers/Lists/FixedList/FixedListIO.C  |  21 +-
 src/OpenFOAM/containers/Lists/List/List.H     |   4 +-
 src/OpenFOAM/containers/Lists/List/ListIO.C   |   6 +-
 src/OpenFOAM/containers/Lists/List/UList.C    |   6 +-
 src/OpenFOAM/containers/Lists/List/UList.H    |  22 +-
 src/OpenFOAM/containers/Lists/List/UListI.H   |   4 +-
 src/OpenFOAM/containers/Lists/List/UListIO.C  |  20 +-
 .../containers/Lists/policy/ListPolicy.H      |   4 +-
 .../containers/PtrLists/UPtrList/UPtrList.H   |  10 +-
 src/OpenFOAM/db/IOobject/IOobjectTemplates.C  |  16 +-
 .../db/IOstreams/IOstreams/IOstream.H         |  26 +--
 src/OpenFOAM/db/IOstreams/IOstreams/Istream.H |   6 +-
 .../db/IOstreams/Pstreams/PstreamBroadcast.C  |   6 +-
 .../IOstreams/Pstreams/PstreamCombineGather.C |  10 +-
 .../db/IOstreams/Pstreams/PstreamExchange.C   |   6 +-
 .../Pstreams/PstreamExchangeConsensus.C       |  12 +-
 .../db/IOstreams/Pstreams/PstreamGather.C     | 196 ++++++++----------
 .../db/IOstreams/Pstreams/PstreamGatherList.C |  25 +--
 .../db/IOstreams/Pstreams/UPstreamTemplates.C |  86 ++++----
 src/OpenFOAM/db/IOstreams/token/token.H       |  28 +--
 src/OpenFOAM/db/IOstreams/token/tokenI.H      |  10 +-
 src/OpenFOAM/db/dictionary/dictionary.H       |  18 +-
 .../objectRegistry/objectRegistryTemplates.C  |  12 +-
 .../exprDriver/exprDriverTemplates.C          |   8 +-
 .../expressions/exprResult/exprResultI.H      |   6 +-
 src/OpenFOAM/fields/Fields/Field/Field.C      |   4 +-
 .../global/constants/unitConversion.H         |  10 +-
 src/OpenFOAM/include/openfoam_mpi.H           |  46 ++--
 src/OpenFOAM/include/stdFoam.H                | 186 +++--------------
 .../tableReaders/csv/csvTableReader.C         |   4 +-
 .../matrices/EigenMatrix/EigenMatrix.H        |   2 +-
 .../LUscalarMatrix/LUscalarMatrixTemplates.C  |  10 +-
 src/OpenFOAM/matrices/Matrix/Matrix.C         |   6 +-
 src/OpenFOAM/matrices/Matrix/Matrix.H         |   2 +-
 src/OpenFOAM/matrices/Matrix/MatrixI.H        |   4 +-
 src/OpenFOAM/matrices/Matrix/MatrixIO.C       |  12 +-
 .../processorLduInterfaceTemplates.C          | 110 +++++-----
 .../PrecisionAdaptor/PrecisionAdaptor.H       |  18 +-
 .../mapDistributeBaseTemplates.C              |  17 +-
 .../meshes/polyMesh/syncTools/syncTools.H     |   4 +-
 .../polyMesh/syncTools/syncToolsTemplates.C   |   4 +-
 .../globalIndex/globalIndexTemplates.C        |  32 +--
 .../primitives/VectorSpace/VectorSpaceOps.H   |  51 +++--
 src/OpenFOAM/primitives/complex/complex.H     |  16 +-
 src/OpenFOAM/primitives/enums/Enum.H          |   2 +-
 .../primitives/functions/Function1/CSV/CSV.C  |   2 +-
 src/OpenFOAM/primitives/ints/int/int.H        |   4 +-
 src/OpenFOAM/primitives/ints/uint/uint.H      |   4 +-
 src/OpenFOAM/primitives/ops/ops.H             |  22 +-
 .../primitives/ranges/IntRange/IntRange.H     |   2 +-
 .../primitives/ranges/MinMax/MinMaxOps.H      |  18 +-
 src/OpenFOAM/primitives/traits/contiguous.H   |  11 +-
 src/OpenFOAM/primitives/traits/pTraits.H      | 114 ++++++----
 .../primitives/transform/symmTransform.H      |   4 +-
 src/OpenFOAM/primitives/transform/transform.H |   6 +-
 .../ensight/output/ensightOutputTemplates.C   |  20 +-
 src/fileFormats/gltf/foamGltfBase.H           |  17 +-
 .../vtk/file/foamVtkFileWriterTemplates.C     |  10 +-
 src/fileFormats/vtk/format/foamVtkFormatter.H |   5 +-
 .../vtk/format/foamVtkFormatterI.H            |  13 +-
 .../vtk/output/foamVtkOutputTemplates.C       |  14 +-
 .../processor/processorFaPatchField.C         |   4 +-
 .../calculatedProcessorFvPatchField.C         |   4 +-
 .../processor/processorFvPatchField.C         |  12 +-
 .../IntegralScaleBox/IntegralScaleBox.H       |   8 +-
 .../turbulentDigitalFilterInletFvPatchField.H |   8 +-
 .../field/DMD/DMDModels/derived/STDMD/STDMD.H |  29 +--
 .../DMDModels/derived/STDMD/STDMDTemplates.C  |  55 ++---
 src/functionObjects/field/multiply/multiply.H |  24 +--
 .../field/multiply/multiplyTemplates.C        |  66 ++----
 .../ensightCloud/ensightCloudWriteObject.cxx  |  38 ++--
 .../ensightCloudWriteObjectImpl.cxx           |   8 +-
 .../lagrangian/vtkCloud/vtkCloudTemplates.C   |  10 +-
 .../conversion/ensight/ensightOutputCloud.C   |   4 +-
 .../meshRefinement/meshRefinementRefine.C     |   4 +-
 .../cyclicAMIPolyPatchTemplates.C             |  47 ++++-
 .../writers/common/coordSetWriterTemplates.C  |  40 ++--
 src/surfMesh/writers/common/surfaceWriter.C   |  29 ++-
 .../nastran/nastranSurfaceWriterImpl.C        |  14 +-
 133 files changed, 1547 insertions(+), 1941 deletions(-)

diff --git a/applications/test/DiagTensor/Test-DiagTensor.C b/applications/test/DiagTensor/Test-DiagTensor.C
index fa5a6523647..7db83d7e3ea 100644
--- a/applications/test/DiagTensor/Test-DiagTensor.C
+++ b/applications/test/DiagTensor/Test-DiagTensor.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -38,12 +38,11 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "Tensor.H"
 #include "SymmTensor.H"
 #include "SphericalTensor.H"
 #include "DiagTensor.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -57,45 +56,11 @@ unsigned nTest_ = 0;
 unsigned nFail_ = 0;
 
 
-// Compare two floating point types, and print output.
-// Do ++nFail_ if values of two objects are not equal within a given tolerance.
-// The function is converted from PEP-485.
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar relTol = 1e-8,  //<! are values the same within 8 decimals
-    const scalar absTol = 0      //<! useful for cmps near zero
-)
-{
-    Info<< msg << x << endl;
-
-    unsigned nFail = 0;
-
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
-    {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
-    }
-    ++nTest_;
-}
-
-
 // Compare two containers elementwise, and print output.
 // Do ++nFail_ if two components are not equal within a given tolerance.
 // The function is converted from PEP-485
 template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
+void cmp
 (
     const word& msg,
     const Type& x,
@@ -104,18 +69,37 @@ cmp
     const scalar absTol = 0
 )
 {
-    Info<< msg << x << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+    if constexpr (is_vectorspace_v<Type>)
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
+    }
+    else
+    {
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -368,27 +352,26 @@ void test_global_opers(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -403,8 +386,8 @@ int main()
 
     const List<word> typeID
     ({
-        "DiagTensor<floatScalar>",
-        "DiagTensor<doubleScalar>",
+        "DiagTensor<float>",
+        "DiagTensor<double>",
         "DiagTensor<complex>"
     });
 
diff --git a/applications/test/Dictionary/Test-Dictionary.C b/applications/test/Dictionary/Test-Dictionary.C
index f1e85eecce6..fae3a143377 100644
--- a/applications/test/Dictionary/Test-Dictionary.C
+++ b/applications/test/Dictionary/Test-Dictionary.C
@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
     }
 
     std::cout<< "iter type: "
-        << typeid(stdFoam::begin(scalarDict2)).name() << '\n';
+        << typeid(std::begin(scalarDict2)).name() << '\n';
 
     scalarDict.transfer(scalarDict2);
 
diff --git a/applications/test/FixedList/Test-FixedList.C b/applications/test/FixedList/Test-FixedList.C
index ae4bbc995cb..e77190a7939 100644
--- a/applications/test/FixedList/Test-FixedList.C
+++ b/applications/test/FixedList/Test-FixedList.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -85,8 +85,7 @@ void compileInfo()
 
 
 template<class FixedListType>
-typename std::enable_if
-<(FixedListType::max_size() == 2), bool>::type
+std::enable_if_t<(FixedListType::max_size() == 2), bool>
 is_pair()
 {
      return true;
@@ -94,7 +93,7 @@ is_pair()
 
 
 template<class FixedListType>
-typename std::enable_if<(FixedListType::max_size() != 2), std::string>::type
+std::enable_if_t<(FixedListType::max_size() != 2), std::string>
 is_pair()
 {
      return "not really at all";
diff --git a/applications/test/Hashing1/HashFunction.H b/applications/test/Hashing1/HashFunction.H
index 964b5b2e290..3b7544a9b8e 100644
--- a/applications/test/Hashing1/HashFunction.H
+++ b/applications/test/Hashing1/HashFunction.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,9 +42,11 @@ Note
 #include "Hash.H"
 
 #ifdef FULLDEBUG
-#define HashTypeInfo(Args)  void info() { std::cerr<< "" Args << "\n"; }
+#define HashTypeInfo(Name)  \
+    static constexpr const char* name() noexcept { return Name; } \
+    void info() const { std::cerr<< name() << " hashing\n"; }
 #else
-#define HashTypeInfo(Args)  void info() {}
+#define HashTypeInfo(Name)  void info() const {}
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -53,20 +55,36 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                            Class Hash Declaration
+                          Class HashFunc Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class T, class SFINAEType=bool>
+template<class T>
 struct HashFun
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "default"; }
-    #endif
-    HashTypeInfo("plain hash")
+    void info() const
+    {
+        #ifdef FULLDEBUG
+        if constexpr (std::is_base_of_v<std::string, T>)
+        {
+            std::cerr<< "std::string hashing\n";
+        }
+        else
+        {
+            std::cerr<< "default hashing\n";
+        }
+        #endif
+    }
 
     unsigned operator()(const T& obj, unsigned seed=0) const
     {
-        return Foam::Hasher(&obj, sizeof(obj), seed);
+        if constexpr (std::is_base_of_v<std::string, T>)
+        {
+            return Foam::Hasher(obj.data(), obj.size(), seed);
+        }
+        else
+        {
+            return Foam::Hasher(&obj, sizeof(obj), seed);
+        }
     }
 };
 
@@ -76,45 +94,17 @@ struct HashFun
 //- Hashing for label
 template<> struct HashFun<Foam::label> : Hash<label>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "label"; }
-    #endif
-    HashTypeInfo("hash label")
+    HashTypeInfo("label")
 };
 
 
 //- Hashing for pointers, interpret pointer as a integer type
 template<> struct HashFun<void*> : Hash<void *>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "pointer"; }
-    #endif
-    HashTypeInfo("hash ptr")
+    HashTypeInfo("pointer")
 };
 
 
-//- Hashing for string types
-template<class StringType>
-struct HashFun
-<
-    StringType,
-    typename std::enable_if
-    <
-        std::is_base_of<std::string, StringType>::value, bool
-    >::type
->
-{
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "string"; }
-    #endif
-    HashTypeInfo("hash string")
-
-    unsigned operator()(const std::string& obj, unsigned seed=0) const
-    {
-        return Foam::Hasher(obj.data(), obj.size(), seed);
-    }
-};
-
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -133,83 +123,56 @@ namespace Foam
 
 template<> struct HashFun<edge> : Hash<edge>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "edge"; }
-    #endif
-    HashTypeInfo("hash edge")
+    HashTypeInfo("edge")
 };
 
 
 template<> struct HashFun<face> : Hash<face>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "face"; }
-    #endif
-    HashTypeInfo("hash face")
+    HashTypeInfo("face")
 };
 
 
 template<> struct HashFun<triFace> : Hash<triFace>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "triFace"; }
-    #endif
-    HashTypeInfo("hash triFace")
+    HashTypeInfo("triFace")
 };
 
 
 template<class T>
 struct HashFun<Pair<T>> : Hash<Pair<T>>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "Pair"; }
-    #endif
-    HashTypeInfo("hash Pair")
+    HashTypeInfo("Pair")
 };
 
 template<class T1, class T2>
 struct HashFun<Tuple2<T1, T2>> : Hash<Tuple2<T1, T2>>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "Tuple2"; }
-    #endif
-    HashTypeInfo("hash Tuple2")
+    HashTypeInfo("Tuple2")
 };
 
 
 template<class T>
 struct HashFun<List<T>> : Hash<List<T>>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "List"; }
-    #endif
-    HashTypeInfo("hash List")
+    HashTypeInfo("List")
 };
 
 template<class T> struct HashFun<UList<T>> : Hash<UList<T>>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "UList"; }
-    #endif
-    HashTypeInfo("hash UList")
+    HashTypeInfo("UList")
 };
 
 template<class T, int SizeMin>
 struct HashFun<DynamicList<T, SizeMin>> : Hash<DynamicList<T, SizeMin>>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "DynamicList"; }
-    #endif
-    HashTypeInfo("hash DynamicList")
+    HashTypeInfo("DynamicList")
 };
 
 template<class T, unsigned N>
 struct HashFun<FixedList<T, N>> : Hash<FixedList<T, N>>
 {
-    #ifdef FULLDEBUG
-    static constexpr const char* name() noexcept { return "FixedList"; }
-    #endif
-    HashTypeInfo("hash FixedList")
+    HashTypeInfo("FixedList")
 };
 
 
diff --git a/applications/test/Hashing2/Test-Hashing2.C b/applications/test/Hashing2/Test-Hashing2.C
index 3506e2da4f9..244afbbcc5d 100644
--- a/applications/test/Hashing2/Test-Hashing2.C
+++ b/applications/test/Hashing2/Test-Hashing2.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2021 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -81,7 +81,7 @@ void infoHashString
 
 void reportHashList(const UList<string>& list)
 {
-    Info<< "contiguous = " << is_contiguous<string>::value << nl << nl;
+    Info<< "contiguous = " << is_contiguous_v<string> << nl << nl;
 
     for (const string& val : list)
     {
@@ -94,7 +94,7 @@ void reportHashList(const UList<string>& list)
 
 void reportHashList(const UList<label>& list)
 {
-    Info<<"contiguous = " << is_contiguous<label>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<label> << nl << nl;
 
     for (const label val : list)
     {
@@ -113,7 +113,7 @@ void reportHashList(const UList<label>& list)
 
 void reportHashList(const UList<face>& list)
 {
-    Info<<"contiguous = " << is_contiguous<label>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<label> << nl << nl;
 
     for (const face& f : list)
     {
@@ -154,7 +154,7 @@ void reportHashList(const UList<labelList>& list)
 
 void reportHashList(const UList<wordPair>& list)
 {
-    Info<<"contiguous = " << is_contiguous<wordPair>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<wordPair> << nl << nl;
 
     for (const wordPair& pr : list)
     {
@@ -179,7 +179,7 @@ void reportHashList(const UList<wordPair>& list)
 
 void reportHashList(const UList<labelPair>& list)
 {
-    Info<<"contiguous = " << is_contiguous<labelPair>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<labelPair> << nl << nl;
 
     for (const labelPair& pr : list)
     {
@@ -200,7 +200,7 @@ void reportHashList(const UList<labelPair>& list)
 
 void reportHashList(const UList<labelPairPair>& list)
 {
-    Info<<"contiguous = " << is_contiguous<labelPairPair>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<labelPairPair> << nl << nl;
 
     for (const labelPairPair& pr : list)
     {
@@ -221,7 +221,7 @@ void reportHashList(const UList<labelPairPair>& list)
 
 void reportHashList(const UList<edge>& list)
 {
-    Info<<"contiguous = " << is_contiguous<edge>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<edge> << nl << nl;
 
     for (const edge& e : list)
     {
@@ -242,7 +242,7 @@ void reportHashList(const UList<edge>& list)
 
 void reportHashList(const UList<triFace>& list)
 {
-    Info<<"contiguous = " << is_contiguous<triFace>::value << nl << nl;
+    Info<<"contiguous = " << is_contiguous_v<triFace> << nl << nl;
 
     for (const triFace& f : list)
     {
diff --git a/applications/test/IOField/Test-IOField.cxx b/applications/test/IOField/Test-IOField.cxx
index d294c5ec9d4..96f91d5e7e5 100644
--- a/applications/test/IOField/Test-IOField.cxx
+++ b/applications/test/IOField/Test-IOField.cxx
@@ -213,11 +213,10 @@ int main(int argc, char *argv[])
             mesh
         );
 
-        Info<< "points path: " << io.typeFilePath<labelIOList>() << nl;
-        Info<< "points path: " << io.typeFilePath<void>() << nl;
+        Info<< "points path: " << io.typeFilePath<pointIOField>() << nl;
 
         io.resetHeader("bad-points");
-        Info<< "bad path: " << io.typeFilePath<void>() << nl;
+        Info<< "bad path: " << io.typeFilePath<labelIOList>() << nl;
     }
 
     IOobject io
diff --git a/applications/test/IOobject-type/Test-IOobject-type.cxx b/applications/test/IOobject-type/Test-IOobject-type.cxx
index a315fdca69e..7bf8e30dcb3 100644
--- a/applications/test/IOobject-type/Test-IOobject-type.cxx
+++ b/applications/test/IOobject-type/Test-IOobject-type.cxx
@@ -45,7 +45,7 @@ using namespace Foam;
 template<class Type>
 word report()
 {
-    if (is_globalIOobject<Type>::value)
+    if constexpr (is_globalIOobject<Type>::value)
     {
         return "global";
     }
diff --git a/applications/test/List/Test-List.C b/applications/test/List/Test-List.C
index 26bc8e82875..74b3701e546 100644
--- a/applications/test/List/Test-List.C
+++ b/applications/test/List/Test-List.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -118,7 +118,7 @@ Ostream& printListOutputType(const char* what)
 {
     Info<< what
         << " (contiguous="
-        << is_contiguous<T>::value << " no_linebreak="
+        << is_contiguous_v<T> << " no_linebreak="
         << Detail::ListPolicy::no_linebreak<T>::value
         << " short_length="
         << Detail::ListPolicy::short_length<T>::value << ')';
diff --git a/applications/test/MathFunctions/Test-MathFunctions.C b/applications/test/MathFunctions/Test-MathFunctions.C
index e1ac201693c..6cb3bcb49a6 100644
--- a/applications/test/MathFunctions/Test-MathFunctions.C
+++ b/applications/test/MathFunctions/Test-MathFunctions.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -128,18 +128,17 @@ void test_member_funcs(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
+
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
diff --git a/applications/test/SphericalTensor/Test-SphericalTensor.C b/applications/test/SphericalTensor/Test-SphericalTensor.C
index d386b4ac2eb..ccdf830e0be 100644
--- a/applications/test/SphericalTensor/Test-SphericalTensor.C
+++ b/applications/test/SphericalTensor/Test-SphericalTensor.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -38,12 +38,11 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "Tensor.H"
 #include "SymmTensor.H"
 #include "SphericalTensor.H"
 #include "DiagTensor.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -57,65 +56,50 @@ unsigned nTest_ = 0;
 unsigned nFail_ = 0;
 
 
-// Compare two floating point types, and print output.
+// Compare two containers elementwise, and print output.
 // Do ++nFail_ if values of two objects are not equal within a given tolerance.
 // The function is converted from PEP-485.
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
+template<class Type, class Type2 = Type>
+void cmp
 (
     const word& msg,
     const Type& x,
-    const Type& y,
+    const Type2& y,
     const scalar relTol = 1e-8,  //<! are values the same within 8 decimals
     const scalar absTol = 0      //<! useful for cmps near zero
 )
 {
-    Info<< msg << x << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
+    if constexpr (is_vectorspace_v<Type>)
     {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
     }
-    ++nTest_;
-}
-
-
-// Compare two containers elementwise, and print output.
-// Do ++nFail_ if two components are not equal within a given tolerance.
-// The function is converted from PEP-485
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar relTol = 1e-8,
-    const scalar absTol = 0
-)
-{
-    Info<< msg << x << endl;
-
-    unsigned nFail = 0;
-
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+    else
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -277,27 +261,26 @@ void test_global_opers(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -312,8 +295,8 @@ int main()
 
     const List<word> typeID
     ({
-        "SphericalTensor<floatScalar>",
-        "SphericalTensor<doubleScalar>",
+        "SphericalTensor<float>",
+        "SphericalTensor<double>",
         "SphericalTensor<complex>"
     });
 
diff --git a/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C b/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C
index 3fc89d8b104..6c77b11a7af 100644
--- a/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C
+++ b/applications/test/SphericalTensor2D/Test-SphericalTensor2D.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -38,11 +38,10 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "Tensor2D.H"
 #include "SymmTensor2D.H"
 #include "SphericalTensor2D.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -56,12 +55,11 @@ unsigned nTest_ = 0;
 unsigned nFail_ = 0;
 
 
-// Compare two floating point types, and print output.
+// Compare two containers elementwise, and print output.
 // Do ++nFail_ if values of two objects are not equal within a given tolerance.
 // The function is converted from PEP-485.
 template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
+void cmp
 (
     const word& msg,
     const Type& x,
@@ -70,51 +68,37 @@ cmp
     const scalar absTol = 0      //<! useful for cmps near zero
 )
 {
-    Info<< msg << x << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
+    if constexpr (is_vectorspace_v<Type>)
     {
-        ++nFail;
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
     }
-
-    if (nFail)
+    else
     {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
-    }
-    ++nTest_;
-}
-
-
-// Compare two containers elementwise, and print output.
-// Do ++nFail_ if two components are not equal within a given tolerance.
-// The function is converted from PEP-485
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar relTol = 1e-8,
-    const scalar absTol = 0
-)
-{
-    Info<< msg << x << endl;
-
-    unsigned nFail = 0;
-
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
-    {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -260,27 +244,26 @@ void test_global_opers(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
+
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        run_tests<I + 1, Tp...>(types, names);
+     }
 }
 
 
@@ -295,8 +278,8 @@ int main()
 
     const List<word> typeID
     ({
-        "SphericalTensor2D<floatScalar>",
-        "SphericalTensor2D<doubleScalar>",
+        "SphericalTensor2D<float>",
+        "SphericalTensor2D<double>",
         "SphericalTensor2D<complex>"
     });
 
diff --git a/applications/test/SymmTensor/Test-SymmTensor.C b/applications/test/SymmTensor/Test-SymmTensor.C
index 0d73f4d0d77..5a937ad4cef 100644
--- a/applications/test/SymmTensor/Test-SymmTensor.C
+++ b/applications/test/SymmTensor/Test-SymmTensor.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -40,11 +40,10 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "symmTensor.H"
 #include "transform.H"
 #include "Random.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -69,12 +68,12 @@ symmTensor makeRandomContainer(Random& rnd)
 
 // Create a symmTensor based on a given value
 template<class Type>
-typename std::enable_if
+std::enable_if_t
 <
-    std::is_same<floatScalar, Type>::value ||
-    std::is_same<doubleScalar, Type>::value,
+    std::is_floating_point_v<Type> || std::is_same_v<complex, Type>,
     symmTensor
->::type makeContainer(const Type val)
+>
+makeContainer(const Type val)
 {
     symmTensor T(Zero);
     std::fill(T.begin(), T.end(), val);
@@ -82,12 +81,11 @@ typename std::enable_if
 }
 
 
-// Compare two floating point types, and print output.
+// Compare two containers elementwise, and print output.
 // Do ++nFail_ if values of two objects are not equal within a given tolerance.
 // The function is converted from PEP-485.
 template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
+void cmp
 (
     const word& msg,
     const Type& x,
@@ -96,51 +94,37 @@ cmp
     const scalar relTol = 1e-8  //<! are values the same within 8 decimals
 )
 {
-    Info<< msg << x << "?=" << y << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
+    if constexpr (is_vectorspace_v<Type>)
     {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
     }
-    ++nTest_;
-}
-
-
-// Compare two containers elementwise, and print output.
-// Do ++nFail_ if two components are not equal within a given tolerance.
-// The function is converted from PEP-485
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar absTol = 0,
-    const scalar relTol = 1e-8
-)
-{
-    Info<< msg << x << "?=" << y << endl;
-
-    unsigned nFail = 0;
-
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+    else
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << "?=" << y << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -588,27 +572,26 @@ void test_eigen_funcs(const symmTensor& T)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -623,8 +606,8 @@ int main()
 
     const List<word> typeID
     ({
-        "SymmTensor<floatScalar>",
-        "SymmTensor<doubleScalar>",
+        "SymmTensor<float>",
+        "SymmTensor<double>",
         "SymmTensor<complex>"
     });
 
diff --git a/applications/test/SymmTensor2D/Test-SymmTensor2D.C b/applications/test/SymmTensor2D/Test-SymmTensor2D.C
index 315e9e808ec..b2684a2efa1 100644
--- a/applications/test/SymmTensor2D/Test-SymmTensor2D.C
+++ b/applications/test/SymmTensor2D/Test-SymmTensor2D.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2022 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -40,11 +40,10 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "symmTensor2D.H"
 #include "transform.H"
 #include "Random.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -67,45 +66,11 @@ symmTensor2D makeRandomContainer(Random& rnd)
 }
 
 
-// Compare two floating point types, and print output.
-// Do ++nFail_ if values of two objects are not equal within a given tolerance.
-// The function is converted from PEP-485.
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar absTol = 0,     //<! useful for cmps near zero
-    const scalar relTol = 1e-8   //<! are values the same within 8 decimals
-)
-{
-    Info<< msg << x << "?=" << y << endl;
-
-    unsigned nFail = 0;
-
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
-    {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
-    }
-    ++nTest_;
-}
-
-
 // Compare two containers elementwise, and print output.
 // Do ++nFail_ if two components are not equal within a given tolerance.
 // The function is converted from PEP-485
 template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
+void cmp
 (
     const word& msg,
     const Type& x,
@@ -114,18 +79,37 @@ cmp
     const scalar relTol = 1e-8
 )
 {
-    Info<< msg << x << "?=" << y << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+    if constexpr (is_vectorspace_v<Type>)
+    {
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
+    }
+    else
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << "?=" << y << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -538,27 +522,26 @@ void test_eigen_funcs(const symmTensor2D& T)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -573,8 +556,8 @@ int main(int argc, char *argv[])
 
     const List<word> typeID
     ({
-        "SymmTensor2D<floatScalar>",
-        "SymmTensor2D<doubleScalar>",
+        "SymmTensor2D<float>",
+        "SymmTensor2D<double>",
         "SymmTensor2D<complex>"
     });
 
diff --git a/applications/test/Tensor/Test-Tensor.C b/applications/test/Tensor/Test-Tensor.C
index ff67487abb6..8f6407f239f 100644
--- a/applications/test/Tensor/Test-Tensor.C
+++ b/applications/test/Tensor/Test-Tensor.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2018 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -41,11 +41,10 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "tensor.H"
 #include "transform.H"
 #include "Random.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -68,45 +67,11 @@ tensor makeRandomContainer(Random& rnd)
 }
 
 
-// Compare two floating point types, and print output.
-// Do ++nFail_ if values of two objects are not equal within a given tolerance.
-// The function is converted from PEP-485.
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar absTol = 0,     //<! useful for cmps near zero
-    const scalar relTol = 1e-8   //<! are values the same within 8 decimals
-)
-{
-    Info<< msg << x << "?=" << y << endl;
-
-    unsigned nFail = 0;
-
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
-    {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
-    }
-    ++nTest_;
-}
-
-
 // Compare two containers elementwise, and print output.
 // Do ++nFail_ if two components are not equal within a given tolerance.
 // The function is converted from PEP-485
 template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
+void cmp
 (
     const word& msg,
     const Type& x,
@@ -115,18 +80,37 @@ cmp
     const scalar relTol = 1e-8
 )
 {
-    Info<< msg << x << "?=" << y << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+    if constexpr (is_vectorspace_v<Type>)
+    {
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
+    }
+    else
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << "?=" << y << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -987,27 +971,26 @@ void test_eigen_funcs(const tensor& T, const bool prod = true)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names;
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name <<" ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test global operators: " << name <<" ##" << nl;
+        test_global_opers(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -1022,8 +1005,8 @@ int main()
 
     const List<word> typeID
     ({
-        "Tensor<floatScalar>",
-        "Tensor<doubleScalar>",
+        "Tensor<float>",
+        "Tensor<double>",
         "Tensor<complex>"
     });
 
diff --git a/applications/test/Tensor2D/Test-Tensor2D.C b/applications/test/Tensor2D/Test-Tensor2D.C
index f1993afbf87..87eeaf50ab7 100644
--- a/applications/test/Tensor2D/Test-Tensor2D.C
+++ b/applications/test/Tensor2D/Test-Tensor2D.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2014 OpenFOAM Foundation
-    Copyright (C) 2019-2022 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -41,13 +41,13 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "scalar.H"
+#include "complex.H"
 #include "vector2DField.H"
 #include "tensor2D.H"
 #include "symmTensor2D.H"
 #include "transform.H"
 #include "Random.H"
-#include "scalar.H"
-#include "complex.H"
 
 using namespace Foam;
 
@@ -70,12 +70,11 @@ tensor2D makeRandomContainer(Random& rnd)
 }
 
 
-// Compare two floating point types, and print output.
-// Do ++nFail_ if values of two objects are not equal within a given tolerance.
-// The function is converted from PEP-485.
+// Compare two containers elementwise, and print output.
+// Do ++nFail_ if two components are not equal within a given tolerance.
+// The function is converted from PEP-485
 template<class Type>
-typename std::enable_if<pTraits<Type>::rank == 0, void>::type
-cmp
+void cmp
 (
     const word& msg,
     const Type& x,
@@ -84,51 +83,37 @@ cmp
     const scalar relTol = 1e-8   //<! are values the same within 8 decimals
 )
 {
-    Info<< msg << x << "?=" << y << endl;
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
+    {
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
+    if constexpr (is_vectorspace_v<Type>)
     {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
+        for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
     }
-    ++nTest_;
-}
-
-
-// Compare two containers elementwise, and print output.
-// Do ++nFail_ if two components are not equal within a given tolerance.
-// The function is converted from PEP-485
-template<class Type>
-typename std::enable_if<pTraits<Type>::rank != 0, void>::type
-cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar absTol = 0,
-    const scalar relTol = 1e-8
-)
-{
-    Info<< msg << x << "?=" << y << endl;
-
-    unsigned nFail = 0;
-
-    for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
+    else
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
 
+    Info<< msg << x << "?=" << y << endl;
+
     if (nFail)
     {
         Info<< nl
@@ -795,27 +780,26 @@ void test_eigen_funcs(const tensor2D& T)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
+
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] <<" ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -831,8 +815,8 @@ int main(int argc, char *argv[])
 
     const List<word> typeID
     ({
-        "Tensor2D<floatScalar>",
-        "Tensor2D<doubleScalar>",
+        "Tensor2D<float>",
+        "Tensor2D<double>",
         "Tensor2D<complex>"
     });
 
diff --git a/applications/test/TestTools/TestTools.H b/applications/test/TestTools/TestTools.H
index e8470d8b271..06832788eda 100644
--- a/applications/test/TestTools/TestTools.H
+++ b/applications/test/TestTools/TestTools.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -67,13 +67,9 @@ doubleScalar getTol(complex)
 }
 
 
-// Create a non-complex random Matrix.
+// Create a random Matrix (real or complex)
 template<class MatrixType>
-typename std::enable_if
-<
-    !std::is_same<complex, typename MatrixType::cmptType>:: value,
-    MatrixType
->::type makeRandomMatrix
+MatrixType makeRandomMatrix
 (
     const labelPair& dims,
     Random& rndGen
@@ -81,34 +77,22 @@ typename std::enable_if
 {
     MatrixType mat(dims);
 
-    std::generate
-    (
-        mat.begin(),
-        mat.end(),
-        [&]{return rndGen.GaussNormal<scalar>();}
-    );
-
-    return mat;
-}
-
-
-// Create a complex random Matrix.
-template<class MatrixType>
-typename std::enable_if
-<
-    std::is_same<complex, typename MatrixType::cmptType>:: value,
-    MatrixType
->::type makeRandomMatrix
-(
-    const labelPair& dims,
-    Random& rndGen
-)
-{
-    MatrixType mat(dims);
-
-    for (auto& x : mat)
+    if constexpr (std::is_same_v<complex, typename MatrixType::cmptType>)
+    {
+        for (auto& x : mat)
+        {
+            x.real(rndGen.GaussNormal<scalar>());
+            x.imag(rndGen.GaussNormal<scalar>());
+        }
+    }
+    else
     {
-        x = complex(rndGen.GaussNormal<scalar>(), rndGen.GaussNormal<scalar>());
+        std::generate
+        (
+            mat.begin(),
+            mat.end(),
+            [&]{ return rndGen.GaussNormal<scalar>(); }
+        );
     }
 
     return mat;
@@ -179,128 +163,57 @@ List<Type> flt
 }
 
 
-// Compare two floating point types, and print output.
+// Compare two values or two containers (elementwise), and print output.
 // Do ++nFail_ if values of two objects are not equal within a given tolerance.
 // The function is converted from PEP-485.
-template<class Type>
-typename std::enable_if
-<
-    std::is_same<floatScalar, Type>::value ||
-    std::is_same<doubleScalar, Type>::value ||
-    std::is_same<complex, Type>::value,
-    void
->::type cmp
+template<class Type1, class Type2 = Type1>
+void cmp
 (
     const word& msg,
-    const Type& x,
-    const Type& y,
+    const Type1& x,
+    const Type2& y,
     const scalar absTol = 0,    //<! useful for cmps near zero
     const scalar relTol = 1e-8, //<! are values the same within 8 decimals
     const bool verbose = false
 )
 {
-    if (verbose)
-    {
-        Info<< msg << x << "?=" << y << endl;
-    }
-
-    unsigned nFail = 0;
-
-    if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
-    {
-        ++nFail;
-    }
-
-    if (nFail)
-    {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
-    }
-    ++nTest_;
-}
-
-
-// Compare two containers elementwise, and print output.
-// Do ++nFail_ if two components are not equal within a given tolerance.
-// The function is converted from PEP-485
-template<class Type>
-typename std::enable_if
-<
-    !std::is_same<floatScalar, Type>::value &&
-    !std::is_same<doubleScalar, Type>::value &&
-    !std::is_same<complex, Type>::value,
-    void
->::type cmp
-(
-    const word& msg,
-    const Type& x,
-    const Type& y,
-    const scalar absTol = 0,
-    const scalar relTol = 1e-8,
-    const bool verbose = false
-)
-{
-    if (verbose)
+    const auto notEqual = [=](const auto& a, const auto& b) -> bool
     {
-        Info<< msg << x << "?=" << y << endl;
-    }
+        return
+        (
+            Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
+          < Foam::mag(a - b)
+        );
+    };
 
     unsigned nFail = 0;
 
-    for (label i = 0; i < x.size(); ++i)
+    if constexpr
+    (
+        std::is_floating_point_v<Type1> || std::is_same_v<complex, Type1>
+    )
     {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
+        if (notEqual(x, y))
         {
             ++nFail;
         }
     }
-
-    if (nFail)
+    else
     {
-        Info<< nl
-            << "        #### Fail in " << nFail << " comps ####" << nl << endl;
-        ++nFail_;
+        for (label i = 0; i < x.size(); ++i)
+        {
+            if (notEqual(x[i], y[i]))
+            {
+                ++nFail;
+            }
+        }
     }
-    ++nTest_;
-}
-
 
-// Compare two containers elementwise, and print output.
-// Do ++nFail_ if two components are not equal within a given tolerance.
-// The function is converted from PEP-485
-template<class Type1, class Type2>
-typename std::enable_if
-<
-    !std::is_same<floatScalar, Type1>::value &&
-    !std::is_same<doubleScalar, Type1>::value &&
-    !std::is_same<complex, Type1>::value,
-    void
->::type cmp
-(
-    const word& msg,
-    const Type1& x,
-    const Type2& y,
-    const scalar absTol = 0,
-    const scalar relTol = 1e-8,
-    const bool verbose = false
-)
-{
     if (verbose)
     {
         Info<< msg << x << "?=" << y << endl;
     }
 
-    unsigned nFail = 0;
-
-    for (label i = 0; i < x.size(); ++i)
-    {
-        if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
-        {
-            ++nFail;
-        }
-    }
-
     if (nFail)
     {
         Info<< nl
@@ -321,11 +234,6 @@ void cmp
     const bool verbose = false
 )
 {
-    if (verbose)
-    {
-        Info<< msg << x << "?=" << y << endl;
-    }
-
     unsigned nFail = 0;
 
     if (x != y)
@@ -333,6 +241,11 @@ void cmp
         ++nFail;
     }
 
+    if (verbose)
+    {
+        Info<< msg << x << "?=" << y << endl;
+    }
+
     if (nFail)
     {
         Info<< nl
diff --git a/applications/test/boolVector/Test-boolVector.C b/applications/test/boolVector/Test-boolVector.C
index d345b55ddf7..43fbc3c51bb 100644
--- a/applications/test/boolVector/Test-boolVector.C
+++ b/applications/test/boolVector/Test-boolVector.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
 {
     Info<< "boolVector" << nl
         << "  size = " << boolVector::size() << nl
-        << "  contiguous = " << is_contiguous<boolVector>::value << nl
+        << "  contiguous = " << is_contiguous_v<boolVector> << nl
         << nl;
 
     {
diff --git a/applications/test/contiguous/Test-contiguous.C b/applications/test/contiguous/Test-contiguous.C
index 22480baea0a..b785ff5b700 100644
--- a/applications/test/contiguous/Test-contiguous.C
+++ b/applications/test/contiguous/Test-contiguous.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2019 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,13 +72,14 @@ void printInfo(const char* const name = nullptr)
         Info<< name;
     }
 
-    Info<< " contiguous=" <<  Switch(is_contiguous<T>::value);
+    Info<< " contiguous=" <<  Switch(is_contiguous<T>::value)
+        << " / " <<  Switch(is_contiguous_v<T>);
 
-    if (is_contiguous_label<T>::value)
+    if constexpr (is_contiguous_label<T>::value)
     {
         Info<< " label";
     }
-    if (is_contiguous_scalar<T>::value)
+    if constexpr (is_contiguous_scalar<T>::value)
     {
         Info<< " scalar";
     }
@@ -96,10 +97,11 @@ int main(int argc, char *argv[])
     argList::noParallel();
     argList::noFunctionObjects();
 
+    printInfo<label>();
     printInfo<label>();
     printInfo<double>();
     printInfo<FixedList<double, 4>>();
-    printInfo<Pair<long>>();
+    printInfo<const Pair<long>>();
 
     printInfo<FixedList<word, 2>>();
     printInfo<Pair<word>>();
diff --git a/applications/test/exprValue1/Test-exprValue1.cxx b/applications/test/exprValue1/Test-exprValue1.cxx
index 2a1f41564c1..0399dc673f2 100644
--- a/applications/test/exprValue1/Test-exprValue1.cxx
+++ b/applications/test/exprValue1/Test-exprValue1.cxx
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2021-2024 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
     // Regular broadcast doesn't work
     Info<< "exprValue"
         << " sizeof:" << sizeof(expressions::exprValue)
-        << " contiguous:" << is_contiguous<expressions::exprValue>::value
+        << " contiguous:" << is_contiguous_v<expressions::exprValue>
         << nl << nl;
 
     {
diff --git a/applications/test/extendedStencil/Make/options b/applications/test/extendedStencil/Make/options
index b733f6ac040..d27c95d033d 100644
--- a/applications/test/extendedStencil/Make/options
+++ b/applications/test/extendedStencil/Make/options
@@ -3,4 +3,5 @@ EXE_INC = \
     -I$(LIB_SRC)/meshTools/lnInclude
 
 EXE_LIBS = \
-    -lfiniteVolume
+    -lfiniteVolume \
+    -lmeshTools
diff --git a/applications/test/fieldDependency/Make/options b/applications/test/fieldDependency/Make/options
index b733f6ac040..d27c95d033d 100644
--- a/applications/test/fieldDependency/Make/options
+++ b/applications/test/fieldDependency/Make/options
@@ -3,4 +3,5 @@ EXE_INC = \
     -I$(LIB_SRC)/meshTools/lnInclude
 
 EXE_LIBS = \
-    -lfiniteVolume
+    -lfiniteVolume \
+    -lmeshTools
diff --git a/applications/test/fileOperation1/Test-fileOperation1.C b/applications/test/fileOperation1/Test-fileOperation1.C
index be4480d12ef..e395ea292dc 100644
--- a/applications/test/fileOperation1/Test-fileOperation1.C
+++ b/applications/test/fileOperation1/Test-fileOperation1.C
@@ -48,7 +48,7 @@ word toString(const fileOperation::procRangeType& group)
     {
         return word::null;
     }
-    return Foam::name(group.first()) + "-" + Foam::name(group.last());
+    return Foam::name(group.min()) + "-" + Foam::name(group.max());
 }
 
 
diff --git a/applications/test/invTensor/Test-invTensor.C b/applications/test/invTensor/Test-invTensor.C
index b16b7d36662..d1d524343e9 100644
--- a/applications/test/invTensor/Test-invTensor.C
+++ b/applications/test/invTensor/Test-invTensor.C
@@ -31,13 +31,12 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "tensor.H"
 #include "symmTensor.H"
 #include "transform.H"
 #include "unitConversion.H"
 #include "Random.H"
-#include "scalar.H"
-#include "complex.H"
 #include "sigFpe.H"
 
 using namespace Foam;
diff --git a/applications/test/mappedPatch/Make/options b/applications/test/mappedPatch/Make/options
index d76bd10c8fa..fcbad8ec2c3 100644
--- a/applications/test/mappedPatch/Make/options
+++ b/applications/test/mappedPatch/Make/options
@@ -3,4 +3,5 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
-    -lfiniteVolume
+    -lfiniteVolume \
+    -lmeshTools
diff --git a/applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.C b/applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.C
index e0b962be22f..e1dd4a2705d 100644
--- a/applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.C
+++ b/applications/test/matrices/DiagonalMatrix/Test-DiagonalMatrix.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -36,10 +36,9 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "DiagonalMatrix.H"
 #include "RectangularMatrix.H"
-#include "scalar.H"
-#include "complex.H"
 #include "TestTools.H"
 
 using namespace Foam;
@@ -173,24 +172,23 @@ void test_global_funcs(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -205,8 +203,8 @@ int main()
 
     const List<word> typeID
     ({
-        "DiagonalMatrix<floatScalar>",
-        "DiagonalMatrix<doubleScalar>",
+        "DiagonalMatrix<float>",
+        "DiagonalMatrix<double>",
         "DiagonalMatrix<complex>"
     });
 
diff --git a/applications/test/matrices/EigenMatrix/Test-EigenMatrix.C b/applications/test/matrices/EigenMatrix/Test-EigenMatrix.C
index 0b7ad7d2f64..e6da1762817 100644
--- a/applications/test/matrices/EigenMatrix/Test-EigenMatrix.C
+++ b/applications/test/matrices/EigenMatrix/Test-EigenMatrix.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is derivative work of OpenFOAM.
@@ -36,10 +36,10 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "scalarMatrices.H"
 #include "RectangularMatrix.H"
 #include "SquareMatrix.H"
-#include "complex.H"
 #include "IOmanip.H"
 #include "EigenMatrix.H"
 #include "TestTools.H"
@@ -335,27 +335,26 @@ void test_eigenvectors(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
+
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test eigenvalues: "<< typeID[I] <<" ##" << nl;
-    test_eigenvalues(std::get<I>(types));
+        Info<< nl << "    ## Test eigenvalues: " << name << " ##" << nl;
+        test_eigenvalues(std::get<I>(types));
 
-    Info<< nl << "    ## Test eigenvectors: "<< typeID[I] <<" ##" << nl;
-    test_eigenvectors(std::get<I>(types));
+        Info<< nl << "    ## Test eigenvectors: " << name << " ##" << nl;
+        test_eigenvectors(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -372,8 +371,8 @@ int main()
 
     const List<word> typeID
     ({
-        "SquareMatrix<floatScalar>",
-        "SquareMatrix<doubleScalar>"
+        "SquareMatrix<float>",
+        "SquareMatrix<double>"
     });
 
     run_tests(types, typeID);
@@ -539,3 +538,6 @@ int main()
     Info<< nl << "        #### Passed all " << nTest_ <<" tests ####\n" << endl;
     return 0;
 }
+
+
+// ************************************************************************* //
diff --git a/applications/test/matrices/QRMatrix/Test-QRMatrix.C b/applications/test/matrices/QRMatrix/Test-QRMatrix.C
index 9e51d67eb02..bf07d7694ef 100644
--- a/applications/test/matrices/QRMatrix/Test-QRMatrix.C
+++ b/applications/test/matrices/QRMatrix/Test-QRMatrix.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2022 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,9 +32,9 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "MatrixTools.H"
 #include "QRMatrix.H"
-#include "complex.H"
 #include "IOmanip.H"
 #include "TestTools.H"
 
@@ -533,21 +533,20 @@ void test_decomposition(MatrixType)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test decomposition: "<< typeID[I] <<" ##" << nl;
-    test_decomposition(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test decomposition: " << name << " ##" << nl;
+        test_decomposition(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -570,9 +569,9 @@ int main()
 
     const List<word> typeID
     ({
-        "RectangularMatrix<doubleScalar>",
+        "RectangularMatrix<double>",
         "RectangularMatrix<complex>",
-        "SquareMatrix<doubleScalar>",
+        "SquareMatrix<double>",
         "SquareMatrix<complex>"
     });
 
diff --git a/applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.C b/applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.C
index 86690ba60f2..b26fc933c10 100644
--- a/applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.C
+++ b/applications/test/matrices/RectangularMatrix/Test-RectangularMatrix.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,10 +42,9 @@ Note
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "RectangularMatrix.H"
 #include "SquareMatrix.H"
-#include "scalar.H"
-#include "complex.H"
 #include "IOmanip.H"
 #include "TestTools.H"
 
@@ -809,35 +808,33 @@ void test_global_opers(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test member opers: "<< typeID[I] <<" ##" << nl;
-    test_member_opers(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member opers: " << name << " ##" << nl;
+        test_member_opers(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] << " ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test friend funcs: "<< typeID[I] <<" ##" << nl;
-    test_friend_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
-}
+        Info<< nl << "    ## Test friend funcs: " << name << " ##" << nl;
+        test_friend_funcs(std::get<I>(types));
 
+        run_tests<I + 1, Tp...>(types, names);
+    }
+}
 
 // * * * * * * * * * * * * * * * Main Program  * * * * * * * * * * * * * * * //
 
@@ -852,8 +849,8 @@ int main()
 
     const List<word> typeID
     ({
-        "RectangularMatrix<floatScalar>",
-        "RectangularMatrix<doubleScalar>",
+        "RectangularMatrix<float>",
+        "RectangularMatrix<double>",
         "RectangularMatrix<complex>"
     });
 
diff --git a/applications/test/matrices/SquareMatrix/Test-SquareMatrix.C b/applications/test/matrices/SquareMatrix/Test-SquareMatrix.C
index 3a454618993..b77a3a1f1eb 100644
--- a/applications/test/matrices/SquareMatrix/Test-SquareMatrix.C
+++ b/applications/test/matrices/SquareMatrix/Test-SquareMatrix.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,11 +42,10 @@ Note
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "scalarMatrices.H"
 #include "RectangularMatrix.H"
 #include "SquareMatrix.H"
-#include "scalar.H"
-#include "complex.H"
 #include "IOmanip.H"
 #include "TestTools.H"
 
@@ -932,33 +931,32 @@ void test_global_opers(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test member opers: "<< typeID[I] <<" ##" << nl;
-    test_member_opers(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member opers: " << name << " ##" << nl;
+        test_member_opers(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] << " ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test friend funcs: "<< typeID[I] <<" ##" << nl;
-    test_friend_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test friend funcs: " << name << " ##" << nl;
+        test_friend_funcs(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -975,8 +973,8 @@ int main()
 
     const List<word> typeID
     ({
-        "SquareMatrix<floatScalar>",
-        "SquareMatrix<doubleScalar>",
+        "SquareMatrix<float>",
+        "SquareMatrix<double>",
         "SquareMatrix<complex>"
     });
 
diff --git a/applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.C b/applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.C
index ab404872c19..e8590677c08 100644
--- a/applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.C
+++ b/applications/test/matrices/SymmetricSquareMatrix/Test-SymmetricSquareMatrix.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,12 +42,11 @@ Note
 
 \*---------------------------------------------------------------------------*/
 
+#include "complex.H"
 #include "scalarMatrices.H"
 #include "RectangularMatrix.H"
 #include "SquareMatrix.H"
 #include "SymmetricSquareMatrix.H"
-#include "scalar.H"
-#include "complex.H"
 #include "IOmanip.H"
 #include "Random.H"
 #include "TestTools.H"
@@ -138,33 +137,32 @@ void test_global_opers(Type)
 
 // Do compile-time recursion over the given types
 template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I == sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
-
-
-template<std::size_t I = 0, typename... Tp>
-inline typename std::enable_if<I < sizeof...(Tp), void>::type
-run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
+void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
 {
-    Info<< nl << "    ## Test constructors: "<< typeID[I] <<" ##" << nl;
-    test_constructors(std::get<I>(types));
+    if constexpr (I < sizeof...(Tp))
+    {
+        const auto& name = names[I];
 
-    Info<< nl << "    ## Test member functions: "<< typeID[I] <<" ##" << nl;
-    test_member_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test constructors: " << name << " ##" << nl;
+        test_constructors(std::get<I>(types));
 
-    Info<< nl << "    ## Test member opers: "<< typeID[I] <<" ##" << nl;
-    test_member_opers(std::get<I>(types));
+        Info<< nl << "    ## Test member functions: " << name << " ##" << nl;
+        test_member_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test global functions: "<< typeID[I] << " ##" << nl;
-    test_global_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test member opers: " << name << " ##" << nl;
+        test_member_opers(std::get<I>(types));
 
-    Info<< nl << "    ## Test global operators: "<< typeID[I] << " ##" << nl;
-    test_global_opers(std::get<I>(types));
+        Info<< nl << "    ## Test global functions: " << name << " ##" << nl;
+        test_global_funcs(std::get<I>(types));
 
-    Info<< nl << "    ## Test friend funcs: "<< typeID[I] <<" ##" << nl;
-    test_friend_funcs(std::get<I>(types));
+        Info<< nl << "    ## Test global operators: " << name << " ##" << nl;
+        test_global_opers(std::get<I>(types));
 
-    run_tests<I + 1, Tp...>(types, typeID);
+        Info<< nl << "    ## Test friend funcs: " << name << " ##" << nl;
+        test_friend_funcs(std::get<I>(types));
+
+        run_tests<I + 1, Tp...>(types, names);
+    }
 }
 
 
@@ -181,8 +179,8 @@ int main()
 
     const List<word> typeID
     ({
-        "SymmetricSquareMatrix<floatScalar>",
-        "SymmetricSquareMatrix<doubleScalar>",
+        "SymmetricSquareMatrix<float>",
+        "SymmetricSquareMatrix<double>",
         "SymmetricSquareMatrix<complex>"
     });
 
diff --git a/applications/test/pTraits/Test-pTraits.C b/applications/test/pTraits/Test-pTraits.C
index 78494ab6a93..63650712c4f 100644
--- a/applications/test/pTraits/Test-pTraits.C
+++ b/applications/test/pTraits/Test-pTraits.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2023 OpenCFD Ltd.
+    Copyright (C) 2023-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,9 +32,11 @@ Description
 #include "pTraits.H"
 #include "contiguous.H"
 #include "boolVector.H"  // A FixedList pretending to be a vector
+#include "complex.H"
 #include "vector.H"
 #include "tensor.H"
-#include "complex.H"
+#include "sphericalTensor.H"
+#include "symmTensor.H"
 #include "uLabel.H"
 #include "Switch.H"
 
@@ -50,26 +52,37 @@ template<class T, class = void>
 struct has_typeName : std::false_type {};
 
 //- Test if Type has typeName member
-
 template<class T>
-struct has_typeName<T, stdFoam::void_t<decltype(pTraits<T>::typeName)>>
+struct has_typeName
+<
+    T,
+    std::void_t<decltype(pTraits<std::remove_cv_t<T>>::typeName)>
+>
 :
     std::true_type
 {};
 
 
 template<class T>
-typename std::enable_if<has_typeName<T>::value, void>::type
-printTypeName()
+void printTypeName()
 {
-    Info<< pTraits<T>::typeName;
-}
-
-template<class T>
-typename std::enable_if<!has_typeName<T>::value, void>::type
-printTypeName()
-{
-    Info<< typeid(T).name();
+    // Both float and double have pTraits typeName = "scalar"!
+    if constexpr (std::is_same_v<float, std::remove_cv_t<T>>)
+    {
+        Info<< "<float>";
+    }
+    else if constexpr (std::is_same_v<double, std::remove_cv_t<T>>)
+    {
+        Info<< "<double>";
+    }
+    else if constexpr (has_typeName<T>::value)
+    {
+        Info<< pTraits<std::remove_cv_t<T>>::typeName;
+    }
+    else
+    {
+        Info<< typeid(T).name();
+    }
 }
 
 
@@ -80,23 +93,24 @@ template<class T>
 struct has_zero_one
 <
     T,
-    stdFoam::void_t<decltype(pTraits<T>::zero), decltype(pTraits<T>::one)>
+    std::void_t
+    <
+        decltype(pTraits<std::remove_cv_t<T>>::zero),
+        decltype(pTraits<std::remove_cv_t<T>>::one)
+    >
 > : std::true_type {};
 
 
 template<class T>
-typename std::enable_if<has_zero_one<T>::value, void>::type
-printMinMaxRange()
+void printMinMaxRange()
 {
-    Info<< " zero=" << pTraits<T>::zero
-        << " one=" << pTraits<T>::one;
+    if constexpr (has_zero_one<T>::value)
+    {
+        Info<< " zero=" << pTraits<std::remove_cv_t<T>>::zero
+            << " one=" << pTraits<std::remove_cv_t<T>>::one;
+    }
 }
 
-template<class T>
-typename std::enable_if<!has_zero_one<T>::value, void>::type
-printMinMaxRange()
-{}
-
 
 template<class T>
 void printTraits()
@@ -104,11 +118,12 @@ void printTraits()
     printTypeName<T>();
     printMinMaxRange<T>();
 
-    Info<< " integral=" << std::is_integral<T>::value
-        << " floating=" << std::is_floating_point<T>::value
+    Info<< " integral=" << std::is_integral_v<T>
+        << " floating=" << std::is_floating_point_v<T>
         << " rank=" << pTraits_rank<T>::value
         << " nComponents=" << pTraits_nComponents<T>::value
-        << " vector-space=" << Switch::name(is_vectorspace<T>::value)
+        << " vector-space=" << Switch::name(is_vectorspace_v<T>)
+        << " rotate=" << Switch::name(is_rotational_vectorspace_v<T>)
         << " is_label=" << Switch::name(is_contiguous_label<T>::value)
         << " is_scalar=" << Switch::name(is_contiguous_scalar<T>::value)
         << " cmptType=" << typeid(typename pTraits_cmptType<T>::type).name()
@@ -137,9 +152,11 @@ int main()
     printTraits<bool>();
     printTraits<label>();
     printTraits<scalar>();
-    printTraits<complex>();     // Uses specialized pTraits_...
+    printTraits<const complex>();     // Uses specialized pTraits_...
     printTraits<floatVector>();
     printTraits<doubleVector>();
+    printTraits<sphericalTensor>();
+    printTraits<symmTensor>();
     printTraits<tensor>();
     printTraits<boolVector>();  // Uses specialized pTraits_...
     printTraits<word>();
diff --git a/applications/test/parallel-broadcast/Test-parallel-broadcast.C b/applications/test/parallel-broadcast/Test-parallel-broadcast.C
index 38a68382e35..0b8ff934fd7 100644
--- a/applications/test/parallel-broadcast/Test-parallel-broadcast.C
+++ b/applications/test/parallel-broadcast/Test-parallel-broadcast.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -46,7 +46,7 @@ using namespace Foam;
 template<class T>
 void printPre(const T& value)
 {
-    Info<< nl << "is_contiguous:" << is_contiguous<T>::value << endl;
+    Info<< nl << "is_contiguous:" << is_contiguous_v<T> << endl;
     Pout<< "pre-broadcast: " << value << endl;
 }
 
@@ -68,7 +68,7 @@ void testBroadcast(T& value)
 template<class T>
 void testBroadcast(List<T>& values)
 {
-    Info<< nl << "is_contiguous:" << is_contiguous<T>::value << endl;
+    Info<< nl << "is_contiguous:" << is_contiguous_v<T> << endl;
     Pout<< "pre-broadcast: " << flatOutput(values) << endl;
     Pstream::broadcast(values);
     Pout<< "post-broadcast: " << flatOutput(values) << endl;
diff --git a/applications/test/parallel-chunks/Test-parallel-chunks.C b/applications/test/parallel-chunks/Test-parallel-chunks.C
index 30e71a12c51..19756998893 100644
--- a/applications/test/parallel-chunks/Test-parallel-chunks.C
+++ b/applications/test/parallel-chunks/Test-parallel-chunks.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022-2024 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -44,55 +44,17 @@ Description
 using namespace Foam;
 
 
-//- Number of elements corresponding to max byte transfer.
-//  Normal upper limit is INT_MAX since MPI sizes are limited to <int>.
-template<class Type>
-inline std::size_t maxTransferCount
-(
-    const std::size_t max_bytes = std::size_t(0)
-) noexcept
-{
-    return
-    (
-        (max_bytes == 0)                        // ie, unlimited
-      ? (std::size_t(0))                        //
-      : (max_bytes > std::size_t(INT_MAX))      // MPI limit is <int>
-      ? (std::size_t(INT_MAX) / sizeof(Type))   //
-      : (max_bytes > sizeof(Type))              // require an integral number
-      ? (max_bytes / sizeof(Type))              //
-      : (std::size_t(1))                        // min of one element
-    );
-}
-
-
-//- Upper limit on number of transfer bytes.
-//  Max bytes is normally INT_MAX since MPI sizes are limited to <int>.
-//  Negative values indicate a subtraction from INT_MAX.
-inline std::size_t PstreamDetail_maxTransferBytes
-(
-    const int64_t max_bytes
-) noexcept
-{
-    return
-    (
-        (max_bytes < 0)  // (numBytes fewer than INT_MAX)
-      ? std::size_t(INT_MAX + max_bytes)
-      : std::size_t(max_bytes)
-    );
-}
-
-
 template<class Container, class Type>
 void broadcast_chunks
 (
     Container& sendData,
     const int tag = UPstream::msgType(),
-    const label comm = UPstream::worldComm
+    const label comm = UPstream::worldComm,
     const int64_t maxComms_bytes = UPstream::maxCommsSize
 )
 {
-    // OR  static_assert(is_contiguous<T>::value, "Contiguous data only!")
-    if (!is_contiguous<Type>::value)
+    // OR  static_assert(is_contiguous_v<Type>, "Contiguous data only!")
+    if constexpr (!is_contiguous_v<Type>)
     {
         FatalErrorInFunction
             << "Contiguous data only." << sizeof(Type)
@@ -119,9 +81,9 @@ void broadcast_chunks
     // Is zero for non-chunked exchanges.
     const std::size_t chunkSize
     (
-        PstreamDetail_maxTransferCount<Type>
+        PstreamDetail::maxTransferCount<Type>
         (
-            PstreamDetail_maxTransferBytes(maxComms_bytes)
+            PstreamDetail::maxTransferBytes(maxComms_bytes)
         )
     );
 
diff --git a/applications/test/parallelOverset/Make/options b/applications/test/parallelOverset/Make/options
index db6c073e474..438700b107c 100644
--- a/applications/test/parallelOverset/Make/options
+++ b/applications/test/parallelOverset/Make/options
@@ -7,6 +7,7 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lfiniteVolume \
+    -lmeshTools \
     -ldynamicFvMesh \
     -lsampling \
     -loverset
diff --git a/applications/test/refPtr/Test-refPtr.C b/applications/test/refPtr/Test-refPtr.C
index 06388a7633b..af70c925217 100644
--- a/applications/test/refPtr/Test-refPtr.C
+++ b/applications/test/refPtr/Test-refPtr.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2023 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -36,13 +36,13 @@ template<class T>
 void constructInfo()
 {
     Info<< " move-constructible:"
-        << std::is_move_constructible<T>::value
+        << std::is_move_constructible_v<T>
         << " move-assignable:"
-        << std::is_move_assignable<T>::value
+        << std::is_move_assignable_v<T>
         << " nothrow:"
-        << std::is_nothrow_move_assignable<T>::value
+        << std::is_nothrow_move_assignable_v<T>
         << " trivially:"
-        << std::is_trivially_move_assignable<T>::value
+        << std::is_trivially_move_assignable_v<T>
         << nl;
 }
 
diff --git a/applications/test/regex1/Test-regex1.C b/applications/test/regex1/Test-regex1.C
index 0c47eb0cbef..afa467ad582 100644
--- a/applications/test/regex1/Test-regex1.C
+++ b/applications/test/regex1/Test-regex1.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2021 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -322,12 +322,12 @@ int main(int argc, char *argv[])
     Info<< "_GLIBCXX_RELEASE = " << (_GLIBCXX_RELEASE) << nl;
     #endif
 
-    if (std::is_same<regExp, regExpCxx>::value)
+    if constexpr (std::is_same_v<regExp, regExpCxx>)
     {
         Info<< "Foam::regExp uses C++11 regex" << nl;
     }
     #ifndef _WIN32
-    if (std::is_same<regExp, regExpPosix>::value)
+    if constexpr (std::is_same_v<regExp, regExpPosix>)
     {
         Info<< "Foam::regExp uses POSIX regex" << nl;
     }
diff --git a/applications/test/sizeof/Test-sizeof.C b/applications/test/sizeof/Test-sizeof.C
index b6235e22137..6852cf96424 100644
--- a/applications/test/sizeof/Test-sizeof.C
+++ b/applications/test/sizeof/Test-sizeof.C
@@ -53,6 +53,27 @@ namespace Foam
       {}
    };
 
+
+   // Test compilation with static_assert workaround
+   // (workaround before CWG2518)
+   template<class T>
+   inline unsigned sizeof_float()
+   {
+       if constexpr (std::is_floating_point_v<T>)
+       {
+           return sizeof(T);
+       }
+       else
+       {
+           // static_assert(false, "only use for floats");
+           static_assert
+           (
+               stdFoam::dependent_false_v<T>,
+               "only use for floats"
+           );
+           return 0u;
+       }
+   }
 }
 
 
diff --git a/applications/test/spline/Make/options b/applications/test/spline/Make/options
index 1a366abf0dd..08a74eada1a 100644
--- a/applications/test/spline/Make/options
+++ b/applications/test/spline/Make/options
@@ -2,4 +2,4 @@ EXE_INC = \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/mesh/blockMesh/lnInclude
 
-EXE_LIBS = -lblockMesh
+EXE_LIBS = -lblockMesh -lmeshTools
diff --git a/applications/test/surfaceReading/Make/options b/applications/test/surfaceReading/Make/options
index 14486e17583..7e058a30386 100644
--- a/applications/test/surfaceReading/Make/options
+++ b/applications/test/surfaceReading/Make/options
@@ -3,4 +3,5 @@ EXE_INC = \
     -I$(LIB_SRC)/surfMesh/lnInclude
 
 EXE_LIBS = \
+    -lfileFormats \
     -lsurfMesh
diff --git a/applications/test/tmp/Test-tmp.C b/applications/test/tmp/Test-tmp.C
index a1d35f1577b..e8e292ccd12 100644
--- a/applications/test/tmp/Test-tmp.C
+++ b/applications/test/tmp/Test-tmp.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2023 OpenCFD Ltd.
+    Copyright (C) 2018-2024 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -45,13 +45,13 @@ void printInfo(const tmp<T>& item, const bool verbose = false)
     }
 
     Info<< " move-constructible:"
-        << std::is_move_constructible<tmp<T>>::value
+        << std::is_move_constructible_v<tmp<T>>
         << " move-assignable:"
-        << std::is_move_assignable<tmp<T>>::value
+        << std::is_move_assignable_v<tmp<T>>
         << " nothrow:"
-        << std::is_nothrow_move_assignable<tmp<T>>::value
+        << std::is_nothrow_move_assignable_v<tmp<T>>
         << " trivially:"
-        << std::is_trivially_move_assignable<tmp<T>>::value
+        << std::is_trivially_move_assignable_v<tmp<T>>
         << nl;
 
     if (verbose && item)
diff --git a/applications/test/volField/Test-volField.C b/applications/test/volField/Test-volField.C
index 813a8b58e1f..55e0044a38c 100644
--- a/applications/test/volField/Test-volField.C
+++ b/applications/test/volField/Test-volField.C
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
 
     Info<< nl
         << "solverPerformanceDict: "
-        << mesh.solverPerformanceDict() << endl;
+        << mesh.data().solverPerformanceDict() << endl;
 
 
     if (args.found("zip"))
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index ca7782f713e..6fbc12edfa5 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2023 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -232,7 +232,7 @@ vtk::outputOptions getOutputOptions(const argList& args)
 
         if (!args.found("ascii"))
         {
-            if (sizeof(float) != 4 || sizeof(label) != 4)
+            if constexpr (sizeof(float) != 4 || sizeof(label) != 4)
             {
                 opts.ascii(true);
 
diff --git a/doc/BuildIssues.md b/doc/BuildIssues.md
index 9faa22087a7..219c034a056 100644
--- a/doc/BuildIssues.md
+++ b/doc/BuildIssues.md
@@ -137,15 +137,11 @@ cd $WM_THIRD_PARTY_DIR
 Subequent compilation with Allwmake will now run largely without any
 problems, except that the components linking against CGAL
 (foamyMesh and surfaceBooleanFeatures) will also try to link against
-a nonexistent mpfr library. As a workaround, the link-dependency can
-be removed in wmake/rules/General/CGAL :
+a nonexistent mpfr library. As a workaround, the link-dependency will
+be removed in wmake/rules/General/cgal by specifying the `CGAL_FLAVOUR`
+when compiling:
 ```
-CGAL_LIBS = \
-    -L$(BOOST_ARCH_PATH)/lib \
-    -L$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-    -L$(CGAL_ARCH_PATH)/lib \
-    -L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-    -lCGAL
+no-cgal | cgal-header | cgal-header-no-mpfr | cgal-no-mpfr | cgal-mpfr
 ```
 
 A robuster solution is still being sought.
diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedList.C b/src/OpenFOAM/containers/Bits/PackedList/PackedList.C
index caf61ecfc7a..da9b18bcb4d 100644
--- a/src/OpenFOAM/containers/Bits/PackedList/PackedList.C
+++ b/src/OpenFOAM/containers/Bits/PackedList/PackedList.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2023 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -188,12 +188,12 @@ Foam::PackedList<Width>::unpack() const
 {
     static_assert
     (
-        std::is_integral<IntType>::value,
+        std::is_integral_v<IntType>,
         "Integral required for output."
     );
     static_assert
     (
-        std::numeric_limits<IntType>::digits >= Width,
+        Width < std::numeric_limits<IntType>::digits,
         "Width of IntType is too small to hold result"
     );
 
@@ -244,12 +244,12 @@ Foam::PackedList<Width>::unpack(const labelRange& range) const
 {
     static_assert
     (
-        std::is_integral<IntType>::value,
+        std::is_integral_v<IntType>,
         "Integral required for unpack output."
     );
     static_assert
     (
-        std::numeric_limits<IntType>::digits >= Width,
+        Width < std::numeric_limits<IntType>::digits,
         "Width of IntType is too small to hold unpack output."
     );
 
@@ -278,12 +278,12 @@ Foam::PackedList<Width>::unpack(const labelUList& locations) const
 {
     static_assert
     (
-        std::is_integral<IntType>::value,
+        std::is_integral_v<IntType>,
         "Integral required for unpack output."
     );
     static_assert
     (
-        std::numeric_limits<IntType>::digits >= Width,
+        Width < std::numeric_limits<IntType>::digits,
         "Width of IntType is too small to hold unpack output."
     );
 
diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H b/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H
index abc10644b0d..cb58bf6d9aa 100644
--- a/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H
+++ b/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -648,7 +648,7 @@ inline std::streamsize Foam::PackedList<Width>::size_data() const noexcept
 template<unsigned Width>
 inline std::streamsize Foam::PackedList<Width>::size_bytes() const noexcept
 {
-    return num_blocks(size()) * sizeof(block_type);
+    return size_data() * sizeof(block_type);
 }
 
 
diff --git a/src/OpenFOAM/containers/Buffers/CircularBufferIO.C b/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
index ce23e0f6c7c..3bb903e4157 100644
--- a/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
+++ b/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022-2023 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -103,7 +103,7 @@ Foam::Ostream& Foam::CircularBuffer<T>::writeList
     }
     #endif
 
-    if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+    if (os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
     {
         // Binary and contiguous
 
@@ -136,11 +136,7 @@ Foam::Ostream& Foam::CircularBuffer<T>::writeList
      ||
         (
             (len <= shortLen)
-         &&
-            (
-                is_contiguous<T>::value
-             || Detail::ListPolicy::no_linebreak<T>::value
-            )
+         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
diff --git a/src/OpenFOAM/containers/Circulators/Circulator.H b/src/OpenFOAM/containers/Circulators/Circulator.H
index d9fca35aeb4..1951c5771dd 100644
--- a/src/OpenFOAM/containers/Circulators/Circulator.H
+++ b/src/OpenFOAM/containers/Circulators/Circulator.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2012-2015 OpenFOAM Foundation
-    Copyright (C) 2022 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -120,20 +120,20 @@ public:
         using difference_type = typename Container::difference_type;
 
         //- The container iterator type (const/non-const)
-        using iterator = typename std::conditional
+        using iterator = std::conditional_t
         <
             Const,
             typename Container::const_iterator,
             typename Container::iterator
-        >::type;
+        >;
 
         //- The reference type (const/non-const)
-        using reference = typename std::conditional
+        using reference = std::conditional_t
         <
             Const,
             typename Container::const_reference,
             typename Container::reference
-        >::type;
+        >;
 
 
 private:
diff --git a/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.C b/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.C
index 0684c31d18c..14572e7d3b8 100644
--- a/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.C
+++ b/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -254,11 +254,11 @@ Foam::label Foam::CompactListList<T>::maxNonLocalSize(const label rowi) const
 template<class T>
 std::streamsize Foam::CompactListList<T>::byteSize() const
 {
-    if (!is_contiguous<T>::value)
+    if constexpr (!is_contiguous_v<T>)
     {
         FatalErrorInFunction
             << "Invalid for non-contiguous data types"
-            << abort(FatalError);
+            << Foam::abort(FatalError);
     }
     return this->size_bytes();
 }
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index e1c88a5384e..5e4c6593808 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2024 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -136,12 +136,12 @@ public:
 
         //- A table entry (node) that encapsulates the key/val tuple
         //- with an additional linked-list entry for hash collisions
-        typedef typename std::conditional
+        using node_type = std::conditional_t
         <
-            std::is_same<Foam::zero, typename std::remove_cv<T>::type>::value,
+            std::is_same_v<Foam::zero, std::remove_cv_t<T>>,
             Detail::HashTableSingle<Key>,
             Detail::HashTablePair<Key, T>
-        >::type node_type;
+        >;
 
 
     // STL type definitions
@@ -652,31 +652,31 @@ protected:
             using difference_type = this_type::difference_type;
 
             //- The HashTable container type
-            using table_type = typename std::conditional
+            using table_type = std::conditional_t
             <
                 Const,
                 const this_type,
                 this_type
-            >::type;
+            >;
 
             //- The node-type being addressed
-            using node_type = typename std::conditional
+            using node_type = std::conditional_t
             <
                 Const,
                 const this_type::node_type,
                 this_type::node_type
-            >::type;
+            >;
 
             //- The key type
             using key_type = this_type::key_type;
 
             //- The object type being addressed
-            using mapped_type = typename std::conditional
+            using mapped_type = std::conditional_t
             <
                 Const,
                 const this_type::mapped_type,
                 this_type::mapped_type
-            >::type;
+            >;
 
 
         protected:
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableDetail.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableDetail.H
index 82b1b884b0a..4f702695115 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableDetail.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableDetail.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.
@@ -165,39 +165,28 @@ struct HashTablePair
             return key_ < rhs.key_;
         }
 
-        //- Write (key, val) pair - for pointer types
-        template<class TypeT = V>
-        typename std::enable_if
-        <
-            (
-                std::is_pointer<TypeT>::value
-             || Detail::isPointerLike<TypeT>::value
-            ),
-            void
-        >::type
-        print(Ostream& os) const
+        //- Write (key, val) pair
+        void print(Ostream& os) const
         {
             os << key_;
 
-            if (val_)
+            if constexpr
+            (
+                std::is_pointer_v<V>
+             || Detail::isPointerLike<V>::value
+            )
             {
-                os << ' ' << *val_;
+                // Pointer or pointer-like types
+                if (val_)
+                {
+                    os << ' ' << *val_;
+                }
+            }
+            else
+            {
+                // Non-pointer types
+                os << ' ' << val_;
             }
-        }
-
-        //- Write (key, val) pair - for non-pointer types
-        template<class TypeT = V>
-        typename std::enable_if
-        <
-            (
-                !std::is_pointer<TypeT>::value
-             && !Detail::isPointerLike<TypeT>::value
-            ),
-            void
-        >::type
-        print(Ostream& os) const
-        {
-            os << key_ << ' ' << val_;
         }
 };
 
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
index acab8cc4775..1978873331c 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2014 OpenFOAM Foundation
-    Copyright (C) 2016-2022 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -44,7 +44,7 @@ Foam::Ostream& Foam::IndirectListBase<T, Addr>::writeList
 
     const label len = list.size();
 
-    if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+    if (os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
     {
         // Binary and contiguous
         os << nl << len << nl;
@@ -69,7 +69,7 @@ Foam::Ostream& Foam::IndirectListBase<T, Addr>::writeList
             os.endRawWrite();
         }
     }
-    else if (is_contiguous<T>::value && len > 1 && list.uniform())
+    else if (is_contiguous_v<T> && len > 1 && list.uniform())
     {
         // Two or more entries, and all entries have identical values.
         os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
@@ -80,11 +80,7 @@ Foam::Ostream& Foam::IndirectListBase<T, Addr>::writeList
      ||
         (
             (len <= shortLen)
-         &&
-            (
-                is_contiguous<T>::value
-             || Detail::ListPolicy::no_linebreak<T>::value
-            )
+         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C
index b47cc12b7aa..996c51cff15 100644
--- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C
+++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2021-2023 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -202,7 +202,7 @@ Foam::Istream& Foam::DynamicList<T, SizeMin>::readList(Istream& is)
         // Resize to length required
         list.resize_nocopy(len);
 
-        if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+        if (is.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
         {
             // Binary and contiguous
 
@@ -222,7 +222,7 @@ Foam::Istream& Foam::DynamicList<T, SizeMin>::readList(Istream& is)
                 );
             }
         }
-        else if (std::is_same<char, typename std::remove_cv<T>::type>::value)
+        else if constexpr (std::is_same_v<char, std::remove_cv_t<T>>)
         {
             // Special treatment for char data (binary I/O only)
             const auto oldFmt = is.format(IOstreamOption::BINARY);
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.C b/src/OpenFOAM/containers/Lists/FixedList/FixedList.C
index df7410febac..5684fcecae5 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.C
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -33,11 +33,11 @@ License
 template<class T, unsigned N>
 std::streamsize Foam::FixedList<T, N>::byteSize()
 {
-    if (!is_contiguous<T>::value)
+    if constexpr (!is_contiguous_v<T>)
     {
         FatalErrorInFunction
             << "Invalid for non-contiguous data types"
-            << abort(FatalError);
+            << Foam::abort(FatalError);
     }
     return FixedList<T, N>::size_bytes();
 }
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
index 1c1f8c8476a..5344e5b3642 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -497,17 +497,19 @@ public:
                 unsigned seed=0
             ) const
             {
-                if (is_contiguous<T>::value)
+                if constexpr (is_contiguous_v<T>)
                 {
                     return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
                 }
-
-                Foam::Hash<T> op;
-                for (const T& val : obj)
+                else
                 {
-                    seed = op(val, seed);
+                    Foam::Hash<T> op;
+                    for (const T& val : obj)
+                    {
+                        seed = op(val, seed);
+                    }
+                    return seed;
                 }
-                return seed;
             }
         };
 
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
index 62bbe66555d..161498d9a94 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2022 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -40,10 +40,13 @@ void Foam::FixedList<T, N>::writeEntry(Ostream& os) const
     if (token::compound::isCompound(tag))
     {
         os  << tag << token::SPACE;
-        if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+        if constexpr (is_contiguous_v<T>)
         {
-            // Need the size too so that List<Type>::readList parses correctly
-            os << static_cast<label>(N);
+            if (os.format() == IOstreamOption::BINARY)
+            {
+                // Need size too so that List<Type>::readList parses correctly
+                os << static_cast<label>(N);
+            }
         }
     }
     os << *this;
@@ -90,7 +93,7 @@ Foam::Ostream& Foam::FixedList<T, N>::writeList
     // small and we prefer a consistent appearance.
     // Eg, FixedList<T,2> or Pair<T> as "(-1 -1)", never as "2{-1}"
 
-    if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+    if (os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
     {
         // Binary and contiguous. Size is always non-zero
 
@@ -103,11 +106,7 @@ Foam::Ostream& Foam::FixedList<T, N>::writeList
      ||
         (
             (N <= unsigned(shortLen))
-         &&
-            (
-                is_contiguous<T>::value
-             || Detail::ListPolicy::no_linebreak<T>::value
-            )
+         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
@@ -158,7 +157,7 @@ Foam::Istream& Foam::FixedList<T, N>::readList
 
     is.fatalCheck(FUNCTION_NAME);
 
-    if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+    if (is.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
     {
         // Binary and contiguous. Length is non-zero
 
diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H
index 87b9bf9019b..76e7c7d94db 100644
--- a/src/OpenFOAM/containers/Lists/List/List.H
+++ b/src/OpenFOAM/containers/Lists/List/List.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -356,7 +356,7 @@ public:
         //
         //  \return True if value changed.
         template<class TypeT = T>
-        typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
+        std::enable_if_t<std::is_same_v<bool, TypeT>, bool>
         inline set(const label i, bool val = true)
         {
             if (i < 0)
diff --git a/src/OpenFOAM/containers/Lists/List/ListIO.C b/src/OpenFOAM/containers/Lists/List/ListIO.C
index 06786f8f2ac..490860c1df4 100644
--- a/src/OpenFOAM/containers/Lists/List/ListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/ListIO.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.
@@ -202,7 +202,7 @@ Foam::Istream& Foam::List<T>::readList(Istream& is)
         // Resize to length required
         list.resize_nocopy(len);
 
-        if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+        if (is.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
         {
             // Binary and contiguous
 
@@ -222,7 +222,7 @@ Foam::Istream& Foam::List<T>::readList(Istream& is)
                 );
             }
         }
-        else if (std::is_same<char, typename std::remove_cv<T>::type>::value)
+        else if constexpr (std::is_same_v<char, std::remove_cv_t<T>>)
         {
             // Special treatment for char data (binary I/O only)
             const auto oldFmt = is.format(IOstreamOption::BINARY);
diff --git a/src/OpenFOAM/containers/Lists/List/UList.C b/src/OpenFOAM/containers/Lists/List/UList.C
index 18609243051..df54e1770e9 100644
--- a/src/OpenFOAM/containers/Lists/List/UList.C
+++ b/src/OpenFOAM/containers/Lists/List/UList.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -166,11 +166,11 @@ void Foam::UList<T>::operator=(const Foam::zero)
 template<class T>
 std::streamsize Foam::UList<T>::byteSize() const
 {
-    if (!is_contiguous<T>::value)
+    if constexpr (!is_contiguous_v<T>)
     {
         FatalErrorInFunction
             << "Invalid for non-contiguous data types"
-            << abort(FatalError);
+            << Foam::abort(FatalError);
     }
     return this->size_bytes();
 }
diff --git a/src/OpenFOAM/containers/Lists/List/UList.H b/src/OpenFOAM/containers/Lists/List/UList.H
index ceb50199c5a..639a60cf4eb 100644
--- a/src/OpenFOAM/containers/Lists/List/UList.H
+++ b/src/OpenFOAM/containers/Lists/List/UList.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -555,7 +555,7 @@ public:
         //- always false for out-of-range access.
         //  \note Method name compatibility with bitSet, HashSet
         template<class TypeT = T>
-        typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
+        std::enable_if_t<std::is_same_v<bool, TypeT>, bool>
         inline test(const label i) const
         {
             return (i >= 0 && i < size_ && v_[i]);
@@ -565,7 +565,7 @@ public:
         //- always false for out-of-range access.
         //  \note Method name compatibility with bitSet
         template<class TypeT = T>
-        typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
+        std::enable_if_t<std::is_same_v<bool, TypeT>, bool>
         inline get(const label i) const
         {
             return (i >= 0 && i < size_ && v_[i]);
@@ -576,7 +576,7 @@ public:
         //  \return True if value changed and was not out-of-range
         //  \note Method name compatibility with bitSet
         template<class TypeT = T>
-        typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
+        std::enable_if_t<std::is_same_v<bool, TypeT>, bool>
         inline unset(const label i)
         {
             if (i >= 0 && i < size_ && v_[i])
@@ -599,17 +599,19 @@ public:
                 unsigned seed=0
             ) const
             {
-                if (is_contiguous<T>::value)
+                if constexpr (is_contiguous_v<T>)
                 {
                     return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
                 }
-
-                Foam::Hash<T> op;
-                for (const T& val : obj)
+                else
                 {
-                    seed = op(val, seed);
+                    Foam::Hash<T> op;
+                    for (const T& val : obj)
+                    {
+                        seed = op(val, seed);
+                    }
+                    return seed;
                 }
-                return seed;
             }
         };
 
diff --git a/src/OpenFOAM/containers/Lists/List/UListI.H b/src/OpenFOAM/containers/Lists/List/UListI.H
index 74cd4c3bbe0..d2f88ffb6f5 100644
--- a/src/OpenFOAM/containers/Lists/List/UListI.H
+++ b/src/OpenFOAM/containers/Lists/List/UListI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2023 OpenCFD Ltd.
+    Copyright (C) 2015-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -69,7 +69,7 @@ inline void Foam::UList<T>::fill_uniform(const Foam::zero)
     // issues.
     // May also have special triggers when assigning non-contiguous from zero...
 
-    if (is_contiguous<T>::value)
+    if constexpr (is_contiguous_v<T>)
     {
         // Can dispatch with
         // - std::execution::parallel_unsequenced_policy
diff --git a/src/OpenFOAM/containers/Lists/List/UListIO.C b/src/OpenFOAM/containers/Lists/List/UListIO.C
index 73f7a1d50c8..1a7ed4385db 100644
--- a/src/OpenFOAM/containers/Lists/List/UListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/UListIO.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2023 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -49,7 +49,7 @@ void Foam::UList<T>::writeEntry(Ostream& os) const
     else if
     (
         os.format() == IOstreamOption::BINARY
-     || std::is_same<char, typename std::remove_cv<T>::type>::value
+     || std::is_same_v<char, std::remove_cv_t<T>>
     )
     {
         // Zero-sized binary - Write size only
@@ -89,7 +89,7 @@ Foam::Ostream& Foam::UList<T>::writeList
 
     const label len = list.size();
 
-    if (os.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+    if (os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
     {
         // Binary and contiguous
 
@@ -101,7 +101,7 @@ Foam::Ostream& Foam::UList<T>::writeList
             os.write(list.cdata_bytes(), list.size_bytes());
         }
     }
-    else if (std::is_same<char, typename std::remove_cv<T>::type>::value)
+    else if constexpr (std::is_same_v<char, std::remove_cv_t<T>>)
     {
         // Special treatment for char data (binary I/O only)
 
@@ -116,7 +116,7 @@ Foam::Ostream& Foam::UList<T>::writeList
 
         os.format(oldFmt);
     }
-    else if (is_contiguous<T>::value && len > 1 && list.uniform())
+    else if (is_contiguous_v<T> && len > 1 && list.uniform())
     {
         // Two or more entries, and all entries have identical values.
         os  << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
@@ -127,11 +127,7 @@ Foam::Ostream& Foam::UList<T>::writeList
      ||
         (
             (len <= shortLen)
-         &&
-            (
-                is_contiguous<T>::value
-             || Detail::ListPolicy::no_linebreak<T>::value
-            )
+         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
@@ -234,7 +230,7 @@ Foam::Istream& Foam::UList<T>::readList(Istream& is)
                 << exit(FatalIOError);
         }
 
-        if (is.format() == IOstreamOption::BINARY && is_contiguous<T>::value)
+        if (is.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
         {
             // Binary and contiguous
 
@@ -254,7 +250,7 @@ Foam::Istream& Foam::UList<T>::readList(Istream& is)
                 );
             }
         }
-        else if (std::is_same<char, typename std::remove_cv<T>::type>::value)
+        else if constexpr (std::is_same_v<char, std::remove_cv_t<T>>)
         {
             // Special treatment for char data (binary I/O only)
             const auto oldFmt = is.format(IOstreamOption::BINARY);
diff --git a/src/OpenFOAM/containers/Lists/policy/ListPolicy.H b/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
index ae4f9bdcb4e..81b3c106b2b 100644
--- a/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
+++ b/src/OpenFOAM/containers/Lists/policy/ListPolicy.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.
@@ -72,7 +72,7 @@ struct short_length : std::integral_constant<int,10> {};
 //  Default definition: (integral | floating-point) are contiguous and thus
 //  never need any line breaks
 template<class T>
-struct no_linebreak : std::is_arithmetic<T> {};
+struct no_linebreak : std::is_arithmetic<std::remove_cv_t<T>> {};
 
 // Specialization for word-like classes
 // These elements are normally fairly short, so ok to output a few (eg, 10)
diff --git a/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H b/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H
index 24c93e4a457..4ab765d0349 100644
--- a/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H
+++ b/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2024 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -413,12 +413,8 @@ protected:
         // Typedefs
 
             //- The list container type
-            using list_type = typename std::conditional
-            <
-                Const,
-                const UPtrList<T>,
-                UPtrList<T>
-            >::type;
+            using list_type =
+                std::conditional_t<Const, const UPtrList<T>, UPtrList<T>>;
 
 
         protected:
diff --git a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C
index 635d0065b3e..bbd23108d9b 100644
--- a/src/OpenFOAM/db/IOobject/IOobjectTemplates.C
+++ b/src/OpenFOAM/db/IOobject/IOobjectTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2015-2017 OpenFOAM Foundation
-    Copyright (C) 2016-2023 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -56,12 +56,14 @@ bool Foam::IOobject::typeHeaderOk
 template<class Type>
 Foam::fileName Foam::IOobject::typeFilePath(const bool search) const
 {
-    return
-    (
-        is_globalIOobject<Type>::value
-      ? this->globalFilePath(Type::typeName, search)
-      : this->localFilePath(Type::typeName, search)
-    );
+    if constexpr (is_globalIOobject<Type>::value)
+    {
+        return this->globalFilePath(Type::typeName, search);
+    }
+    else
+    {
+        return this->localFilePath(Type::typeName, search);
+    }
 }
 
 
diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H b/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H
index b67807efcd9..90678c5c8b4 100644
--- a/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H
+++ b/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
-    Copyright (C) 2018-2024 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -300,7 +300,7 @@ public:
         //- Check if the label byte-size associated with the stream
         //- is the same as the given type
         template<class T = label>
-        typename std::enable_if<std::is_integral<T>::value, bool>::type
+        std::enable_if_t<std::is_integral_v<T>, bool>
         checkLabelSize() const noexcept
         {
             return sizeofLabel_ == sizeof(T);
@@ -309,7 +309,7 @@ public:
         //- Check if the scalar byte-size associated with the stream
         //- is the same as the given type
         template<class T = scalar>
-        typename std::enable_if<std::is_floating_point<T>::value, bool>::type
+        std::enable_if_t<std::is_floating_point_v<T>, bool>
         checkScalarSize() const noexcept
         {
             return sizeofScalar_ == sizeof(T);
@@ -515,26 +515,26 @@ protected:
 namespace Detail
 {
 
-//- Termination for input looping (no-op)
-template<class IS> inline void inputLoop(IS&) {}
-
-//- Termination for output looping (no-op)
-template<class OS> inline void outputLoop(OS&) {}
-
 //- Input looping. Read into first parameter and recurse.
 template<class IS, class Type, class... Args>
-inline void inputLoop(IS& is, Type& arg1, Args&&... args)
+void inputLoop(IS& is, Type& arg1, Args&&... args)
 {
     is >> arg1;
-    Detail::inputLoop(is, std::forward<Args>(args)...);
+    if constexpr (sizeof...(args))
+    {
+        Detail::inputLoop(is, std::forward<Args>(args)...);
+    }
 }
 
 //- Output looping. Write first parameter and recurse.
 template<class OS, class Type, class... Args>
-inline void outputLoop(OS& os, const Type& arg1, Args&&... args)
+void outputLoop(OS& os, const Type& arg1, Args&&... args)
 {
     os << arg1;
-    Detail::outputLoop(os, std::forward<Args>(args)...);
+    if constexpr (sizeof...(args))
+    {
+        Detail::outputLoop(os, std::forward<Args>(args)...);
+    }
 }
 
 } // End namespace Detail
diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H
index 1710eab7bf5..dcb775eddb8 100644
--- a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H
+++ b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -237,7 +237,7 @@ namespace Detail
     {
         is.beginRawRead();
 
-        if (is_contiguous_label<T>::value)
+        if constexpr (is_contiguous_label<T>::value)
         {
             readRawLabel
             (
@@ -246,7 +246,7 @@ namespace Detail
                 byteCount/sizeof(label)
             );
         }
-        else if (is_contiguous_scalar<T>::value)
+        else if constexpr (is_contiguous_scalar<T>::value)
         {
             readRawScalar
             (
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBroadcast.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBroadcast.C
index b41fafee10d..90c427ab506 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBroadcast.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBroadcast.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022-2024 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,7 +34,7 @@ License
 template<class Type>
 void Foam::Pstream::broadcast(Type& value, const label comm)
 {
-    if (is_contiguous<Type>::value)
+    if constexpr (is_contiguous_v<Type>)
     {
         // Note: contains parallel guard internally
         UPstream::broadcast
@@ -82,7 +82,7 @@ void Foam::Pstream::broadcasts(const label comm, Type& arg1, Args&&... args)
 template<class ListType>
 void Foam::Pstream::broadcastList(ListType& list, const label comm)
 {
-    if (is_contiguous<typename ListType::value_type>::value)
+    if constexpr (is_contiguous_v<typename ListType::value_type>)
     {
         // List data are contiguous
         // 1. broadcast the size
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineGather.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineGather.C
index 4e37481e56b..ca86325537b 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineGather.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamCombineGather.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2024 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,7 +62,7 @@ void Foam::Pstream::combineGather
         // Receive from my downstairs neighbours
         for (const label belowID : myComm.below())
         {
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 T received;
 
@@ -115,7 +115,7 @@ void Foam::Pstream::combineGather
                     << " data:" << value << endl;
             }
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 UOPstream::write
                 (
@@ -174,7 +174,7 @@ void Foam::Pstream::listCombineGather
         // Receive from my downstairs neighbours
         for (const label belowID : myComm.below())
         {
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 List<T> received(values.size());
 
@@ -233,7 +233,7 @@ void Foam::Pstream::listCombineGather
                     << " data:" << values << endl;
             }
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 UOPstream::write
                 (
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchange.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchange.C
index c3f271d643f..b8bc41861c4 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchange.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchange.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2024 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -631,7 +631,7 @@ void Foam::Pstream::exchange
     const bool wait
 )
 {
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     if (!UPstream::is_rank(comm))
     {
@@ -695,7 +695,7 @@ void Foam::Pstream::exchange
     const bool wait
 )
 {
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     const int myProci = UPstream::myProcNo(comm);
 
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchangeConsensus.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchangeConsensus.C
index b26b1be61d1..9d1fea23d55 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchangeConsensus.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamExchangeConsensus.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2023-2024 OpenCFD Ltd.
+    Copyright (C) 2023-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -70,7 +70,7 @@ void exchangeConsensus
     const label comm
 )
 {
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     const bool initialBarrier = (UPstream::tuning_NBX_ > 0);
 
@@ -252,7 +252,7 @@ void exchangeConsensus
     const label comm
 )
 {
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     const bool initialBarrier = (UPstream::tuning_NBX_ > 0);
 
@@ -419,7 +419,7 @@ void Foam::Pstream::exchangeConsensus
     const bool /* wait (ignored) */
 )
 {
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     if (sendBufs.size() != UPstream::nProcs(comm))
     {
@@ -454,7 +454,7 @@ void Foam::Pstream::exchangeConsensus
     const bool  /* wait (ignored) */
 )
 {
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     PstreamDetail::exchangeConsensus<Container, Type>
     (
@@ -478,7 +478,7 @@ Foam::Pstream::exchangeConsensus
 {
     Map<Container> recvBufs;
 
-    static_assert(is_contiguous<Type>::value, "Contiguous data only!");
+    static_assert(is_contiguous_v<Type>, "Contiguous data only!");
 
     PstreamDetail::exchangeConsensus<Container, Type>
     (
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGather.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGather.C
index ce2a1b34aef..f3ec676e1ec 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGather.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGather.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2024 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -59,7 +59,7 @@ void Foam::Pstream::gather
         {
             T received;
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 UIPstream::read
                 (
@@ -82,7 +82,7 @@ void Foam::Pstream::gather
         // Send up value
         if (myComm.above() >= 0)
         {
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 UOPstream::write
                 (
@@ -108,43 +108,29 @@ Foam::List<T> Foam::Pstream::listGatherValues
 (
     const T& localValue,
     const label comm,
-    const int tag
+    [[maybe_unused]] const int tag
 )
 {
-    // OR
-    // if (is_contiguous<T>::value)
-    // {
-    //     return UPstream::listGatherValues(localValue, comm);
-    // }
-
-    List<T> allValues;
-
-    if (UPstream::is_parallel(comm))
+    if constexpr (is_contiguous_v<T>)
     {
-        const label numProc = UPstream::nProcs(comm);
+        // UPstream version is contiguous only
+        return UPstream::listGatherValues(localValue, comm);
+    }
+    else
+    {
+        List<T> allValues;
 
-        if (UPstream::master(comm))
+        if (UPstream::is_parallel(comm))
         {
-            allValues.resize(numProc);
-        }
+            const label numProc = UPstream::nProcs(comm);
 
-        if (is_contiguous<T>::value)
-        {
-            UPstream::mpiGather
-            (
-                reinterpret_cast<const char*>(&localValue),
-                allValues.data_bytes(),
-                sizeof(T),  // The send/recv size per rank
-                comm
-            );
-        }
-        else
-        {
             if (UPstream::master(comm))
             {
+                allValues.resize(numProc);
+
                 // Non-trivial to manage non-blocking gather without a
-                // PEX/NBX approach (eg, PstreamBuffers) but leave with
-                // with simple exchange for now
+                // PEX/NBX approach (eg, PstreamBuffers).
+                // Leave with simple exchange for now
 
                 allValues[0] = localValue;
 
@@ -158,16 +144,16 @@ Foam::List<T> Foam::Pstream::listGatherValues
                 OPstream::send(localValue, UPstream::masterNo(), tag, comm);
             }
         }
-    }
-    else
-    {
-        // non-parallel: return own value
-        // TBD: only when UPstream::is_rank(comm) as well?
-        allValues.resize(1);
-        allValues[0] = localValue;
-    }
+        else
+        {
+            // non-parallel: return own value
+            // TBD: only when UPstream::is_rank(comm) as well?
+            allValues.resize(1);
+            allValues[0] = localValue;
+        }
 
-    return allValues;
+        return allValues;
+    }
 }
 
 
@@ -176,85 +162,73 @@ T Foam::Pstream::listScatterValues
 (
     const UList<T>& allValues,
     const label comm,
-    const int tag
+    [[maybe_unused]] const int tag
 )
 {
-    // OR
-    // if (is_contiguous<T>::value)
-    // {
-    //     return UPstream::listScatterValues(allValues, comm);
-    // }
-
-    T localValue{};
-
-    if (UPstream::is_parallel(comm))
+    if constexpr (is_contiguous_v<T>)
     {
-        const label numProc = UPstream::nProcs(comm);
-
-        if (UPstream::master(comm) && allValues.size() < numProc)
-        {
-            FatalErrorInFunction
-                << "Attempting to send " << allValues.size()
-                << " values to " << numProc << " processors" << endl
-                << Foam::abort(FatalError);
-        }
-
-        if (is_contiguous<T>::value)
-        {
-            UPstream::mpiScatter
-            (
-                allValues.cdata_bytes(),
-                reinterpret_cast<char*>(&localValue),
-                sizeof(T),  // The send/recv size per rank
-                comm
-            );
-        }
-        else
-        {
-            if (UPstream::master(comm))
-            {
-                const label startOfRequests = UPstream::nRequests();
-
-                List<DynamicList<char>> sendBuffers(numProc);
-
-                for (int proci = 1; proci < numProc; ++proci)
-                {
-                    UOPstream toProc
-                    (
-                        UPstream::commsTypes::nonBlocking,
-                        proci,
-                        sendBuffers[proci],
-                        tag,
-                        comm
-                    );
-                    toProc << allValues[proci];
-                }
-
-                // Wait for outstanding requests
-                UPstream::waitRequests(startOfRequests);
-
-                return allValues[0];
-            }
-            else if (UPstream::is_rank(comm))
-            {
-                IPstream::recv(localValue, UPstream::masterNo(), tag, comm);
-            }
-        }
+        // UPstream version is contiguous only
+        return UPstream::listScatterValues(allValues, comm);
     }
     else
     {
-        // non-parallel: return first value
-        // TBD: only when UPstream::is_rank(comm) as well?
-
-        if (!allValues.empty())
-        {
-            return allValues[0];
-        }
+         T localValue{};
+
+         if (UPstream::is_parallel(comm))
+         {
+             const label numProc = UPstream::nProcs(comm);
+
+             if (UPstream::master(comm) && allValues.size() < numProc)
+             {
+                 FatalErrorInFunction
+                     << "Attempting to send " << allValues.size()
+                     << " values to " << numProc << " processors" << endl
+                     << Foam::abort(FatalError);
+             }
+
+             if (UPstream::master(comm))
+             {
+                 const label startOfRequests = UPstream::nRequests();
+
+                 List<DynamicList<char>> sendBuffers(numProc);
+
+                 for (int proci = 1; proci < numProc; ++proci)
+                 {
+                     UOPstream toProc
+                     (
+                         UPstream::commsTypes::nonBlocking,
+                         proci,
+                         sendBuffers[proci],
+                         tag,
+                         comm
+                     );
+                     toProc << allValues[proci];
+                 }
+
+                 // Wait for outstanding requests
+                 UPstream::waitRequests(startOfRequests);
+
+                 return allValues[0];
+             }
+             else if (UPstream::is_rank(comm))
+             {
+                 IPstream::recv(localValue, UPstream::masterNo(), tag, comm);
+             }
+         }
+         else
+         {
+             // non-parallel: return first value
+             // TBD: only when UPstream::is_rank(comm) as well?
+
+             if (!allValues.empty())
+             {
+                 return allValues[0];
+             }
+          }
+
+          return localValue;
      }
-
-     return localValue;
 }
 
 
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGatherList.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGatherList.C
index 5b3719e9616..add213e7a30 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGatherList.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamGatherList.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2015-2024 OpenCFD Ltd.
+    Copyright (C) 2015-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,7 +72,7 @@ void Foam::Pstream::gatherList
         {
             const labelList& belowLeaves = comms[belowID].allBelow();
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 List<T> received(belowLeaves.size() + 1);
 
@@ -141,7 +141,7 @@ void Foam::Pstream::gatherList
                     << " data:" << values[myProci] << endl;
             }
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 List<T> sending(belowLeaves.size() + 1);
                 sending[0] = values[myProci];
@@ -223,7 +223,7 @@ void Foam::Pstream::scatterList
         {
             const labelList& notBelowLeaves = myComm.allNotBelow();
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 List<T> received(notBelowLeaves.size());
 
@@ -273,7 +273,7 @@ void Foam::Pstream::scatterList
             const label belowID = myComm.below()[belowI];
             const labelList& notBelowLeaves = comms[belowID].allNotBelow();
 
-            if (is_contiguous<T>::value)
+            if constexpr (is_contiguous_v<T>)
             {
                 List<T> sending(notBelowLeaves.size());
 
@@ -362,13 +362,13 @@ template<class T>
 void Foam::Pstream::allGatherList
 (
     UList<T>& values,
-    const int tag,
+    [[maybe_unused]] const int tag,
     const label comm
 )
 {
     if (UPstream::is_parallel(comm))
     {
-        if (is_contiguous<T>::value)
+        if constexpr (is_contiguous_v<T>)
         {
             if (values.size() < UPstream::nProcs(comm))
             {
@@ -379,13 +379,14 @@ void Foam::Pstream::allGatherList
             }
 
             UPstream::mpiAllGather(values.data_bytes(), sizeof(T), comm);
-            return;
         }
+        else
+        {
+            const auto& comms = UPstream::whichCommunication(comm);
 
-        const auto& comms = UPstream::whichCommunication(comm);
-
-        Pstream::gatherList(comms, values, tag, comm);
-        Pstream::scatterList(comms, values, tag, comm);
+            Pstream::gatherList(comms, values, tag, comm);
+            Pstream::scatterList(comms, values, tag, comm);
+        }
     }
 }
 
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamTemplates.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamTemplates.C
index 6f71ec548f8..844b203446d 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamTemplates.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2021-2023 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,6 +34,14 @@ Foam::List<T> Foam::UPstream::allGatherValues
     const label comm
 )
 {
+    if constexpr (!is_contiguous_v<T>)
+    {
+        FatalErrorInFunction
+            << "Cannot all-gather values for non-contiguous types"
+               " - consider Pstream variant instead" << endl
+            << Foam::abort(FatalError);
+    }
+
     List<T> allValues;
 
     if (UPstream::is_parallel(comm))
@@ -41,17 +49,7 @@ Foam::List<T> Foam::UPstream::allGatherValues
         allValues.resize(UPstream::nProcs(comm));
         allValues[UPstream::myProcNo(comm)] = localValue;
 
-        if (is_contiguous<T>::value)
-        {
-            UPstream::mpiAllGather(allValues.data_bytes(), sizeof(T), comm);
-        }
-        else
-        {
-            FatalErrorInFunction
-                << "Cannot all-gather values for non-contiguous types"
-                   " - consider Pstream variant instead" << endl
-                << Foam::abort(FatalError);
-        }
+        UPstream::mpiAllGather(allValues.data_bytes(), sizeof(T), comm);
     }
     else
     {
@@ -72,6 +70,14 @@ Foam::List<T> Foam::UPstream::listGatherValues
     const label comm
 )
 {
+    if constexpr (!is_contiguous_v<T>)
+    {
+        FatalErrorInFunction
+            << "Cannot gather values for non-contiguous types"
+               " - consider Pstream variant instead" << endl
+            << Foam::abort(FatalError);
+    }
+
     List<T> allValues;
 
     if (UPstream::is_parallel(comm))
@@ -81,23 +87,13 @@ Foam::List<T> Foam::UPstream::listGatherValues
             allValues.resize(UPstream::nProcs(comm));
         }
 
-        if (is_contiguous<T>::value)
-        {
-            UPstream::mpiGather
-            (
-                reinterpret_cast<const char*>(&localValue),
-                allValues.data_bytes(),
-                sizeof(T),  // The send/recv size per rank
-                comm
-            );
-        }
-        else
-        {
-            FatalErrorInFunction
-                << "Cannot gather values for non-contiguous types"
-                   " - consider Pstream variant instead" << endl
-                << Foam::abort(FatalError);
-        }
+        UPstream::mpiGather
+        (
+            reinterpret_cast<const char*>(&localValue),
+            allValues.data_bytes(),
+            sizeof(T),  // The send/recv size per rank
+            comm
+        );
     }
     else
     {
@@ -118,6 +114,14 @@ T Foam::UPstream::listScatterValues
     const label comm
 )
 {
+    if constexpr (!is_contiguous_v<T>)
+    {
+        FatalErrorInFunction
+            << "Cannot scatter values for non-contiguous types"
+               " - consider Pstream variant instead" << endl
+            << Foam::abort(FatalError);
+    }
+
     T localValue{};
 
     if (UPstream::is_parallel(comm))
@@ -132,23 +136,13 @@ T Foam::UPstream::listScatterValues
                 << Foam::abort(FatalError);
         }
 
-        if (is_contiguous<T>::value)
-        {
-            UPstream::mpiScatter
-            (
-                allValues.cdata_bytes(),
-                reinterpret_cast<char*>(&localValue),
-                sizeof(T),  // The send/recv size per rank
-                comm
-            );
-        }
-        else
-        {
-            FatalErrorInFunction
-                << "Cannot scatter values for non-contiguous types"
-                   " - consider Pstream variant instead" << endl
-                << Foam::abort(FatalError);
-        }
+        UPstream::mpiScatter
+        (
+            allValues.cdata_bytes(),
+            reinterpret_cast<char*>(&localValue),
+            sizeof(T),  // The send/recv size per rank
+            comm
+        );
     }
     else
     {
diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H
index 7c7698e098d..a443ddad167 100644
--- a/src/OpenFOAM/db/IOstreams/token/token.H
+++ b/src/OpenFOAM/db/IOstreams/token/token.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2024 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -312,20 +312,20 @@ public:
     {
         // Private Member Functions
 
-            //- Fill with zero (contiguous types)
-            template<class ValT = typename T::value_type>
-            typename std::enable_if<pTraits_has_zero<ValT>::value, void>::type
-            _m_fill_zero()
+            //- Fill with zero (contiguous types) or with default value
+            //- initialized (non-contiguous types)
+            void _m_fill_zero()
             {
-                T::operator=(pTraits<ValT>::zero);
-            }
-
-            //- Fill with default value initialized (non-contiguous types)
-            template<class ValT = typename T::value_type>
-            typename std::enable_if<!pTraits_has_zero<ValT>::value, void>::type
-            _m_fill_zero()
-            {
-                T::operator=(ValT());
+                typedef typename T::value_type valueType;
+
+                if constexpr (pTraits_has_zero<valueType>::value)
+                {
+                    T::operator=(pTraits<valueType>::zero);
+                }
+                else
+                {
+                    T::operator=(valueType());
+                }
             }
 
     public:
diff --git a/src/OpenFOAM/db/IOstreams/token/tokenI.H b/src/OpenFOAM/db/IOstreams/token/tokenI.H
index f4d7ec119a9..a8fd3cac7bc 100644
--- a/src/OpenFOAM/db/IOstreams/token/tokenI.H
+++ b/src/OpenFOAM/db/IOstreams/token/tokenI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2024 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -920,12 +920,12 @@ Foam::token::tokenType Foam::token::Compound<T>::typeCode() const
 
     typedef typename T::value_type valueType;
 
-    if (std::is_same<valueType, bool>::value)
+    if constexpr (std::is_same_v<bool, valueType>)
     {
         // List<bool>
         return token::tokenType::BOOL;
     }
-    else if (is_contiguous_label<valueType>::value)
+    else if constexpr (is_contiguous_label<valueType>::value)
     {
         // List<label>, List<labelVector> etc
         return token::tokenType::LABEL;
@@ -939,7 +939,7 @@ Foam::token::tokenType Foam::token::Compound<T>::typeCode() const
         // );
 
     }
-    else if (is_contiguous_scalar<valueType>::value)
+    else if constexpr (is_contiguous_scalar<valueType>::value)
     {
         // List<scalar>, List<vector>, List<tensor> etc
         return
@@ -949,7 +949,7 @@ Foam::token::tokenType Foam::token::Compound<T>::typeCode() const
           : token::tokenType::DOUBLE
         );
     }
-    else if (std::is_same<valueType, char>::value)
+    else if constexpr (std::is_same_v<char, valueType>)
     {
         // List<char>
         return token::tokenType::PUNCTUATION;
diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H
index e0c045b571e..5c185d245ae 100644
--- a/src/OpenFOAM/db/dictionary/dictionary.H
+++ b/src/OpenFOAM/db/dictionary/dictionary.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2016-2024 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -154,24 +154,24 @@ public:
             friend dictionary;
 
             //- The const/non-const type for the context and sub-dictionaries
-            typedef typename std::conditional
-                <Const, const dictionary, dictionary>::type dict_type;
+            using dict_type =
+                std::conditional_t<Const, const dictionary, dictionary>;
 
             //- The const/non-const type for entries
-            typedef typename std::conditional
-                <Const, const entry, entry>::type value_type;
+            using value_type =
+                std::conditional_t<Const, const entry, entry>;
 
             //- A pointer to a const/non-const dictionary
-            typedef dict_type* dict_pointer;
+            using dict_pointer = dict_type*;
 
             //- A reference to a const/non-const dictionary
-            typedef dict_type& dict_reference;
+            using dict_reference = dict_type&;
 
             //- A pointer to a const/non-const entry
-            typedef value_type* pointer;
+            using pointer = value_type*;
 
             //- A reference to a const/non-const entry
-            typedef value_type& reference;
+            using reference = value_type&;
 
 
         protected:
diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C
index 637460ea5be..1b13cf40787 100644
--- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C
+++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2019 OpenFOAM Foundation
-    Copyright (C) 2016-2023 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -99,7 +99,7 @@ Foam::label Foam::objectRegistry::countTypeImpl
 
         if
         (
-            (std::is_void<Type>::value || Foam::isA<Type>(*obj))
+            (std::is_void_v<Type> || Foam::isA<Type>(*obj))
          && matchName(obj->name())
         )
         {
@@ -164,7 +164,7 @@ Foam::wordList Foam::objectRegistry::namesTypeImpl
 
         if
         (
-            (std::is_void<Type>::value || Foam::isA<Type>(*obj))
+            (std::is_void_v<Type> || Foam::isA<Type>(*obj))
          && matchName(obj->name())
         )
         {
@@ -195,7 +195,7 @@ Foam::objectRegistry::objectsTypeImpl
     const bool doSort
 )
 {
-    typedef typename std::remove_cv<Type>::type BaseType;
+    using BaseType = std::remove_cv_t<Type>;
 
     UPtrList<Type> result(list.size());
 
@@ -237,7 +237,7 @@ Foam::objectRegistry::lookupClassTypeImpl
     const objectRegistry& list
 )
 {
-    typedef typename std::remove_cv<Type>::type BaseType;
+    using BaseType = std::remove_cv_t<Type>;
 
     HashTable<Type*> result(list.capacity());
 
@@ -318,7 +318,7 @@ Foam::label Foam::objectRegistry::count
 
         if
         (
-            std::is_void<Type>::value
+            std::is_void_v<Type>
          ||
             (
                 strict
diff --git a/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C b/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C
index 511f3a1acc8..7e4072286e5 100644
--- a/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C
+++ b/src/OpenFOAM/expressions/exprDriver/exprDriverTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2010-2018 Bernhard Gschaider
-    Copyright (C) 2019-2022 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -137,7 +137,7 @@ bool Foam::expressions::exprDriver::isFunction(const word& name) const
     // Currently only scalar, vector
     #undef doLocalCode
     #define doLocalCode(WhichType, MapperMember)                    \
-    if (std::is_same<Type, WhichType>::value)                       \
+    if constexpr (std::is_same_v<Type, WhichType>)                  \
     {                                                               \
         return bool                                                 \
         (                                                           \
@@ -172,7 +172,7 @@ Type Foam::expressions::exprDriver::getFunctionValue
         // Currently only scalar, vector
         #undef doLocalCode
         #define doLocalCode(WhichType, MapperMember)                \
-        if (std::is_same<Type, WhichType>::value)                   \
+        if constexpr (std::is_same_v<Type, WhichType>)              \
         {                                                           \
             const Function1<WhichType>* ptr =                       \
                 this->template getFunction1Ptr<WhichType>           \
@@ -230,7 +230,7 @@ void Foam::expressions::exprDriver::fillFunctionValues
         // Currently only scalar, vector
         #undef doLocalCode
         #define doLocalCode(WhichType, MapperMember)                \
-        if (std::is_same<Type, WhichType>::value)                   \
+        if constexpr (std::is_same_v<Type, WhichType>)              \
         {                                                           \
             const Function1<WhichType>* ptr =                       \
                 this->template getFunction1Ptr<WhichType>           \
diff --git a/src/OpenFOAM/expressions/exprResult/exprResultI.H b/src/OpenFOAM/expressions/exprResult/exprResultI.H
index abddbc5e610..a73cee9c357 100644
--- a/src/OpenFOAM/expressions/exprResult/exprResultI.H
+++ b/src/OpenFOAM/expressions/exprResult/exprResultI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2012-2018 Bernhard Gschaider
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -512,7 +512,7 @@ bool Foam::expressions::exprResult::writeEntryChecked
 
     if (this->size() <= 0)
     {
-        if (value_.good() && is_contiguous<Type>::value)
+        if (value_.good() && is_contiguous_v<Type>)
         {
             const Type& val = value_.get<Type>();
 
@@ -534,7 +534,7 @@ bool Foam::expressions::exprResult::writeEntryChecked
     {
         const Field<Type>& fld = *static_cast<const Field<Type>*>(fieldPtr_);
 
-        if (value_.good() && is_contiguous<Type>::value)
+        if (value_.good() && is_contiguous_v<Type>)
         {
             if (keyword.size())
             {
diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C
index e116fa2cb45..0372523102a 100644
--- a/src/OpenFOAM/fields/Fields/Field/Field.C
+++ b/src/OpenFOAM/fields/Fields/Field/Field.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2023 OpenCFD Ltd.
+    Copyright (C) 2015-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -734,7 +734,7 @@ void Foam::Field<Type>::writeEntry(const word& keyword, Ostream& os) const
     // The contents are 'uniform' if the list is non-empty
     // and all entries have identical values.
 
-    if (is_contiguous<Type>::value && List<Type>::uniform())
+    if (is_contiguous_v<Type> && List<Type>::uniform())
     {
         os << word("uniform") << token::SPACE << List<Type>::front();
     }
diff --git a/src/OpenFOAM/global/constants/unitConversion.H b/src/OpenFOAM/global/constants/unitConversion.H
index bea79f0141e..a7a3b1b5820 100644
--- a/src/OpenFOAM/global/constants/unitConversion.H
+++ b/src/OpenFOAM/global/constants/unitConversion.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2017-2019 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,8 +32,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef unitConversion_H
-#define unitConversion_H
+#ifndef Foam_unitConversion_H
+#define Foam_unitConversion_H
 
 #include "mathematicalConstants.H"
 
@@ -121,13 +121,13 @@ inline constexpr scalar paToBar(const scalar pa) noexcept
 
 
 //- User literal for degrees to radians conversion (integers)
-inline constexpr scalar operator "" _deg(unsigned long long int deg) noexcept
+inline constexpr scalar operator ""_deg(unsigned long long int deg) noexcept
 {
     return (deg*M_PI/180.0);
 }
 
 //- User literal for degrees to radians conversion (floats)
-inline constexpr scalar operator "" _deg(long double deg) noexcept
+inline constexpr scalar operator ""_deg(long double deg) noexcept
 {
     return (deg*M_PI/180.0);
 }
diff --git a/src/OpenFOAM/include/openfoam_mpi.H b/src/OpenFOAM/include/openfoam_mpi.H
index 7359bd8a925..d6bcc5534f5 100644
--- a/src/OpenFOAM/include/openfoam_mpi.H
+++ b/src/OpenFOAM/include/openfoam_mpi.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022-2024 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -53,36 +53,32 @@ namespace PstreamUtils
 // Casting helpers
 struct Cast
 {
-    // Cast UPstream::Communicator to MPI_Comm (pointer)
+    //- Cast UPstream::Communicator to MPI_Comm
     template<typename Type = MPI_Comm>
-    static typename std::enable_if<std::is_pointer<Type>::value, Type>::type
-    to_mpi(const UPstream::Communicator& arg) noexcept
+    static Type to_mpi(UPstream::Communicator arg) noexcept
     {
-        return reinterpret_cast<Type>(arg.value());
+        if constexpr (std::is_pointer_v<Type>)
+        {
+            return reinterpret_cast<Type>(arg.value());
+        }
+        else  // std::is_integral_v<Type>
+        {
+            return static_cast<Type>(arg.value());
+        }
     }
 
-    // Cast UPstream::Communicator to MPI_Comm (integer)
-    template<typename Type = MPI_Comm>
-    static typename std::enable_if<std::is_integral<Type>::value, Type>::type
-    to_mpi(const UPstream::Communicator& arg) noexcept
-    {
-        return static_cast<Type>(arg.value());
-    }
-
-    // Cast UPstream::Request to MPI_Request (pointer)
-    template<typename Type = MPI_Request>
-    static typename std::enable_if<std::is_pointer<Type>::value, Type>::type
-    to_mpi(const UPstream::Request& arg) noexcept
-    {
-        return reinterpret_cast<Type>(arg.value());
-    }
-
-    // Cast UPstream::Request to MPI_Request (integer)
+    //- Cast UPstream::Request to MPI_Request
     template<typename Type = MPI_Request>
-    static typename std::enable_if<std::is_integral<Type>::value, Type>::type
-    to_mpi(const UPstream::Request& arg) noexcept
+    static Type to_mpi(UPstream::Request arg) noexcept
     {
-        return static_cast<Type>(arg.value());
+        if constexpr (std::is_pointer_v<Type>)
+        {
+            return reinterpret_cast<Type>(arg.value());
+        }
+        else  // std::is_integral_v<Type>
+        {
+            return static_cast<Type>(arg.value());
+        }
     }
 };
 
diff --git a/src/OpenFOAM/include/stdFoam.H b/src/OpenFOAM/include/stdFoam.H
index 65b091cf017..a34e34e0948 100644
--- a/src/OpenFOAM/include/stdFoam.H
+++ b/src/OpenFOAM/include/stdFoam.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2023 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -34,39 +34,27 @@ Description
 
 #include <algorithm>
 #include <initializer_list>
+#include <iterator>  // for std::begin, std::end, ...
 #include <memory>
-#include <utility>
 #include <type_traits>
+#include <utility>
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 // Compile-time warning for use of deprecated methods (compiler-dependent).
 // Use within the class declaration.
 
-#if (__cplusplus >= 201402L)
-# define FOAM_DEPRECATED(since) [[deprecated("Since " #since)]]
-# define FOAM_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]]
-# define FOAM_DEPRECATED_STRICT(since, replacement) [[deprecated("Since " #since "; use " #replacement)]]
-#elif defined(__GNUC__)
-# define FOAM_DEPRECATED(since) __attribute__((__deprecated__("Since " #since)))
-# define FOAM_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
-# define FOAM_DEPRECATED_STRICT(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
-#else
-# define FOAM_DEPRECATED(since)
-# define FOAM_DEPRECATED_FOR(since, replacement)
-# define FOAM_DEPRECATED_STRICT(since, replacement)
-#endif
-#ifndef FOAM_COMPILE_STRICT
-# undef  FOAM_DEPRECATED_STRICT
-# define FOAM_DEPRECATED_STRICT(since, replacement)
-#endif
+#define FOAM_DEPRECATED(since) [[deprecated("Since " #since)]]
+#define FOAM_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]]
+#define FOAM_DEPRECATED_STRICT(since, replacement) [[deprecated("Since " #since "; use " #replacement)]]
 
-// Compile-time warning about unused result
-// FUTURE: check __has_cpp_attribute(nodiscard) and define with [[nodiscard]]
-#if defined(__GNUC__)
-# define FOAM_NODISCARD __attribute__((warn_unused_result))
+// Branch prediction helpers. With C++20 can use [[likely]], [[unlikely]]
+#if defined(__GNUC__) || defined(__clang__)
+#  define FOAM_UNLIKELY(cond) __builtin_expect(!!(cond),0)
+#  define FOAM_LIKELY(cond)   __builtin_expect(!!(cond),1)
 #else
-# define FOAM_NODISCARD
+#  define FOAM_UNLIKELY(cond) (cond)
+#  define FOAM_LIKELY(cond)   (cond)
 #endif
 
 
@@ -104,6 +92,8 @@ struct identityOp
 };
 
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
 //- Swap non-array types as per std::swap, but in Foam namespace.
 //  \sa http://www.cplusplus.com/reference/utility/swap/
 //
@@ -141,127 +131,13 @@ void Swap(T (&a)[N], T (&b)[N])
 //     - https://en.cppreference.com/w/cpp/iterator/rbegin
 //     - https://en.cppreference.com/w/cpp/iterator/rend
 
-namespace stdFoam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-// Forward iteration
-
-//- Return iterator to the beginning of the container \a c.
-//  Definition as per std::begin C++17
-template<class C>
-constexpr auto begin(C& c) -> decltype(c.begin())
-{
-    return c.begin();
-}
-
-//- Return const_iterator to the beginning of the container \a c.
-//  Definition as per std::begin C++17
-template<class C>
-constexpr auto begin(const C& c) -> decltype(c.begin())
-{
-    return c.begin();
-}
-
-//- Return const_iterator to the beginning of the container \a c.
-//  Definition as per std::cbegin C++17
-template<class C>
-constexpr auto cbegin(const C& c) -> decltype(c.begin())
-{
-    return c.begin();
-}
-
-//- Return iterator to the end of the container \a c.
-//  Definition as per std::end C++17
-template<class C>
-constexpr auto end(C& c) -> decltype(c.end())
-{
-    return c.end();
-}
-
-//- Return const_iterator to the end of the container \a c.
-//  Definition as per std::end C++17
-template<class C>
-constexpr auto end(const C& c) -> decltype(c.end())
-{
-    return c.end();
-}
-
-//- Return const_iterator to the end of the container \a c.
-//  Definition as per std::cend C++17
-template<class C>
-constexpr auto cend(const C& c) -> decltype(c.end())
-{
-    return c.end();
-}
-
-
-// Reverse iteration
-
-//- Return reverse_iterator to the reverse-begin of container \a c.
-//  Definition as per std::rbegin C++17
-template<class C>
-constexpr auto rbegin(C& c) -> decltype(c.rbegin())
-{
-    return c.rbegin();
-}
-
-//- Return const_reverse_iterator to the reverse-begin of container \a c.
-//  Definition as per std::rbegin C++17
-template<class C>
-constexpr auto rbegin(const C& c) -> decltype(c.rbegin())
-{
-    return c.rbegin();
-}
-
-//- Return const_reverse_iterator to the reverse-begin of container \a c.
-//  Definition as per std::crbegin C++17
-template<class C>
-constexpr auto crbegin(const C& c) -> decltype(c.rbegin())
-{
-    return c.rbegin();
-}
-
-//- Return reverse_iterator to reverse-end of container \a c.
-//  Definition as per std::rend C++17
-template<class C>
-constexpr auto rend(C& c) -> decltype(c.rend())
-{
-    return c.rend();
-}
 
-//- Return const_reverse_iterator to reverse-end of container \a c.
-//  Definition as per std::rend C++17
-template<class C>
-constexpr auto rend(const C& c) -> decltype(c.rend())
-{
-    return c.rend();
-}
-
-//- Return const_reverse_iterator to reverse-end of container \a c.
-//  Definition as per std::crend C++17
-template<class C>
-constexpr auto crend(const C& c) -> decltype(c.rend())
-{
-    return c.rend();
-}
-
-//- Return the lesser of the parameters.
-//  Definition as per std::min C++14
-template<class T>
-constexpr inline const T& min(const T& a, const T& b)
+namespace stdFoam
 {
-    return (b < a) ? b : a;
-}
 
-//- Return the greater of the parameters.
-//  Definition as per std::max C++14
-template<class T>
-constexpr inline const T& max(const T& a, const T& b)
-{
-    return (a < b) ? b : a;
-}
+//- Map any dependent type to false (workaround before CWG2518)
+template<typename...>
+inline constexpr bool dependent_false_v = false;
 
 } // End namespace stdFoam
 
@@ -280,8 +156,8 @@ constexpr inline const T& max(const T& a, const T& b)
 #define forAllIters(container,iter)                                            \
     for                                                                        \
     (                                                                          \
-        auto iter = stdFoam::begin(container);                                 \
-        iter != stdFoam::end(container);                                       \
+        auto iter = std::begin(container);                                     \
+        iter != std::end(container);                                           \
         ++iter                                                                 \
     )
 
@@ -298,8 +174,8 @@ constexpr inline const T& max(const T& a, const T& b)
 #define forAllConstIters(container,iter)                                       \
     for                                                                        \
     (                                                                          \
-        auto iter = stdFoam::cbegin(container);                                \
-        iter != stdFoam::cend(container);                                      \
+        auto iter = std::cbegin(container);                                    \
+        iter != std::cend(container);                                          \
         ++iter                                                                 \
     )
 
@@ -317,8 +193,8 @@ constexpr inline const T& max(const T& a, const T& b)
 #define forAllReverseIters(container,iter)                                     \
     for                                                                        \
     (                                                                          \
-        auto iter = stdFoam::rbegin(container);                                \
-        iter != stdFoam::rend(container);                                      \
+        auto iter = std::rbegin(container);                                    \
+        iter != std::rend(container);                                          \
         ++iter                                                                 \
     )
 
@@ -335,8 +211,8 @@ constexpr inline const T& max(const T& a, const T& b)
 #define forAllConstReverseIters(container,iter)                                \
     for                                                                        \
     (                                                                          \
-        auto iter = stdFoam::crbegin(container);                               \
-        iter != stdFoam::crend(container);                                     \
+        auto iter = std::crbegin(container);                                   \
+        iter != std::crend(container);                                         \
         ++iter                                                                 \
     )
 
@@ -434,13 +310,13 @@ public:
     // STL type definitions
 
         using element_type = Type;
-        using value_type = std::remove_cv<Type>;
+        using value_type = std::remove_cv_t<Type>;
         using size_type = std::size_t;
+        using difference_type = std::ptrdiff_t;
         using pointer = Type*;
         using const_pointer = const Type*;
-        using reference = Type&;
-        using const_reference = const Type&;
-        using difference_type = std::ptrdiff_t;
+        using reference = element_type&;
+        using const_reference = const element_type&;
         using iterator = Type*;
 
 
@@ -565,7 +441,7 @@ public:
         //- A writable view as byte content (if the pointer type is non-const).
         //- Like data(), the const access itself is const.
         template<class TypeT = Type>
-        typename std::enable_if<!std::is_const<TypeT>::value, char*>::type
+        std::enable_if_t<!std::is_const_v<TypeT>, char*>
         data_bytes() const noexcept
         {
             return reinterpret_cast<char*>(data_);
diff --git a/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C b/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C
index 8ad62055ab6..1762457845e 100644
--- a/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C
+++ b/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2020-2023 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -74,7 +74,7 @@ Type Foam::csvTableReader<Type>::readValue
 {
     Type result;
 
-    if (std::is_integral<Type>::value)
+    if constexpr (std::is_integral_v<Type>)
     {
         // nComponents == 1
         setComponent(result, 0) = readLabel(strings[componentColumns_[0]]);
diff --git a/src/OpenFOAM/matrices/EigenMatrix/EigenMatrix.H b/src/OpenFOAM/matrices/EigenMatrix/EigenMatrix.H
index 66cfa4a87d5..e88db3f55b7 100644
--- a/src/OpenFOAM/matrices/EigenMatrix/EigenMatrix.H
+++ b/src/OpenFOAM/matrices/EigenMatrix/EigenMatrix.H
@@ -159,7 +159,7 @@ class EigenMatrix
 {
     static_assert
     (
-        std::is_floating_point<cmptType>::value,
+        std::is_floating_point_v<cmptType>,
         "EigenMatrix operates only with scalar base type."
     );
 
diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C
index 9113a8a1243..34f2b2e7877 100644
--- a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C
+++ b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrixTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2024 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,7 +72,7 @@ void Foam::LUscalarMatrix::solve
                 {
                     // Nothing to do
                 }
-                else if (is_contiguous<Type>::value)
+                else if constexpr (is_contiguous_v<Type>)
                 {
                     UIPstream::read
                     (
@@ -96,7 +96,7 @@ void Foam::LUscalarMatrix::solve
             {
                 // Nothing to do
             }
-            else if (is_contiguous<Type>::value)
+            else if constexpr (is_contiguous_v<Type>)
             {
                 UOPstream::write
                 (
@@ -136,7 +136,7 @@ void Foam::LUscalarMatrix::solve
                 {
                     // Nothing to do
                 }
-                else if (is_contiguous<Type>::value)
+                else if constexpr (is_contiguous_v<Type>)
                 {
                     UOPstream::write
                     (
@@ -160,7 +160,7 @@ void Foam::LUscalarMatrix::solve
             {
                 // Nothing to do
             }
-            else if (is_contiguous<Type>::value)
+            else if constexpr (is_contiguous_v<Type>)
             {
                 UIPstream::read
                 (
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C
index 86fd78da723..f98ad1849f8 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.C
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2022 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -508,11 +508,11 @@ Foam::scalar Foam::Matrix<Form, Type>::norm(const bool noSqrt) const
 template<class Form, class Type>
 std::streamsize Foam::Matrix<Form, Type>::byteSize() const
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         FatalErrorInFunction
             << "Invalid for non-contiguous data types"
-            << abort(FatalError);
+            << Foam::abort(FatalError);
     }
     return this->size_bytes();
 }
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H
index 7e299d96cfa..7099fd52a49 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.H
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.H
@@ -210,7 +210,7 @@ public:
         inline bool empty() const noexcept;
 
         //- The number of elements in Matrix (m*n)
-        inline label size() const;
+        inline label size() const noexcept;
 
         //- Return row/column sizes
         inline labelPair sizes() const;
diff --git a/src/OpenFOAM/matrices/Matrix/MatrixI.H b/src/OpenFOAM/matrices/Matrix/MatrixI.H
index b1dc3b1267c..ff6768b14f1 100644
--- a/src/OpenFOAM/matrices/Matrix/MatrixI.H
+++ b/src/OpenFOAM/matrices/Matrix/MatrixI.H
@@ -86,7 +86,7 @@ Foam::Matrix<Form, Type>::clone() const
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Form, class Type>
-inline Foam::label Foam::Matrix<Form, Type>::size() const
+inline Foam::label Foam::Matrix<Form, Type>::size() const noexcept
 {
     return mRows_ * nCols_;
 }
@@ -209,7 +209,7 @@ inline char* Foam::Matrix<Form, Type>::data_bytes() noexcept
 template<class Form, class Type>
 inline std::streamsize Foam::Matrix<Form, Type>::size_bytes() const noexcept
 {
-    return mRows_*nCols_*sizeof(Type);
+    return std::streamsize(mRows_*nCols_)*sizeof(Type);
 }
 
 
diff --git a/src/OpenFOAM/matrices/Matrix/MatrixIO.C b/src/OpenFOAM/matrices/Matrix/MatrixIO.C
index e2fd604558c..cd166efdc9d 100644
--- a/src/OpenFOAM/matrices/Matrix/MatrixIO.C
+++ b/src/OpenFOAM/matrices/Matrix/MatrixIO.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -69,7 +69,7 @@ bool Foam::Matrix<Form, Type>::readMatrix(Istream& is)
         // The total size
         const label len = size();
 
-        if (is.format() == IOstreamOption::BINARY && is_contiguous<Type>::value)
+        if (is.format() == IOstreamOption::BINARY && is_contiguous_v<Type>)
         {
             // Binary and contiguous
 
@@ -152,7 +152,7 @@ Foam::Ostream& Foam::Matrix<Form, Type>::writeMatrix
     // Rows, columns size
     os  << mat.nRows() << token::SPACE << mat.nCols();
 
-    if (os.format() == IOstreamOption::BINARY && is_contiguous<Type>::value)
+    if (os.format() == IOstreamOption::BINARY && is_contiguous_v<Type>)
     {
         // Binary and contiguous
 
@@ -162,7 +162,7 @@ Foam::Ostream& Foam::Matrix<Form, Type>::writeMatrix
             os.write(mat.cdata_bytes(), mat.size_bytes());
         }
     }
-    else if (is_contiguous<Type>::value && len > 1 && mat.uniform())
+    else if (is_contiguous_v<Type> && len > 1 && mat.uniform())
     {
         // Two or more entries, and all entries have identical values.
         os  << token::BEGIN_BLOCK << *iter << token::END_BLOCK;
@@ -170,7 +170,7 @@ Foam::Ostream& Foam::Matrix<Form, Type>::writeMatrix
     else if
     (
         (len <= 1 || !shortLen)
-     || (len <= shortLen && is_contiguous<Type>::value)
+     || (len <= shortLen && is_contiguous_v<Type>)
     )
     {
         // Single-line output (entire matrix)
@@ -201,7 +201,7 @@ Foam::Ostream& Foam::Matrix<Form, Type>::writeMatrix
     else if
     (
         (mat.nCols() <= 1 || !shortLen)
-     || (mat.nCols() <= shortLen && is_contiguous<Type>::value)
+     || (mat.nCols() <= shortLen && is_contiguous_v<Type>)
     )
     {
         // Multi-line matrix, single-line rows
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
index 6d95e5215a7..0b54b876830 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -36,10 +36,15 @@ template<class Type>
 void Foam::processorLduInterface::send
 (
     const UPstream::commsTypes commsType,
-    const UList<Type>& f
+    const UList<Type>& fld
 ) const
 {
-    const label nBytes = f.byteSize();
+    if constexpr (!is_contiguous_v<Type>)
+    {
+        FatalErrorInFunction
+            << "Invalid for non-contiguous data types"
+            << Foam::abort(FatalError);
+    }
 
     if
     (
@@ -51,28 +56,30 @@ void Foam::processorLduInterface::send
         (
             commsType,
             neighbProcNo(),
-            f.cdata_bytes(),
-            nBytes,
+            fld.cdata_bytes(),
+            fld.size_bytes(),
             tag(),
             comm()
         );
     }
     else if (commsType == UPstream::commsTypes::nonBlocking)
     {
-        resizeBuf(byteSendBuf_, nBytes);
-        std::memcpy
-        (
-            static_cast<void*>(byteSendBuf_.data()), f.cdata(), nBytes
-        );
-
-        resizeBuf(byteRecvBuf_, nBytes);
-
-        if (!nBytes)
+        if (fld.empty())
         {
             // Can skip empty messages
             return;
         }
 
+        const label nBytes = fld.size_bytes();
+
+        resizeBuf(byteSendBuf_, nBytes);
+        resizeBuf(byteRecvBuf_, nBytes);
+
+        std::memcpy
+        (
+            static_cast<void*>(byteSendBuf_.data()), fld.cdata(), nBytes
+        );
+
         UIPstream::read
         (
             commsType,
@@ -106,10 +113,15 @@ template<class Type>
 void Foam::processorLduInterface::receive
 (
     const UPstream::commsTypes commsType,
-    UList<Type>& f
+    UList<Type>& fld
 ) const
 {
-    const label nBytes = f.byteSize();
+    if constexpr (!is_contiguous_v<Type>)
+    {
+        FatalErrorInFunction
+            << "Invalid for non-contiguous data types"
+            << Foam::abort(FatalError);
+    }
 
     if
     (
@@ -121,17 +133,19 @@ void Foam::processorLduInterface::receive
         (
             commsType,
             neighbProcNo(),
-            f.data_bytes(),
-            nBytes,
+            fld.data_bytes(),
+            fld.size_bytes(),
             tag(),
             comm()
         );
     }
     else if (commsType == UPstream::commsTypes::nonBlocking)
     {
+        const label nBytes = fld.size_bytes();
+
         std::memcpy
         (
-            static_cast<void*>(f.data()), byteRecvBuf_.cdata(), nBytes
+            static_cast<void*>(fld.data()), byteRecvBuf_.cdata(), nBytes
         );
     }
     else
@@ -163,20 +177,23 @@ void Foam::processorLduInterface::compressedSend
     const UList<Type>& f
 ) const
 {
-    if
+    if constexpr
     (
-        f.size()
-     && UPstream::floatTransfer
-     && (!std::is_integral<Type>::value && sizeof(scalar) != sizeof(float))
+        std::is_integral_v<Type>
+     || (sizeof(float) == sizeof(scalar))
     )
     {
-        static const label nCmpts =
-        (
-            // Placeholder value for unusable template instantiation
-            std::is_integral<Type>::value
-          ? 1
-          : sizeof(Type)/sizeof(scalar)
-        );
+        // No compression if integral or scalar is float
+        this->send(commsType, f);
+    }
+    else if (f.empty() || !UPstream::floatTransfer)
+    {
+        // No compression
+        this->send(commsType, f);
+    }
+    else  // (!f.empty() && UPstream::floatTransfer)
+    {
+        static const label nCmpts = (sizeof(Type)/sizeof(scalar));
         const label nm1 = (f.size() - 1)*nCmpts;
         const label nBytes = f.size()*nCmpts*sizeof(float);
 
@@ -239,10 +256,6 @@ void Foam::processorLduInterface::compressedSend
                 << exit(FatalError);
         }
     }
-    else
-    {
-        this->send(commsType, f);
-    }
 }
 
 
@@ -253,20 +266,23 @@ void Foam::processorLduInterface::compressedReceive
     UList<Type>& f
 ) const
 {
-    if
+    if constexpr
     (
-        f.size()
-     && UPstream::floatTransfer
-     && (!std::is_integral<Type>::value && sizeof(scalar) != sizeof(float))
+        std::is_integral_v<Type>
+     || (sizeof(float) == sizeof(scalar))
     )
     {
-        static const label nCmpts =
-        (
-            // Placeholder value for unusable template instantiation
-            std::is_integral<Type>::value
-          ? 1
-          : sizeof(Type)/sizeof(scalar)
-        );
+        // No compression if integral or scalar is float
+        this->receive<Type>(commsType, f);
+    }
+    else if (f.empty() || !UPstream::floatTransfer)
+    {
+        // Nothing to compress
+        this->receive<Type>(commsType, f);
+    }
+    else  // (!f.empty() && UPstream::floatTransfer)
+    {
+        static const label nCmpts = (sizeof(Type)/sizeof(scalar));
         const label nm1 = (f.size() - 1)*nCmpts;
         const label nBytes = f.size()*nCmpts*sizeof(float);
 
@@ -306,10 +322,6 @@ void Foam::processorLduInterface::compressedReceive
             sArray[i] = fArray[i] + slast[i%nCmpts];
         }
     }
-    else
-    {
-        this->receive<Type>(commsType, f);
-    }
 }
 
 
diff --git a/src/OpenFOAM/memory/PrecisionAdaptor/PrecisionAdaptor.H b/src/OpenFOAM/memory/PrecisionAdaptor/PrecisionAdaptor.H
index 82792f5971d..21dd8a5f819 100644
--- a/src/OpenFOAM/memory/PrecisionAdaptor/PrecisionAdaptor.H
+++ b/src/OpenFOAM/memory/PrecisionAdaptor/PrecisionAdaptor.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2021 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -64,7 +64,7 @@ class ConstPrecisionAdaptor
         //- Set adaptor for different input, copying as required
         void setInput(const Container<InputType>& src)
         {
-            if (std::is_same<Type, InputType>::value)
+            if constexpr (std::is_same_v<Type, InputType>)
             {
                 // Use reference directly
                 this->cref(reinterpret_cast<const Container<Type>&>(src));
@@ -80,7 +80,7 @@ class ConstPrecisionAdaptor
         //- Set from tmp, steal pointer if possible
         void tmpInput(tmp<Container<InputType>>& tsrc)
         {
-            if (std::is_same<Type, InputType>::value && tsrc.is_pointer())
+            if (std::is_same_v<Type, InputType> && tsrc.is_pointer())
             {
                 // Acquire control of the managed pointer
                 this->reset(reinterpret_cast<Container<Type>*>(tsrc.ptr()));
@@ -161,10 +161,10 @@ public:
         static const Container<Type>& select
         (
             const Container<InputType>& input,
-            Container<Type>& other
+            [[maybe_unused]] Container<Type>& other
         )
         {
-            if (std::is_same<Type, InputType>::value)
+            if constexpr (std::is_same_v<Type, InputType>)
             {
                 return reinterpret_cast<const Container<Type>&>(input);
             }
@@ -197,10 +197,14 @@ class PrecisionAdaptor
     // Private Member Functions
 
         //- Set adaptor for different input, copying as required
-        void setInput(Container<InputType>& src, const bool doCopy)
+        void setInput
+        (
+            Container<InputType>& src,
+            [[maybe_unused]] const bool doCopy
+        )
         {
             orig_.ref(src);
-            if (std::is_same<Type, InputType>::value)
+            if constexpr (std::is_same_v<Type, InputType>)
             {
                 // Use reference directly
                 this->ref(reinterpret_cast<Container<Type>&>(src));
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C
index ce75d448405..7005e95ee59 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2015-2017 OpenFOAM Foundation
-    Copyright (C) 2015-2024 OpenCFD Ltd.
+    Copyright (C) 2015-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -162,11 +162,11 @@ void Foam::mapDistributeBase::send
     const label comm
 )
 {
-    if (!is_contiguous<T>::value)
+    if constexpr (!is_contiguous_v<T>)
     {
         FatalErrorInFunction
             << "Only contiguous is currently supported"
-            << exit(FatalError);
+            << Foam::abort(FatalError);
     }
 
     const auto myRank = UPstream::myProcNo(comm);
@@ -318,14 +318,15 @@ void Foam::mapDistributeBase::receive
     const label comm
 )
 {
-    if (!is_contiguous<T>::value)
+    if constexpr (!is_contiguous_v<T>)
     {
         FatalErrorInFunction
             << "Only contiguous is currently supported"
-            << exit(FatalError);
+            << Foam::abort(FatalError);
     }
 
     const auto myRank = UPstream::myProcNo(comm);
+    [[maybe_unused]]
     const auto nProcs = UPstream::nProcs(comm);
 
 
@@ -463,6 +464,7 @@ void Foam::mapDistributeBase::distribute
 )
 {
     const auto myRank = UPstream::myProcNo(comm);
+    [[maybe_unused]]
     const auto nProcs = UPstream::nProcs(comm);
 
     if (!UPstream::parRun())
@@ -679,7 +681,7 @@ void Foam::mapDistributeBase::distribute
     {
         const label startOfRequests = UPstream::nRequests();
 
-        if (!is_contiguous<T>::value)
+        if constexpr (!is_contiguous_v<T>)
         {
             PstreamBuffers pBufs(comm, tag);
 
@@ -909,6 +911,7 @@ void Foam::mapDistributeBase::distribute
 )
 {
     const auto myRank = UPstream::myProcNo(comm);
+    [[maybe_unused]]
     const auto nProcs = UPstream::nProcs(comm);
 
     if (!UPstream::parRun())
@@ -1119,7 +1122,7 @@ void Foam::mapDistributeBase::distribute
     {
         const label startOfRequests = UPstream::nRequests();
 
-        if (!is_contiguous<T>::value)
+        if constexpr (!is_contiguous_v<T>)
         {
             PstreamBuffers pBufs(comm, tag);
 
diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
index 053cdb91033..d0bbc6eda4c 100644
--- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
+++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
@@ -555,7 +555,7 @@ public:
             //- Return neighbour cell values for all boundary faces
             //- by swapping via boundary faces
             template<class T>
-            FOAM_NODISCARD static List<T> swapBoundaryCellList
+            [[nodiscard]] static List<T> swapBoundaryCellList
             (
                 const polyMesh& mesh,
                 const UList<T>& cellData,
@@ -570,7 +570,7 @@ public:
 
             //- Return neighbour cell positions for all boundary faces
             //- by swapping via boundary faces
-            FOAM_NODISCARD static List<point> swapBoundaryCellPositions
+            [[nodiscard]] static List<point> swapBoundaryCellPositions
             (
                 const polyMesh& mesh,
                 const UList<point>& cellData,
diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C
index b08250eade3..7d2b879d728 100644
--- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C
+++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2015-2024 OpenCFD Ltd.
+    Copyright (C) 2015-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -1057,7 +1057,7 @@ void Foam::syncTools::syncBoundaryFaceList
 
         if
         (
-            is_contiguous<T>::value
+            is_contiguous_v<T>
          && UPstream::defaultCommsType == UPstream::commsTypes::nonBlocking
         )
         {
diff --git a/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C b/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C
index 4519893055d..1808cdf0af4 100644
--- a/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C
+++ b/src/OpenFOAM/parallel/globalIndex/globalIndexTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2013-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2024 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -40,7 +40,7 @@ License
 //     return
 //     (
 //         (
-//             !is_contiguous<Type>::value
+//             !is_contiguous_v<Type>
 //          && UPstream::commsTypes::nonBlocking == preferred
 //         )
 //       ? UPstream::commsTypes::scheduled
@@ -138,7 +138,7 @@ void Foam::globalIndex::gatherValues
     const UPstream::commsTypes commsType =
     (
         (
-            !is_contiguous<Type>::value
+            !is_contiguous_v<Type>
          && UPstream::commsTypes::nonBlocking == preferredCommsType
         )
       ? UPstream::commsTypes::scheduled
@@ -156,7 +156,7 @@ void Foam::globalIndex::gatherValues
 
         for (label i = 1; i < procIDs.size(); ++i)
         {
-            if (is_contiguous<Type>::value)
+            if constexpr (is_contiguous_v<Type>)
             {
                 UIPstream::read
                 (
@@ -178,7 +178,7 @@ void Foam::globalIndex::gatherValues
     {
         allValues.clear();  // safety: zero-size on non-master
 
-        if (is_contiguous<Type>::value)
+        if constexpr (is_contiguous_v<Type>)
         {
             UOPstream::write
             (
@@ -222,7 +222,7 @@ void Foam::globalIndex::gather
     const UPstream::commsTypes commsType =
     (
         (
-            !is_contiguous<Type>::value
+            !is_contiguous_v<Type>
          && UPstream::commsTypes::nonBlocking == preferredCommsType
         )
       ? UPstream::commsTypes::scheduled
@@ -253,7 +253,7 @@ void Foam::globalIndex::gather
             {
                 // Nothing to do
             }
-            else if (is_contiguous<Type>::value)
+            else if constexpr (is_contiguous_v<Type>)
             {
                 UIPstream::read
                 (
@@ -277,7 +277,7 @@ void Foam::globalIndex::gather
         {
             // Nothing to do
         }
-        else if (is_contiguous<Type>::value)
+        else if constexpr (is_contiguous_v<Type>)
         {
             UOPstream::write
             (
@@ -317,7 +317,7 @@ void Foam::globalIndex::gather
 {
     // low-level: no parRun guard
 
-    if (is_contiguous<Type>::value)
+    if constexpr (is_contiguous_v<Type>)
     {
         // Flatten list (locally) so that we can benefit from using direct
         // read/write of contiguous data
@@ -339,7 +339,7 @@ void Foam::globalIndex::gather
     const UPstream::commsTypes commsType =
     (
         (
-            !is_contiguous<Type>::value
+            !is_contiguous_v<Type>
          && UPstream::commsTypes::nonBlocking == preferredCommsType
         )
       ? UPstream::commsTypes::scheduled
@@ -567,14 +567,14 @@ void Foam::globalIndex::mpiGather
     char dataMode(0);
     int nCmpts(0);
 
-    if (is_contiguous<Type>::value)
+    if constexpr (is_contiguous_v<Type>)
     {
-        if (is_contiguous_scalar<Type>::value)
+        if constexpr (is_contiguous_scalar<Type>::value)
         {
             dataMode = 'f';
             nCmpts = static_cast<int>(sizeof(Type)/sizeof(scalar));
         }
-        else if (is_contiguous_label<Type>::value)
+        else if constexpr (is_contiguous_label<Type>::value)
         {
             dataMode = 'i';
             nCmpts = static_cast<int>(sizeof(Type)/sizeof(label));
@@ -921,7 +921,7 @@ void Foam::globalIndex::scatter
     const UPstream::commsTypes commsType =
     (
         (
-            !is_contiguous<Type>::value
+            !is_contiguous_v<Type>
          && UPstream::commsTypes::nonBlocking == preferredCommsType
         )
       ? UPstream::commsTypes::scheduled
@@ -942,7 +942,7 @@ void Foam::globalIndex::scatter
             {
                 // Nothing to do
             }
-            else if (is_contiguous<Type>::value)
+            else if constexpr (is_contiguous_v<Type>)
             {
                 UOPstream::write
                 (
@@ -978,7 +978,7 @@ void Foam::globalIndex::scatter
         {
             // Nothing to do
         }
-        else if (is_contiguous<Type>::value)
+        else if constexpr (is_contiguous_v<Type>)
         {
             UIPstream::read
             (
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H
index 4b4056ca4ed..c608971b265 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceOps.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -31,8 +32,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef VectorSpaceOps_H
-#define VectorSpaceOps_H
+#ifndef Foam_VectorSpaceOps_H
+#define Foam_VectorSpaceOps_H
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -41,56 +42,76 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-//- General looping form. Executing at index \<I\> with termination at \<N\>
+//- Recursive execution. Terminating at \<N\>, starting at index \<I\>
 template<direction N, direction I>
 struct VectorSpaceOps
 {
     template<class V, class S, class EqOp>
     static inline void eqOpS(V& vs, const S& s, EqOp eo)
     {
-        eo(vs.v_[I], s);
-        VectorSpaceOps<N, I+1>::eqOpS(vs, s, eo);
+        // if constexpr (I < N)
+        {
+            eo(vs.v_[I], s);
+            VectorSpaceOps<N, I+1>::eqOpS(vs, s, eo);
+        }
     }
 
     template<class S, class V, class EqOp>
     static inline void SeqOp(S& s, const V& vs, EqOp eo)
     {
-        eo(s, vs.v_[I]);
-        VectorSpaceOps<N, I+1>::SeqOp(s, vs, eo);
+        // if constexpr (I < N)
+        {
+            eo(s, vs.v_[I]);
+            VectorSpaceOps<N, I+1>::SeqOp(s, vs, eo);
+        }
     }
 
     template<class V1, class V2, class EqOp>
     static inline void eqOp(V1& vs1, const V2& vs2, EqOp eo)
     {
-        eo(vs1.v_[I], vs2.v_[I]);
-        VectorSpaceOps<N, I+1>::eqOp(vs1, vs2, eo);
+        // if constexpr (I < N)
+        {
+            eo(vs1.v_[I], vs2.v_[I]);
+            VectorSpaceOps<N, I+1>::eqOp(vs1, vs2, eo);
+        }
     }
 
 
     template<class V, class V1, class S, class Op>
     static inline void opVS(V& vs, const V1& vs1, const S& s, Op o)
     {
-        vs.v_[I] = o(vs1.v_[I], s);
-        VectorSpaceOps<N, I+1>::opVS(vs, vs1, s, o);
+        // if constexpr (I < N)
+        {
+            vs.v_[I] = o(vs1.v_[I], s);
+            VectorSpaceOps<N, I+1>::opVS(vs, vs1, s, o);
+        }
     }
 
     template<class V, class S, class V1, class Op>
     static inline void opSV(V& vs, const S& s,  const V1& vs1, Op o)
     {
-        vs.v_[I] = o(s, vs1.v_[I]);
-        VectorSpaceOps<N, I+1>::opSV(vs, s, vs1, o);
+        // if constexpr (I < N)
+        {
+            vs.v_[I] = o(s, vs1.v_[I]);
+            VectorSpaceOps<N, I+1>::opSV(vs, s, vs1, o);
+        }
     }
 
     template<class V, class V1, class Op>
     static inline void op(V& vs, const V1& vs1, const V1& vs2, Op o)
     {
-        vs.v_[I] = o(vs1.v_[I], vs2.v_[I]);
-        VectorSpaceOps<N, I+1>::op(vs, vs1, vs2, o);
+        // if constexpr (I < N)
+        {
+            vs.v_[I] = o(vs1.v_[I], vs2.v_[I]);
+            VectorSpaceOps<N, I+1>::op(vs, vs1, vs2, o);
+        }
     }
 };
 
 
 //- Loop termination form, when index and loop count \<N\> are identical
+//  Not really needed with c++17 'if constexpr' except that gcc-7, gcc-8
+//  produce spurious warnings about unused parameters
 template<direction N>
 struct VectorSpaceOps<N, N>
 {
diff --git a/src/OpenFOAM/primitives/complex/complex.H b/src/OpenFOAM/primitives/complex/complex.H
index c33d09957f1..7749aae7adf 100644
--- a/src/OpenFOAM/primitives/complex/complex.H
+++ b/src/OpenFOAM/primitives/complex/complex.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2014 OpenFOAM Foundation
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -320,22 +320,16 @@ namespace Detail
     //- The 'conjugate' of non-complex returns itself (pass-through)
     //- it does not return a complex!
     template<class T>
-    typename std::enable_if
-    <
-        !std::is_same<complex, T>::value,
-        const T&
-    >::type conj(const T& val)
+    std::enable_if_t<!std::is_same_v<complex, T>, const T&>
+    conj(const T& val)
     {
         return val;
     }
 
     //- The conjugate of a complex number
     template<class T>
-    typename std::enable_if
-    <
-        std::is_same<complex, T>::value,
-        complex
-    >::type conj(const T& val)
+    std::enable_if_t<std::is_same_v<complex, T>, complex>
+    conj(const T& val)
     {
         return val.conjugate();
     }
diff --git a/src/OpenFOAM/primitives/enums/Enum.H b/src/OpenFOAM/primitives/enums/Enum.H
index 0ee27e49a2f..a5e07145a61 100644
--- a/src/OpenFOAM/primitives/enums/Enum.H
+++ b/src/OpenFOAM/primitives/enums/Enum.H
@@ -72,7 +72,7 @@ class Enum
     // Allow enums and integrals (should fit within an int)
     static_assert
     (
-        std::is_enum<EnumType>::value || std::is_integral<EnumType>::value,
+        std::is_enum_v<EnumType> || std::is_integral_v<EnumType>,
         "Enum must be enum or an integral type"
     );
 
diff --git a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C
index 19c962456ef..9aa1417200b 100644
--- a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C
+++ b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C
@@ -72,7 +72,7 @@ Type Foam::Function1Types::CSV<Type>::readValue
 {
     Type result;
 
-    if (std::is_integral<Type>::value)
+    if constexpr (std::is_integral_v<Type>)
     {
         // nComponents == 1
         setComponent(result, 0) = readLabel(strings[componentColumns_[0]]);
diff --git a/src/OpenFOAM/primitives/ints/int/int.H b/src/OpenFOAM/primitives/ints/int/int.H
index 9e9af9d59ba..81e1d7e5f77 100644
--- a/src/OpenFOAM/primitives/ints/int/int.H
+++ b/src/OpenFOAM/primitives/ints/int/int.H
@@ -49,13 +49,13 @@ namespace Foam
 
 #define MAXMIN(RetType, Type1, Type2)                                          \
                                                                                \
-/*! \brief Floating/integral min. Use stdFoam::min() to preserve references */ \
+/*! \brief Floating/integral min. Use std::min() to preserve references */     \
 inline RetType min(const Type1 s1, const Type2 s2)                             \
 {                                                                              \
     return (s1 < s2) ? s1 : s2;                                                \
 }                                                                              \
                                                                                \
-/*! \brief Floating integral max. Use stdFoam::max() to preserve references */ \
+/*! \brief Floating integral max. Use std::max() to preserve references */     \
 inline RetType max(const Type1 s1, const Type2 s2)                             \
 {                                                                              \
     return (s2 < s1) ? s1 : s2;                                                \
diff --git a/src/OpenFOAM/primitives/ints/uint/uint.H b/src/OpenFOAM/primitives/ints/uint/uint.H
index ec00595e3a6..174aac6a70a 100644
--- a/src/OpenFOAM/primitives/ints/uint/uint.H
+++ b/src/OpenFOAM/primitives/ints/uint/uint.H
@@ -50,13 +50,13 @@ namespace Foam
 
 #define MAXMIN(RetType, Type1, Type2)                                          \
                                                                                \
-/*! \brief Floating/integral min. Use stdFoam::min() to preserve references */ \
+/*! \brief Floating/integral min. Use std::min() to preserve references */     \
 inline RetType min(const Type1 s1, const Type2 s2)                             \
 {                                                                              \
     return (s1 < s2) ? s1 : s2;                                                \
 }                                                                              \
                                                                                \
-/*! \brief Floating/integral max. Use stdFoam::max() to preserve references */ \
+/*! \brief Floating/integral max. Use std::max() to preserve references */     \
 inline RetType max(const Type1 s1, const Type2 s2)                             \
 {                                                                              \
     return (s2 < s1) ? s1 : s2;                                                \
diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H
index 37de2bf97af..65210503c48 100644
--- a/src/OpenFOAM/primitives/ops/ops.H
+++ b/src/OpenFOAM/primitives/ops/ops.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.
@@ -37,8 +37,6 @@ Description
 #ifndef Foam_ops_H
 #define Foam_ops_H
 
-#include "stdFoam.H"    // For FOAM_NODISCARD
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
@@ -109,7 +107,7 @@ EqOp(nopEq, (void)x)
     template<class T, class T1, class T2>                                      \
     struct opName##Op3                                                         \
     {                                                                          \
-        FOAM_NODISCARD T operator()(const T1& x, const T2& y) const            \
+        [[nodiscard]] T operator()(const T1& x, const T2& y) const             \
         {                                                                      \
             return op;                                                         \
         }                                                                      \
@@ -118,7 +116,7 @@ EqOp(nopEq, (void)x)
     template<class T1, class T2>                                               \
     struct opName##Op2                                                         \
     {                                                                          \
-        FOAM_NODISCARD T1 operator()(const T1& x, const T2& y) const           \
+        [[nodiscard]] T1 operator()(const T1& x, const T2& y) const            \
         {                                                                      \
             return op;                                                         \
         }                                                                      \
@@ -127,7 +125,7 @@ EqOp(nopEq, (void)x)
     template<class T>                                                          \
     struct opName##Op                                                          \
     {                                                                          \
-        FOAM_NODISCARD T operator()(const T& x, const T& y) const              \
+        [[nodiscard]] T operator()(const T& x, const T& y) const               \
         {                                                                      \
             return op;                                                         \
         }                                                                      \
@@ -141,7 +139,7 @@ EqOp(nopEq, (void)x)
     template<class T1, class T2>                                               \
     struct opName##Op2                                                         \
     {                                                                          \
-        FOAM_NODISCARD bool operator()(const T1& x, const T2& y) const         \
+        [[nodiscard]] bool operator()(const T1& x, const T2& y) const          \
         {                                                                      \
             return op;                                                         \
         }                                                                      \
@@ -150,7 +148,7 @@ EqOp(nopEq, (void)x)
     template<class T>                                                          \
     struct opName##Op                                                          \
     {                                                                          \
-        FOAM_NODISCARD bool operator()(const T& x, const T& y) const           \
+        [[nodiscard]] bool operator()(const T& x, const T& y) const            \
         {                                                                      \
             return op;                                                         \
         }                                                                      \
@@ -169,7 +167,7 @@ EqOp(nopEq, (void)x)
                                                                                \
         opName##Op1(const T& v) : value(v) {}                                  \
                                                                                \
-        FOAM_NODISCARD bool operator()(const T& x) const                       \
+        [[nodiscard]] bool operator()(const T& x) const                        \
         {                                                                      \
             return op;                                                         \
         }                                                                      \
@@ -262,7 +260,7 @@ WeightedOp(multiply, (weight*y))
 template<class T>
 struct compareOp
 {
-    FOAM_NODISCARD int operator()(const T& a, const T& b) const
+    [[nodiscard]] int operator()(const T& a, const T& b) const
     {
         return (a < b) ? -1 : (b < a) ? 1 : 0;
     }
@@ -273,7 +271,7 @@ struct compareOp
 template<class T>
 struct lerpOp
 {
-    FOAM_NODISCARD T operator()(const T& a, const T& b, const scalar t) const
+    [[nodiscard]] T operator()(const T& a, const T& b, const scalar t) const
     {
         return lerp(a, b, t);
     }
@@ -288,7 +286,7 @@ struct lerpOp1
 
     lerpOp1(scalar v) : value(v) {}
 
-    FOAM_NODISCARD T operator()(const T& a, const T& b) const
+    [[nodiscard]] T operator()(const T& a, const T& b) const
     {
         return lerp(a, b, value);
     }
diff --git a/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H b/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H
index bebceb4b5db..cb03fcd3cce 100644
--- a/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H
+++ b/src/OpenFOAM/primitives/ranges/IntRange/IntRange.H
@@ -63,7 +63,7 @@ template<class T> class List;
 template<class IntType>
 class IntRange
 {
-    static_assert(std::is_integral<IntType>::value, "Integral required");
+    static_assert(std::is_integral_v<IntType>, "Integral required");
 
     // Private Data
 
diff --git a/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H b/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H
index 2d175e82152..5bad8452ec1 100644
--- a/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H
+++ b/src/OpenFOAM/primitives/ranges/MinMax/MinMaxOps.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -338,28 +338,28 @@ inline MinMax<T> operator/(const MinMax<T>& x, const scalar& s)
 // Comparison
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator<(const MinMax<T>& range, const U& val)
 {
     return (range.compare(val) < 0);
 }
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator<=(const MinMax<T>& range, const U& val)
 {
     return (range.compare(val) <= 0);
 }
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator>(const MinMax<T>& range, const U& val)
 {
     return (range.compare(val) > 0);
 }
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator>=(const MinMax<T>& range, const U& val)
 {
     return (range.compare(val) >= 0);
@@ -367,28 +367,28 @@ operator>=(const MinMax<T>& range, const U& val)
 
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator<(const U& val, const MinMax<T>& range)
 {
     return (range.compare(val) > 0);
 }
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator<=(const U& val, const MinMax<T>& range)
 {
     return (range.compare(val) >= 0);
 }
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator>(const U& val, const MinMax<T>& range)
 {
     return (range.compare(val) < 0);
 }
 
 template<class T, class U>
-inline typename std::enable_if<std::is_convertible<U, T>::value, bool>::type
+inline std::enable_if_t<std::is_convertible_v<U, T>, bool>
 operator>=(const U& val, const MinMax<T>& range)
 {
     return (range.compare(val) <= 0);
diff --git a/src/OpenFOAM/primitives/traits/contiguous.H b/src/OpenFOAM/primitives/traits/contiguous.H
index b0cde4607bb..ed0c723871e 100644
--- a/src/OpenFOAM/primitives/traits/contiguous.H
+++ b/src/OpenFOAM/primitives/traits/contiguous.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2019 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -76,15 +76,20 @@ namespace Foam
 template<class T>
 struct is_contiguous : std::is_arithmetic<T> {};
 
+//- The is_contiguous value of Type (after stripping of qualifiers)
+template<class T>
+inline constexpr bool is_contiguous_v
+    = is_contiguous<std::remove_cv_t<T>>::value;
+
 
 // Base definition for 'label'
 template<class T>
-struct is_contiguous_label : std::is_same<T, label> {};
+struct is_contiguous_label : std::is_same<label, std::remove_cv_t<T>> {};
 
 
 // Base definition for 'scalar'
 template<class T>
-struct is_contiguous_scalar : std::is_same<T, scalar> {};
+struct is_contiguous_scalar : std::is_same<scalar, std::remove_cv_t<T>> {};
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/traits/pTraits.H b/src/OpenFOAM/primitives/traits/pTraits.H
index b397b9b8371..d3650de008c 100644
--- a/src/OpenFOAM/primitives/traits/pTraits.H
+++ b/src/OpenFOAM/primitives/traits/pTraits.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2020-2023 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -40,21 +40,9 @@ Description
 #define Foam_pTraits_H
 
 #include "direction.H"
-#include <type_traits>  // For std::integral_constant, std::void_t (C++17)
+#include <type_traits>  // For std::integral_constant, std::void_t
 #include <utility>      // For declval
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace stdFoam
-{
-
-//- Map a sequence of any types to \c void as per C++17 \c std::void_t
-template<class... >
-using void_t = void;
-
-} // End namespace stdFoam
-
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
@@ -98,22 +86,9 @@ public:
 
 
 /*---------------------------------------------------------------------------*\
-                              VectorSpace Traits
+                         Robuster generalised pTraits
 \*---------------------------------------------------------------------------*/
 
-//- Test for VectorSpace : default is false
-template<class T, class = void>
-struct is_vectorspace : std::false_type {};
-
-//- Test for VectorSpace : test for T::rank != 0 static member directly
-//  Do not need pTraits layer since rank is defined via VectorSpace etc
-template<class T>
-struct is_vectorspace<T, stdFoam::void_t<decltype(T::rank)>>
-:
-    std::integral_constant<bool, (T::rank != 0)>
-{};
-
-
 //- The vector-space rank: default is 0.
 template<class T, class = void>
 struct pTraits_rank : std::integral_constant<Foam::direction, 0> {};
@@ -124,10 +99,10 @@ template<class T>
 struct pTraits_rank
 <
     T,
-    stdFoam::void_t<decltype(pTraits<T>::rank)>
+    std::void_t<decltype(pTraits<std::remove_cv_t<T>>::rank)>
 >
 :
-    std::integral_constant<Foam::direction, pTraits<T>::rank>
+    std::integral_constant<Foam::direction, pTraits<std::remove_cv_t<T>>::rank>
 {};
 
 
@@ -140,9 +115,13 @@ struct pTraits_cmptType { typedef T type; };
 //  such as for arithmetic primitives, vector-space etc. where the concept
 //  of a component type also makes sense.
 template<class T>
-struct pTraits_cmptType<T, stdFoam::void_t<decltype(pTraits<T>::zero)>>
+struct pTraits_cmptType
+<
+    T,
+    std::void_t<decltype(pTraits<std::remove_cv_t<T>>::zero)>
+>
 {
-    typedef typename pTraits<T>::cmptType type;
+    using type = typename pTraits<std::remove_cv_t<T>>::cmptType;
 };
 
 
@@ -156,10 +135,14 @@ template<class T>
 struct pTraits_nComponents
 <
     T,
-    stdFoam::void_t<decltype(pTraits<T>::nComponents)>
+    std::void_t<decltype(std::remove_cv_t<T>::nComponents)>
 >
 :
-    std::integral_constant<Foam::direction, pTraits<T>::nComponents>
+    std::integral_constant
+    <
+        Foam::direction,
+        pTraits<std::remove_cv_t<T>>::nComponents
+    >
 {};
 
 
@@ -172,13 +155,72 @@ template<class T>
 struct pTraits_has_zero
 <
     T,
-    stdFoam::void_t<decltype(pTraits<T>::zero)>
+    std::void_t<decltype(pTraits<std::remove_cv_t<T>>::zero)>
 >
 :
     std::true_type
 {};
 
 
+/*---------------------------------------------------------------------------*\
+                              VectorSpace Traits
+\*---------------------------------------------------------------------------*/
+
+//- Test for VectorSpace : default is false
+template<class T, class = void>
+struct is_vectorspace : std::false_type {};
+
+//- Test for VectorSpace : test for T::rank != 0 static member directly
+//  Do not need pTraits layer since rank is defined via VectorSpace etc
+template<class T>
+struct is_vectorspace
+<
+    T,
+    std::void_t<decltype(std::remove_cv_t<T>::rank)>
+>
+:
+    std::bool_constant<std::remove_cv_t<T>::rank != 0>
+{};
+
+
+//- Test for VectorSpace and multiple components (eg, not sphericalTensor)
+//- which means it is not rotationally invariant
+template<class T, class = void>
+struct is_rotational_vectorspace : std::false_type {};
+
+//- Test for VectorSpace and multiple components (eg, not sphericalTensor)
+//  Do not need pTraits layer since rank and nComponents are both
+//  defined via VectorSpace
+template<class T>
+struct is_rotational_vectorspace
+<
+    T,
+    std::void_t
+    <
+        decltype(std::remove_cv_t<T>::rank),
+        decltype(std::remove_cv_t<T>::nComponents)
+    >
+>
+:
+    std::bool_constant
+    <
+        (std::remove_cv_t<T>::rank != 0)
+     && (std::remove_cv_t<T>::nComponents > 1)
+    >
+{};
+
+
+//- The is_vectorspace value of Type
+template<class T>
+inline constexpr bool is_vectorspace_v
+    = is_vectorspace<T>::value;
+
+//- The is_rotational_vectorspace value of Type
+template<class T>
+inline constexpr bool is_rotational_vectorspace_v
+    = is_rotational_vectorspace<T>::value;
+
+
 /*---------------------------------------------------------------------------*\
                                Container Traits
 \*---------------------------------------------------------------------------*/
@@ -193,7 +235,7 @@ template<class T>
 struct is_range
 <
     T,
-    stdFoam::void_t
+    std::void_t
     <
         decltype(std::declval<T>().begin()),
         decltype(std::declval<T>().end())
diff --git a/src/OpenFOAM/primitives/transform/symmTransform.H b/src/OpenFOAM/primitives/transform/symmTransform.H
index f463e576321..4f167cdb5cf 100644
--- a/src/OpenFOAM/primitives/transform/symmTransform.H
+++ b/src/OpenFOAM/primitives/transform/symmTransform.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2023 OpenCFD Ltd.
+    Copyright (C) 2023-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -46,7 +46,7 @@ namespace Foam
 
 //- No-op rotational transform for base types
 template<class T>
-constexpr typename std::enable_if<std::is_arithmetic<T>::value, T>::type
+constexpr std::enable_if_t<std::is_arithmetic_v<T>, T>
 transform(const symmTensor&, const T val)
 {
     return val;
diff --git a/src/OpenFOAM/primitives/transform/transform.H b/src/OpenFOAM/primitives/transform/transform.H
index cc921ef0386..29b5e18ce02 100644
--- a/src/OpenFOAM/primitives/transform/transform.H
+++ b/src/OpenFOAM/primitives/transform/transform.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020-2023 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -150,7 +150,7 @@ inline tensor Ra(const vector& a, const scalar omega)
 
 //- No-op rotational transform for base types
 template<class T>
-constexpr typename std::enable_if<std::is_arithmetic<T>::value, T>::type
+constexpr std::enable_if_t<std::is_arithmetic_v<T>, T>
 transform(const tensor&, const T val)
 {
     return val;
@@ -171,7 +171,7 @@ inline SphericalTensor<Cmpt> transform
 
 //- No-op inverse rotational transform for base types
 template<class T>
-constexpr typename std::enable_if<std::is_arithmetic<T>::value, T>::type
+constexpr std::enable_if_t<std::is_arithmetic_v<T>, T>
 invTransform(const tensor&, const T val)
 {
     return val;
diff --git a/src/fileFormats/ensight/output/ensightOutputTemplates.C b/src/fileFormats/ensight/output/ensightOutputTemplates.C
index 0c318339549..17417135394 100644
--- a/src/fileFormats/ensight/output/ensightOutputTemplates.C
+++ b/src/fileFormats/ensight/output/ensightOutputTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2022 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,6 +60,8 @@ void Foam::ensightOutput::Detail::copyComponent
     UList<float>& cmptBuffer
 )
 {
+    typedef typename pTraits<Type>::cmptType cmptType;
+
     if (cmptBuffer.size() < input.size())
     {
         FatalErrorInFunction
@@ -70,23 +72,19 @@ void Foam::ensightOutput::Detail::copyComponent
 
     auto iter = cmptBuffer.begin();
 
-    if (std::is_same<float, typename pTraits<Type>::cmptType>::value)
+    for (const Type& val : input)
     {
-        // Direct copy
-        for (const Type& val : input)
+        if constexpr (std::is_same_v<float, cmptType>)
         {
+            // Direct copy
             *iter = component(val, cmpt);
-            ++iter;
         }
-    }
-    else
-    {
-        // Copy with narrowing
-        for (const Type& val : input)
+        else
         {
+            // Copy with narrowing
             *iter = narrowFloat(component(val, cmpt));
-            ++iter;
         }
+        ++iter;
     }
 }
 
diff --git a/src/fileFormats/gltf/foamGltfBase.H b/src/fileFormats/gltf/foamGltfBase.H
index ba00201007d..172d280c353 100644
--- a/src/fileFormats/gltf/foamGltfBase.H
+++ b/src/fileFormats/gltf/foamGltfBase.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -38,8 +38,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef foam_gltf_base_H
-#define foam_gltf_base_H
+#ifndef Foam_gltf_base_H
+#define Foam_gltf_base_H
 
 #include "word.H"
 #include "label.H"
@@ -106,15 +106,16 @@ namespace glTF
 
     // Helper function to return the enum value
     template<class Type>
-    auto key(const Type& t) -> typename std::enable_if
+    auto key(const Type& t) -> std::enable_if_t
     <
-        std::is_enum<Type>::value,
-        typename std::underlying_type<Type>::type
-    >::type
+        std::is_enum_v<Type>,
+        std::underlying_type_t<Type>
+    >
     {
-        return static_cast<typename std::underlying_type<Type>::type>(t);
+        return static_cast<std::underlying_type_t<Type>>(t);
     }
 
+
 /*---------------------------------------------------------------------------*\
                           Class base Declaration
 \*---------------------------------------------------------------------------*/
diff --git a/src/fileFormats/vtk/file/foamVtkFileWriterTemplates.C b/src/fileFormats/vtk/file/foamVtkFileWriterTemplates.C
index 21ec488823f..3cb0b7a490a 100644
--- a/src/fileFormats/vtk/file/foamVtkFileWriterTemplates.C
+++ b/src/fileFormats/vtk/file/foamVtkFileWriterTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2021 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -37,11 +37,13 @@ void Foam::vtk::fileWriter::beginDataArray
     const label nValues
 )
 {
+    typedef typename pTraits<Type>::cmptType cmptType;
+
     static_assert
     (
         (
-            std::is_same<label, typename pTraits<Type>::cmptType>::value
-         || std::is_floating_point<typename pTraits<Type>::cmptType>::value
+            std::is_same_v<label, cmptType>
+         || std::is_floating_point_v<cmptType>
         ),
         "Label and Floating-point vector space only"
     );
@@ -50,7 +52,7 @@ void Foam::vtk::fileWriter::beginDataArray
 
     if (format_)
     {
-        if (std::is_same<label, typename pTraits<Type>::cmptType>::value)
+        if constexpr (std::is_same_v<label, cmptType>)
         {
             if (legacy())
             {
diff --git a/src/fileFormats/vtk/format/foamVtkFormatter.H b/src/fileFormats/vtk/format/foamVtkFormatter.H
index 6814704bd42..b8f83229fc2 100644
--- a/src/fileFormats/vtk/format/foamVtkFormatter.H
+++ b/src/fileFormats/vtk/format/foamVtkFormatter.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016-2022 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -116,9 +116,6 @@ protected:
         //  \return formatter for chaining
         inline formatter& xmlAttr();
 
-        //- No-op XML comment loop (for templating code).
-        inline void xmlCommentLoop();
-
         //- Loop/output XML comments
         template<class... Args>
         inline void xmlCommentLoop(const std::string& text, Args&&... args);
diff --git a/src/fileFormats/vtk/format/foamVtkFormatterI.H b/src/fileFormats/vtk/format/foamVtkFormatterI.H
index 4bd23ea96fc..7f0ac71234a 100644
--- a/src/fileFormats/vtk/format/foamVtkFormatterI.H
+++ b/src/fileFormats/vtk/format/foamVtkFormatterI.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2018 OpenCFD Ltd.
+    Copyright (C) 2017-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -33,10 +33,6 @@ inline Foam::vtk::formatter& Foam::vtk::formatter::xmlAttr()
 }
 
 
-inline void Foam::vtk::formatter::xmlCommentLoop()
-{}
-
-
 template<class... Args>
 inline void Foam::vtk::formatter::xmlCommentLoop
 (
@@ -50,7 +46,10 @@ inline void Foam::vtk::formatter::xmlCommentLoop
         os_ << text << nl;
     }
 
-    xmlCommentLoop(std::forward<Args>(args)...);
+    if constexpr (sizeof...(Args))
+    {
+        xmlCommentLoop(std::forward<Args>(args)...);
+    }
 }
 
 
@@ -111,7 +110,7 @@ inline Foam::vtk::formatter& Foam::vtk::formatter::xmlComment
         indent();
         os_ << "<!--";
 
-        if (sizeof...(Args))
+        if constexpr (sizeof...(Args))
         {
             os_ << nl;
 
diff --git a/src/fileFormats/vtk/output/foamVtkOutputTemplates.C b/src/fileFormats/vtk/output/foamVtkOutputTemplates.C
index 552cf654bd5..4d7c63cd375 100644
--- a/src/fileFormats/vtk/output/foamVtkOutputTemplates.C
+++ b/src/fileFormats/vtk/output/foamVtkOutputTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016-2022 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -131,7 +131,7 @@ void Foam::vtk::writeValueParallel
     const label count
 )
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         // Non-contiguous data does not make sense
         FatalErrorInFunction
@@ -161,7 +161,7 @@ void Foam::vtk::writeListParallel
     const UList<Type>& values
 )
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         // Non-contiguous data does not make sense
         FatalErrorInFunction
@@ -224,7 +224,7 @@ void Foam::vtk::writeListParallel
     const labelUList& addressing
 )
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         // Non-contiguous data does not make sense
         FatalErrorInFunction
@@ -293,7 +293,7 @@ void Foam::vtk::writeListParallel
     const bitSet& selected
 )
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         // Non-contiguous data does not make sense
         FatalErrorInFunction
@@ -363,7 +363,7 @@ void Foam::vtk::writeListsParallel
     const UList<Type>& values2
 )
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         // Non-contiguous data does not make sense
         FatalErrorInFunction
@@ -460,7 +460,7 @@ void Foam::vtk::writeListsParallel
     const labelUList& addressing
 )
 {
-    if (!is_contiguous<Type>::value)
+    if constexpr (!is_contiguous_v<Type>)
     {
         // Non-contiguous data does not make sense
         FatalErrorInFunction
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C
index 429fccf4f04..9d361e03c27 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C
+++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016-2017 Wikki Ltd
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -219,7 +219,7 @@ void Foam::processorFaPatchField<Type>::initEvaluate
 
         if (commsType == UPstream::commsTypes::nonBlocking)
         {
-            if (!is_contiguous<Type>::value)
+            if constexpr (!is_contiguous_v<Type>)
             {
                 FatalErrorInFunction
                     << "Invalid for non-contiguous data types"
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C
index 6b346a2f9d0..d94f194834b 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C
@@ -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.
@@ -118,7 +118,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate
 {
     if (UPstream::parRun())
     {
-        if (!is_contiguous<Type>::value)
+        if constexpr (!is_contiguous_v<Type>)
         {
             FatalErrorInFunction
                 << "Invalid for non-contiguous data types"
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
index 793b638cc6e..6784bf3b134 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2023 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -221,10 +221,10 @@ void Foam::processorFvPatchField<Type>::initEvaluate
         if
         (
             commsType == UPstream::commsTypes::nonBlocking
-         && (std::is_integral<Type>::value || !UPstream::floatTransfer)
+         && (std::is_integral_v<Type> || !UPstream::floatTransfer)
         )
         {
-            if (!is_contiguous<Type>::value)
+            if constexpr (!is_contiguous_v<Type>)
             {
                 FatalErrorInFunction
                     << "Invalid for non-contiguous data types"
@@ -275,7 +275,7 @@ void Foam::processorFvPatchField<Type>::evaluate
         if
         (
             commsType == UPstream::commsTypes::nonBlocking
-         && (std::is_integral<Type>::value || !UPstream::floatTransfer)
+         && (std::is_integral_v<Type> || !UPstream::floatTransfer)
         )
         {
             // Fast path: received into *this
@@ -456,7 +456,7 @@ void Foam::processorFvPatchField<Type>::initInterfaceMatrixUpdate
     if
     (
         commsType == UPstream::commsTypes::nonBlocking
-     && (std::is_integral<Type>::value || !UPstream::floatTransfer)
+     && (std::is_integral_v<Type> || !UPstream::floatTransfer)
     )
     {
         // Fast path.
@@ -522,7 +522,7 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix
     if
     (
         commsType == UPstream::commsTypes::nonBlocking
-     && (std::is_integral<Type>::value || !UPstream::floatTransfer)
+     && (std::is_integral_v<Type> || !UPstream::floatTransfer)
     )
     {
         // Fast path: consume straight from receive buffer
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/IntegralScaleBox/IntegralScaleBox.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/IntegralScaleBox/IntegralScaleBox.H
index b04c1dfdad1..68946839ad0 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/IntegralScaleBox/IntegralScaleBox.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/IntegralScaleBox/IntegralScaleBox.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,12 +60,12 @@ class IntegralScaleBox
     // Private Typedefs
 
         //- Type of input set of integral scales
-        typedef typename std::conditional
+        using TypeL = std::conditional_t
         <
-            std::is_same<Type, scalar>::value,
+            std::is_same_v<scalar, Type>,
             vector,
             tensor
-        >::type TypeL;
+        >;
 
 
     // Private Enumerations
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchField.H
index a45207389a1..714bd2e2274 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchField.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2022 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -199,12 +199,12 @@ class turbulentDigitalFilterInletFvPatchField
     // Private Typedefs
 
         //- Type of input set of Reynolds stresses
-        typedef typename std::conditional
+        using TypeR = std::conditional_t
         <
-            std::is_same<Type, scalar>::value,
+            std::is_same_v<scalar, Type>,
             scalar,
             symmTensor
-        >::type TypeR;
+        >;
 
 
     // Private Data
diff --git a/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.H b/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.H
index 006a6631529..a795484e641 100644
--- a/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.H
+++ b/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMD.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020-2021 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -187,8 +187,8 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef DMDModels_STDMD_H
-#define DMDModels_STDMD_H
+#ifndef Foam_DMDModels_STDMD_H
+#define Foam_DMDModels_STDMD_H
 
 #include "DMDModel.H"
 #include "SquareMatrix.H"
@@ -400,28 +400,9 @@ class STDMD
             template<class GeoFieldType>
             bool calcModes();
 
-            //- Compute a mode for a given scalar-based input field
+            //- Compute a mode for a given scalar-based or other input field
             template<class GeoFieldType>
-            typename std::enable_if
-            <
-                std::is_same<scalar, typename GeoFieldType::value_type>::value,
-                void
-            >::type calcMode
-            (
-                GeoFieldType& modeRe,
-                GeoFieldType& modeIm,
-                const RMatrix& primitiveMode,
-                const label magi,
-                const label rowi = 0
-            );
-
-            //- Compute a mode for a given non-scalar-based input field
-            template<class GeoFieldType>
-            typename std::enable_if
-            <
-                !std::is_same<scalar, typename GeoFieldType::value_type>::value,
-                void
-            >::type calcMode
+            void calcMode
             (
                 GeoFieldType& modeRe,
                 GeoFieldType& modeIm,
diff --git a/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMDTemplates.C b/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMDTemplates.C
index 1804741bbd5..9f9aeac941d 100644
--- a/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMDTemplates.C
+++ b/src/functionObjects/field/DMD/DMDModels/derived/STDMD/STDMDTemplates.C
@@ -184,41 +184,7 @@ bool Foam::DMDModels::STDMD::calcModes()
 
 
 template<class GeoFieldType>
-typename std::enable_if
-<
-    std::is_same<Foam::scalar, typename GeoFieldType::value_type>::value,
-    void
->::type Foam::DMDModels::STDMD::calcMode
-(
-    GeoFieldType& modeRe,
-    GeoFieldType& modeIm,
-    const RMatrix& primitiveMode,
-    const label magi,
-    const label rowi
-)
-{
-    const label szfld = modeRe.size();
-
-    for (label i = rowi; i < szfld + rowi; ++i)
-    {
-        complex mode(Zero);
-        for (label j = 0; j < evecs_.m(); ++j)
-        {
-            mode += primitiveMode(i, j)*evecs_(j, magi);
-        }
-        const label k = (i-rowi)%szfld;
-        modeRe[k] = mode.real();
-        modeIm[k] = mode.imag();
-    }
-}
-
-
-template<class GeoFieldType>
-typename std::enable_if
-<
-    !std::is_same<Foam::scalar, typename GeoFieldType::value_type>::value,
-    void
->::type Foam::DMDModels::STDMD::calcMode
+void Foam::DMDModels::STDMD::calcMode
 (
     GeoFieldType& modeRe,
     GeoFieldType& modeIm,
@@ -238,10 +204,23 @@ typename std::enable_if
         {
             mode += primitiveMode(i, j)*evecs_(j, magi);
         }
+
         const label k = (i-rowi)%szfld;
-        const label m = (i-rowi)/szfld;
-        modeRe[k][m] = mode.real();
-        modeIm[k][m] = mode.imag();
+
+        if constexpr
+        (
+            std::is_same_v<scalar, typename GeoFieldType::value_type>
+        )
+        {
+            modeRe[k] = mode.real();
+            modeIm[k] = mode.imag();
+        }
+        else
+        {
+            const label m = (i-rowi)/szfld;
+            modeRe[k][m] = mode.real();
+            modeIm[k][m] = mode.imag();
+        }
     }
 }
 
diff --git a/src/functionObjects/field/multiply/multiply.H b/src/functionObjects/field/multiply/multiply.H
index 1528204e7fd..c21a525d953 100644
--- a/src/functionObjects/field/multiply/multiply.H
+++ b/src/functionObjects/field/multiply/multiply.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -88,8 +88,8 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef functionObjects_multiply_H
-#define functionObjects_multiply_H
+#ifndef Foam_functionObjects_multiply_H
+#define Foam_functionObjects_multiply_H
 
 #include "fieldsExpression.H"
 
@@ -127,23 +127,7 @@ class multiply
         bool multiplyResult(const word& fieldName, bool& processed);
 
         template<class Type1, class Type2>
-        typename std::enable_if
-        <
-            is_valid_op<Type1, Type2>::value, bool
-        >::type
-        multiplyFieldType
-        (
-            GeometricField<Type1, fvPatchField, volMesh>& result,
-            const word& fieldName,
-            bool& processed
-        );
-
-        template<class Type1, class Type2>
-        typename std::enable_if
-        <
-            !is_valid_op<Type1, Type2>::value, bool
-        >::type
-        multiplyFieldType
+        bool multiplyFieldType
         (
             GeometricField<Type1, fvPatchField, volMesh>& result,
             const word& fieldName,
diff --git a/src/functionObjects/field/multiply/multiplyTemplates.C b/src/functionObjects/field/multiply/multiplyTemplates.C
index 806252d2af6..69195ef68ca 100644
--- a/src/functionObjects/field/multiply/multiplyTemplates.C
+++ b/src/functionObjects/field/multiply/multiplyTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -88,11 +88,7 @@ bool Foam::functionObjects::multiply::multiplyResult
 
 
 template<class Type1, class Type2>
-typename std::enable_if
-<
-    Foam::functionObjects::multiply::is_valid_op<Type1, Type2>::value, bool
->::type
-Foam::functionObjects::multiply::multiplyFieldType
+bool Foam::functionObjects::multiply::multiplyFieldType
 (
     GeometricField<Type1, fvPatchField, volMesh>& result,
     const word& fieldName,
@@ -107,46 +103,30 @@ Foam::functionObjects::multiply::multiplyFieldType
 
     if (fieldPtr)
     {
-        Log << "    Performing " << result.name() << " * " << fieldPtr->name()
-            << endl;
-
-        auto newResult(result*(*fieldPtr));
-        result.checkOut();
-
-        store(resultName_, newResult);
-
-        processed = true;
-    }
-
-    return processed;
-}
-
-
-template<class Type1, class Type2>
-typename std::enable_if
-<
-    !Foam::functionObjects::multiply::is_valid_op<Type1, Type2>::value, bool
->::type
-Foam::functionObjects::multiply::multiplyFieldType
-(
-    GeometricField<Type1, fvPatchField, volMesh>& result,
-    const word& fieldName,
-    bool& processed
-)
-{
-    if (processed) return processed;
+        if constexpr
+        (
+            Foam::functionObjects::multiply::is_valid_op<Type1, Type2>::value
+        )
+        {
+            Log << "    Performing "
+                << result.name() << " * " << fieldPtr->name()
+                << endl;
 
-    typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType;
+            auto newResult(result*(*fieldPtr));
+            result.checkOut();
 
-    auto* fieldPtr = mesh_.cfindObject<volFieldType>(fieldName);
+            store(resultName_, newResult);
 
-    if (fieldPtr)
-    {
-        Info<< "    Unsupported operation for "
-            << result.name() << '(' << pTraits<Type1>::typeName << ')'
-            << " * "
-            << fieldPtr->name() << '(' << pTraits<Type2>::typeName << ')'
-            << endl;
+            processed = true;
+        }
+        else
+        {
+            Info<< "    Unsupported operation for "
+                << result.name() << '(' << pTraits<Type1>::typeName << ')'
+                << " * "
+                << fieldPtr->name() << '(' << pTraits<Type2>::typeName << ')'
+                << endl;
+        }
     }
 
     return processed;
diff --git a/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObject.cxx b/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObject.cxx
index c9a78982ea2..09591517c22 100644
--- a/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObject.cxx
+++ b/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObject.cxx
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2024 OpenCFD Ltd.
+    Copyright (C) 2024-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -131,7 +131,7 @@ bool Foam::functionObjects::ensightCloudWriteObject::writeCloud
 
 
     // Copy positions (for simplicity and for filtering).
-    // Store as floatVector, since that is what Ensight will write anyhow
+    // Store as floatVector, since Ensight will write float components anyhow
 
     DynamicList<floatVector> positions;
     positions.reserve(UPstream::master() ? procAddr_.maxSize() : nParcels);
@@ -145,46 +145,42 @@ bool Foam::functionObjects::ensightCloudWriteObject::writeCloud
 
         if (applyFilter_)
         {
-            if (std::is_same<float, vector::cmptType>::value)
+            for (const label idx : parcelAddr_)
             {
-                for (const label idx : parcelAddr_)
+                const auto& pos = points[idx];
+
+                if constexpr (std::is_same_v<float, vector::cmptType>)
                 {
-                    *iter = points[idx];
-                    ++iter;
+                    // Direct copy
+                    *iter = pos;
                 }
-            }
-            else
-            {
-                for (const label idx : parcelAddr_)
+                else
                 {
-                    const auto& pos = points[idx];
-
+                    // Copy with narrowing
                     (*iter).x() = narrowFloat(pos.x());
                     (*iter).y() = narrowFloat(pos.y());
                     (*iter).z() = narrowFloat(pos.z());
-                    ++iter;
                 }
+                ++iter;
             }
         }
         else
         {
-            if (std::is_same<float, vector::cmptType>::value)
+            for (const auto& pos : points)
             {
-                for (const auto& pos : points)
+                if constexpr (std::is_same_v<float, vector::cmptType>)
                 {
+                    // Direct copy
                     *iter = pos;
-                    ++iter;
                 }
-            }
-            else
-            {
-                for (const auto& pos : points)
+                else
                 {
+                    // Copy with narrowing
                     (*iter).x() = narrowFloat(pos.x());
                     (*iter).y() = narrowFloat(pos.y());
                     (*iter).z() = narrowFloat(pos.z());
-                    ++iter;
                 }
+                ++iter;
             }
         }
     }
diff --git a/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObjectImpl.cxx b/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObjectImpl.cxx
index 01fcf08b148..6d2ef5c66f7 100644
--- a/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObjectImpl.cxx
+++ b/src/functionObjects/lagrangian/ensightCloud/ensightCloudWriteObjectImpl.cxx
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2024 OpenCFD Ltd.
+    Copyright (C) 2024-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -37,11 +37,13 @@ Foam::wordList Foam::functionObjects::ensightCloudWriteObject::writeFields
     const objectRegistry& obrTmp
 )
 {
+    using cmptType = typename pTraits<Type>::cmptType;
+
     static_assert
     (
         (
-            std::is_same<label, typename pTraits<Type>::cmptType>::value
-         || std::is_floating_point<typename pTraits<Type>::cmptType>::value
+            std::is_same_v<label, cmptType>
+         || std::is_floating_point_v<cmptType>
         ),
         "Label and Floating-point vector space only"
     );
diff --git a/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C b/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C
index f61c1de41e6..3e7c398f540 100644
--- a/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C
+++ b/src/functionObjects/lagrangian/vtkCloud/vtkCloudTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2024 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -39,11 +39,13 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
 {
     const direction nCmpt(pTraits<Type>::nComponents);
 
+    typedef typename pTraits<Type>::cmptType cmptType;
+
     static_assert
     (
         (
-            std::is_same<label, typename pTraits<Type>::cmptType>::value
-         || std::is_floating_point<typename pTraits<Type>::cmptType>::value
+            std::is_same_v<label, cmptType>
+         || std::is_floating_point_v<cmptType>
         ),
         "Label and Floating-point vector space only"
     );
@@ -72,7 +74,7 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
 
         if (UPstream::master())
         {
-            if (std::is_same<label, typename pTraits<Type>::cmptType>::value)
+            if constexpr (std::is_same_v<label, cmptType>)
             {
                 const uint64_t payLoad =
                     vtk::sizeofData<label, nCmpt>(nTotParcels);
diff --git a/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloud.C b/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloud.C
index 720ad68a457..dac7eaf44ed 100644
--- a/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloud.C
+++ b/src/lagrangian/intermediate/conversion/ensight/ensightOutputCloud.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016-2024 OpenCFD Ltd.
+    Copyright (C) 2016-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -230,7 +230,7 @@ bool Foam::ensightOutput::writeCloudPositions
 
         auto iter = positions.begin();
 
-        if (std::is_same<float, vector::cmptType>::value)
+        if constexpr (std::is_same_v<float, vector::cmptType>)
         {
             for (const auto& p : parcels)
             {
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C
index d8c2ada5e33..a29b150a092 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C
@@ -94,18 +94,16 @@ namespace Foam
     template<>
     class pTraits<labelList>
     {
-
     public:
 
         //- Component type
         typedef labelList cmptType;
     };
 
-    //- Template specialization for pTraits<labelList> so we can have fields
+    //- Template specialization for pTraits<vectorList> so we can have fields
     template<>
     class pTraits<vectorList>
     {
-
     public:
 
         //- Component type
diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C
index 036737e15c3..46805ddb026 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C
+++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2021-2024 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -53,12 +53,15 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
     const UList<Type>& defaultValues
 ) const
 {
+    // Can rotate fields (vector and non-spherical tensors)
+    constexpr bool transform_supported = is_rotational_vectorspace_v<Type>;
+
+    [[maybe_unused]]
     autoPtr<coordSystem::cylindrical> cs;
 
     // Similar to doTransform.
-    // - could also check if !std::is_same<sphericalTensor, Type>:value
 
-    if (is_vectorspace<Type>::value)
+    if constexpr (transform_supported)
     {
         cs.reset(cylindricalCS());
     }
@@ -67,7 +70,8 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
     {
         return interpolateUntransformed(fld, defaultValues);
     }
-    else
+
+    if constexpr (transform_supported)
     {
         const cyclicAMIPolyPatch& nbrPp = this->neighbPatch();
 
@@ -144,6 +148,15 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
             interpolateUntransformed(localFld, localDeflt)
         );
     }
+    else  // (!transform_supported)
+    {
+        FatalErrorInFunction
+            << "CODING ERROR??" << nl
+            << "calculated cylindrical coordinate system,"
+               " but does not appear to be a vector-space type" << endl
+            << Foam::abort(FatalError);
+        return nullptr;
+    }
 }
 
 
@@ -205,9 +218,13 @@ void Foam::cyclicAMIPolyPatch::initInterpolate
         return;
     }
 
+    // Can rotate fields (vector and non-spherical tensors)
+    constexpr bool transform_supported = is_rotational_vectorspace_v<Type>;
+
+    [[maybe_unused]]
     autoPtr<coordSystem::cylindrical> cs;
 
-    if (is_vectorspace<Type>::value)
+    if constexpr (transform_supported)
     {
         cs.reset(cylindricalCS());
     }
@@ -223,7 +240,7 @@ void Foam::cyclicAMIPolyPatch::initInterpolate
             recvBuffers
         );
     }
-    else
+    else if constexpr (transform_supported)
     {
         const cyclicAMIPolyPatch& nbrPp = this->neighbPatch();
 
@@ -276,10 +293,14 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
 
     auto tresult = tmp<Field<Type>>::New(this->size(), Zero);
 
-    // Note: tresult is optionally in transformed coord system
+    // Rotate fields (vector and non-spherical tensors)
+    constexpr bool transform_supported = is_rotational_vectorspace_v<Type>;
+
+    [[maybe_unused]]
     autoPtr<coordSystem::cylindrical> cs;
 
-    if (is_vectorspace<Type>::value)
+    // Rotate fields (vector and non-spherical tensors)
+    if constexpr (transform_supported)
     {
         cs.reset(cylindricalCS());
     }
@@ -294,7 +315,7 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
             defaultValues
         );
     }
-    else
+    else if constexpr (transform_supported)
     {
         const tensorField ownT(cs().R(this->faceCentres()));
 
@@ -338,9 +359,15 @@ void Foam::cyclicAMIPolyPatch::interpolate
     //- Commented out for now since called with non-primitives (e.g. wallPoint
     //  from FaceCellWave) - missing Foam::transform, Foam::invTransform
     /*
+     *
+    // Rotate fields (vector and non-spherical tensors)
+    constexpr bool transform_supported = is_rotational_vectorspace_v<Type>;
+
+    [[maybe_unused]]
     autoPtr<coordSystem::cylindrical> cs;
 
-    if (is_vectorspace<Type>::value)
+    // Rotate fields (vector and non-spherical tensors)
+    if constexpr (transform_supported)
     {
         cs.reset(cylindricalCS());
     }
diff --git a/src/meshTools/coordSet/writers/common/coordSetWriterTemplates.C b/src/meshTools/coordSet/writers/common/coordSetWriterTemplates.C
index d1ea1d8564e..62205bb99fd 100644
--- a/src/meshTools/coordSet/writers/common/coordSetWriterTemplates.C
+++ b/src/meshTools/coordSet/writers/common/coordSetWriterTemplates.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2022 OpenCFD Ltd.
+    Copyright (C) 2022-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -45,7 +45,11 @@ Foam::tmp<Foam::Field<Type>> Foam::coordSetWriter::adjustFieldTemplate
 
     // Output scaling for the variable, but not for integer types
     // which are typically ids etc.
-    if (!std::is_integral<Type>::value)
+    if constexpr (std::is_integral_v<Type>)
+    {
+        return tfield;
+    }
+    else
     {
         scalar value;
 
@@ -60,9 +64,13 @@ Foam::tmp<Foam::Field<Type>> Foam::coordSetWriter::adjustFieldTemplate
             // or automatically scale by 1/sqrt(nComponents) instead ...
 
             Type refLevel;
-            for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
+            if constexpr (is_vectorspace_v<Type>)
             {
-                setComponent(refLevel, cmpt) = value;
+                refLevel.fill(value);
+            }
+            else
+            {
+                refLevel = value;
             }
 
             if (verbose_)
@@ -101,14 +109,12 @@ Foam::tmp<Foam::Field<Type>> Foam::coordSetWriter::adjustFieldTemplate
             // Apply scaling
             tadjusted.ref() *= value;
         }
+    }
 
-        // Rotate fields (vector and non-spherical tensors)
-        if
-        (
-            (is_vectorspace<Type>::value && pTraits<Type>::nComponents > 1)
-         && geometryTransform_.good()
-         && !geometryTransform_.R().is_identity()
-        )
+    // Rotate fields (vector and non-spherical tensors)
+    if constexpr (is_rotational_vectorspace_v<Type>)
+    {
+        if (geometryTransform_.good() && !geometryTransform_.R().is_identity())
         {
             if (!tadjusted)
             {
@@ -116,12 +122,12 @@ Foam::tmp<Foam::Field<Type>> Foam::coordSetWriter::adjustFieldTemplate
                 tadjusted.reset(tfield.ptr());
             }
 
-           Foam::transform
-           (
-               tadjusted.ref(),
-               geometryTransform_.R(),
-               tadjusted()
-           );
+            Foam::transform
+            (
+                tadjusted.ref(),
+                geometryTransform_.R(),
+                tadjusted()
+            );
         }
     }
 
diff --git a/src/surfMesh/writers/common/surfaceWriter.C b/src/surfMesh/writers/common/surfaceWriter.C
index 6658e542c93..59e6285427d 100644
--- a/src/surfMesh/writers/common/surfaceWriter.C
+++ b/src/surfMesh/writers/common/surfaceWriter.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2024 OpenCFD Ltd.
+    Copyright (C) 2019-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -652,7 +652,11 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::adjustFieldTemplate
 
     // Output scaling for the variable, but not for integer types
     // which are typically ids etc.
-    if (!std::is_integral<Type>::value)
+    if constexpr (std::is_integral_v<Type>)
+    {
+        return tfield;
+    }
+    else
     {
         scalar value;
 
@@ -667,9 +671,13 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::adjustFieldTemplate
             // or automatically scale by 1/sqrt(nComponents) instead ...
 
             Type refLevel;
-            for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
+            if constexpr (is_vectorspace_v<Type>)
             {
-                setComponent(refLevel, cmpt) = value;
+                refLevel.fill(value);
+            }
+            else
+            {
+                refLevel = value;
             }
 
             if (verbose_)
@@ -708,14 +716,13 @@ Foam::tmp<Foam::Field<Type>> Foam::surfaceWriter::adjustFieldTemplate
             // Apply scaling
             tadjusted.ref() *= value;
         }
+    }
 
-        // Rotate fields (vector and non-spherical tensors)
-        if
-        (
-            (is_vectorspace<Type>::value && pTraits<Type>::nComponents > 1)
-         && geometryTransform_.good()
-         && !geometryTransform_.R().is_identity()
-        )
+
+    // Rotate fields (vector and non-spherical tensors)
+    if constexpr (is_rotational_vectorspace_v<Type>)
+    {
+        if (geometryTransform_.good() && !geometryTransform_.R().is_identity())
         {
             if (!tadjusted)
             {
diff --git a/src/surfMesh/writers/nastran/nastranSurfaceWriterImpl.C b/src/surfMesh/writers/nastran/nastranSurfaceWriterImpl.C
index f534d915c7f..47194792fd5 100644
--- a/src/surfMesh/writers/nastran/nastranSurfaceWriterImpl.C
+++ b/src/surfMesh/writers/nastran/nastranSurfaceWriterImpl.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2012-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2022 OpenCFD Ltd.
+    Copyright (C) 2015-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -103,7 +103,7 @@ Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
     {
         case loadFormat::PLOAD2 :
         {
-            if (pTraits<Type>::nComponents > 1)
+            if constexpr (pTraits_nComponents<Type>::value > 1)
             {
                 writeValue(os, Foam::mag(value));
             }
@@ -162,11 +162,11 @@ Foam::fileName Foam::surfaceWriters::nastranWriter::writeTemplate
     // Default is PLOAD2
     loadFormat format = loadFormat::PLOAD2;
 
-    if
-    (
-        !std::is_integral<Type>::value  // Handle 'Ids' etc silently
-     && !pload4_.empty()
-    )
+    if constexpr (std::is_integral_v<Type>)
+    {
+        // Handle 'Ids' etc silently
+    }
+    else if (!pload4_.empty())
     {
         const wordRes::filter matcher(pload4_, pload2_);
 
-- 
GitLab