diff --git a/include/bout/array.hxx b/include/bout/array.hxx index 0a0034b8fa..9e1437eb9c 100644 --- a/include/bout/array.hxx +++ b/include/bout/array.hxx @@ -37,6 +37,7 @@ #include #endif +#include "bout/build_config.hxx" #include "bout/build_defines.hxx" #if BOUT_HAS_UMPIRE @@ -98,7 +99,7 @@ struct ArrayData { } iterator begin() const { return data; } iterator end() const { return data + len; } - int size() const { return len; } + BOUT_FORCEINLINE int size() const { return len; } /// Copy assignment /// Copy the underlying data from one array to the other diff --git a/include/bout/assert.hxx b/include/bout/assert.hxx index 63bed2407b..bebd7e4372 100644 --- a/include/bout/assert.hxx +++ b/include/bout/assert.hxx @@ -19,6 +19,8 @@ #include "bout/boutexception.hxx" +#include + #ifndef CHECK #define CHECKLEVEL 0 #else @@ -26,41 +28,45 @@ #endif #if CHECKLEVEL >= 0 -#define ASSERT0(condition) \ - if (!(condition)) { \ - throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", __FILE__, __LINE__, \ - #condition); \ +#define ASSERT0(condition) \ + if (!(condition)) { \ + throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", \ + std::string_view(__FILE__), __LINE__, \ + std::string_view(#condition)); \ } #else // CHECKLEVEL >= 0 #define ASSERT0(condition) #endif #if CHECKLEVEL >= 1 -#define ASSERT1(condition) \ - if (!(condition)) { \ - throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", __FILE__, __LINE__, \ - #condition); \ - abort(); \ +#define ASSERT1(condition) \ + if (!(condition)) { \ + throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", \ + std::string_view(__FILE__), __LINE__, \ + std::string_view(#condition)); \ + abort(); \ } #else // CHECKLEVEL >= 1 #define ASSERT1(condition) #endif #if CHECKLEVEL >= 2 -#define ASSERT2(condition) \ - if (!(condition)) { \ - throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", __FILE__, __LINE__, \ - #condition); \ +#define ASSERT2(condition) \ + if (!(condition)) { \ + throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", \ + std::string_view(__FILE__), __LINE__, \ + std::string_view(#condition)); \ } #else // CHECKLEVEL >= 2 #define ASSERT2(condition) #endif #if CHECKLEVEL >= 3 -#define ASSERT3(condition) \ - if (!(condition)) { \ - throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", __FILE__, __LINE__, \ - #condition); \ +#define ASSERT3(condition) \ + if (!(condition)) { \ + throw BoutException("Assertion failed in {:s}, line {:d}: {:s}", \ + std::string_view(__FILE__), __LINE__, \ + std::string_view(#condition)); \ } #else // CHECKLEVEL >= 3 #define ASSERT3(condition) diff --git a/include/bout/boundary_op.hxx b/include/bout/boundary_op.hxx index e4d2c459bf..dedc56d0e8 100644 --- a/include/bout/boundary_op.hxx +++ b/include/bout/boundary_op.hxx @@ -86,6 +86,8 @@ public: BoundaryModifier() = default; BoundaryModifier(BoundaryOp* operation) : BoundaryOp(operation->bndry), op(operation) {} virtual BoundaryOp* cloneMod(BoundaryOp* op, const std::list& args) = 0; + + using BoundaryOp::clone; BoundaryOp* clone(BoundaryRegion* UNUSED(region), const std::list& UNUSED(args)) override { throw BoutException("This must not be used!"); diff --git a/include/bout/fieldops.hxx b/include/bout/fieldops.hxx index f36061ceaa..46bcaf77ec 100644 --- a/include/bout/fieldops.hxx +++ b/include/bout/fieldops.hxx @@ -7,6 +7,7 @@ #include "bout/bout_types.hxx" #include "bout/build_config.hxx" #include "bout/build_defines.hxx" +#include "bout/build_config.hxx" #include "bout/region.hxx" #include @@ -366,7 +367,7 @@ struct BinaryExpr { BinaryExpr& operator=(const BinaryExpr&) = delete; BinaryExpr& operator=(BinaryExpr&&) = delete; - BOUT_HOST_DEVICE BOUT_FORCEINLINE int size() const { return indices.size(); } + BOUT_FORCEINLINE int size() const { return indices.size(); } BOUT_HOST_DEVICE BOUT_FORCEINLINE BoutReal operator()(int idx) const { return f(idx, lhs, rhs); // single‐pass fusion } diff --git a/include/bout/fieldperp.hxx b/include/bout/fieldperp.hxx index 36a116e1b5..4814be1d90 100644 --- a/include/bout/fieldperp.hxx +++ b/include/bout/fieldperp.hxx @@ -438,8 +438,8 @@ inline FieldPerp emptyFrom(const FieldPerp& f) { #if CHECK > 0 void checkData(const FieldPerp& f, const std::string& region = "RGN_NOX"); #else -inline void checkData(const FieldPerp& UNUSED(f), - const std::string& UNUSED(region) = "RGN_NOX") {} +inline void checkData([[maybe_unused]] const FieldPerp& f, + [[maybe_unused]] const std::string& region = "RGN_NOX") {} #endif /// Force guard cells of passed field \p var to NaN @@ -452,7 +452,7 @@ inline void invalidateGuards(FieldPerp& UNUSED(var)) {} /// toString template specialisation /// Defined in utils.hxx template <> -inline std::string toString<>(const FieldPerp& UNUSED(val)) { +inline std::string toString<>([[maybe_unused]] const FieldPerp& val) { return ""; } diff --git a/include/bout/griddata.hxx b/include/bout/griddata.hxx index d5aff04b4d..61a8a2b40b 100644 --- a/include/bout/griddata.hxx +++ b/include/bout/griddata.hxx @@ -196,6 +196,8 @@ public: */ bool hasVar(const std::string& name) const override; + using GridDataSource::get; + /*! * Reads strings from options. Uses Options::get to handle * expressions diff --git a/include/bout/paralleltransform.hxx b/include/bout/paralleltransform.hxx index d9ed397bb5..2b578c2900 100644 --- a/include/bout/paralleltransform.hxx +++ b/include/bout/paralleltransform.hxx @@ -124,6 +124,8 @@ public: */ void calcParallelSlices(Field3D& f) override; + using ParallelTransform::toFieldAligned; + /*! * The field is already aligned in Y, so this * does nothing @@ -141,6 +143,8 @@ public: return result.setDirectionY(YDirectionType::Aligned); } + using ParallelTransform::fromFieldAligned; + /*! * The field is already aligned in Y, so this * does nothing @@ -196,6 +200,8 @@ public: */ void calcParallelSlices(Field3D& f) override; + using ParallelTransform::toFieldAligned; + /*! * Uses FFTs and a phase shift to align the grid points * with the y coordinate (along magnetic field usually). @@ -209,6 +215,8 @@ public: FieldPerp toFieldAligned(const FieldPerp& f, const std::string& region = "RGN_ALL") override; + using ParallelTransform::fromFieldAligned; + /*! * Converts a field back to X-Z orthogonal coordinates * from field aligned coordinates. diff --git a/include/bout/region.hxx b/include/bout/region.hxx index df6769eda4..b4922bae00 100644 --- a/include/bout/region.hxx +++ b/include/bout/region.hxx @@ -254,6 +254,7 @@ struct SpecificInd { case (DIRECTION::Z): return zp(dd); } + return *this; } /// Templated routine to return index.?m(offset), where `?` is one of {x,y,z} @@ -274,6 +275,7 @@ struct SpecificInd { case (DIRECTION::Z): return zm(dd); } + return *this; } inline SpecificInd xp(int dx = 1) const { return {ind + (dx * ny * nz), ny, nz}; } diff --git a/src/mesh/fv_ops.cxx b/src/mesh/fv_ops.cxx index 660fc51abc..d8c6eaaa01 100644 --- a/src/mesh/fv_ops.cxx +++ b/src/mesh/fv_ops.cxx @@ -571,103 +571,102 @@ Field3D Div_Perp_Lap(const Field3D& a, const Field3D& f, CELL_LOC outloc) { // Explicit instantiations of flux-limited finite volume methods template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, - Field3D& flow_ylow, bool fixflux = true); + Field3D& flow_ylow, bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, - Field3D& flow_ylow, bool fixflux = true); + Field3D& flow_ylow, bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, - Field3D& flow_ylow, bool fixflux = true); + Field3D& flow_ylow, bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, - Field3D& flow_ylow, bool fixflux = true); + Field3D& flow_ylow, bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, - bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, - Field3D& flow_ylow, bool fixflux = true); + Field3D& flow_ylow, bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); template Field3D Div_par_fvv(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_par(const Field3D& f_in, const Field3D& v_in, - const Field3D& wave_speed_in, bool fixflux = true); + const Field3D& wave_speed_in, bool fixflux); template Field3D Div_f_v(const Field3D& n_in, const Vector3D& v, bool bndry_flux); template Field3D Div_par_mod(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, Field3D& flow_ylow, - bool fixflux = true); + bool fixflux); template Field3D Div_par_fvv_heating(const Field3D& f_in, const Field3D& v_in, const Field3D& wave_speed_in, - Field3D& flow_ylow, bool fixflux = true); + Field3D& flow_ylow, bool fixflux); template Field3D Div_a_Grad_perp_limit(const Field3D& a, const Field3D& g, const Field3D& f); } // Namespace FV diff --git a/src/sys/options.cxx b/src/sys/options.cxx index 85cfa7a49a..5f1f2fe91b 100644 --- a/src/sys/options.cxx +++ b/src/sys/options.cxx @@ -749,13 +749,11 @@ namespace { template struct ConvertContainer; -/// Visitor to convert an int, BoutReal or Array/Matrix/Tensor to the -/// appropriate container. Templated on both the container class C -/// and scalar type Scalar. -template