Explicit Shape Specifications

Explicit Shape Specifications

I would like to know how after defining an array, in my main program, with explicit values for the bounds, I can pass this array to multiple subroutines.
Currently, if I use a common statement, I get an error that automatic arrays are not allowed in common statements.

I have 20 such arrays, all of which have to be passed to multiple subroutines.


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

When you say that you are providing explicit bounds, do you mean in the declaration?

If you are declaring the array as "Allocatable" and then explicitly dimensioning it in an "Allocate" statement, the compiler is telling you that it needs to know the size and shape of all elements in the common at compile time.

If you are declaring the array explicitly, the error message is probably generated by the common statement where you have tried to use something like:

Common /Shared_Data/ Big_Array(:,:)

In any case...
The best method for sharing data between routines is to pass it through an explicit interface. This provides the best compile time error checking.
Admittedly, 20 arrays is a little much for a calling interface. So, the second best method is to write a "Module" that contains the data and "Use" that module in each of the routines. The CVF documentation or any text on Fortran90 will get you started.

Leave a Comment

Please sign in to add a comment. Not a member? Join today