row_col_3D_reflected Subroutine

private subroutine row_col_3D_reflected(irow3D, icol3D, nrows3D, ncols3D, shift3D)

Apply reflected order, i.e. row increasing value for odd col value, row decreasing value for even col value

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: irow3D
integer, intent(inout) :: icol3D
integer, intent(in) :: nrows3D
integer, intent(in) :: ncols3D
integer, intent(in) :: shift3D

Source Code

   SUBROUTINE row_col_3D_reflected(irow3D, icol3D, nrows3D, ncols3D, shift3D)
      !! Apply reflected order, i.e. row increasing value for odd col value,
      !! row decreasing value for even col value

      INTEGER, INTENT(INOUT)                             :: irow3D, icol3D
      INTEGER, INTENT(IN)                                :: nrows3D, ncols3D, shift3D

      INTEGER                                            :: odd_or_even

      icol3D = MOD(shift3D/nrows3D, ncols3D) + 1
      irow3D = MOD(shift3D, nrows3D)
      odd_or_even = MOD(icol3D, 2)
      irow3D = (nrows3D - irow3D)*(1 - odd_or_even) + (irow3D + 1)*odd_or_even
   END SUBROUTINE row_col_3D_reflected