Read an $MshMeshFormat
from a connected unformatted unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(gmsh_msh_format_type), | intent(inout) | :: | gmsh_msh_format | |||
integer, | intent(in) | :: | unit | |||
integer, | intent(out) | :: | iostat | |||
character(len=*), | intent(inout) | :: | iomsg |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=1), | private | :: | buffer |
A |
|||
integer, | private | :: | itr | ||||
character(len=32), | private | :: | str |
A |
subroutine read_unformatted(gmsh_msh_format, unit, iostat, iomsg) class(gmsh_msh_format_type), intent(inout) :: gmsh_msh_format integer, intent(in) :: unit integer, intent(out) :: iostat character(*), intent(inout) :: iomsg integer :: itr !> Version: experimental !> A `character` variable to read a character. character(1) :: buffer !> Version: experimental !> A `character` variable for holding read string.<br> !> The length of this string is provisional. character(32) :: str read_header: &! block itr = 1 iomsg = '' str = '' do read( &! unit = unit , &! iostat = iostat , &! iomsg = iomsg &! ) &! buffer if ( iostat .ne. iostat_success ) return if ( buffer(1:1) .eq. '$' ) then str(itr:itr) = buffer(1:1) itr = itr + 1 exit end if end do do read( &! unit = unit , &! iostat = iostat , &! iomsg = iomsg &! ) &! buffer if ( iostat .ne. iostat_success ) return if ( buffer(1:1) .eq. c_new_line ) then call check_text_line( &! text_line = str(1:itr) , &! str = header , &! iostat = iostat , &! iomsg = iomsg &! ) exit end if str(itr:itr) = buffer(1:1) itr = itr + 1 end do if ( iostat .ne. iostat_success ) return end block &! read_header read_values: &! block itr = 1 str = '' do read( &! unit = unit , &! iostat = iostat , &! iomsg = iomsg &! ) &! buffer if ( iostat .ne. iostat_success ) return if ( buffer(1:1) .eq. c_new_line ) exit str(itr:itr) = buffer(1:1) itr = itr + 1 end do read( &! unit = str(1:itr) , &! fmt = * , &! iostat = iostat , &! iomsg = iomsg &! ) &! gmsh_msh_format%version , &! gmsh_msh_format%file_type , &! gmsh_msh_format%data_size if ( iostat .ne. iostat_success ) return end block &! read_values read_footer: &! block itr = 1 iomsg = '' str = '' do read( &! unit = unit , &! iostat = iostat , &! iomsg = iomsg &! ) &! buffer if ( iostat .ne. iostat_success ) return if ( buffer(1:1) .eq. '$' ) then str(itr:itr) = buffer(1:1) itr = itr + 1 exit end if end do do read( &! unit = unit , &! iostat = iostat , &! iomsg = iomsg &! ) &! buffer if ( iostat .ne. iostat_success ) return if ( buffer(1:1) .eq. c_new_line ) then call check_text_line( &! text_line = str(1:itr) , &! str = footer , &! iostat = iostat , &! iomsg = iomsg &! ) exit end if str(itr:itr) = buffer(1:1) itr = itr + 1 end do if ( iostat .ne. iostat_success ) return end block &! read_footer end subroutine read_unformatted