rename_id Subroutine

private recursive subroutine rename_id(cmp, prefix, postfix)

Arguments

Type IntentOptional Attributes Name
type(type_dictionary), intent(inout) :: cmp
character(len=*), intent(in) :: prefix
character(len=*), intent(in) :: postfix

Calls

proc~~rename_id~~CallsGraph proc~rename_id rename_id proc~rename_id->proc~rename_id get_dictionary get_dictionary proc~rename_id->get_dictionary get_list get_list proc~rename_id->get_list get_string get_string proc~rename_id->get_string proc~select_dict select_dict proc~rename_id->proc~select_dict set_string set_string proc~rename_id->set_string

Called by

proc~~rename_id~~CalledByGraph proc~rename_id rename_id proc~rename_id->proc~rename_id proc~rename_components rename_components proc~rename_components->proc~rename_id proc~rename_components->proc~rename_components proc~input_open_yaml input_t%input_open_yaml proc~input_open_yaml->proc~rename_components

Source Code

recursive subroutine rename_id(cmp,prefix,postfix)
    type(type_dictionary), intent(inout) :: cmp
    character(*), intent(in) :: prefix,postfix
    type(type_error),allocatable :: err
    character(:), allocatable :: cmp_id
    type(type_dictionary),pointer :: dict
    type(type_list),pointer       :: list
    type(type_list_item),pointer  :: list_item
    list => null()
    dict => null()

    cmp_id = cmp%get_string('id','',err)    
    if (cmp_id/='') then
        cmp_id = prefix//cmp_id//postfix
        call cmp%set_string('id',cmp_id)
    endif

    dict => cmp%get_dictionary('port',.true.,err)
    if (allocated(err)) then; deallocate(err)
    else; call rename_id(dict,prefix,postfix); endif

    dict => cmp%get_dictionary('in',.true.,err)
    if (allocated(err)) then; deallocate(err)
    else; call rename_id(dict,prefix,postfix); endif
    
    dict => cmp%get_dictionary('out',.true.,err)
    if (allocated(err)) then; deallocate(err)
    else; call rename_id(dict,prefix,postfix); endif
    
    list => cmp%get_list('branches',.false.,err)
    if (.not.associated(list)) then
        list => cmp%get_list('link',.false.,err)
        if (.not.associated(list)) then
            return
        endif
    endif
    list_item => list%first
    do while(associated(list_item))
        dict => select_dict(list_item%node)
        call rename_id(dict,prefix,postfix)
        list_item => list_item%next
    enddo
end subroutine rename_id