tem_varSys_append_stFunVar Subroutine

private subroutine tem_varSys_append_stFunVar(stFunVar, varSys, st_funList, solverData_evalElem)

subroutine to add the variables from the input lua script to the varsys

Arguments

Type IntentOptional Attributes Name
type(tem_variable_type), intent(in) :: stFunVar

variables defined in the lua file

type(tem_varSys_type), intent(inout) :: varSys

global variable system to which stFunVar to be appended

type(tem_st_fun_linkedList_type), intent(inout) :: st_funList

contains spacetime functions of all variables

type(tem_varSys_solverData_evalElem_type), intent(in), optional :: solverData_evalElem

A setter routine that allows the caller to define routine for the construction of an element representation.


Calls

proc~~tem_varsys_append_stfunvar~~CallsGraph proc~tem_varsys_append_stfunvar tem_varSys_append_stFunVar interface~append~9 append proc~tem_varsys_append_stfunvar->interface~append~9 proc~tem_abort tem_abort proc~tem_varsys_append_stfunvar->proc~tem_abort proc~tem_varsys_assignevaltype tem_varSys_assignEvalType proc~tem_varsys_append_stfunvar->proc~tem_varsys_assignevaltype proc~tem_varsys_append_dervar tem_varSys_append_derVar proc~tem_varsys_append_stfunvar->proc~tem_varsys_append_dervar proc~append_da_label append_da_label interface~append~9->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~9->proc~append_da_veclabel mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~tem_varsys_append_dervar->interface~append~9 interface~positionofval~5 positionofval proc~tem_varsys_append_dervar->interface~positionofval~5 interface~sortedposofval~5 sortedposofval proc~append_da_label->interface~sortedposofval~5 interface~expand~9 expand proc~append_da_label->interface~expand~9 proc~posofval_label posofval_label interface~positionofval~5->proc~posofval_label proc~append_da_veclabel->interface~expand~9 proc~sortposofval_label sortposofval_label interface~sortedposofval~5->proc~sortposofval_label proc~expand_da_label expand_da_label interface~expand~9->proc~expand_da_label proc~posofval_label->interface~sortedposofval~5

Called by

proc~~tem_varsys_append_stfunvar~~CalledByGraph proc~tem_varsys_append_stfunvar tem_varSys_append_stFunVar interface~tem_varsys_append_stfun tem_varSys_append_stfun interface~tem_varsys_append_stfun->proc~tem_varsys_append_stfunvar proc~tem_varsys_append_luavar tem_varSys_append_luaVar proc~tem_varsys_append_luavar->interface~tem_varsys_append_stfun proc~tem_variable_loadmapping_single tem_variable_loadMapping_single proc~tem_variable_loadmapping_single->interface~tem_varsys_append_stfun proc~tem_variable_loadmapping_vector tem_variable_loadMapping_vector proc~tem_variable_loadmapping_vector->proc~tem_variable_loadmapping_single interface~tem_variable_loadmapping tem_variable_loadMapping interface~tem_variable_loadmapping->proc~tem_variable_loadmapping_single interface~tem_variable_loadmapping->proc~tem_variable_loadmapping_vector proc~tem_load_bc_state tem_load_bc_state proc~tem_load_bc_state->interface~tem_variable_loadmapping

Contents


Source Code

  subroutine tem_varSys_append_stFunVar( stFunVar, varSys, st_funList, &
    &                                    solverData_evalElem           )
    ! -------------------------------------------------------------------------
    !> variables defined in the lua file
    type(tem_variable_type), intent(in)           :: stFunVar

    !> global variable system to which stFunVar to be appended
    type(tem_varSys_type), intent(inout)            :: varSys

    !> contains spacetime functions of all variables
    type(tem_st_fun_linkedList_type), intent(inout) :: st_funList

    !> A setter routine that allows the caller to define routine for the
    !! construction of an element representation.
    type(tem_varSys_solverData_evalElem_type), &
      &  optional, intent(in) :: solverData_evalElem
    ! -------------------------------------------------------------------------
    integer :: addedPos
    integer :: nComp
    logical :: wasAdded
    type(c_ptr) :: method_data
    procedure(tem_varSys_proc_point), pointer :: get_point => NULL()
    procedure(tem_varSys_proc_element), pointer :: get_element => NULL()
    procedure(tem_varSys_proc_setParams), pointer :: set_params => null()
    procedure(tem_varSys_proc_getParams), pointer :: get_params => null()
    procedure(tem_varSys_proc_setupIndices), pointer :: &
      &                                      setup_indices => null()
    procedure(tem_varSys_proc_getValOfIndex), pointer :: &
      &                                       get_valOfIndex => null()
    type(tem_st_fun_listElem_type), pointer  :: newElem
    ! -------------------------------------------------------------------------
    nullify(get_point, get_element, set_params, get_params, setup_indices, &
      &     get_valOfIndex)
    nComp = stFunVar%nComponents

    ! append space time function to linked list of spacetime functions
    call append( st_funList, stFunVar%st_fun, newElem )

    ! c pointer to list of spacetime functions of current variable
    !method_data = c_loc(st_funList%current)
    method_data = c_loc(newElem)

    ! assign function pointer depends on evaluation type
    call tem_varSys_assignEvalType( evaltype       = stfunVar%evaltype,    &
      &                             nComp          = stfunVar%nComponents, &
      &                             get_point      = get_point,            &
      &                             get_element    = get_element,          &
      &                             get_valOfIndex = get_valOfIndex        )

    set_params => set_params_spacetime
    get_params => get_params_spacetime
    setup_indices => setup_indices_spacetime

    if (.not. associated(get_point)) then
      call tem_abort( 'Error: No evaluation is defined for variable ' &
        & // trim(stfunvar%label) )
    end if

    ! append variable to varSys
    call tem_varSys_append_derVar( me             = varSys,         &
      &                            varName        = stFunVar%label, &
      &                            operType       = 'st_fun',       &
      &                            nComponents    = nComp,          &
      &                            method_data    = method_data,    &
      &                            get_point      = get_point,      &
      &                            get_element    = get_element,    &
      &                            set_params     = set_params,     &
      &                            get_params     = get_params,     &
      &                            setup_indices  = setup_indices,  &
      &                            get_valOfIndex = get_valOfIndex, &
      &                            pos            = addedPos,       &
      &                            wasAdded       = wasAdded        )

    if (wasAdded) then
      if (present(solverData_evalElem)) then
        ! If an solverData_evalElem function is provided,
        ! override the get_element pointer and use the provided setter
        ! solverData_evalElem instead to define the get_element routine.
        call solverData_evalElem%stFun_setter(varSys%method%val(addedPos))
      end if
      write(logUnit(9),*) 'Successfully appended variable "' &
        & // trim(stFunVar%label) // '" to the variable system'
    else if (addedpos < 1) then
      write(logUnit(1),*) 'WARNING: variable '//trim(stFunVar%label)// &
        &                 ' is not added to variable system'
    end if

  end subroutine tem_varSys_append_stFunVar