2323#include " hermite_spline_xz.hxx"
2424
2525#include " ../../../impls/bout/boutmesh.hxx"
26+
27+ #include " bout/assert.hxx"
2628#include " bout/bout.hxx"
29+ #include " bout/bout_types.hxx"
30+ #include " bout/boutexception.hxx"
31+ #include " bout/field2d.hxx"
2732#include " bout/globals.hxx"
2833#include " bout/index_derivs_interface.hxx"
2934#include " bout/interpolation_xz.hxx"
35+ #include " bout/mask.hxx"
36+ #include " bout/paralleltransform.hxx"
37+ #include " bout/region.hxx"
3038
31- #include < vector >
39+ #include < fmt/format.h >
3240
41+ #include < cmath>
42+ #include < string>
43+ #include < vector>
3344
3445XZHermiteSpline::XZHermiteSpline (int y_offset, Mesh* meshin)
3546 : XZInterpolation(y_offset, meshin), h00_x(localmesh), h01_x(localmesh),
@@ -64,7 +75,7 @@ void XZHermiteSpline::calcWeights(const Field3D& delta_x, const Field3D& delta_z
6475
6576 const int ny = localmesh->LocalNy ;
6677 const int nz = localmesh->LocalNz ;
67- const int xend = (localmesh->xend - localmesh->xstart + 1 ) * localmesh->getNXPE ()
78+ const int xend = (( localmesh->xend - localmesh->xstart + 1 ) * localmesh->getNXPE () )
6879 + localmesh->xstart - 1 ;
6980
7081 BOUT_FOR (i, getRegion (region)) {
@@ -80,7 +91,7 @@ void XZHermiteSpline::calcWeights(const Field3D& delta_x, const Field3D& delta_z
8091 // t_x, t_z are the normalised coordinates \in [0,1) within the cell
8192 // calculated by taking the remainder of the floating point index
8293 BoutReal t_x = delta_x (x, y, z) - static_cast <BoutReal>(i_corn);
83- BoutReal t_z = delta_z (x, y, z) - static_cast <BoutReal>(k_corner (x, y, z));
94+ BoutReal const t_z = delta_z (x, y, z) - static_cast <BoutReal>(k_corner (x, y, z));
8495
8596 // NOTE: A (small) hack to avoid one-sided differences. We need at
8697 // least 2 interior points due to an awkwardness with the
@@ -120,7 +131,7 @@ void XZHermiteSpline::calcWeights(const Field3D& delta_x, const Field3D& delta_z
120131 }
121132
122133 i_corner[i] = SpecificInd<IND_TYPE::IND_3D>(
123- (((i_corn * ny) + (y + y_offset)) * nz + k_corner (x, y, z)), ny, nz);
134+ (((( i_corn * ny) + (y + y_offset)) * nz) + k_corner (x, y, z)), ny, nz);
124135
125136 h00_x[i] = (2 . * t_x * t_x * t_x) - (3 . * t_x * t_x) + 1 .;
126137 h00_z[i] = (2 . * t_z * t_z * t_z) - (3 . * t_z * t_z) + 1 .;
@@ -167,8 +178,8 @@ XZHermiteSpline::getWeightsForYApproximation(int i, int j, int k, int yoffset) {
167178 const int k_mod_p2 = (k_mod_p1 == nz) ? 0 : k_mod_p1 + 1 ;
168179
169180 return {{i, j + yoffset, k_mod_m1, -0.5 * h10_z (i, j, k)},
170- {i, j + yoffset, k_mod, h00_z (i, j, k) - 0.5 * h11_z (i, j, k)},
171- {i, j + yoffset, k_mod_p1, h01_z (i, j, k) + 0.5 * h10_z (i, j, k)},
181+ {i, j + yoffset, k_mod, h00_z (i, j, k) - ( 0.5 * h11_z (i, j, k) )},
182+ {i, j + yoffset, k_mod_p1, h01_z (i, j, k) + ( 0.5 * h10_z (i, j, k) )},
172183 {i, j + yoffset, k_mod_p2, 0.5 * h11_z (i, j, k)}};
173184}
174185
@@ -199,24 +210,24 @@ Field3D XZHermiteSpline::interpolate(const Field3D& f, const std::string& region
199210 const auto icxpzp = iczp.xp ();
200211
201212 // Interpolate f in X at Z
202- const BoutReal f_z =
203- f[ic] * h00_x[i] + f[icxp] * h01_x[i] + fx[ic] * h10_x[i] + fx[icxp] * h11_x[i];
213+ const BoutReal f_z = (f[ic] * h00_x[i]) + (f[icxp] * h01_x[i]) + (fx[ic] * h10_x[i])
214+ + ( fx[icxp] * h11_x[i]) ;
204215
205216 // Interpolate f in X at Z+1
206- const BoutReal f_zp1 = f[iczp] * h00_x[i] + f[icxpzp] * h01_x[i] + fx[iczp] * h10_x[i]
207- + fx[icxpzp] * h11_x[i];
217+ const BoutReal f_zp1 = ( f[iczp] * h00_x[i]) + ( f[icxpzp] * h01_x[i])
218+ + ( fx[iczp] * h10_x[i]) + (fx[ icxpzp] * h11_x[i]) ;
208219
209220 // Interpolate fz in X at Z
210- const BoutReal fz_z = fz[ic] * h00_x[i] + fz[icxp] * h01_x[i] + fxz[ic] * h10_x[i]
211- + fxz[icxp] * h11_x[i];
221+ const BoutReal fz_z = ( fz[ic] * h00_x[i]) + ( fz[icxp] * h01_x[i])
222+ + ( fxz[ic] * h10_x[i]) + (fxz[ icxp] * h11_x[i]) ;
212223
213224 // Interpolate fz in X at Z+1
214- const BoutReal fz_zp1 = fz[iczp] * h00_x[i] + fz[icxpzp] * h01_x[i]
215- + fxz[iczp] * h10_x[i] + fxz[icxpzp] * h11_x[i];
225+ const BoutReal fz_zp1 = ( fz[iczp] * h00_x[i]) + ( fz[icxpzp] * h01_x[i])
226+ + ( fxz[iczp] * h10_x[i]) + ( fxz[icxpzp] * h11_x[i]) ;
216227
217228 // Interpolate in Z
218229 f_interp[iyp] =
219- +f_z * h00_z[i] + f_zp1 * h01_z[i] + fz_z * h10_z[i] + fz_zp1 * h11_z[i];
230+ ( +f_z * h00_z[i]) + ( f_zp1 * h01_z[i]) + ( fz_z * h10_z[i]) + ( fz_zp1 * h11_z[i]) ;
220231
221232 ASSERT2 (std::isfinite (f_interp[iyp]) || i.x () < localmesh->xstart
222233 || i.x () > localmesh->xend );
0 commit comments