From 8eb7b4a07033dcdc0c27f6513f312c2c12eb75c0 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 13 May 2025 15:06:23 +0200
Subject: [PATCH] ENH: extend GeoMesh interface to include boundary_size()
 static method

- can be used to pre-allocate space for internal+boundary field for
  flat addressing (issue #3364).

  For example:

      DynamicField<Type> fld
      (
          std::pair<label,label>
          (
              GeoMesh::size(mesh),
              GeoMesh::size(mesh)
            + (extra ? GeoMesh::boundary_size(mesh) : label(0))
          )
      );

ENH: extend polyBoundaryMesh patch selectors

- indices_if() method with a predicate, or with a patch-type
  behaves similarly to findPatchIDs(), but returns a sorted
  labelList instead of a labelHashSet

- nFaces_if() method with a predicate return the number of boundary
  faces for patches matching the given predicate.
---
 src/OpenFOAM/meshes/GeoMesh/GeoMesh.H         |  7 +-
 src/OpenFOAM/meshes/pointMesh/pointMesh.H     | 18 ++++-
 .../polyBoundaryMesh/polyBoundaryMesh.H       | 20 ++++-
 .../polyBoundaryMesh/polyBoundaryMesh.txx     | 81 ++++++++++++++++++-
 src/finiteArea/areaMesh/areaFaMesh.H          | 31 +++++--
 src/finiteArea/edgeMesh/edgeFaMesh.H          | 33 ++++++--
 src/finiteVolume/surfaceMesh/surfaceMesh.H    | 28 +++++--
 src/finiteVolume/volMesh/volMesh.H            | 31 ++++---
 src/meshTools/fields/volume/polyGeoMesh.H     | 24 ++++--
 .../polySurface/fields/polySurfaceGeoMesh.H   | 22 +++--
 .../fields/polySurfacePointGeoMesh.H          | 22 +++--
 src/surfMesh/surfMesh/fields/surfGeoMesh.H    | 22 +++--
 .../surfMesh/fields/surfPointGeoMesh.H        | 22 +++--
 .../triSurface/fields/triSurfaceGeoMesh.H     | 22 +++--
 .../fields/triSurfacePointGeoMesh.H           | 22 +++--
 15 files changed, 328 insertions(+), 77 deletions(-)

diff --git a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H
index 21f0377d1f9..9845e9dd861 100644
--- a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H
+++ b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H
@@ -29,10 +29,13 @@ Class
 Description
     Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
 
+    Derived classes are typically expected to implement the static methods
+    size() and boundary_size().
+
 \*---------------------------------------------------------------------------*/
 
-#ifndef GeoMesh_H
-#define GeoMesh_H
+#ifndef Foam_GeoMesh_H
+#define Foam_GeoMesh_H
 
 #include "objectRegistry.H"
 
diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H
index 8aaeb4f698c..0634da54366 100644
--- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H
+++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H
@@ -121,15 +121,27 @@ public:
     ~pointMesh() = default;
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
+        //- The geometric (internal) size - number of mesh points.
+        //  Method name expected by GeoMesh interface
         static label size(const Mesh& mesh)
         {
             return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not implemented.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const Mesh& mesh)
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(*this);
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
index 80af040dc7a..4c19f6362de 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
@@ -244,6 +244,11 @@ public:
         //  Same as polyMesh::nBoundaryFaces()
         label nFaces() const noexcept;
 
+        //- The number of boundary faces with patches that match the
+        //- given predicate.
+        template<class UnaryPredicate>
+        label nFaces_if(UnaryPredicate pred) const;
+
         //- The face range for all boundary faces
         //  Spans [nInternalFaces, nFaces) of the underlying mesh
         labelRange range() const noexcept;
@@ -284,6 +289,17 @@ public:
             const bool useGroups = true
         ) const;
 
+        //- Return (sorted) patch indices for patches that match the
+        //- given polyPatch type (uses \c isA test).
+        //- Can be used as a direct alternative to findPatchIDs
+        template<class PatchType>
+        labelList indices_if() const;
+
+        //- Return (sorted) patch indices for patches that match the
+        //- given predicate. Can be used as an alternative to findPatchIDs
+        template<class UnaryPredicate>
+        labelList indices_if(UnaryPredicate pred) const;
+
         //- Return patch index for the first match, return -1 if not found
         //  A no-op (returns -1) for an empty key
         label findIndex(const wordRe& key) const;
@@ -296,8 +312,8 @@ public:
             const bool allowNotFound = true
         ) const;
 
-        //- Find patch indices for a given polyPatch type
-        template<class Type>
+        //- Find patch indices for a given polyPatch type (uses \c isA test).
+        template<class PatchType>
         labelHashSet findPatchIDs() const;
 
         //- Lookup mesh face index and return (patchi, patchFacei) tuple
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.txx b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.txx
index 18ce94f997b..b15aab25d35 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.txx
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.txx
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2013-2016 OpenFOAM Foundation
+    Copyright (C) 2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -27,20 +28,92 @@ License
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template<class Type>
+template<class UnaryPredicate>
+Foam::label Foam::polyBoundaryMesh::nFaces_if(UnaryPredicate pred) const
+{
+    const polyBoundaryMesh& patches = *this;
+
+    label count = 0;
+
+    for (const polyPatch& pp : patches)
+    {
+        if (pred(pp))
+        {
+            count += pp.size();
+        }
+    }
+
+    return count;
+}
+
+
+template<class UnaryPredicate>
+Foam::labelList Foam::polyBoundaryMesh::indices_if(UnaryPredicate pred) const
+{
+    const polyBoundaryMesh& patches = *this;
+    const label total = patches.size();
+
+    labelList patchIDs(total);
+
+    label count = 0;
+
+    for (label patchi = 0; patchi < total; ++patchi)
+    {
+        if (pred(patches[patchi]))
+        {
+            patchIDs[count] = patchi;
+            ++count;
+        }
+    }
+
+    patchIDs.resize(count);
+
+    return patchIDs;
+}
+
+
+template<class PatchType>
+Foam::labelList Foam::polyBoundaryMesh::indices_if() const
+{
+    const polyBoundaryMesh& patches = *this;
+    const label total = patches.size();
+
+    labelList patchIDs(total);
+
+    label count = 0;
+
+    for (label patchi = 0; patchi < total; ++patchi)
+    {
+        if (isA<PatchType>(patches[patchi]))
+        {
+            patchIDs[count] = patchi;
+            ++count;
+        }
+    }
+
+    patchIDs.resize(count);
+
+    return patchIDs;
+}
+
+
+template<class PatchType>
 Foam::labelHashSet Foam::polyBoundaryMesh::findPatchIDs() const
 {
     const polyBoundaryMesh& patches = *this;
+    const label total = patches.size();
 
-    labelHashSet patchIDs(patches.size());
+    labelHashSet patchIDs;
+    patchIDs.reserve(total);
 
-    forAll(patches, patchi)
+    for (label patchi = 0; patchi < total; ++patchi)
     {
-        if (isA<Type>(patches[patchi]))
+        if (isA<PatchType>(patches[patchi]))
         {
             patchIDs.insert(patchi);
         }
     }
+
     return patchIDs;
 }
 
diff --git a/src/finiteArea/areaMesh/areaFaMesh.H b/src/finiteArea/areaMesh/areaFaMesh.H
index 039a574c7c1..35ceba46c84 100644
--- a/src/finiteArea/areaMesh/areaFaMesh.H
+++ b/src/finiteArea/areaMesh/areaFaMesh.H
@@ -36,8 +36,8 @@ Author
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef areaFaMesh_H
-#define areaFaMesh_H
+#ifndef Foam_areaFaMesh_H
+#define Foam_areaFaMesh_H
 
 #include "GeoMesh.H"
 #include "faMesh.H"
@@ -66,13 +66,32 @@ public:
         {}
 
 
+    // Static Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const faMesh& mesh) noexcept
+        {
+            return mesh.nFaces();
+        }
+
+        //- The geometric boundary size - number of boundary edges.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const faMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryEdges();
+        }
+
+
     // Member Functions
 
-        //- Return size. Number of faces
-        static label size(const Mesh& mesh) { return mesh.nFaces(); }
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
+        {
+            return size(mesh_);
+        }
 
-        //- Return size. Number of faces
-        label size() const { return size(mesh_); }
 
         //- Field of face centres
         const areaVectorField& C() const { return mesh_.areaCentres(); }
diff --git a/src/finiteArea/edgeMesh/edgeFaMesh.H b/src/finiteArea/edgeMesh/edgeFaMesh.H
index 214af6a9c74..e4a298a83db 100644
--- a/src/finiteArea/edgeMesh/edgeFaMesh.H
+++ b/src/finiteArea/edgeMesh/edgeFaMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016-2017 Wikki Ltd
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -36,8 +36,8 @@ Author
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef edgeFaMesh_H
-#define edgeFaMesh_H
+#ifndef Foam_edgeFaMesh_H
+#define Foam_edgeFaMesh_H
 
 #include "GeoMesh.H"
 #include "faMesh.H"
@@ -66,13 +66,32 @@ public:
         {}
 
 
+    // Static Functions
+
+        //- The geometric (internal) size - number of internal edges.
+        //  Method name expected by GeoMesh interface
+        static label size(const faMesh& mesh) noexcept
+        {
+            return mesh.nInternalEdges();
+        }
+
+        //- The geometric boundary size - number of boundary edges.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const faMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryEdges();
+        }
+
+
     // Member Functions
 
-        //- Return size. Number of internal edges
-        static label size(const Mesh& mesh) { return mesh.nInternalEdges(); }
+        //- The geometric (internal) size - number of internal edges.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
+        {
+            return size(mesh_);
+        }
 
-        //- Return size. Number of internal edges
-        label size() const { return size(mesh_); }
 
         //- Field of edge centres
         const edgeVectorField& C() const { return mesh_.edgeCentres(); }
diff --git a/src/finiteVolume/surfaceMesh/surfaceMesh.H b/src/finiteVolume/surfaceMesh/surfaceMesh.H
index b82d2ac9822..19399a0ba9e 100644
--- a/src/finiteVolume/surfaceMesh/surfaceMesh.H
+++ b/src/finiteVolume/surfaceMesh/surfaceMesh.H
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -31,8 +32,8 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef surfaceMesh_H
-#define surfaceMesh_H
+#ifndef Foam_surfaceMesh_H
+#define Foam_surfaceMesh_H
 
 #include "GeoMesh.H"
 #include "fvMesh.H"
@@ -62,20 +63,33 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of internal faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of internal faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const polyMesh& mesh) noexcept
         {
             return mesh.nInternalFaces();
         }
 
-        //- Return size. Number of internal faces
-        label size() const
+        //- The geometric boundary size - number of boundary faces.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polyMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryFaces();
+        }
+
+
+    // Member Functions
+
+        //- The geometric mesh size - number of internal faces.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
         {
             return size(mesh_);
         }
 
+
         //- Field of face centres
         const surfaceVectorField& C() const
         {
diff --git a/src/finiteVolume/volMesh/volMesh.H b/src/finiteVolume/volMesh/volMesh.H
index cde07521f37..df014a7f7e0 100644
--- a/src/finiteVolume/volMesh/volMesh.H
+++ b/src/finiteVolume/volMesh/volMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -32,13 +32,12 @@ Description
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef volMesh_H
-#define volMesh_H
+#ifndef Foam_volMesh_H
+#define Foam_volMesh_H
 
 #include "GeoMesh.H"
 #include "fvMesh.H"
 #include "primitiveMesh.H"
-#include <type_traits>
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -57,23 +56,35 @@ public:
 
     // Constructors
 
-        //- Construct from fvMesh
+        //- Construct from fvMesh reference
         explicit volMesh(const fvMesh& mesh)
         :
             GeoMesh<fvMesh>(mesh)
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of cells
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        static label size(const polyMesh& mesh) noexcept
         {
             return mesh.nCells();
         }
 
-        //- Return size. Number of cells
-        label size() const
+        //- The geometric boundary size - number of boundary faces.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polyMesh& mesh) noexcept
+        {
+            return mesh.nBoundaryFaces();
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
         {
             return size(mesh_);
         }
diff --git a/src/meshTools/fields/volume/polyGeoMesh.H b/src/meshTools/fields/volume/polyGeoMesh.H
index dd7e5c483a7..42c7213272a 100644
--- a/src/meshTools/fields/volume/polyGeoMesh.H
+++ b/src/meshTools/fields/volume/polyGeoMesh.H
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2021 OpenCFD Ltd.
+    Copyright (C) 2018-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -61,16 +61,28 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of cells
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        static label size(const polyMesh& mesh) noexcept
         {
             return mesh.nCells();
         }
 
-        //- Return size. Number of cells
-        label size() const
+        //- The geometric boundary size - not used (internal fields only).
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polyMesh& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) mesh size - number of cells.
+        //  Method name expected by GeoMesh interface
+        label size() const noexcept
         {
             return size(mesh_);
         }
diff --git a/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H b/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H
index 9adff973152..7cdc501d4d0 100644
--- a/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.H
+++ b/src/surfMesh/polySurface/fields/polySurfaceGeoMesh.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.
@@ -61,15 +61,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const polySurface& mesh)
         {
             return mesh.nFaces();
         }
 
-        //- Return size. Number of faces
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polySurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H b/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H
index 8ccca1e11a3..d5cd53625e9 100644
--- a/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.H
+++ b/src/surfMesh/polySurface/fields/polySurfacePointGeoMesh.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.
@@ -61,15 +61,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
+        static label size(const polySurface& mesh)
         {
             return mesh.nPoints();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const polySurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/surfMesh/fields/surfGeoMesh.H b/src/surfMesh/surfMesh/fields/surfGeoMesh.H
index 4d4dd20d876..75e94b62dd3 100644
--- a/src/surfMesh/surfMesh/fields/surfGeoMesh.H
+++ b/src/surfMesh/surfMesh/fields/surfGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021-2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -62,15 +62,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const surfMesh& mesh)
         {
             return mesh.nFaces();
         }
 
-        //- Return size. Number of faces
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const surfMesh& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H b/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H
index 6a152d3fe72..6e00f61c3b0 100644
--- a/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H
+++ b/src/surfMesh/surfMesh/fields/surfPointGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -64,15 +64,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
+        static label size(const surfMesh& mesh)
         {
             return mesh.nPoints();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const surfMesh& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H b/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H
index e2688a39f10..9cfba9d3421 100644
--- a/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H
+++ b/src/surfMesh/triSurface/fields/triSurfaceGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,15 +60,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Numer of faces
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
+        static label size(const triSurface& mesh)
         {
             return mesh.size();
         }
 
-        //- Return size. Numer of faces
+        //- The geometric boundary size - not used.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const triSurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of faces.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
diff --git a/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H b/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H
index 031ff5fb56b..5ffd6fa6898 100644
--- a/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H
+++ b/src/surfMesh/triSurface/fields/triSurfacePointGeoMesh.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2021 OpenCFD Ltd.
+    Copyright (C) 2021,2025 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,15 +60,27 @@ public:
         {}
 
 
-    // Member Functions
+    // Static Functions
 
-        //- Return size. Number of points
-        static label size(const Mesh& mesh)
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
+        static label size(const triSurface& mesh)
         {
             return mesh.points().size();
         }
 
-        //- Return size. Number of points
+        //- The geometric boundary size - not applicable.
+        //  Method name expected by GeoMesh interface
+        static label boundary_size(const triSurface& mesh) noexcept
+        {
+            return 0;
+        }
+
+
+    // Member Functions
+
+        //- The geometric (internal) size - number of points.
+        //  Method name expected by GeoMesh interface
         label size() const
         {
             return size(mesh_);
-- 
GitLab