Reads boundary patch definitions and face lists from patches.dat.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename | |||
| type(mesh_t), | intent(inout) | :: | m |
subroutine read_patches(filename, m) character(len=*), intent(in) :: filename type(mesh_t), intent(inout) :: m integer :: unit_id, ios, p, id, nfaces character(len=64) :: name open(newunit=unit_id, file=trim(filename), status='old', action='read', iostat=ios) if (ios /= 0) call fatal_error('mesh_io', 'could not open '//trim(filename)) read(unit_id, *, iostat=ios) m%npatches if (ios /= 0 .or. m%npatches < 0) call fatal_error('mesh_io', 'invalid patches header') allocate(m%patches(m%npatches)) do p = 1, m%npatches read(unit_id, *, iostat=ios) id, name, nfaces if (ios /= 0) call fatal_error('mesh_io', 'failed reading patch header') if (id < 1 .or. id > m%npatches) call fatal_error('mesh_io', 'patch id out of range') m%patches(id)%id = id m%patches(id)%name = name m%patches(id)%nfaces = nfaces allocate(m%patches(id)%face_ids(nfaces)) if (nfaces > 0) then read(unit_id, *, iostat=ios) m%patches(id)%face_ids if (ios /= 0) call fatal_error('mesh_io', 'failed reading patch face ids') else read(unit_id, *, iostat=ios) end if end do close(unit_id) end subroutine read_patches