
! written by plasma_cwrite.py
! input: plasma_state_spec.dat   version 2.055
! *** do not edit *** (use code generator instead)


  subroutine ccps_getset_r9_dummy
     return
  end subroutine ccps_getset_r9_dummy

subroutine psget_rad_code_info(iobj, data, ierr)
    !! Information: code implementing RAD component
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
     ! list of dimensions (if any)
    CHARACTER*(*), intent(out)  :: data ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psget_rad_code_info', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    data = ss % RAD_Code_Info
end subroutine psget_rad_code_info


subroutine psset_rad_code_info(iobj, data, ierr)
    !! Information: code implementing RAD component
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
     ! list of dimensions (if any)
    CHARACTER*(*), intent(in)  :: data ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psset_rad_code_info', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    ss % RAD_Code_Info = data
end subroutine psset_rad_code_info


subroutine psgetsz_rad_code_info(iobj, size, ierr)
    !! Information: code implementing RAD component
    use plasma_state_mod, only :  plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(out) :: size    ! size of character string
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psgetsz_rad_code_info', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! note that the following will return the character length size regardless of
    ! the number of array elements (if RAD_Code_Info is an array)
    size = len(ss % RAD_Code_Info)
end subroutine psgetsz_rad_code_info


subroutine psget_rho_eq_geo(iobj, n1, data, ierr)
    !! rho grid (EQ flux surface averages), this grid is built from
    !! rho_eq: nrho_eq_geo = 2*nrho_eq - 1,
    !! rho_eq_geo(1:nrho_eq_geo:2) = rho_eq(1:nrho_eq),
    !! rho_eq_geo(2:nrho_eq_geo:2) =,
    !! (rho_eq(1:nrho_eq-1)+rho_eq(2:nrho_eq))/2, i.e. a doubly fine
    !! grid for metric flux surface averages stored, as piecewise
    !! linear radidal profiles.
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
    integer, intent(in) :: n1 ! list of dimensions (if any)
    REAL(KIND=rspec), intent(out)  :: data(n1) ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psget_rho_eq_geo', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    data(1:n1) = ss % rho_eq_geo
end subroutine psget_rho_eq_geo


subroutine psset_rho_eq_geo(iobj, n1, data, ierr)
    !! rho grid (EQ flux surface averages), this grid is built from
    !! rho_eq: nrho_eq_geo = 2*nrho_eq - 1,
    !! rho_eq_geo(1:nrho_eq_geo:2) = rho_eq(1:nrho_eq),
    !! rho_eq_geo(2:nrho_eq_geo:2) =,
    !! (rho_eq(1:nrho_eq-1)+rho_eq(2:nrho_eq))/2, i.e. a doubly fine
    !! grid for metric flux surface averages stored, as piecewise
    !! linear radidal profiles.
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
    integer, intent(in) :: n1 ! list of dimensions (if any)
    REAL(KIND=rspec), intent(in)  :: data(n1) ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psset_rho_eq_geo', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    ss % rho_eq_geo = data(1:n1)
end subroutine psset_rho_eq_geo


subroutine psgetrnk_rho_eq_geo(iobj, ndims, ierr)
    !! rho grid (EQ flux surface averages), this grid is built from
    !! rho_eq: nrho_eq_geo = 2*nrho_eq - 1,
    !! rho_eq_geo(1:nrho_eq_geo:2) = rho_eq(1:nrho_eq),
    !! rho_eq_geo(2:nrho_eq_geo:2) =,
    !! (rho_eq(1:nrho_eq-1)+rho_eq(2:nrho_eq))/2, i.e. a doubly fine
    !! grid for metric flux surface averages stored, as piecewise
    !! linear radidal profiles.
    use plasma_state_mod, only :  plasma_state_container, plasma_state, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(out) :: ndims  ! number of dimensions
    integer, intent(out) :: ierr   ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    ndims = 1
end subroutine psgetrnk_rho_eq_geo


subroutine psgetdim_rho_eq_geo(iobj, ndims, dims, ierr)
    !! rho grid (EQ flux surface averages), this grid is built from
    !! rho_eq: nrho_eq_geo = 2*nrho_eq - 1,
    !! rho_eq_geo(1:nrho_eq_geo:2) = rho_eq(1:nrho_eq),
    !! rho_eq_geo(2:nrho_eq_geo:2) =,
    !! (rho_eq(1:nrho_eq-1)+rho_eq(2:nrho_eq))/2, i.e. a doubly fine
    !! grid for metric flux surface averages stored, as piecewise
    !! linear radidal profiles.
    use plasma_state_mod, only :  plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(in) :: ndims   ! number of dimensions
    integer, intent(out) :: dims(ndims) ! sizes
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    if (ndims /= 1) ierr = 1
    call ccps_argcheck('psgetdim_rho_eq_geo', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    dims = 0
    if (allocated( ss % rho_eq_geo ) ) then
        ! can only call 'shape' on allocated/associated arrays
        dims = shape(ss % rho_eq_geo)
    endif
end subroutine psgetdim_rho_eq_geo


subroutine psget_rho_anom(iobj, n1, data, ierr)
    !! rho grid (1d anomalous transport profiles)
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
    integer, intent(in) :: n1 ! list of dimensions (if any)
    REAL(KIND=rspec), intent(out)  :: data(n1) ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psget_rho_anom', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    data(1:n1) = ss % rho_anom
end subroutine psget_rho_anom


subroutine psset_rho_anom(iobj, n1, data, ierr)
    !! rho grid (1d anomalous transport profiles)
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
    integer, intent(in) :: n1 ! list of dimensions (if any)
    REAL(KIND=rspec), intent(in)  :: data(n1) ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psset_rho_anom', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    ss % rho_anom = data(1:n1)
end subroutine psset_rho_anom


subroutine psgetrnk_rho_anom(iobj, ndims, ierr)
    !! rho grid (1d anomalous transport profiles)
    use plasma_state_mod, only :  plasma_state_container, plasma_state, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(out) :: ndims  ! number of dimensions
    integer, intent(out) :: ierr   ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    ndims = 1
end subroutine psgetrnk_rho_anom


subroutine psgetdim_rho_anom(iobj, ndims, dims, ierr)
    !! rho grid (1d anomalous transport profiles)
    use plasma_state_mod, only :  plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(in) :: ndims   ! number of dimensions
    integer, intent(out) :: dims(ndims) ! sizes
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    if (ndims /= 1) ierr = 1
    call ccps_argcheck('psgetdim_rho_anom', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    dims = 0
    if (allocated( ss % rho_anom ) ) then
        ! can only call 'shape' on allocated/associated arrays
        dims = shape(ss % rho_anom)
    endif
end subroutine psgetdim_rho_anom


subroutine psget_res_sn(iobj, n1, n2, data, ierr)
    !! residuals for particle transport eqn
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
    integer, intent(in) :: n1, n2 ! list of dimensions (if any)
    REAL(KIND=rspec), intent(out)  :: data(n1, n2) ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psget_res_sn', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    data(1:n1, 1: n2) = ss % res_sn
end subroutine psget_res_sn


subroutine psset_res_sn(iobj, n1, n2, data, ierr)
    !! residuals for particle transport eqn
    use plasma_state_mod, only : plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*)  ! object handle
    integer, intent(in) :: n1, n2 ! list of dimensions (if any)
    REAL(KIND=rspec), intent(in)  :: data(n1, n2) ! to read to/write from
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    call ccps_argcheck('psset_res_sn', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    ! set
    ss % res_sn = data(1:n1, 1: n2)
end subroutine psset_res_sn


subroutine psgetrnk_res_sn(iobj, ndims, ierr)
    !! residuals for particle transport eqn
    use plasma_state_mod, only :  plasma_state_container, plasma_state, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(out) :: ndims  ! number of dimensions
    integer, intent(out) :: ierr   ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    ndims = 2
end subroutine psgetrnk_res_sn


subroutine psgetdim_res_sn(iobj, ndims, dims, ierr)
    !! residuals for particle transport eqn
    use plasma_state_mod, only :  plasma_state_container, plasma_state, &
                                & load_ps_container, rspec
    implicit NONE
    integer, intent(in) :: iobj(*) ! object handle
    integer, intent(in) :: ndims   ! number of dimensions
    integer, intent(out) :: dims(ndims) ! sizes
    integer, intent(out) :: ierr ! error code (0=OK)
    ! local
    type (plasma_state_container) :: ptr
    type (plasma_state), pointer  :: ss

    ierr = 0
    if (ndims /= 2) ierr = 1
    call ccps_argcheck('psgetdim_res_sn', iobj, ierr)
    if(ierr.ne.0) return
    ! proceed...
    call load_ps_container(iobj,ptr)
    ss => ptr % ps_ptr
    dims = 0
    if (allocated( ss % res_sn ) ) then
        ! can only call 'shape' on allocated/associated arrays
        dims = shape(ss % res_sn)
    endif
end subroutine psgetdim_res_sn

