<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Even modifying the code I in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092470#M124698</link>
    <description>&lt;P&gt;Even modifying the code I still get runtime errors.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;As workaround, there is a simple way to overload read a write?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Jun 2016 19:40:14 GMT</pubDate>
    <dc:creator>ericcp_dias_ie</dc:creator>
    <dc:date>2016-06-12T19:40:14Z</dc:date>
    <item>
      <title>troubles with io: nested dt descriptor</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092467#M124695</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hello,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;I am writing a code in which I need to use a derived data type that include another derived data type.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I've been able to follow the examples tu use the DT descriptor for user defined io within the first one, but in the second one I get an error from the compiler, namely&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;model.f90: error #8638: The type/rank signature for arguments of this specific subroutine is identical to another specific subroutine that shares the same defined I/O.   [UDIO_WRITE_NODE]
model.f90: error #8638: The type/rank signature for arguments of this specific subroutine is identical to another specific subroutine that shares the same defined I/O.   [UDIO_WRITE_MODEL]
model.f90: error #8638: The type/rank signature for arguments of this specific subroutine is identical to another specific subroutine that shares the same defined I/O.   [UDIO_READ_NODE]
compilation aborted for model.f90 (code 1)
&lt;/PRE&gt;

&lt;P&gt;I have to admit that I simply nested the two io procedures.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The inner derived data type works finely&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module myNode
  implicit none
  type node
     logical :: isIsotropic
     real    :: depth
     real    :: sigmaMean
     real    :: sigmaRatio
     real    :: betaS
  end type node

  interface write(formatted)
     module procedure udio_write_node
  end interface write(formatted)

  interface read(formatted)
     module procedure udio_read_node
  end interface read(formatted)


contains



  subroutine udio_read_node(dtv, unit, iotype, v_list, iostat, iomsg)
    !
    !
    !        ifort note: to enable reading int as logical the code must be compiled with the flag
    !
    !        -assume old_logical_ldio
    !
    !
    class(node), intent(inout)  :: dtv
    integer, intent(in)         :: unit
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg

    read(unit,fmt=*,iostat=iostat,iomsg=iomsg) dtv%isIsotropic, dtv%depth, dtv%sigmamean, dtv%sigmaratio, dtv%betas

  end subroutine udio_read_node

  subroutine udio_write_node(dtv, unit, iotype, v_list, iostat, iomsg)
    class(node), intent(in)     :: dtv
    integer, intent(in)         :: unit
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg
    if(dtv%isIsotropic)then
       write(unit, fmt=*, iostat=iostat, iomsg=iomsg) 1, dtv%depth, dtv%sigmamean, dtv%sigmaratio, dtv%betas
    else
       write(unit, fmt=*, iostat=iostat, iomsg=iomsg) 0, dtv%depth, dtv%sigmamean, dtv%sigmaratio, dtv%betas
    end if
  end subroutine udio_write_node

end module myNode
&lt;/PRE&gt;

&lt;PRE class="brush:fortran;"&gt;program test1
  use myNode
  implicit none
  integer :: i
  type(node),dimension(4) :: n

!!$  do i = 1,4
!!$     n(i)%isIsotropic = .true.
!!$     n(i)%depth = real(i)*1.1
!!$     n(i)%sigmamean = real(i) * 0.5
!!$     n(i)%sigmaratio = real(i) * 1.0
!!$     n(i)%betas = real(i) * 15.0
!!$  end do

  open(1,file='iotest.txt',form='formatted',recl=2048)
  read(1,"(4(dt))") n
  close(1)

  do i = 1,4
     write(*,"(dt)") n(i)
  end do


end program test1
&lt;/PRE&gt;

&lt;P&gt;but when I try to use the same with another type that contains an array of type(node) i get the compilation error.&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module model
  use mynode
  implicit none

  integer, private, parameter :: kmax = 32
  
  type model
     integer :: k     = 1
     real    :: logL  = 0.
     real    :: logPr = 0.
     real    :: h_par = 1.
     type(node), dimension (kmax) :: par
    
  end type model
  
  interface write(formatted)
     module procedure udio_write_model
  end interface write(formatted)

  interface read(formatted)
     module procedure udio_read_model
  end interface read(formatted)

contains
  subroutine udio_read_model(dtvv, unit, iotype, v_list, iostat, iomsg)
    !
    !
    !        ifort note: to enable reading int as logical the code must be compiled with the flag
    !
    !        -assume old_logical_ldio
    !
    !
    class(model), intent(inout)    :: dtvv
    integer, intent(in)            :: unit
    character(*), intent(in)       :: iotype
    integer, intent(in)            :: v_list(:)
    integer, intent(out)           :: iostat
    character(*), intent(inout)    :: iomsg

    read(unit,fmt=*,iostat=iostat,iomsg=iomsg) dtvv%k, dtvv%logL, dtvv%logPr, dtvv%h_par, dtvv%par(1:dtvv%k)
    
  end subroutine udio_read_model

subroutine udio_write_model(dtv, unit, iotype, v_list, iostat, iomsg)
    class(model), intent(in)    :: dtv
    integer, intent(in)         :: unit
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg

    write(unit, fmt=*, iostat=iostat, iomsg=iomsg) dtv%k, dtv%logL, dtv%logPr, dtv%h_par, dtv%par(1:dtv%k)

  end subroutine udio_write_model

end module model

program test1
  use mtmodel
  use mynode
  implicit none

  type(model) :: m
  integer :: i
  open(1,file='iotest.txt',form='formatted',recl=2048)
  read(1,"(dt)") m
  close(1)

  write(*,"(dt)") m

  do i = 1,4
     write(*,"(dt)") m%par(i)
  end do
end program test1
&lt;/PRE&gt;

&lt;P&gt;What's the proper way to chain the user defined io procedure?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks in advance for any help.&lt;/P&gt;

&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 10:50:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092467#M124695</guid>
      <dc:creator>ericcp_dias_ie</dc:creator>
      <dc:date>2016-06-10T10:50:43Z</dc:date>
    </item>
    <item>
      <title>I believe that your code is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092468#M124696</link>
      <description>&lt;P&gt;I believe that your code is correct, but apparently, the compiler is getting confused by the interface declarations.&lt;/P&gt;

&lt;P&gt;I changed the type declarations to have type-bound procedures instead, and removed the generic interfaces, and the program compiled.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;More specifically, I changed the declaration of node to:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&amp;nbsp; type node
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logical :: isIsotropic
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real&amp;nbsp;&amp;nbsp;&amp;nbsp; :: depth
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real&amp;nbsp;&amp;nbsp;&amp;nbsp; :: sigmaMean
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real&amp;nbsp;&amp;nbsp;&amp;nbsp; :: sigmaRatio
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real&amp;nbsp;&amp;nbsp;&amp;nbsp; :: betaS
&amp;nbsp; contains
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; procedure :: udio_read_node
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; procedure :: udio_write_node
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; generic&amp;nbsp;&amp;nbsp; :: write(formatted) =&amp;gt; udio_write_node
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; generic&amp;nbsp;&amp;nbsp; :: read(formatted) =&amp;gt; udio_read_node
&amp;nbsp; end type node&lt;/PRE&gt;

&lt;P&gt;Similar edit for type model.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I hope this helps -&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --Lorri&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 11:58:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092468#M124696</guid>
      <dc:creator>Lorri_M_Intel</dc:creator>
      <dc:date>2016-06-10T11:58:19Z</dc:date>
    </item>
    <item>
      <title>I have escalated this as</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092469#M124697</link>
      <description>&lt;P&gt;I have escalated this as issue&amp;nbsp;DPD200411713. I also note that the error messages lack "locator" information to tell you where in the source file the error (allegedly) occurred.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 17:15:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092469#M124697</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2016-06-10T17:15:34Z</dc:date>
    </item>
    <item>
      <title>Even modifying the code I</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092470#M124698</link>
      <description>&lt;P&gt;Even modifying the code I still get runtime errors.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;As workaround, there is a simple way to overload read a write?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2016 19:40:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092470#M124698</guid>
      <dc:creator>ericcp_dias_ie</dc:creator>
      <dc:date>2016-06-12T19:40:14Z</dc:date>
    </item>
    <item>
      <title>Please show a complete test</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092471#M124699</link>
      <description>&lt;P&gt;Please show a complete test case with the modified code.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2016 23:25:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092471#M124699</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2016-06-12T23:25:45Z</dc:date>
    </item>
    <item>
      <title>The node.f90 module stays the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092472#M124700</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;The node.f90 module stays the same&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module myNode
  implicit none
  type node
     logical :: isIsotropic
     real    :: depth
     real    :: sigmaMean
     real    :: sigmaRatio
     real    :: betaS
   contains
     procedure :: udio_read_node
     procedure :: udio_write_node
     generic   :: read(formatted)  =&amp;gt; udio_read_node
     generic   :: write(formatted) =&amp;gt; udio_write_node
  end type node

!!$  interface write(formatted)
!!$     module procedure udio_write_node
!!$  end interface write(formatted)
!!$
!!$  interface read(formatted)
!!$     module procedure udio_read_node
!!$  end interface read(formatted)


contains


  
  subroutine udio_read_node(dtv, unit, iotype, v_list, iostat, iomsg)
    !
    !
    !        ifort note: to enable reading int as logical the code must be compiled with the flag
    !
    !        -assume old_logical_ldio
    !
    !
    class(node), intent(inout)  :: dtv
    integer, intent(in)         :: unit
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg
    
    read(unit,fmt=*,iostat=iostat,iomsg=iomsg) dtv%isIsotropic, dtv%depth, dtv%sigmamean, dtv%sigmaratio, dtv%betas

  end subroutine udio_read_node

  subroutine udio_write_node(dtv, unit, iotype, v_list, iostat, iomsg)
    class(node), intent(in)     :: dtv
    integer, intent(in)         :: unit
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg
    if(dtv%isIsotropic)then
       write(unit, fmt=*, iostat=iostat, iomsg=iomsg) 1, dtv%depth, dtv%sigmamean, dtv%sigmaratio, dtv%betas
    else
       write(unit, fmt=*, iostat=iostat, iomsg=iomsg) 0, dtv%depth, dtv%sigmamean, dtv%sigmaratio, dtv%betas
    end if
  end subroutine udio_write_node

end module myNode&lt;/PRE&gt;

&lt;P&gt;and works as before.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;If I try to nest the node structure into another one I get&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;forrtl: severe (105): there is no data-edit-descriptor to match a data-item in the I/O list, unit 1, file /Users/eric/Src/greenTDMT/iotest_write.txt
Image              PC                Routine            Line        Source             
test               0000000104292E5C  Unknown               Unknown  Unknown
test               00000001042BE122  Unknown               Unknown  Unknown
test               000000010427C00E  Unknown               Unknown  Unknown
test               000000010427BB7E  Unknown               Unknown  Unknown
&lt;/PRE&gt;

&lt;P&gt;explicitly I try to read/write na array of nodes and a bunch of other parameters&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module mtmodel
  use mynode
  implicit none

  integer, private, parameter :: kmax = 32
  
  type model
     integer :: k     = 1
     real    :: logL  = 0.
     real    :: logPr = 0.
     real    :: h_par = 1.
     type(node), dimension (kmax) :: par
   contains
     procedure :: udio_read_model
     procedure :: udio_write_model
     generic   :: read(formatted)  =&amp;gt; udio_read_model
     generic   :: write(formatted) =&amp;gt; udio_write_model
  end type model

!!$  interface read(formatted)
!!$     module procedure udio_read_model
!!$  end interface read(formatted)
!!$
!!$  interface write(formatted)
!!$     module procedure udio_write_model
!!$  end interface write(formatted)


contains
  subroutine udio_read_model(dtv, unit, iotype, v_list, iostat, iomsg)
    !
    !
    !        ifort note: to enable reading int as logical the code must be compiled with the flag
    !
    !        -assume old_logical_ldio
    !
    !
    class(model), intent(inout)    :: dtv
    integer, intent(in)            :: unit
    character(*), intent(in)       :: iotype
    integer, intent(in)            :: v_list(:)
    integer, intent(out)           :: iostat
    character(*), intent(inout)    :: iomsg

    read(unit,fmt=*,iostat=iostat,iomsg=iomsg) dtv%k, dtv%logL, dtv%logPr, dtv%h_par, dtv%par(1:dtv%k)
    
  end subroutine udio_read_model

subroutine udio_write_model(dtv, unit, iotype, v_list, iostat, iomsg)
    class(model), intent(in)    :: dtv
    integer, intent(in)         :: unit
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg

    write(unit, fmt=*, iostat=iostat, iomsg=iomsg) dtv%k, dtv%logL, dtv%logPr, dtv%h_par, dtv%par(1:dtv%k)
  end subroutine udio_write_model

!!$  function forward(m,period) result(z)
!!$    implicit none
!!$    type(model), intent(in) :: m
!!$    real, intent(in)        :: period
!!$    complex, dimension(2,2) :: z
!!$
!!$    call z1anis()
  
end module mtmodel

program test1
  use mtmodel
  use mynode, only : node
  implicit none

  type(model) :: m
  type(node), dimension(4)  :: n
  integer :: i

  do i = 1,4
     n(i)%isIsotropic = .true.
     n(i)%depth = real(i)*1.1
     n(i)%sigmamean = real(i) * 0.5
     n(i)%sigmaratio = real(i) * 1.0
     n(i)%betas = real(i) * 15.0
  end do  

  m%par(1:4) = n
  
  open(1,file='iotest_write.txt',form='formatted',recl=2048)
  write(1,113) m
  close(1)

!  write(*,113) m

!!$  do i = 1,4
!!$     write(*,"(dt)") m%par(i)
!!$  end do
113 format(dt)
end program test1
&lt;/PRE&gt;

&lt;P&gt;I think that the problem could be that I use the * descriptor in both the node and model i/o subroutine, but I am not sure about that.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2016 14:19:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/troubles-with-io-nested-dt-descriptor/m-p/1092472#M124700</guid>
      <dc:creator>ericcp_dias_ie</dc:creator>
      <dc:date>2016-06-25T14:19:36Z</dc:date>
    </item>
  </channel>
</rss>

