Print

Print


On Wed, Apr 11, 2012 at 6:34 PM, Malcolm Cohen <[log in to unmask]> wrote:
> Anthony Stone suggested:
>
>> Perhaps you could declare a(30,40,1)?
>
>
> Oliver Fuhrer replied:
>
>> that's not really an option. I am working in a 250'000 lines code where
>> changing the dimensionality of a field potentially impacts _a lot_ of lines
>> to change (switching (i,j) to (i,j,1) throughout the whole program). I am
>> looking for a way for p(:,:,1:1) to point to a(:,:) somehow.
>
>
> Well then, you could do it the other way around:
>   Real,Target :: p(30,40,1)
Maybe you mean
     Real,Target :: a3(30,40,1)  ?

>   Real,Pointer :: a(:,:)
>   a => a3(:,:,1)
>
> Or if sometimes you want p to point to a, and sometimes to something else
>
>  Real,Target :: a3(30,40,1)
>  Real,Pointer :: a(:,:),p(:,:,:)
>  a => a3(:,:,1)
>  p => a3
>
> Both of these work in plain F90, no complicated F2008 feature required!
>
> Cheers.
> --
> ................................Malcolm Cohen, Nihon NAG, Tokyo.