Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29281 Discussions

Make a short Sentence for Declaring Array in Derived Type

우왕희_WooWangHee
827 Views
I want to make a shortly Sentence From A to B
For Example,
allocate(AllToAllTPath(1:11,1:11)%ID(11,11)) -> Occured Error ^^;
Help me~

!!!Sample Code
program Console1

Implicit None

Type :: ATATP
INTEGER, ALLOCATABLE:: ID(:,:)
End Type ATATP

Type(ATATP), Allocatable :: AllToAllTPath(:,:)

Integer I, J

allocate(AllToAllTPath(11,11))

!!!!!!! A

Do I=1, 11

Do J=1, 11

allocate(AllToAllTPath(I,J)%ID(11,11))

End Do

End Do

!!!!! B

end program Console1

0 Kudos
1 Solution
Steven_L_Intel1
Employee
827 Views
Sorry, the Fortran language does not have the shortcut you are looking for. You cannot allocate multiple elements of AllToAllTPath in a single ALLOCATE. You have to do it with a loop as in your program - first allocating AllToAllTPath and then allocating the ID component of each element.

View solution in original post

0 Kudos
1 Reply
Steven_L_Intel1
Employee
828 Views
Sorry, the Fortran language does not have the shortcut you are looking for. You cannot allocate multiple elements of AllToAllTPath in a single ALLOCATE. You have to do it with a loop as in your program - first allocating AllToAllTPath and then allocating the ID component of each element.
0 Kudos
Reply