dyn_mpas_get_constituent_name Function

private pure function dyn_mpas_get_constituent_name(self, constituent_index) result(constituent_name)

This function returns the constituent name that corresponds to the given constituent index. In case of errors, an empty character string is produced.

Type Bound

mpas_dynamical_core_type

Arguments

Type IntentOptional Attributes Name
class(mpas_dynamical_core_type), intent(in) :: self
integer, intent(in) :: constituent_index

Return Value character(len=:), allocatable


Called by

proc~~dyn_mpas_get_constituent_name~~CalledByGraph proc~dyn_mpas_get_constituent_name mpas_dynamical_core_type%dyn_mpas_get_constituent_name none~set_mpas_state_scalars set_mpas_state_scalars none~set_mpas_state_scalars->proc~dyn_mpas_get_constituent_name proc~set_analytic_initial_condition set_analytic_initial_condition proc~set_analytic_initial_condition->none~set_mpas_state_scalars proc~dyn_init dyn_init proc~dyn_init->proc~set_analytic_initial_condition

Source Code

    pure function dyn_mpas_get_constituent_name(self, constituent_index) result(constituent_name)
        class(mpas_dynamical_core_type), intent(in) :: self
        integer, intent(in) :: constituent_index

        character(:), allocatable :: constituent_name

        ! Catch segmentation fault.
        if (.not. allocated(self % constituent_name)) then
            constituent_name = ''

            return
        end if

        if (constituent_index < lbound(self % constituent_name, 1) .or. &
            constituent_index > ubound(self % constituent_name, 1)) then
            constituent_name = ''

            return
        end if

        constituent_name = trim(adjustl(self % constituent_name(constituent_index)))
    end function dyn_mpas_get_constituent_name