- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am encounting a very strange run-time error at following code
----------------------------------------------------------
DOUBLE PRECISION,ALLOCATABLE, DIMENSION(:,:) :: coordinate
INTEGER, ALLOCATABLE, DIMENSION(:,:) :: element
INTEGER, ALLOCATABLE, DIMENSION(:) :: elementType
INTEGER, DIMENSION(n) :: a,b
DO i=1,n
...
ALLOCATE(coordinate(a(i),3),STAT=status)
ALLOCATE(element(b(i),3),STAT=status)
ALLOCATE(elementType(b(i)),STAT=status)
...
DEALLOCATE(coordinate,element,elementType)
...
ENDO
----------------------------------------------------------
When i==1,no problem.
When i==2. At first, all the allocatble arrays are in the state of undefined pointer/array. But after ALLOCATE(coordinate(a(i),3) is excuted, Array element turns to be allocated automatically with its size as (b(1),3), but elementType is still an undefined array. Therefore, the excution of Allocate(element(b(2),3)) would give rise to a severe error" allocatable array is already allocated" (status=151). Could you tell me what's the possible reason?
Thanks!
----------------------------------------------------------
DOUBLE PRECISION,ALLOCATABLE, DIMENSION(:,:) :: coordinate
INTEGER, ALLOCATABLE, DIMENSION(:,:) :: element
INTEGER, ALLOCATABLE, DIMENSION(:) :: elementType
INTEGER, DIMENSION(n) :: a,b
DO i=1,n
...
ALLOCATE(coordinate(a(i),3),STAT=status)
ALLOCATE(element(b(i),3),STAT=status)
ALLOCATE(elementType(b(i)),STAT=status)
...
DEALLOCATE(coordinate,element,elementType)
...
ENDO
----------------------------------------------------------
When i==1,no problem.
When i==2. At first, all the allocatble arrays are in the state of undefined pointer/array. But after ALLOCATE(coordinate(a(i),3) is excuted, Array element turns to be allocated automatically with its size as (b(1),3), but elementType is still an undefined array. Therefore, the excution of Allocate(element(b(2),3)) would give rise to a severe error" allocatable array is already allocated" (status=151). Could you tell me what's the possible reason?
Thanks!
Link Copied
0 Replies
![](/skins/images/8B5EA638CA3587CA763EE9EF53643DD4/responsive_peak/images/icon_anonymous_message.png)
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