diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index cc795d6d86..c70b34babe 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -17,3 +17,4 @@ d1cfb8abd6aa5c76e6c1a4d7ab20929c65f8afc2 ec69e8838be2dde140a915e50506f8e1ce3cb534 f2bc0488a298f136294c523bc5ab4086d090059b 1b4707187a3a85126338303dc766280b8fb2dc56 +64e4285ec38569f66d31e589a4610cefd16d8076 diff --git a/include/bout/interpolation_xz.hxx b/include/bout/interpolation_xz.hxx index d14a5eeca0..1a8be9ef6b 100644 --- a/include/bout/interpolation_xz.hxx +++ b/include/bout/interpolation_xz.hxx @@ -1,8 +1,7 @@ /************************************************************************** - * Copyright 2010-2020 B.D.Dudson, S.Farley, P. Hill, J.T. Omotani, J.T. Parker, - * M.V.Umansky, X.Q.Xu + * Copyright 2010 - 2026 BOUT++ contributors * - * Contact: Ben Dudson, bd512@york.ac.uk + * Contact: Ben Dudson, dudson2@llnl.gov * * This file is part of BOUT++. * @@ -33,9 +32,11 @@ #include "bout/petsclib.hxx" #endif -namespace { +namespace bout { +namespace details { enum class implementation_type { new_weights, petsc, legacy }; } +} // namespace bout class Options; class GlobalField3DAccess; @@ -144,7 +145,7 @@ public: /// but also degrades accuracy near maxima and minima. /// Perhaps should only impose near boundaries, since that is where /// problems most obviously occur. -template +template class XZHermiteSplineBase : public XZInterpolation { protected: /// This is protected rather than private so that it can be @@ -224,19 +225,23 @@ public: }; using XZMonotonicHermiteSplineSerial = - XZHermiteSplineBase; + XZHermiteSplineBase; using XZHermiteSplineSerial = - XZHermiteSplineBase; + XZHermiteSplineBase; using XZMonotonicHermiteSplineLegacy = - XZHermiteSplineBase; -using XZHermiteSplineLegacy = XZHermiteSplineBase; + XZHermiteSplineBase; +using XZHermiteSplineLegacy = + XZHermiteSplineBase; #if BOUT_HAS_PETSC -using XZMonotonicHermiteSpline = XZHermiteSplineBase; -using XZHermiteSpline = XZHermiteSplineBase; +using XZMonotonicHermiteSpline = + XZHermiteSplineBase; +using XZHermiteSpline = + XZHermiteSplineBase; #else using XZMonotonicHermiteSpline = - XZHermiteSplineBase; -using XZHermiteSpline = XZHermiteSplineBase; + XZHermiteSplineBase; +using XZHermiteSpline = + XZHermiteSplineBase; #endif /// XZLagrange4pt interpolation class diff --git a/src/mesh/interpolation/hermite_spline_xz.cxx b/src/mesh/interpolation/hermite_spline_xz.cxx index 48e7d2904e..0aa1f2b066 100644 --- a/src/mesh/interpolation/hermite_spline_xz.cxx +++ b/src/mesh/interpolation/hermite_spline_xz.cxx @@ -1,7 +1,7 @@ /************************************************************************** - * Copyright 2015-2018 B.D.Dudson, P. Hill + * Copyright 2015 - 2026 BOUT++ contributors * - * Contact: Ben Dudson, bd512@york.ac.uk + * Contact: Ben Dudson, dudson2@llnl.gov * * This file is part of BOUT++. * @@ -109,7 +109,7 @@ class IndConverter { } }; -template +template XZHermiteSplineBase::XZHermiteSplineBase(int y_offset, Mesh* meshin, Options* options) : XZInterpolation(y_offset, meshin), h00_x(localmesh), h01_x(localmesh), @@ -142,15 +142,15 @@ XZHermiteSplineBase::XZHermiteSplineBase(int y_offset, Mesh h10_z.allocate(); h11_z.allocate(); - if constexpr (imp_type == implementation_type::new_weights - || imp_type == implementation_type::petsc) { + if constexpr (imp_type == bout::details::implementation_type::new_weights + || imp_type == bout::details::implementation_type::petsc) { newWeights.reserve(16); for (int w = 0; w < 16; ++w) { newWeights.emplace_back(localmesh); newWeights[w].allocate(); } } - if constexpr (imp_type == implementation_type::petsc) { + if constexpr (imp_type == bout::details::implementation_type::petsc) { #if BOUT_HAS_PETSC petsclib = new PetscLib( &Options::root()["mesh:paralleltransform:xzinterpolation:hermitespline"]); @@ -163,15 +163,15 @@ XZHermiteSplineBase::XZHermiteSplineBase(int y_offset, Mesh gf3daccess = std::make_unique(localmesh); g3dinds.reallocate(localmesh->LocalNx, localmesh->LocalNy, localmesh->LocalNz); } - if constexpr (imp_type == implementation_type::new_weights - || imp_type == implementation_type::legacy) { + if constexpr (imp_type == bout::details::implementation_type::new_weights + || imp_type == bout::details::implementation_type::legacy) { if (localmesh->getNXPE() > 1) { throw BoutException("Require PETSc for MPI splitting in X"); } } } -template +template void XZHermiteSplineBase::calcWeights( const Field3D& delta_x, const Field3D& delta_z, [[maybe_unused]] const std::string& region) { @@ -251,8 +251,8 @@ void XZHermiteSplineBase::calcWeights( h11_x[i] = (t_x * t_x * t_x) - (t_x * t_x); h11_z[i] = (t_z * t_z * t_z) - (t_z * t_z); - if constexpr (imp_type == implementation_type::new_weights - || imp_type == implementation_type::petsc) { + if constexpr (imp_type == bout::details::implementation_type::new_weights + || imp_type == bout::details::implementation_type::petsc) { for (int w = 0; w < 16; ++w) { newWeights[w][i] = 0; } @@ -309,7 +309,7 @@ void XZHermiteSplineBase::calcWeights( newWeights[13][i] -= h11_x[i] * h11_z[i] / 4; newWeights[7][i] -= h11_x[i] * h11_z[i] / 4; newWeights[5][i] += h11_x[i] * h11_z[i] / 4; - if (imp_type == implementation_type::petsc) { + if (imp_type == bout::details::implementation_type::petsc) { #if BOUT_HAS_PETSC PetscInt idxn[1] = {conv.fromLocalToGlobal(x, y + y_offset, z)}; // output.write("debug: {:d} -> {:d}: {:d}:{:d} -> {:d}:{:d}\n", @@ -340,7 +340,7 @@ void XZHermiteSplineBase::calcWeights( g3dinds[i] = {gind.ind, gind.xp(1).ind, gind.zp(1).ind, gind.xp(1).zp(1).ind}; } } - if constexpr (imp_type == implementation_type::petsc) { + if constexpr (imp_type == bout::details::implementation_type::petsc) { #if BOUT_HAS_PETSC MatAssemblyBegin(petscWeights, MAT_FINAL_ASSEMBLY); MatAssemblyEnd(petscWeights, MAT_FINAL_ASSEMBLY); @@ -352,7 +352,7 @@ void XZHermiteSplineBase::calcWeights( } } -template +template void XZHermiteSplineBase::calcWeights(const Field3D& delta_x, const Field3D& delta_z, const BoutMask& mask, @@ -377,7 +377,7 @@ void XZHermiteSplineBase::calcWeights(const Field3D& delta_ * (i, j+1, k+1) h01_z + h10_z / 2 * (i, j+1, k+2) h11_z / 2 */ -template +template std::vector XZHermiteSplineBase::getWeightsForYApproximation(int i, int j, int k, int yoffset) { @@ -397,7 +397,7 @@ XZHermiteSplineBase::getWeightsForYApproximation(int i, int {i, j + yoffset, k_mod_p2, 0.5 * h11_z(i, j, k)}}; } -template +template Field3D XZHermiteSplineBase::interpolate( const Field3D& f, [[maybe_unused]] const std::string& region) const { @@ -411,7 +411,7 @@ Field3D XZHermiteSplineBase::interpolate( gf = gf3daccess->communicate_asPtr(f); } - if constexpr (imp_type == implementation_type::petsc) { + if constexpr (imp_type == bout::details::implementation_type::petsc) { #if BOUT_HAS_PETSC BoutReal* ptr = nullptr; const BoutReal* cptr = nullptr; @@ -439,7 +439,7 @@ Field3D XZHermiteSplineBase::interpolate( #endif } - if constexpr (imp_type == implementation_type::new_weights) { + if constexpr (imp_type == bout::details::implementation_type::new_weights) { BOUT_FOR(i, getRegion(region)) { auto ic = i_corner[i]; auto iyp = i.yp(y_offset); @@ -463,7 +463,7 @@ Field3D XZHermiteSplineBase::interpolate( ASSERT2(std::isfinite(f_interp[iyp])); } } - if constexpr (imp_type == implementation_type::legacy) { + if constexpr (imp_type == bout::details::implementation_type::legacy) { // Legacy interpolation // TODO(peter): Should we apply dirichlet BCs to derivatives? // Derivatives are used for tension and need to be on dimensionless @@ -523,7 +523,7 @@ Field3D XZHermiteSplineBase::interpolate( return f_interp; } -template +template Field3D XZHermiteSplineBase::interpolate(const Field3D& f, const Field3D& delta_x, const Field3D& delta_z, @@ -532,7 +532,7 @@ Field3D XZHermiteSplineBase::interpolate(const Field3D& f, return interpolate(f, region); } -template +template Field3D XZHermiteSplineBase::interpolate(const Field3D& f, const Field3D& delta_x, const Field3D& delta_z, @@ -543,11 +543,12 @@ Field3D XZHermiteSplineBase::interpolate(const Field3D& f, } // ensure they are instantiated -template class XZHermiteSplineBase; -template class XZHermiteSplineBase; -template class XZHermiteSplineBase; -template class XZHermiteSplineBase; +template class XZHermiteSplineBase; +template class XZHermiteSplineBase; +template class XZHermiteSplineBase; +template class XZHermiteSplineBase; #if BOUT_HAS_PETSC -template class XZHermiteSplineBase; -template class XZHermiteSplineBase; +template class XZHermiteSplineBase; +template class XZHermiteSplineBase; #endif