Hi,
If your compiler supports pointer rank remapping, try
p( 1: 30, 1: 40, 1: 1) => a
On Apr 11, 2012, at 09:51 , Oliver Fuhrer wrote:
> Hi all,
>
> I have the following...
>
> real, target :: a(30,40)
> real, target :: b(30,40,50)
> real, pointer :: p(:,:,:)
>
> subroutine work(c,nx,ny,nz)
> implicit none
> real, pointer :: c(:,:,:)
> ...do some work...
> end subroutine work
>
> ...and I would like to be able to pass a and b to work with a being passed as the degenerate case where the three dimensions are nx=30, ny=40, nz=1, in a way similar to...
>
> p => b
> call work(p,30,40,50)
> p => a
> call work(p,30,40,1)
>
> The line "p => a" is not legal. But is there any way of pointing a 3d pointer to a 2d array with the last dimension being simply 1:1? That would make the design of my code significantly simpler.
>
> Cheers,
> Oli
--
Cheers!
Dan Nagle
|