tem_spatial_scalar_for_index Function

private function tem_spatial_scalar_for_index(me, grwPnt, idx, nVals, iLevel) result(res)

This function returns pre-stored value at given idx or evaluate a spatial function for a point at given idx in growing array of points. Return value is a scalar.

Arguments

Type IntentOptional 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

Return Value real(kind=rk), (nVals)

return value of a function


Calls

proc~~tem_spatial_scalar_for_index~~CallsGraph proc~tem_spatial_scalar_for_index tem_spatial_scalar_for_index interface~tem_spatial_lua_for tem_spatial_lua_for proc~tem_spatial_scalar_for_index->interface~tem_spatial_lua_for proc~tem_spatial_for_coord tem_spatial_for_coord proc~tem_spatial_scalar_for_index->proc~tem_spatial_for_coord

Called by

proc~~tem_spatial_scalar_for_index~~CalledByGraph proc~tem_spatial_scalar_for_index tem_spatial_scalar_for_index interface~tem_spatial_for tem_spatial_for interface~tem_spatial_for->proc~tem_spatial_scalar_for_index proc~tem_spacetime_for_treeids tem_spacetime_for_treeIDs proc~tem_spacetime_for_treeids->interface~tem_spatial_for proc~tem_spacetime_vector_for_index tem_spacetime_vector_for_index proc~tem_spacetime_vector_for_index->interface~tem_spatial_for proc~tem_spacetime_vector_for_coord tem_spacetime_vector_for_coord proc~tem_spacetime_vector_for_index->proc~tem_spacetime_vector_for_coord proc~tem_spatial_scalar_storeval tem_spatial_scalar_storeVal proc~tem_spatial_scalar_storeval->interface~tem_spatial_for proc~tem_spacetime_for_coord tem_spacetime_for_coord proc~tem_spacetime_for_coord->interface~tem_spatial_for proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index proc~tem_spacetime_scalar_for_index->interface~tem_spatial_for proc~tem_spacetime_scalar_for_index->proc~tem_spacetime_for_coord proc~tem_spacetime_vector_for_treeids tem_spacetime_vector_for_treeIDs proc~tem_spacetime_vector_for_treeids->interface~tem_spatial_for proc~tem_spacetime_vector_for_coord->interface~tem_spatial_for proc~tem_spatial_vector_storeval tem_spatial_vector_storeVal proc~tem_spatial_vector_storeval->interface~tem_spatial_for interface~tem_spacetime_for tem_spacetime_for interface~tem_spacetime_for->proc~tem_spacetime_for_treeids interface~tem_spacetime_for->proc~tem_spacetime_vector_for_index interface~tem_spacetime_for->proc~tem_spacetime_for_coord interface~tem_spacetime_for->proc~tem_spacetime_scalar_for_index interface~tem_spacetime_for->proc~tem_spacetime_vector_for_treeids interface~tem_spacetime_for->proc~tem_spacetime_vector_for_coord proc~tem_spacetime_for_stcoord tem_spacetime_for_stcoord proc~tem_spacetime_for_stcoord->proc~tem_spacetime_for_coord interface~tem_spatial_storeval tem_spatial_storeVal interface~tem_spatial_storeval->proc~tem_spatial_scalar_storeval interface~tem_spatial_storeval->proc~tem_spatial_vector_storeval

Contents


Source Code

  function tem_spatial_scalar_for_index( me, grwPnt, idx, nVals, iLevel ) &
    &                                    result (res)
    ! -------------------------------------------------------------------- !
    !> spatial type
    type(tem_spatial_type), intent(in) :: me
    !> number of return values
    integer, intent(in) :: nVals
    !> 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)
    !> Level to which the evaluated values to be returned
    integer, intent(in) :: iLevel
    ! -------------------------------------------------------------------- !
    integer :: iVal
    real(kind=rk) :: coord(1,3), res_tmp(1)
    ! -------------------------------------------------------------------- !

    if (me%isStored) then
      res(1:nVals) = me%valOnLvl(iLevel)%evalVal%val( idx(1:nVals) )
    else
      select case (trim(me%kind))
      case ('none', 'const')
        res = me%const(1)

      case ('lua_fun')
        res = tem_spatial_lua_for( fun_ref = me%lua_fun_ref, &
          &                        conf    = me%conf,        &
          &                        grwPnt  = grwPnt,         &
          &                        idx     = idx,            &
          &                        nVals   = nVals           )

      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_for_coord( me    = me,    &
            &                              coord = coord, &
            &                              n     = 1      )
          res(iVal) = res_tmp(1)
        end do

      end select
    end if

  end function tem_spatial_scalar_for_index