- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

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