subroutine to add the variables from the input lua script to the varsys
Type | Intent | Optional | 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. |
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