From ab783f0fe4554db8f541763353bb7528c6777ae6 Mon Sep 17 00:00:00 2001 From: David Bold Date: Mon, 6 Nov 2023 16:30:06 +0100 Subject: [PATCH 01/17] Make Field2d and Field3D more similar Useful for templates --- include/bout/field2d.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 92658f1bbf..3bafe3b116 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -133,8 +133,9 @@ public: return *this; } - /// Check if this field has yup and ydown fields + /// Dummy functions to increase portability bool hasParallelSlices() const { return true; } + void calcParallelSlices() const {} Field2D& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } const Field2D& yup(std::vector::size_type UNUSED(index) = 0) const { From fc2decea8723e1ac868796fd02c1a381754ac47b Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 27 Mar 2024 13:30:54 +0100 Subject: [PATCH 02/17] Add more dummy functions to field2d Allows to write code for Field3D, that also works for Field2D --- include/bout/field2d.hxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 3bafe3b116..6e82526bca 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -136,6 +136,8 @@ public: /// Dummy functions to increase portability bool hasParallelSlices() const { return true; } void calcParallelSlices() const {} + void clearParallelSlices() {} + int numberParallelSlices() { return 0; } Field2D& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } const Field2D& yup(std::vector::size_type UNUSED(index) = 0) const { @@ -275,7 +277,7 @@ public: friend void swap(Field2D& first, Field2D& second) noexcept; - int size() const override { return nx * ny; }; + int size() const override { return nx * ny; } private: /// Internal data array. Handles allocation/freeing of memory From 4d6873dba47411408f895117cba6d31ed34bb1c9 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 27 Sep 2024 11:05:33 +0200 Subject: [PATCH 03/17] Add dummy functions for FieldPerp --- include/bout/fieldperp.hxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/bout/fieldperp.hxx b/include/bout/fieldperp.hxx index 6995308dbe..ad069f0d01 100644 --- a/include/bout/fieldperp.hxx +++ b/include/bout/fieldperp.hxx @@ -157,6 +157,25 @@ public: return *this; } + /// Dummy functions to increase portability + bool hasParallelSlices() const { return true; } + void calcParallelSlices() const {} + void clearParallelSlices() {} + int numberParallelSlices() { return 0; } + + FieldPerp& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } + const FieldPerp& yup(std::vector::size_type UNUSED(index) = 0) const { + return *this; + } + + FieldPerp& ydown(std::vector::size_type UNUSED(index) = 0) { return *this; } + const FieldPerp& ydown(std::vector::size_type UNUSED(index) = 0) const { + return *this; + } + + FieldPerp& ynext(int UNUSED(dir)) { return *this; } + const FieldPerp& ynext(int UNUSED(dir)) const { return *this; } + /*! * Ensure that data array is allocated and unique */ From 3156681fdcd7bee3384a55ec3a3b98e0f2323744 Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 16 Oct 2024 10:27:20 +0200 Subject: [PATCH 04/17] add setRegion / getRegionID to all fields --- include/bout/field.hxx | 9 +++++++++ include/bout/field3d.hxx | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/bout/field.hxx b/include/bout/field.hxx index 4e41aa3632..d6af2be3c2 100644 --- a/include/bout/field.hxx +++ b/include/bout/field.hxx @@ -30,6 +30,9 @@ class Field; #define FIELD_H #include +#include +#include +#include #include #include "bout/bout_types.hxx" @@ -125,6 +128,12 @@ public: swap(first.directions, second.directions); } + virtual void setRegion(size_t UNUSED(regionID)) {} + virtual void setRegion(std::optional UNUSED(regionID)) {} + virtual void setRegion(const std::string& UNUSED(region_name)) {} + virtual void resetRegion() {} + virtual std::optional getRegionID() const { return {}; } + private: /// Labels for the type of coordinate system this field is defined over DirectionTypes directions{YDirectionType::Standard, ZDirectionType::Standard}; diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index fad4815b92..607cbb37c4 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -327,11 +327,11 @@ public: const Region& getRegion(const std::string& region_name) const; /// Use region provided by the default, and if none is set, use the provided one const Region& getValidRegionWithDefault(const std::string& region_name) const; - void setRegion(const std::string& region_name); - void resetRegion() { regionID.reset(); }; - void setRegion(size_t id) { regionID = id; }; - void setRegion(std::optional id) { regionID = id; }; - std::optional getRegionID() const { return regionID; }; + void setRegion(const std::string& region_name) override; + void resetRegion() override { regionID.reset(); }; + void setRegion(size_t id) override { regionID = id; }; + void setRegion(std::optional id) override { regionID = id; }; + std::optional getRegionID() const override { return regionID; }; /// Return a Region reference to use to iterate over the x- and /// y-indices of this field @@ -510,6 +510,8 @@ public: std::weak_ptr getTracking() { return tracking; }; + bool allowCalcParallelSlices{true}; + private: /// Array sizes (from fieldmesh). These are valid only if fieldmesh is not null int nx{-1}, ny{-1}, nz{-1}; From 160adb41523556bc93ad00c16975f871e65c7006 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 14 Mar 2025 15:38:24 +0100 Subject: [PATCH 05/17] Add Field2D::splitParallelSlices() for writing FCI aware code --- include/bout/field2d.hxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 6e82526bca..fca0dd3c3f 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -136,8 +136,9 @@ public: /// Dummy functions to increase portability bool hasParallelSlices() const { return true; } void calcParallelSlices() const {} - void clearParallelSlices() {} - int numberParallelSlices() { return 0; } + void splitParallelSlices() const {} + void clearParallelSlices() const {} + int numberParallelSlices() const { return 0; } Field2D& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } const Field2D& yup(std::vector::size_type UNUSED(index) = 0) const { From b043da35a828e689792ce7b9ab2c1f1eb13bc5c6 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 3 Mar 2026 13:50:15 +0100 Subject: [PATCH 06/17] Apply clang-tidy fixes --- include/bout/field.hxx | 2 +- include/bout/field3d.hxx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/bout/field.hxx b/include/bout/field.hxx index d6af2be3c2..141e47ce04 100644 --- a/include/bout/field.hxx +++ b/include/bout/field.hxx @@ -24,6 +24,7 @@ * */ +#include "bout/unused.hxx" class Field; #ifndef FIELD_H @@ -31,7 +32,6 @@ class Field; #include #include -#include #include #include diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index 607cbb37c4..b9e9fb66c6 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -20,6 +20,7 @@ * **************************************************************************/ +#include class Field3D; #pragma once From d37661b66bec5a50365537be4b92fcb59aab8649 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 3 Mar 2026 13:57:51 +0100 Subject: [PATCH 07/17] Move functions to field.hxx and make them virtual --- include/bout/field.hxx | 5 +++++ include/bout/field2d.hxx | 7 ------- include/bout/field3d.hxx | 13 ++++++++----- include/bout/fieldperp.hxx | 6 ------ 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/include/bout/field.hxx b/include/bout/field.hxx index 141e47ce04..bfae83cef0 100644 --- a/include/bout/field.hxx +++ b/include/bout/field.hxx @@ -128,11 +128,16 @@ public: swap(first.directions, second.directions); } + /// Dummy functions to increase portability virtual void setRegion(size_t UNUSED(regionID)) {} virtual void setRegion(std::optional UNUSED(regionID)) {} virtual void setRegion(const std::string& UNUSED(region_name)) {} virtual void resetRegion() {} virtual std::optional getRegionID() const { return {}; } + virtual bool hasParallelSlices() const { return true; } + virtual void calcParallelSlices() const {} + virtual void splitParallelSlices() const {} + virtual void clearParallelSlices() const {} private: /// Labels for the type of coordinate system this field is defined over diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index fca0dd3c3f..a13da6b92e 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -133,13 +133,6 @@ public: return *this; } - /// Dummy functions to increase portability - bool hasParallelSlices() const { return true; } - void calcParallelSlices() const {} - void splitParallelSlices() const {} - void clearParallelSlices() const {} - int numberParallelSlices() const { return 0; } - Field2D& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } const Field2D& yup(std::vector::size_type UNUSED(index) = 0) const { return *this; diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index b9e9fb66c6..9f46d25198 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -239,15 +239,15 @@ public: * Ensure that this field has separate fields * for yup and ydown. */ - void splitParallelSlices(); + void splitParallelSlices() override; /*! * Clear the parallel slices, yup and ydown */ - void clearParallelSlices(); + void clearParallelSlices() override; /// Check if this field has yup and ydown fields - bool hasParallelSlices() const { + bool hasParallelSlices() const override { #if CHECK > 2 if (yup_fields.size() != ydown_fields.size()) { throw BoutException( @@ -482,7 +482,7 @@ public: friend class Vector3D; friend class Vector2D; - Field3D& calcParallelSlices(); + void calcParallelSlices() override; void applyBoundary(bool init = false) override; void applyBoundary(BoutReal t); @@ -511,7 +511,8 @@ public: std::weak_ptr getTracking() { return tracking; }; - bool allowCalcParallelSlices{true}; + bool allowCalcParallelSlices() const { return _allowCalcParallelSlices; }; + void disallowCalcParallelSlices() { _allowCalcParallelSlices = false; }; private: /// Array sizes (from fieldmesh). These are valid only if fieldmesh is not null @@ -532,6 +533,8 @@ private: /// counter for tracking, to assign unique names to the variable names int tracking_state{0}; std::weak_ptr tracking; + + bool _allowCalcParallelSlices{true}; // name is changed if we assign to the variable, while selfname is a // non-changing copy that is used for the variable names in the dump files std::string selfname; diff --git a/include/bout/fieldperp.hxx b/include/bout/fieldperp.hxx index ad069f0d01..dcfb89f54c 100644 --- a/include/bout/fieldperp.hxx +++ b/include/bout/fieldperp.hxx @@ -157,12 +157,6 @@ public: return *this; } - /// Dummy functions to increase portability - bool hasParallelSlices() const { return true; } - void calcParallelSlices() const {} - void clearParallelSlices() {} - int numberParallelSlices() { return 0; } - FieldPerp& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } const FieldPerp& yup(std::vector::size_type UNUSED(index) = 0) const { return *this; From 48e78ec6d80d378b38d5ec15a7725447d3ed836c Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 3 Mar 2026 13:58:06 +0100 Subject: [PATCH 08/17] Apply fixes from clang-tidy --- include/bout/fieldperp.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/include/bout/fieldperp.hxx b/include/bout/fieldperp.hxx index dcfb89f54c..1f70089990 100644 --- a/include/bout/fieldperp.hxx +++ b/include/bout/fieldperp.hxx @@ -23,6 +23,7 @@ * **************************************************************************/ +#include class FieldPerp; #ifndef BOUT_FIELDPERP_H From b6b39d9d4a6f11e4fc8dbc70d48484aee3b2ada0 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 3 Mar 2026 14:06:52 +0100 Subject: [PATCH 09/17] The overrides are non-const --- include/bout/field.hxx | 6 +++--- src/field/field3d.cxx | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/bout/field.hxx b/include/bout/field.hxx index bfae83cef0..a5b9d1390b 100644 --- a/include/bout/field.hxx +++ b/include/bout/field.hxx @@ -135,9 +135,9 @@ public: virtual void resetRegion() {} virtual std::optional getRegionID() const { return {}; } virtual bool hasParallelSlices() const { return true; } - virtual void calcParallelSlices() const {} - virtual void splitParallelSlices() const {} - virtual void clearParallelSlices() const {} + virtual void calcParallelSlices() {} + virtual void splitParallelSlices() {} + virtual void clearParallelSlices() {} private: /// Labels for the type of coordinate system this field is defined over diff --git a/src/field/field3d.cxx b/src/field/field3d.cxx index 2cd55b0957..fe9fdc9263 100644 --- a/src/field/field3d.cxx +++ b/src/field/field3d.cxx @@ -341,9 +341,8 @@ Field3D& Field3D::operator=(const BoutReal val) { return *this; } -Field3D& Field3D::calcParallelSlices() { +void Field3D::calcParallelSlices() { getCoordinates()->getParallelTransform().calcParallelSlices(*this); - return *this; } ///////////////////// BOUNDARY CONDITIONS ////////////////// From ea2ea211079e43c547f828a016d1d398a88d3376 Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 4 Mar 2026 09:59:36 +0100 Subject: [PATCH 10/17] Switch to [[maybe_unused]] --- include/bout/field.hxx | 7 +++---- include/bout/field2d.hxx | 29 ++++++++++++++--------------- include/bout/field3d.hxx | 8 ++++---- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/include/bout/field.hxx b/include/bout/field.hxx index a5b9d1390b..3f7f591528 100644 --- a/include/bout/field.hxx +++ b/include/bout/field.hxx @@ -24,7 +24,6 @@ * */ -#include "bout/unused.hxx" class Field; #ifndef FIELD_H @@ -129,9 +128,9 @@ public: } /// Dummy functions to increase portability - virtual void setRegion(size_t UNUSED(regionID)) {} - virtual void setRegion(std::optional UNUSED(regionID)) {} - virtual void setRegion(const std::string& UNUSED(region_name)) {} + virtual void setRegion([[maybe_unused]] size_t regionID) {} + virtual void setRegion([[maybe_unused]] std::optional regionID) {} + virtual void setRegion([[maybe_unused]] const std::string& region_name) {} virtual void resetRegion() {} virtual std::optional getRegionID() const { return {}; } virtual bool hasParallelSlices() const { return true; } diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index a13da6b92e..97c4be2716 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -36,7 +36,6 @@ class Field2D; #include "bout/field_data.hxx" #include "bout/fieldperp.hxx" #include "bout/region.hxx" -#include "bout/unused.hxx" #if BOUT_HAS_RAJA #include "RAJA/RAJA.hpp" // using RAJA lib @@ -133,18 +132,18 @@ public: return *this; } - Field2D& yup(std::vector::size_type UNUSED(index) = 0) { return *this; } - const Field2D& yup(std::vector::size_type UNUSED(index) = 0) const { + Field2D& yup([[maybe_unused]] std::vector::size_type index = 0) { return *this; } + const Field2D& yup([[maybe_unused]] std::vector::size_type index = 0) const { return *this; } - Field2D& ydown(std::vector::size_type UNUSED(index) = 0) { return *this; } - const Field2D& ydown(std::vector::size_type UNUSED(index) = 0) const { + Field2D& ydown([[maybe_unused]] std::vector::size_type index = 0) { return *this; } + const Field2D& ydown([[maybe_unused]] std::vector::size_type index) = 0 const { return *this; } - Field2D& ynext(int UNUSED(dir)) { return *this; } - const Field2D& ynext(int UNUSED(dir)) const { return *this; } + Field2D& ynext([[maybe_unused]] int dir) { return *this; } + const Field2D& ynext([[maybe_unused]] int dir) const { return *this; } // Operators @@ -227,8 +226,8 @@ public: * DIrect access to underlying array. This version is for compatibility * with Field3D objects */ - BoutReal& operator()(int jx, int jy, int UNUSED(jz)) { return operator()(jx, jy); } - const BoutReal& operator()(int jx, int jy, int UNUSED(jz)) const { + BoutReal& operator()(int jx, int jy, [[maybe_unused]] int jz) { return operator()(jx, jy); } + const BoutReal& operator()(int jx, int jy, [[maybe_unused]] int jz) const { return operator()(jx, jy); } @@ -315,12 +314,12 @@ Field2D operator-(const Field2D& f); // Non-member functions inline Field2D toFieldAligned(const Field2D& f, - const std::string& UNUSED(region) = "RGN_ALL") { + [[maybe_unused]] const std::string& region = "RGN_ALL") { return f; } inline Field2D fromFieldAligned(const Field2D& f, - const std::string& UNUSED(region) = "RGN_ALL") { + [[maybe_unused]] const std::string& region = "RGN_ALL") { return f; } @@ -331,15 +330,15 @@ inline Field2D fromFieldAligned(const Field2D& f, /// default (can be changed using the \p rgn argument void checkData(const Field2D& f, const std::string& region = "RGN_NOBNDRY"); #else -inline void checkData(const Field2D& UNUSED(f), - std::string UNUSED(region) = "RGN_NOBNDRY") {} +inline void checkData([[maybe_unused]] const Field2D& f, + [[maybe_unused]] std::string region) = "RGN_NOBNDRY" {} #endif /// Force guard cells of passed field \p var to NaN #if CHECK > 2 void invalidateGuards(Field2D& var); #else -inline void invalidateGuards(Field2D& UNUSED(var)) {} +inline void invalidateGuards([[maybe_unused]] Field2D& var) {} #endif /// Average in the Z direction @@ -355,7 +354,7 @@ inline Field2D& ddt(Field2D& f) { return *(f.timeDeriv()); } /// toString template specialisation /// Defined in utils.hxx template <> -inline std::string toString<>(const Field2D& UNUSED(val)) { +inline std::string toString<>([[maybe_unused]] const Field2D& val) { return ""; } diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index 9f46d25198..8546a430ed 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -605,8 +605,8 @@ void checkData(const Field3D& f, const std::string& region = "RGN_NOBNDRY"); #else /// Ignored with disabled CHECK; Throw an exception if \p f is not /// allocated or if any elements are non-finite (for CHECK > 2) -inline void checkData(const Field3D& UNUSED(f), - const std::string& UNUSED(region) = "RGN_NOBNDRY"){}; +inline void checkData([[maybe_unused]] const Field3D& f, + [[maybe_unused]] const std::string& region = "RGN_NOBNDRY"){}; #endif /// Fourier filtering, removes all except one mode @@ -667,7 +667,7 @@ Field2D DC(const Field3D& f, const std::string& rgn = "RGN_ALL"); #if CHECK > 2 void invalidateGuards(Field3D& var); #else -inline void invalidateGuards(Field3D& UNUSED(var)) {} +inline void invalidateGuards([[maybe_unused]] Field3D& var) {} #endif /// Returns a reference to the time-derivative of a field \p f @@ -678,7 +678,7 @@ inline Field3D& ddt(Field3D& f) { return *(f.timeDeriv()); } /// toString template specialisation /// Defined in utils.hxx template <> -inline std::string toString<>(const Field3D& UNUSED(val)) { +inline std::string toString<>([[maybe_unused]] const Field3D& val) { return ""; } From 8a3f82debba0a6751a51f9c38d434265c2de92c5 Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 4 Mar 2026 10:02:08 +0100 Subject: [PATCH 11/17] Prefer size_t --- include/bout/field2d.hxx | 8 ++++---- include/bout/field3d.hxx | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 97c4be2716..001201b5e1 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -132,13 +132,13 @@ public: return *this; } - Field2D& yup([[maybe_unused]] std::vector::size_type index = 0) { return *this; } - const Field2D& yup([[maybe_unused]] std::vector::size_type index = 0) const { + Field2D& yup([[maybe_unused]] size_t index = 0) { return *this; } + const Field2D& yup([[maybe_unused]] size_t index = 0) const { return *this; } - Field2D& ydown([[maybe_unused]] std::vector::size_type index = 0) { return *this; } - const Field2D& ydown([[maybe_unused]] std::vector::size_type index) = 0 const { + Field2D& ydown([[maybe_unused]] size_t index = 0) { return *this; } + const Field2D& ydown([[maybe_unused]] size_t index = 0) const { return *this; } diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index 8546a430ed..42fee60a7c 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -264,24 +264,24 @@ public: /// Check if this field has yup and ydown fields /// Return reference to yup field - Field3D& yup(std::vector::size_type index = 0) { + Field3D& yup(size_t index = 0) { ASSERT2(index < yup_fields.size()); return yup_fields[index]; } /// Return const reference to yup field - const Field3D& yup(std::vector::size_type index = 0) const { + const Field3D& yup(size_t index = 0) const { ASSERT2(index < yup_fields.size()); return yup_fields[index]; } /// Return reference to ydown field - Field3D& ydown(std::vector::size_type index = 0) { + Field3D& ydown(size_t index = 0) { ASSERT2(index < ydown_fields.size()); return ydown_fields[index]; } /// Return const reference to ydown field - const Field3D& ydown(std::vector::size_type index = 0) const { + const Field3D& ydown(size_t index = 0) const { ASSERT2(index < ydown_fields.size()); return ydown_fields[index]; } From 1f7623c86455de9d75fe6a97f7f33fd80a491df2 Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 4 Mar 2026 11:35:42 +0100 Subject: [PATCH 12/17] fixup --- include/bout/field2d.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 001201b5e1..d1585522f0 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -331,7 +331,7 @@ inline Field2D fromFieldAligned(const Field2D& f, void checkData(const Field2D& f, const std::string& region = "RGN_NOBNDRY"); #else inline void checkData([[maybe_unused]] const Field2D& f, - [[maybe_unused]] std::string region) = "RGN_NOBNDRY" {} + [[maybe_unused]] std::string region = "RGN_NOBNDRY") {} #endif /// Force guard cells of passed field \p var to NaN From 88abeb55fd7c89388f501a2918e9933169bad301 Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 4 Mar 2026 11:13:27 +0100 Subject: [PATCH 13/17] Add missing header --- include/bout/field2d.hxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index d1585522f0..899c741991 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -37,6 +37,8 @@ class Field2D; #include "bout/fieldperp.hxx" #include "bout/region.hxx" +#include + #if BOUT_HAS_RAJA #include "RAJA/RAJA.hpp" // using RAJA lib #endif From ec69e8838be2dde140a915e50506f8e1ce3cb534 Mon Sep 17 00:00:00 2001 From: dschwoerer <5637662+dschwoerer@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:55:59 +0000 Subject: [PATCH 14/17] [bot] Apply format changes --- include/bout/field2d.hxx | 12 +++++------- include/bout/field3d.hxx | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 899c741991..757880ed70 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -135,14 +135,10 @@ public: } Field2D& yup([[maybe_unused]] size_t index = 0) { return *this; } - const Field2D& yup([[maybe_unused]] size_t index = 0) const { - return *this; - } + const Field2D& yup([[maybe_unused]] size_t index = 0) const { return *this; } Field2D& ydown([[maybe_unused]] size_t index = 0) { return *this; } - const Field2D& ydown([[maybe_unused]] size_t index = 0) const { - return *this; - } + const Field2D& ydown([[maybe_unused]] size_t index = 0) const { return *this; } Field2D& ynext([[maybe_unused]] int dir) { return *this; } const Field2D& ynext([[maybe_unused]] int dir) const { return *this; } @@ -228,7 +224,9 @@ public: * DIrect access to underlying array. This version is for compatibility * with Field3D objects */ - BoutReal& operator()(int jx, int jy, [[maybe_unused]] int jz) { return operator()(jx, jy); } + BoutReal& operator()(int jx, int jy, [[maybe_unused]] int jz) { + return operator()(jx, jy); + } const BoutReal& operator()(int jx, int jy, [[maybe_unused]] int jz) const { return operator()(jx, jy); } diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index 42fee60a7c..df2a807706 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -606,7 +606,7 @@ void checkData(const Field3D& f, const std::string& region = "RGN_NOBNDRY"); /// Ignored with disabled CHECK; Throw an exception if \p f is not /// allocated or if any elements are non-finite (for CHECK > 2) inline void checkData([[maybe_unused]] const Field3D& f, - [[maybe_unused]] const std::string& region = "RGN_NOBNDRY"){}; + [[maybe_unused]] const std::string& region = "RGN_NOBNDRY") {}; #endif /// Fourier filtering, removes all except one mode From 013a8478ab374abb3022e7f86efa138143d21bbb Mon Sep 17 00:00:00 2001 From: dschwoerer <5637662+dschwoerer@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:56:00 +0000 Subject: [PATCH 15/17] [bot] Add last format changes commit to ignore file --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index abd11c7762..8d488ade81 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -11,3 +11,4 @@ a71cad2dd6ace5741a754e2ca7daacd4bb094e0e 2c2402ed59c91164eaff46dee0f79386b7347e9e 05b7c571544c3bcb153fce67d12b9ac48947fc2d c8f38049359170a34c915e209276238ea66b9a1e +ec69e8838be2dde140a915e50506f8e1ce3cb534 From 640d27d5b299f1e95ee8ad451bde3162e015d317 Mon Sep 17 00:00:00 2001 From: David Bold Date: Thu, 5 Mar 2026 14:12:10 +0100 Subject: [PATCH 16/17] Add missing headers --- include/bout/field2d.hxx | 1 + include/bout/field3d.hxx | 1 + 2 files changed, 2 insertions(+) diff --git a/include/bout/field2d.hxx b/include/bout/field2d.hxx index 757880ed70..906af38a1d 100644 --- a/include/bout/field2d.hxx +++ b/include/bout/field2d.hxx @@ -24,6 +24,7 @@ * along with BOUT++. If not, see . * */ +#include "bout/utils.hxx" class Field2D; #pragma once diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index 021c45c426..b0318aa9d2 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -20,6 +20,7 @@ * **************************************************************************/ +#include "bout/utils.hxx" #include class Field3D; From 9bb5bca06baa60e4c8be32e08970f04b2f7f7bf1 Mon Sep 17 00:00:00 2001 From: David Bold Date: Fri, 6 Mar 2026 13:31:56 +0100 Subject: [PATCH 17/17] Make clear it is a setter --- include/bout/field3d.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/bout/field3d.hxx b/include/bout/field3d.hxx index b0318aa9d2..c6e1d1191d 100644 --- a/include/bout/field3d.hxx +++ b/include/bout/field3d.hxx @@ -513,7 +513,7 @@ public: std::weak_ptr getTracking() { return tracking; }; - bool allowCalcParallelSlices() const { return _allowCalcParallelSlices; }; + bool areCalcParallelSlicesAllowed() const { return _allowCalcParallelSlices; }; void disallowCalcParallelSlices() { _allowCalcParallelSlices = false; }; private: