subroutine get_fio_profile_p(params,P,Y_R,Y_PHI,Y_Z, &
n_e,T_e,flag,hint)
TYPE(PROFILES), INTENT(IN) :: P
TYPE(KORC_PARAMS), INTENT(IN) :: params
REAL(rp), DIMENSION(params%pchunk), INTENT(IN) :: Y_R,Y_PHI,Y_Z
REAL(rp), DIMENSION(params%pchunk), INTENT(INOUT) :: n_e,T_e
INTEGER(is), DIMENSION(params%pchunk), INTENT(INOUT) :: flag
TYPE(C_PTR), DIMENSION(params%pchunk), INTENT(INOUT) :: hint
INTEGER (C_INT) :: status
INTEGER :: pp,pchunk
REAL(rp), DIMENSION(3) :: x
REAL(rp) :: netmp=-1._rp,Tetmp=-1._rp
pchunk=params%pchunk
do pp = 1,pchunk
if (flag(pp) .EQ. 1_is) then
x(1) = Y_R(pp)*params%cpp%length
x(2) = Y_PHI(pp)
x(3) = Y_Z(pp)*params%cpp%length
!write(6,*) P%FIO_ne,x
status = fio_eval_field(P%FIO_ne, x(1), &
netmp,hint(pp))
if (status .eq. FIO_SUCCESS) then
if(netmp.le.0) netmp=1._rp
n_e(pp) = netmp/params%cpp%density
else if (status .eq. FIO_NO_DATA) then
flag(pp) = 0_is
else if (status .ne. FIO_SUCCESS) then
flag(pp) = 0_is
CYCLE
end if
status = fio_eval_field(P%FIO_te, x(1), &
Tetmp,hint(pp))
if (status .eq. FIO_SUCCESS) then
if(Tetmp.le.0) Tetmp=0.1_rp
T_e(pp) = Tetmp/(params%cpp%temperature/C_E)
end if
! write(6,*) E_R,E_PHI,E_Z
end if
end do
end subroutine get_fio_profile_p