Size(ASSUMED Size ARRAY) 
Author Message
 Size(ASSUMED Size ARRAY)

Hiho everyone!
    In the following snippet:

INTEGER FUNCTION GRID_CHECKSUM( Array_of_2_DIMS )
INTEGER, DIMENSION( 255, * ), INTENT(IN)    :: Array_of_2_DIMS

INTEGER x, y
      .
      .
      .

y = SIZE( Array_of_2_DIMS, DIM=2 )

    .
    .
    .
END FUNCTION GRID_CHECKSUM

Is it the intent of the F90 STANDARD that this is invalid?

Thanks



Wed, 18 Jun 1902 08:00:00 GMT  
 Size(ASSUMED Size ARRAY)

Quote:

> Hiho everyone!
>     In the following snippet:

> INTEGER FUNCTION GRID_CHECKSUM( Array_of_2_DIMS )
> INTEGER, DIMENSION( 255, * ), INTENT(IN)    :: Array_of_2_DIMS

> INTEGER x, y
>       .
>       .
>       .

> y = SIZE( Array_of_2_DIMS, DIM=2 )

>     .
>     .
>     .
> END FUNCTION GRID_CHECKSUM

> Is it the intent of the F90 STANDARD that this is invalid?

> Thanks

Yes.  You're using the old fortran 77 assumed SIZE array feature.
Here it is your responsibility to control all references to the
array and NEVER use it in a context where the last subscript isn't
explicitly present.  The compiler doesn't pass the dimension by magic,
you have to do that.

Maybe you want the new assumed SHAPE arrays where the compiler does
pass the shape information by magic.  You need to do two things,
first put the subroutine in a module and use the module (or you
could write an interface block for the subroutine, but that's
very much inferior to using a module), and second change the
declaration to
INTEGER, DIMENSION( : , : ), INTENT(IN)    :: Array_of_2_DIMS

In effect, this declares the array to be dimensioned
(1:x1, 1:x2) where the compiler passes in x1 and x2 by magic.

There is no way to have the compiler only pass in the last dimension.

Dick Hendrickson



Wed, 18 Jun 1902 08:00:00 GMT  
 Size(ASSUMED Size ARRAY)
Quote: "An assumed-size array has no upper bound in its last
dimension and therefore has no extent in its last dimension and
no shape. etc."

So, it cannot be used as you are attempting.

Regards,

Mike Metcalf

--



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Assumed Size VS Assumed Shape Array

2. advantages of assumed shape (fortran 90 feature) over assumed size (fortran 77 feature)

3. Rank matching on assumed size array argument

4. f2py Assumed-Size Array Arguments

5. f2py Assumed-Size Array Arguments

6. Problem with Cray pointers and assumed-size arrays

7. Assumed-size arrays and explicit interfaces

8. g77 and adjustable/assumed size arrays question

9. Assumed-Size Arrays

10. Q: F90 and Assumed Size Arrays

11. Are assumed-size array args faster than adjustable?

12. Assumed-size arrays and intent(out)

 

 
Powered by phpBB® Forum Software