tem_spacetime_scalar_for_index Function

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

This function returns pre-stored value at given idx if spacetime function is predefined apesmate else evaluate a spacetime function for a point at given idx in growing array of points. Return value is a scalar.

Arguments

Type IntentOptional Attributes Name
type(tem_spacetime_fun_type), intent(in) :: me

spacetime type

type(tem_grwPoints_type), intent(in) :: grwPnt

growing array of all spacetime 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 access stored value in aps_coupling

type(tem_time_type), intent(in) :: time

timer object incl. the current time information

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

return value of a function


Calls

proc~~tem_spacetime_scalar_for_index~~CallsGraph proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index ids ids proc~tem_spacetime_scalar_for_index->ids interface~tem_spacetime_lua_for tem_spacetime_lua_for proc~tem_spacetime_scalar_for_index->interface~tem_spacetime_lua_for interface~tem_spatial_for tem_spatial_for proc~tem_spacetime_scalar_for_index->interface~tem_spatial_for posids posids proc~tem_spacetime_scalar_for_index->posids proc~tem_spacetime_for_coord tem_spacetime_for_coord proc~tem_spacetime_scalar_for_index->proc~tem_spacetime_for_coord proc~tem_temporal_for tem_temporal_for proc~tem_spacetime_scalar_for_index->proc~tem_temporal_for tem_precice_read tem_precice_read proc~tem_spacetime_scalar_for_index->tem_precice_read proc~tem_spacetime_lua_for_coord tem_spacetime_lua_for_coord interface~tem_spacetime_lua_for->proc~tem_spacetime_lua_for_coord proc~tem_spacetime_lua_for_treeids tem_spacetime_lua_for_treeIds interface~tem_spacetime_lua_for->proc~tem_spacetime_lua_for_treeids proc~tem_spacetime_lua_vector_for_coord tem_spacetime_lua_vector_for_coord interface~tem_spacetime_lua_for->proc~tem_spacetime_lua_vector_for_coord proc~tem_spacetime_lua_vector_for_treeids tem_spacetime_lua_vector_for_treeIds interface~tem_spacetime_lua_for->proc~tem_spacetime_lua_vector_for_treeids proc~tem_spatial_for_coord tem_spatial_for_coord interface~tem_spatial_for->proc~tem_spatial_for_coord proc~tem_spatial_for_treeids tem_spatial_for_treeIDs interface~tem_spatial_for->proc~tem_spatial_for_treeids proc~tem_spatial_scalar_for_index tem_spatial_scalar_for_index interface~tem_spatial_for->proc~tem_spatial_scalar_for_index proc~tem_spatial_vector_for_coord tem_spatial_vector_for_coord interface~tem_spatial_for->proc~tem_spatial_vector_for_coord proc~tem_spatial_vector_for_index tem_spatial_vector_for_index interface~tem_spatial_for->proc~tem_spatial_vector_for_index proc~tem_spatial_vector_for_treeids tem_spatial_vector_for_treeIDs interface~tem_spatial_for->proc~tem_spatial_vector_for_treeids proc~tem_spacetime_for_coord->interface~tem_spacetime_lua_for proc~tem_spacetime_for_coord->interface~tem_spatial_for proc~tem_spacetime_for_coord->proc~tem_temporal_for proc~tem_abort tem_abort proc~tem_spacetime_for_coord->proc~tem_abort proc~tem_eval_acoustic_pulse tem_eval_acoustic_pulse proc~tem_spacetime_for_coord->proc~tem_eval_acoustic_pulse proc~tem_eval_cylindricalwave tem_eval_cylindricalWave proc~tem_spacetime_for_coord->proc~tem_eval_cylindricalwave proc~tem_eval_miescatter_displz tem_eval_miescatter_displz proc~tem_spacetime_for_coord->proc~tem_eval_miescatter_displz proc~tem_eval_miescatter_magnx tem_eval_miescatter_magnx proc~tem_spacetime_for_coord->proc~tem_eval_miescatter_magnx proc~tem_eval_miescatter_magny tem_eval_miescatter_magny proc~tem_spacetime_for_coord->proc~tem_eval_miescatter_magny proc~tem_polygon_material_movement_multi tem_polygon_material_movement_multi proc~tem_spacetime_for_coord->proc~tem_polygon_material_movement_multi proc~tem_polygon_material_movement_single tem_polygon_material_movement_single proc~tem_spacetime_for_coord->proc~tem_polygon_material_movement_single proc~tem_temporal_for->proc~tem_abort proc~temporal_from_file_periodic_for temporal_from_file_periodic_for proc~tem_temporal_for->proc~temporal_from_file_periodic_for proc~temporal_linear_for temporal_linear_for proc~tem_temporal_for->proc~temporal_linear_for proc~temporal_lua_for temporal_lua_for proc~tem_temporal_for->proc~temporal_lua_for proc~temporal_smooth_for temporal_smooth_for proc~tem_temporal_for->proc~temporal_smooth_for

Called by

proc~~tem_spacetime_scalar_for_index~~CalledByGraph proc~tem_spacetime_scalar_for_index tem_spacetime_scalar_for_index interface~tem_spacetime_for tem_spacetime_for interface~tem_spacetime_for->proc~tem_spacetime_scalar_for_index proc~evaluate_add_spacetime_scalarbycoordinate evaluate_add_spacetime_scalarByCoordinate proc~evaluate_add_spacetime_scalarbycoordinate->interface~tem_spacetime_for proc~evaluate_add_spacetime_scalarbytreeid evaluate_add_spacetime_scalarByTreeID proc~evaluate_add_spacetime_scalarbytreeid->interface~tem_spacetime_for proc~evaluate_add_spacetime_vectorbycoordinate evaluate_add_spacetime_vectorByCoordinate proc~evaluate_add_spacetime_vectorbycoordinate->interface~tem_spacetime_for proc~evaluate_add_spacetime_vectorbytreeid evaluate_add_spacetime_vectorByTreeID proc~evaluate_add_spacetime_vectorbytreeid->interface~tem_spacetime_for proc~evaluate_first_spacetime_scalarbycoordinate evaluate_first_spacetime_scalarByCoordinate proc~evaluate_first_spacetime_scalarbycoordinate->interface~tem_spacetime_for proc~evaluate_first_spacetime_scalarbytreeid evaluate_first_spacetime_scalarByTreeID proc~evaluate_first_spacetime_scalarbytreeid->interface~tem_spacetime_for proc~evaluate_first_spacetime_vectorbycoordinate evaluate_first_spacetime_vectorByCoordinate proc~evaluate_first_spacetime_vectorbycoordinate->interface~tem_spacetime_for proc~evaluate_first_spacetime_vectorbytreeid evaluate_first_spacetime_vectorByTreeID proc~evaluate_first_spacetime_vectorbytreeid->interface~tem_spacetime_for proc~evaluate_foag_spacetime_scalarbycoordinate evaluate_FOAG_spacetime_scalarByCoordinate proc~evaluate_foag_spacetime_scalarbycoordinate->interface~tem_spacetime_for proc~evaluate_foag_spacetime_scalarbytreeid evaluate_FOAG_spacetime_scalarByTreeID proc~evaluate_foag_spacetime_scalarbytreeid->interface~tem_spacetime_for proc~evaluate_foag_spacetime_vectorbycoordinate evaluate_FOAG_spacetime_vectorByCoordinate proc~evaluate_foag_spacetime_vectorbycoordinate->interface~tem_spacetime_for proc~evaluate_foag_spacetime_vectorbytreeid evaluate_FOAG_spacetime_vectorByTreeID proc~evaluate_foag_spacetime_vectorbytreeid->interface~tem_spacetime_for proc~get_valofindex_add_scalar_spacetime get_valOfIndex_add_scalar_spacetime proc~get_valofindex_add_scalar_spacetime->interface~tem_spacetime_for proc~get_valofindex_add_vector_spacetime get_valOfIndex_add_vector_spacetime proc~get_valofindex_add_vector_spacetime->interface~tem_spacetime_for proc~get_valofindex_first_scalar_spacetime get_valOfIndex_first_scalar_spacetime proc~get_valofindex_first_scalar_spacetime->interface~tem_spacetime_for proc~get_valofindex_first_vector_spacetime get_valOfIndex_first_vector_spacetime proc~get_valofindex_first_vector_spacetime->interface~tem_spacetime_for proc~get_valofindex_foag_scalar_spacetime get_valOfIndex_FOAG_scalar_spacetime proc~get_valofindex_foag_scalar_spacetime->interface~tem_spacetime_for proc~get_valofindex_foag_vector_spacetime get_valOfIndex_FOAG_vector_spacetime proc~get_valofindex_foag_vector_spacetime->interface~tem_spacetime_for proc~tem_update_surfpos tem_update_surfPos proc~tem_update_surfpos->interface~tem_spacetime_for

Source Code

  function tem_spacetime_scalar_for_index( me, grwPnt, idx, nVals, iLevel, &
    &                                      time ) result (res)
    ! -------------------------------------------------------------------- !
    !> spacetime type
    type(tem_spacetime_fun_type), intent(in) :: me
    !> number of return values
    integer, intent(in) :: nVals
    !> growing array of all spacetime 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 access stored value in aps_coupling
    integer, intent(in) :: iLevel
    !> timer object incl. the current time information
    type(tem_time_type), intent(in)  :: time
    ! -------------------------------------------------------------------- !
    integer :: iVal
    real(kind=rk) :: coord(1,3), res_tmp(1), trans
    ! -------------------------------------------------------------------- !
    select case (trim(me%fun_kind))
    case ('none')
      res = 0.0
    case ('const')
      res = me%const(1)
    case ('lua_fun')
      do iVal = 1, nVals
        coord(1,:) =  (/ grwPnt%coordX%val( idx(iVal) ), &
          &              grwPnt%coordY%val( idx(iVal) ), &
          &              grwPnt%coordZ%val( idx(iVal) ) /)

        res_tmp = tem_spacetime_lua_for( fun_ref = me%lua_fun_ref, &
          &                              coord   = coord,          &
          &                              time    = time,           &
          &                              n       = 1,              &
          &                              conf    = me%conf         )

        res(iVal) = res_tmp(1)
      end do
    case ('combined')
      trans = tem_temporal_for( temporal   = me%temporal, &
        &                       time       = time         )
      res = tem_spatial_for( me     = me%spatial, &
        &                    grwPnt = grwPnt,     &
        &                    idx    = idx,        &
        &                    nVals  = nVals,      &
        &                    iLevel = iLevel      )
      res = trans*res
    case ('apesmate')
      res(1:nVals) = me%aps_coupling%valOnLvl(iLevel)      &
        &                           %evalVal( idx(1:nVals) )
    case ('precice')
      res(1:nVals) = tem_precice_read(                            &
        & dataID   = me%precice_coupling%readVar%IDs(1),          &
        & npoints  = nVals,                                       &
        & posIDs   = me%precice_coupling%readVar%posIDLvl(iLevel) &
        &                              %posIDs(idx(:))            )
    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_spacetime_for_coord( me    = me,    &
          &                                coord = coord, &
          &                                time  = time,  &
          &                                n     = 1      )
        res(iVal) = res_tmp(1)
      end do
    end select

  end function tem_spacetime_scalar_for_index