FIXME : Add documentation
subroutine init_dist_fn_arrays
use mp, only: nproc, iproc
use species, only: nspec
use kt_grids, only: naky, ntheta0
use le_grids, only: nlambda, negrid
use gs2_time, only: init_gs2_time
use theta_grid, only: ntgrid
use gs2_layouts, only: init_dist_fn_layouts, init_gf_layouts
use nonlinear_terms, only: init_nonlinear_terms
use run_parameters, only: init_run_parameters
logical,parameter:: debug=.false.
if (initialized_dist_fn_arrays) return
initialized_dist_fn_arrays = .true.
call init_dist_fn_parameters
if (debug) write(6,*) "init_dist_fn: run_parameters"
call init_run_parameters
if (debug) write(6,*) "init_dist_fn: gs2_time"
call init_gs2_time
if (debug) write(6,*) "init_dist_fn: dist_fn_layouts"
call init_dist_fn_layouts (ntgrid, naky, ntheta0, nlambda, negrid, nspec, nproc, iproc)
if (debug) write(6,*) "init_dist_fn: gf_layouts"
call init_gf_layouts (ntgrid, naky, ntheta0, negrid, nlambda, nspec, nproc, iproc)
! TODO: I don't think we need to call init_nonlinear_terms
! before calling allocate_arrays here because allocate_arrays
! does not require any of the transform layouts. I think
! we can take this line out and remove the dependency
! dist_fn_arrays<=nonlinear_terms in gs2_init.rb. Anyone
! see any problems with this? EGH
if (debug) write(6,*) "init_dist_fn: nonlinear_terms"
call init_nonlinear_terms
if (debug) write(6,*) "init_dist_fn: allocate_arrays"
call allocate_arrays
end subroutine init_dist_fn_arrays