Subroutine wrapper hides some of the details of calling subroutines set_mesh and redistribute_data. Arguments to wrapper are as described in § 5.3.5 .
subroutine wrapper(dg,pg,type,local,flag)
implicit none
include 'arch_uparms.h'
include 'arch_parms.h'
include 'multigrid_header.h'
integer dg,pg,type
integer local(*)
integer ip(3), id(3),ig(3)
logical lw(3),corners,flag
goto (100, 200, 300, 400), dg
100 call pack3(nx_lv1, ny_lv1, nz_lv1, id)
goto 9998
200 call pack3(nx_lv2, ny_lv2, nz_lv2, id)
goto 9998
300 call pack3(nx_lv3, ny_lv3, nz_lv3, id)
goto 9998
400 call pack3(nx_lv4, ny_lv4, nz_lv4, id)
goto 9998
9998 goto (1), pg
1 call pack3(nprocx_blk, nprocy_blk, nprocz_blk, ip)
call pack3(nghostx_blk, nghosty_blk, nghostz_blk, ig)
call pack3l(lwrapx_blk, lwrapy_blk, lwrapz_blk, lw)
corners = lcorner_blk
goto 9999
9999 if (flag) then
call set_mesh(ip, id, ig, lw, corners, type, dg)
else
call redistribute_data(ip, ig, lw, corners, local, dg)
endif
end