How to best pass arguments of different rank to concrete methods of an abstract derived type?

What about making them all rank 1 and then using a contiguous pointer
with shape remapping and use the pointer variable locally.

subroutine backward(input, ni, nj, nk, ...)

  real, intent(in), target :: input(:)
  integer, intent(in)        :: ni, nj, nk
  
  real, pointer, contiguous :: iptr(:,:,:)
  
  iptr(1:ni,1:nj,1:nk) => input(:) 
  
 etc

I would trust this to work before assumed rank in any current compiler

1 Like