- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does intel Fortran support User-defined derived type I/O ?
this example code from http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=%2Fcom.ibm.xlf131.aix.doc%2Flanguage_ref%2Fuddtioprocedures.html
does not compile with ifort 12.1
this example code from http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=%2Fcom.ibm.xlf131.aix.doc%2Flanguage_ref%2Fuddtioprocedures.html
does not compile with ifort 12.1
[fortran]module m type point character(20) label integer x, y contains procedure :: writepoint generic :: write(formatted) => writepoint end type type :: line type(point) :: p1,p2 contains procedure :: writeline generic :: write(formatted) => writeline end type contains subroutine writepoint(dtv, unit, iotype, vlist, iostat, iomsg) class(point), intent(in) :: dtv integer, intent(in) :: unit character(*), intent(in) :: iotype integer, intent(in) :: vlist(:) integer, intent(out) :: iostat character(*), intent(inout) :: iomsg write(unit, *, iostat=iostat, iomsg=iomsg) & trim(dtv%label), ': (', dtv%x, ', ', dtv%y, ')' end subroutine subroutine writeline(dtv, unit, iotype, vlist, iostat, iomsg) class(line), intent(in) :: dtv integer, intent(in) :: unit character(*), intent(in) :: iotype integer, intent(in) :: vlist(:) integer, intent(out) :: iostat character(*), intent(inout) :: iomsg real length, delta_x, delta_y delta_x = dtv%p2%x - dtv%p1%x delta_y = dtv%p2%y - dtv%p1%y length = sqrt(delta_x**2 + delta_y**2) write(unit, *, iostat=iostat, iomsg=iomsg) & 'Distance from ', dtv%p1, ' to ', dtv%p2, ' is ', length end subroutine end module m program Test use m type(point) :: p = point('Point1', x=1, y=1) type(line) :: l l = line(p, point('Point2', x=4, y=5)) print *, l end program Test[/fortran]
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No - we don't support that or parameterized derived types yet.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page