Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29278 Discussions

Make a short Sentence for Declaring Array in Derived Type

우왕희_WooWangHee
818 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
818 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
819 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