This function returns pre-stored value at given idx or evaluate a spatial function for a point at given idx. Return value is a vector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_spatial_type), | intent(in) | :: | me |
spatial type |
||
type(tem_grwPoints_type), | intent(in) | :: | grwPnt |
growing array of all spatial point of a variable |
||
integer, | intent(in) | :: | idx(nVals) |
Index position to return a pre-store value or to compute |
||
integer, | intent(in) | :: | nVals |
number of return values |
||
integer, | intent(in) | :: | iLevel |
Level to which the evaluated values to be returned |
||
integer, | intent(in) | :: | nComps |
number of components per returned value |
return value of a function
function tem_spatial_vector_for_index( me, grwPnt, idx, nVals, iLevel, &
& nComps ) result (res)
! -------------------------------------------------------------------- !
!> spatial type
type(tem_spatial_type), intent(in) :: me
!> number of return values
integer, intent(in) :: nVals
!> number of components per returned value
integer, intent(in) :: nComps
!> growing array of all spatial point of a variable
type(tem_grwPoints_type), intent(in) :: grwPnt
!> Index position to return a pre-store value or to compute
integer, intent(in) :: idx(nVals)
!> return value of a function
real( kind=rk ) :: res(nVals, nComps)
!> Level to which the evaluated values to be returned
integer, intent(in) :: iLevel
! -------------------------------------------------------------------- !
integer :: iVal, iComp, offset
real(kind=rk) :: coord(1,3), res_tmp(1, nComps)
! -------------------------------------------------------------------- !
if (me%isStored) then
do iVal = 1, nVals
offset = (idx(iVal)-1)*nComps
res(iVal, :) = me%valOnLvl(iLevel)%evalVal%val( offset+1 &
& :offset+nComps )
end do
else
select case (trim(me%kind))
case ('none', 'const')
do iComp = 1, nComps
res(:, iComp) = me%const(iComp)
end do
case ('lua_fun')
res = tem_spatial_lua_for( fun_ref = me%lua_fun_ref, &
& conf = me%conf, &
& grwPnt = grwPnt, &
& idx = idx, &
& nVals = nVals, &
& nComps = nComps )
case default
do iVal = 1, nVals
coord(1,:) = (/ grwPnt%coordX%val( idx(iVal) ), &
& grwPnt%coordY%val( idx(iVal) ), &
& grwPnt%coordZ%val( idx(iVal) ) /)
res_tmp = tem_spatial_vector_for_coord( me = me, &
& coord = coord, &
& n = 1, &
& nComp = nComps )
res(iVal,:) = res_tmp(1,:)
end do
end select
end if
end function tem_spatial_vector_for_index