module sfx_common
    !> @brief surface flux code common subroutines
    public

contains

    ! ----------------------------------------------------------------------------
    elemental subroutine str2int(int, str, stat)
        !> @brief string to int conversion
        ! ----------------------------------------------------------------------------
        implicit none
        integer, intent(out) :: int
        integer, intent(out) :: stat

        character(len = *), intent(in) :: str
        ! ----------------------------------------------------------------------------

        read(str, * , iostat=stat) int
    end subroutine str2int
    ! ----------------------------------------------------------------------------

    elemental function is_finite(value)
        use ieee_arithmetic
        implicit none
        logical :: is_finite
        real, intent(in) :: value

        is_finite = ieee_is_finite(value)
    end function is_finite

end module sfx_common