Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 4

pointer boundaries

$
0
0

PROGRAM INDICES
   INTEGER, POINTER, DIMENSION(:) :: a, b

   ALLOCATE(a(0:1))
   a(0) = 1
   a(1) = 2

   b => a

   WRITE(*,*) LBOUND(b,1)   !__    = 0
   WRITE(*,*) UBOUND(b,1)   !__   = 1
   WRITE(*,*)

   b => a(:)
   WRITE(*,*) LBOUND(b,1)    !__  = 1
   WRITE(*,*) UBOUND(b,1)    !__  = 2
END PROGRAM INDICES

Apparently, the boundaries of indices are only kept if I do not specify (:). Though, this makes it impossible for me to work with parts of a large array (e.g. x => y(:,:,:, j)) since all the indices get shifted to start from 1.  Is there any way to have a pointer to a subfield without shifting the boundaries of indices? Or do i have to allocate another array for that?

Thanks

Dino


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>