Skip to content

Commit

Permalink
try different return style
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaddy committed Jun 17, 2024
1 parent 0257178 commit 33005f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/mhd_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
// =========================================================================

Expand Down

0 comments on commit 33005f3

Please sign in to comment.