- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am creating an allocatable array and filling an array with data.
type ObsType
character p*8
integer*4 x,y,z
character desc*32
end type ObsType
common/Obsc/Obs/ObsTot
integer*4 ObsTot
type (ObsType),allocatable :: Obs(:)
allocate (Obs(ObsTot))
I then want to use this data in a subrourine and in the subroutine repeat the type & common definition bove.
Is this the correct way to go about it as I am getting compile errors,
the first is "This COMMON scalar or array is invalid in this context" on the allocatable line,
or cannot you not use allocatable arrays in subroutines?
David
type ObsType
character p*8
integer*4 x,y,z
character desc*32
end type ObsType
common/Obsc/Obs/ObsTot
integer*4 ObsTot
type (ObsType),allocatable :: Obs(:)
allocate (Obs(ObsTot))
I then want to use this data in a subrourine and in the subroutine repeat the type & common definition bove.
Is this the correct way to go about it as I am getting compile errors,
the first is "This COMMON scalar or array is invalid in this context" on the allocatable line,
or cannot you not use allocatable arrays in subroutines?
David
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
COMMON can't be ALLOCATABLE. Follow published examples where an allocatable module array is used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
COMMON can't be ALLOCATABLE. Follow published examples where an allocatable module array is used.
I have looked in the help - it mentions allocatable but not allocatable module
I am using Visual Fortran 6.0C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think DVF 6.0 had any samples of using allocatable arrays. That version is now 11 years old.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, the version is 6.6C.
Are there any examples elsewhere?
Are there any examples elsewhere?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - davidgraham
Sorry, the version is 6.6C.
Are there any examples elsewhere?
Are there any examples elsewhere?
http://www.stanford.edu/class/me200c/tutorial_90/09_modules.html
or
http://www.sdsc.edu/~tkaiser/f90.html#Passing arrays to subroutines
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