port_list_find Function

public function port_list_find(me, name, idx) result(idx_out)

Type Bound

port_list_t

Arguments

Type IntentOptional Attributes Name
class(port_list_t), intent(in), target :: me
character(len=*), intent(in) :: name

Name of the component

integer, intent(in) :: idx

Port number

Return Value integer

Index of the port on ports array


Calls

proc~~port_list_find~~CallsGraph proc~port_list_find port_list_t%port_list_find interface~to_str to_str proc~port_list_find->interface~to_str proc~to_int to_int proc~port_list_find->proc~to_int proc~str_from_int str_from_int interface~to_str->proc~str_from_int proc~str_from_real str_from_real interface~to_str->proc~str_from_real

Called by

proc~~port_list_find~~CalledByGraph proc~port_list_find port_list_t%port_list_find proc~boundary_init_part2 boundary_init_part2 proc~boundary_init_part2->proc~port_list_find proc~circulator_init_part2 circulator_init_part2 proc~circulator_init_part2->proc~port_list_find proc~ffsrclink_init_part2 FFsrcLink_init_part2 proc~ffsrclink_init_part2->proc~port_list_find proc~fslink_init_part2 FSlink_init_part2 proc~fslink_init_part2->proc~port_list_find proc~junction_init_part2 junction_init_part2 proc~junction_init_part2->proc~port_list_find proc~ssfluxlink_init_part2 SSfluxLink_init_part2 proc~ssfluxlink_init_part2->proc~port_list_find proc~sssrclink_init_part2 SSsrcLink_init_part2 proc~sssrclink_init_part2->proc~port_list_find program~reims_p reims_p program~reims_p->proc~boundary_init_part2 program~reims_p->proc~circulator_init_part2 program~reims_p->proc~ffsrclink_init_part2 program~reims_p->proc~fslink_init_part2 program~reims_p->proc~junction_init_part2 program~reims_p->proc~ssfluxlink_init_part2 program~reims_p->proc~sssrclink_init_part2

Source Code

function port_list_find(me,name,idx) result(idx_out)
    class(port_list_t), target, intent(in) :: me
    character(*), intent(in) :: name !! Name of the component
    integer, intent(in) :: idx       !! Port number
    integer :: idx_out               !! Index of the port on ports array
    integer :: nbPorts, offset, i, pos

    pos = index(me%list,' '//name//':')
    if (pos == 0) then
        print*, 'ERROR: component "'//name//'" not found in port list.'
        error stop 'Aborting: unknown component ID in connection.'
    endif
    i = pos + len(name) + 2
    nbPorts = to_int(me%list(i:))
    if (idx > nbPorts) then
        print*, 'ERROR: port index '//to_str(idx)//' exceeds nb ports ('//to_str(nbPorts)//') for "'//name//'"'
        error stop 'Aborting: port index out of range.'
    endif
    offset = to_int(me%list(i+index(me%list(i:),','):))
    idx_out = idx + offset - 1
end function port_list_find