diff --git a/src/utils/mhd_utilities.h b/src/utils/mhd_utilities.h index 6de94760e..9a48ed94b 100644 --- a/src/utils/mhd_utilities.h +++ b/src/utils/mhd_utilities.h @@ -219,26 +219,27 @@ inline __host__ __device__ hydro_utilities::VectorXYZ cellCenteredMagneticFields // arrays are loaded. If the cell is on the edge that doesn't have magnetic // fields on both sides then instead set the centered magnetic field to be // equal to the magnetic field of the closest edge. - Real avgBx = (xid > 0) ? + hydro_utilities::VectorXYZ output; + output.x() = (xid > 0) ? /*if true*/ 0.5 * (dev_conserved[(grid_enum::magnetic_x)*n_cells + id] + dev_conserved[(grid_enum::magnetic_x)*n_cells + cuda_utilities::compute1DIndex(xid - 1, yid, zid, nx, ny)]) : /*if false*/ dev_conserved[(grid_enum::magnetic_x)*n_cells + id]; - Real avgBy = (yid > 0) ? + output.y() = (yid > 0) ? /*if true*/ 0.5 * (dev_conserved[(grid_enum::magnetic_y)*n_cells + id] + dev_conserved[(grid_enum::magnetic_y)*n_cells + cuda_utilities::compute1DIndex(xid, yid - 1, zid, nx, ny)]) : /*if false*/ dev_conserved[(grid_enum::magnetic_y)*n_cells + id]; - Real avgBz = (zid > 0) ? + output.z() = (zid > 0) ? /*if true*/ 0.5 * (dev_conserved[(grid_enum::magnetic_z)*n_cells + id] + dev_conserved[(grid_enum::magnetic_z)*n_cells + cuda_utilities::compute1DIndex(xid, yid, zid - 1, nx, ny)]) : /*if false*/ dev_conserved[(grid_enum::magnetic_z)*n_cells + id]; - return {avgBx, avgBy, avgBz}; + return output; } // =========================================================================