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

Allocate and subroutines

davidgraham
Einsteiger
827Aufrufe
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



0 Kudos
5 Antworten
TimP
Geehrter Beitragender III
827Aufrufe
COMMON can't be ALLOCATABLE. Follow published examples where an allocatable module array is used.
davidgraham
Einsteiger
827Aufrufe
Quoting - tim18
COMMON can't be ALLOCATABLE. Follow published examples where an allocatable module array is used.
Where are the published examples?
I have looked in the help - it mentions allocatable but not allocatable module
I am using Visual Fortran 6.0C

Steven_L_Intel1
Mitarbeiter
827Aufrufe
I don't think DVF 6.0 had any samples of using allocatable arrays. That version is now 11 years old.
davidgraham
Einsteiger
827Aufrufe
Sorry, the version is 6.6C.
Are there any examples elsewhere?

TimP
Geehrter Beitragender III
827Aufrufe
Quoting - davidgraham
Sorry, the version is 6.6C.
Are there any examples elsewhere?
I was thinking of the example in MR&C textbook, right at the beginning of the discussion of allocatable. What about
http://www.stanford.edu/class/me200c/tutorial_90/09_modules.html
or
http://www.sdsc.edu/~tkaiser/f90.html#Passing arrays to subroutines

Antworten