Fortran produces a 2D pointer with different lower index bounds, depending on the syntax of the assignment. Consider:
real(4), target:: D(-10:10, -10:10)
read(4) pointer P(:,: ), Q(:,: )
P => D
Q => D(:,: )
P will have extents (-10:10, -10,10)
Q will have extents(1,21: 1:21)
Even though Q is pointed to the entire array D, the presence of dimension specification in the target D produces a pointer.with all lower index bounds of 1
I had a 3D array
real(4), target:: F(-10:-10, -10:10, 5)
I need to point to a particular 2D page of F and have the pointer maintain the array bounds (-10:10, -10:10). A simple pointer assignment such as
Q => f(:,:, n)
yields a pointer with the wrong array bounds and can be used in subsequent code. Does anyone know a way to accomplish this?