diff --git a/applications/test/contiguous/Make/files b/applications/test/contiguous/Make/files
index 56a409b24f..3f17831424 100644
--- a/applications/test/contiguous/Make/files
+++ b/applications/test/contiguous/Make/files
@@ -1,3 +1,3 @@
-Test-contiguous.C
+Test-contiguous.cxx
EXE = $(FOAM_USER_APPBIN)/Test-contiguous
diff --git a/applications/test/contiguous/Test-contiguous.C b/applications/test/contiguous/Test-contiguous.cxx
similarity index 100%
rename from applications/test/contiguous/Test-contiguous.C
rename to applications/test/contiguous/Test-contiguous.cxx
diff --git a/applications/test/memoryPool1/Make/files b/applications/test/memoryPool1/Make/files
new file mode 100644
index 0000000000..200520b0ad
--- /dev/null
+++ b/applications/test/memoryPool1/Make/files
@@ -0,0 +1,3 @@
+Test-memoryPool1.cxx
+
+EXE = $(FOAM_USER_APPBIN)/Test-memoryPool1
diff --git a/applications/test/memoryPool1/Make/options b/applications/test/memoryPool1/Make/options
new file mode 100644
index 0000000000..18e6fe47af
--- /dev/null
+++ b/applications/test/memoryPool1/Make/options
@@ -0,0 +1,2 @@
+/* EXE_INC = */
+/* EXE_LIBS = */
diff --git a/applications/test/memoryPool1/Test-memoryPool1.cxx b/applications/test/memoryPool1/Test-memoryPool1.cxx
new file mode 100644
index 0000000000..74bf128e1e
--- /dev/null
+++ b/applications/test/memoryPool1/Test-memoryPool1.cxx
@@ -0,0 +1,252 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2025 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "argList.H"
+#include "IOstreams.H"
+
+// Enable/disable based on header
+#ifdef Foam_MemoryPool_H
+#define FOAM_HAS_MEMORY_POOL
+#else
+#undef FOAM_HAS_MEMORY_POOL
+#endif
+
+// options
+int min_align_size = 5;
+int min_pool_size = 10;
+bool use_aligned_alloc(true);
+bool use_aligned_dealloc(true);
+
+//- True if size exceeds the min-size for using memory alignment
+template
+inline bool use_alignment(IntType n) noexcept
+{
+ return (n >= min_align_size);
+}
+
+
+//- True if size exceeds the min-size for using the memory pool
+template
+inline bool use_memory_pool(IntType n) noexcept
+{
+ return (n >= IntType(min_pool_size));
+}
+
+
+//- Default alignment
+inline constexpr std::align_val_t default_alignment() noexcept
+{
+ return std::align_val_t(64);
+}
+
+
+//- Allocate from memory pool (if active) or aligned/normal
+template
+inline T* my_allocate(IntType n)
+{
+ std::cerr<< "my_allocate(" << n << ")\n";
+
+ if (use_aligned_alloc && use_alignment(n))
+ {
+ #ifdef FOAM_HAS_MEMORY_POOL
+ if
+ (
+ void *pool_ptr
+ (
+ // Consider memory pool for large amounts of data
+ use_memory_pool(n)
+ ? Foam::MemoryPool::try_allocate(sizeof(T)*n)
+ : nullptr
+ );
+ pool_ptr
+ )
+ {
+ // Placement new
+ return new (pool_ptr) T[n];
+ }
+ else
+ #endif
+ {
+ return new (default_alignment()) T[n];
+ }
+ }
+ else
+ {
+ // Plain new
+ return new T[n];
+ }
+}
+
+
+//- Deallocate from memory pool or normal
+template
+inline void my_deallocate(T* ptr)
+{
+ std::cerr<< "my_deallocate() : " << Foam::name(ptr) << '\n';
+
+ #ifdef FOAM_HAS_MEMORY_POOL
+ if
+ (
+ ptr && !Foam::MemoryPool::try_deallocate(ptr)
+ )
+ #endif
+ {
+ // Plain new
+ delete[] ptr;
+ }
+}
+
+
+//- Deallocate from memory pool or aligned/normal
+template
+inline void my_deallocate(T* ptr, IntType n)
+{
+ std::cerr<< "my_deallocate(" << n << ") : " << Foam::name(ptr) << '\n';
+
+ if (use_aligned_dealloc && use_alignment(n))
+ {
+ if
+ (
+ #ifdef FOAM_HAS_MEMORY_POOL
+ ptr && !Foam::MemoryPool::try_deallocate(ptr)
+ #else
+ ptr
+ #endif
+ )
+ {
+ ::operator delete[](ptr, default_alignment());
+ }
+ }
+ else
+ {
+ // Plain new
+ delete[] ptr;
+ }
+}
+
+
+using namespace Foam;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Main program:
+
+int main(int argc, char *argv[])
+{
+ argList::noCheckProcessorDirectories();
+ argList::addOption
+ (
+ "min-align",
+ "INT",
+ "Min number of elements for memory alignment (default: 5)"
+ );
+ argList::addOption
+ (
+ "min-pool",
+ "INT",
+ "Min number of elements for using memory pool (default: 10)"
+ );
+ argList::addOption
+ (
+ "count",
+ "INT",
+ "Number of elements to test (default: 10)"
+ );
+ argList::addBoolOption
+ (
+ "no-align",
+ "Disable aligned alloc/dealloc"
+ );
+ argList::addBoolOption
+ (
+ "no-align-alloc",
+ "Disable aligned alloc (default: false)"
+ );
+ argList::addBoolOption
+ (
+ "no-align-dealloc",
+ "Disable aligned dealloc (default: false)"
+ );
+
+ #include "setRootCase.H"
+
+ label count(10);
+
+ args.readIfPresent("count", count);
+ args.readIfPresent("min-align", min_align_size);
+ args.readIfPresent("min-pool", min_pool_size);
+
+ if (min_pool_size < min_align_size)
+ {
+ min_pool_size = min_align_size;
+ }
+
+ if (args.found("no-align"))
+ {
+ use_aligned_alloc = false;
+ use_aligned_dealloc = false;
+ }
+ else
+ {
+ use_aligned_alloc = !args.found("no-align-alloc");
+ use_aligned_dealloc = !args.found("no-align-dealloc");
+ }
+
+
+ Info<< "Testing with " << count << " elements" << nl
+ << "min-align: " << int(min_align_size) << " elements" << nl
+ #ifdef FOAM_HAS_MEMORY_POOL
+ << "min-pool: " << int(min_pool_size)
+ << " elements, active:" << MemoryPool::active() << nl
+ #endif
+ << "alignment: " << int(default_alignment()) << " bytes" << nl
+ << nl;
+
+ {
+ using T = double;
+ label len = count;
+
+ UList list(my_allocate(len), len);
+
+ Info<< "List ptr: " << Foam::name(list.data()) << nl;
+
+ list = 1.234;
+
+ Info<< "List: " << list << nl;
+
+ my_deallocate(list.data(), len);
+
+ list = UList();
+
+ my_deallocate(list.data());
+ my_deallocate(list.data(), len);
+ }
+
+ return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C
index 45115f1715..1e6f6358a3 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C
@@ -193,7 +193,7 @@ Foam::List Foam::bodyCentredCubic::initialPoints() const
}
}
- return initialPoints.shrink();
+ return List(std::move(initialPoints));
}
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C
index 6f30ab9daf..4ad6644321 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C
@@ -254,7 +254,7 @@ Foam::List Foam::faceCentredCubic::initialPoints() const
}
}
- return initialPoints.shrink();
+ return List(std::move(initialPoints));
}
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C
index 5a1c358456..3b47f25e98 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C
@@ -272,7 +272,7 @@ Foam::List Foam::rayShooting::initialPoints() const
}
}
- return initialPoints.shrink();
+ return List(std::move(initialPoints));
}
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C
index b7c04ad5b2..9745ba62c2 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C
@@ -173,7 +173,7 @@ Foam::List Foam::uniformGrid::initialPoints() const
}
}
- return initialPoints.shrink();
+ return List(std::move(initialPoints));
}
diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
index 232acc23be..01f2d864c1 100644
--- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
+++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
@@ -256,7 +256,7 @@ labelList getNonRegionCells(const labelList& cellRegion, const label regionI)
nonRegionCells.append(celli);
}
}
- return nonRegionCells.shrink();
+ return labelList(std::move(nonRegionCells));
}
diff --git a/src/OpenFOAM/containers/Buffers/CircularBufferIO.C b/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
index 18dbe29db5..614b3b030f 100644
--- a/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
+++ b/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
@@ -27,7 +27,6 @@ License
#include "DynamicList.H"
#include "Istream.H"
-#include "contiguous.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
index 620cd63ced..4e55953f4f 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
@@ -29,7 +29,6 @@ License
#include "IndirectListBase.H"
#include "Ostream.H"
#include "token.H"
-#include "contiguous.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C
index 63e9cf3561..e71a8e51a4 100644
--- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C
+++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListIO.C
@@ -28,8 +28,6 @@ License
#include "List.H"
#include "Istream.H"
#include "token.H"
-#include "contiguous.H"
-#include
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
index 8d8d818b95..0654aed5e9 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
@@ -44,17 +44,13 @@ SourceFiles
#include "label.H"
#include "uLabel.H"
#include "zero.H"
-#include "contiguous.H"
#include "stdFoam.H"
#include "nullObject.H"
#include "Hash.H"
-#include "ListPolicy.H"
+#include "ListPolicy.H" // Also includes "contiguous"
#include "autoPtr.H"
-// already included by stdFoam.H
-#include
#include
-#include
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C
index c9707ef29b..fa1e680e9c 100644
--- a/src/OpenFOAM/containers/Lists/List/List.C
+++ b/src/OpenFOAM/containers/Lists/List/List.C
@@ -29,7 +29,6 @@ License
#include "List.H"
#include "FixedList.H"
#include "PtrList.H"
-#include "contiguous.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@@ -42,7 +41,7 @@ void Foam::List::resize_copy(const label count, const label len)
if (FOAM_LIKELY(len > 0))
{
// With sign-check to avoid spurious -Walloc-size-larger-than
- // const label oldLen = this->size_;
+ const label oldLen = this->size_;
const label overlap = Foam::min(count, len);
// Extra safety, not currently necessary:
// const label overlap = Foam::min(Foam::min(count, oldLen), len);
@@ -54,22 +53,22 @@ void Foam::List::resize_copy(const label count, const label len)
// Recover overlapping content when resizing
this->size_ = len;
- this->v_ = new T[len];
+ this->v_ = ListPolicy::allocate(len);
// Can dispatch with
// - std::execution::par_unseq
// - std::execution::unseq
std::move(old, (old + overlap), this->v_);
- delete[] old;
+ ListPolicy::deallocate(old, oldLen);
}
else
{
// No overlapping content
- delete[] old;
+ ListPolicy::deallocate(old, oldLen);
this->size_ = len;
- this->v_ = new T[len];
+ this->v_ = ListPolicy::allocate(len);
}
}
else
@@ -152,7 +151,7 @@ Foam::List::List(const label len, Foam::zero)
template
Foam::List::List(Foam::one, const T& val)
:
- UList(new T[1], 1)
+ UList(ListPolicy::allocate(1), 1)
{
this->v_[0] = val;
}
@@ -161,7 +160,7 @@ Foam::List::List(Foam::one, const T& val)
template
Foam::List::List(Foam::one, T&& val)
:
- UList(new T[1], 1)
+ UList(ListPolicy::allocate(1), 1)
{
this->v_[0] = std::move(val);
}
@@ -170,9 +169,9 @@ Foam::List::List(Foam::one, T&& val)
template
Foam::List::List(Foam::one, Foam::zero)
:
- UList(new T[1], 1)
+ UList(ListPolicy::allocate(1), 1)
{
- this->v_[0] = Zero;
+ this->v_[0] = Foam::zero{};
}
@@ -311,7 +310,8 @@ Foam::List::List(DynamicList&& list)
template
Foam::List::~List()
{
- delete[] this->v_;
+ //TODO? May need to verify that size is accurate (for correct alignment)
+ ListPolicy::deallocate(this->v_, this->size_);
}
diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H
index 228df08392..b8d292950b 100644
--- a/src/OpenFOAM/containers/Lists/List/ListI.H
+++ b/src/OpenFOAM/containers/Lists/List/ListI.H
@@ -34,7 +34,7 @@ inline void Foam::List::doAlloc()
if (this->size_ > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
- this->v_ = new T[this->size_];
+ this->v_ = ListPolicy::allocate(this->size_);
}
}
@@ -136,11 +136,8 @@ inline Foam::autoPtr> Foam::List::clone() const
template
inline void Foam::List::clear()
{
- if (this->v_)
- {
- delete[] this->v_;
- this->v_ = nullptr;
- }
+ ListPolicy::deallocate(this->v_, this->size_);
+ this->v_ = nullptr;
this->size_ = 0;
}
diff --git a/src/OpenFOAM/containers/Lists/List/ListIO.C b/src/OpenFOAM/containers/Lists/List/ListIO.C
index b5c7ebfc43..130da8a748 100644
--- a/src/OpenFOAM/containers/Lists/List/ListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/ListIO.C
@@ -29,8 +29,6 @@ License
#include "List.H"
#include "Istream.H"
#include "token.H"
-#include "contiguous.H"
-#include
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/List/UList.C b/src/OpenFOAM/containers/Lists/List/UList.C
index 4fcc176e0a..d2b0cb67b3 100644
--- a/src/OpenFOAM/containers/Lists/List/UList.C
+++ b/src/OpenFOAM/containers/Lists/List/UList.C
@@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/
#include "UList.H"
-#include "contiguous.H"
#include "labelRange.H"
#include
diff --git a/src/OpenFOAM/containers/Lists/List/UList.H b/src/OpenFOAM/containers/Lists/List/UList.H
index 0c54fe8a59..a446eca351 100644
--- a/src/OpenFOAM/containers/Lists/List/UList.H
+++ b/src/OpenFOAM/containers/Lists/List/UList.H
@@ -50,13 +50,11 @@ SourceFiles
#include "uLabel.H"
#include "zero.H"
#include "one.H"
-#include "contiguous.H"
#include "stdFoam.H"
#include "nullObject.H"
#include "Hash.H"
-#include "ListPolicy.H"
+#include "ListPolicy.H" // Also includes "contiguous"
-#include
#include // i.e, std::vector
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/List/UListIO.C b/src/OpenFOAM/containers/Lists/List/UListIO.C
index bd85943a7f..e4e59bc3d5 100644
--- a/src/OpenFOAM/containers/Lists/List/UListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/UListIO.C
@@ -29,7 +29,6 @@ License
#include "UList.H"
#include "Ostream.H"
#include "token.H"
-#include "contiguous.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/policy/ListPolicy.H b/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
index ed81c10d8f..b7289be8fe 100644
--- a/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
+++ b/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
@@ -34,7 +34,7 @@ Description
#ifndef Foam_ListPolicy_H
#define Foam_ListPolicy_H
-#include
+#include "contiguous.H" // Also includes
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -86,12 +86,96 @@ template<> struct no_linebreak : std::true_type {};
template<> struct no_linebreak : std::true_type {};
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+//
+// Memory allocation/deallocation handling - primarily used by List and Matrix
+//
+// - is_aligned_type() :
+// Defines which types may be aligned
+//
+// - use_alignment(n) :
+// Lower threshold for using memory alignment
+//
+// - use_memory_pool(n) :
+// Lower threshold for using a memory pool.
+// Must be larger than use_alignment() value.
+//
+// - use_offload(n) :
+// Lower threshold for switching to device offloading
+//
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//- Calculate a reserve size (eg, doubling) based on the request length
+//- Consider aligned allocation for the given type?
+// Benefits for field data (floating-point, ints, vectorspace),
+// but avoid for char data, strings, pointers etc
+template
+inline constexpr bool is_aligned_type() noexcept
+{
+ return
+ (
+ !std::is_enum_v
+ && !std::is_pointer_v
+ && !std::is_union_v
+ && (sizeof(T) >= 4) // skip small data (eg, char)
+ && is_contiguous_v
+ );
+}
+
+
+//- True if size exceeds the min-size for using memory alignment
+template
+inline constexpr bool use_alignment(IntType n) noexcept
+{
+ return (n >= IntType(200));
+}
+
+
+//- True if size exceeds the min-size for using the memory pool
+template
+inline constexpr bool use_memory_pool(IntType n) noexcept
+{
+ return (n >= IntType(3000));
+}
+
+
+//- True if size exceeds the min-size for offloading
+template
+inline constexpr bool use_offload(IntType n) noexcept
+{
+ return (n >= IntType(1000));
+}
+
+
+template
+inline T* allocate(IntType n)
+{
+ // Plain new
+ return new T[n];
+}
+
+
+template
+inline void deallocate(T* ptr)
+{
+ // Plain new
+ delete[] ptr;
+}
+
+
+template
+inline void deallocate(T* ptr, [[maybe_unused]] IntType n)
+{
+ // Plain new
+ delete[] ptr;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+//- Calculate a reserve size (eg, doubling) based on the requested length
//- and the current capacity
template
-inline IntType reserve_size(IntType requested, IntType capacity)
+inline IntType reserve_size(IntType requested, IntType capacity) noexcept
{
static_assert(Numerator > 1, "Invalid numerator");
@@ -114,10 +198,10 @@ inline IntType reserve_size(IntType requested, IntType capacity)
}
-//- Calculate a reserve size based on the request length
+//- Calculate a reserve size based on the requested length
//- and the current capacity
template
-inline IntType reserve_size(IntType requested, IntType capacity)
+inline IntType reserve_size(IntType requested, IntType capacity) noexcept
{
static_assert(Numerator > Denominator, "Invalid numerator");
static_assert(Denominator > 0, "Invalid denominator");
diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C
index 1b500ff6c9..1dd8d1be9d 100644
--- a/src/OpenFOAM/fields/Fields/Field/Field.C
+++ b/src/OpenFOAM/fields/Fields/Field/Field.C
@@ -29,7 +29,6 @@ License
#include "FieldMapper.H"
#include "FieldM.H"
#include "dictionary.H"
-#include "contiguous.H"
#include "mapDistributeBase.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C
index bb1251cf62..a1652c1e7d 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.C
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.C
@@ -244,7 +244,8 @@ inline Foam::Matrix