fortran - rank values passed in subroutines -
i having issues using multi-dimensional array in fortran code writing.
basically, define 2-dimensional array, passed membrane
, have pass 1-dimensional version of set
.
case (1) call membrane ("set", scv(i,:), sty)
here routine takes 1-d array.
subroutine membrane (tsk, scv, sty) implicit none character (len=*), intent (in) :: tsk logical, intent (in), optional :: scv(:,:) character (len=*), intent (in), optional :: sty select case (tsk) case ("set") call set (tsk, scv(1,:), sty) ...
here set subroutine
subroutine set (tsk, scv, sty) implicit none character (len=*), intent (in) :: tsk logical, intent (in), optional :: scv(:) character (len=*), intent (in), optional :: sty
i error when try compile code
sct/btun/membrane.f:185:35: call membrane ("set", scv(i,:), sty) 1 error: rank mismatch in argument 'scv' @ (1) (rank-2 , rank-1)
you calling routine membrane
using one-dimensional slice of scv
. since subroutine expecting two-dimensional array:
logical, intent (in), optional :: scv(:,:)
you error. not quite sure trying achieve, since accessing first column of array in membrane (hard-coded), change dummy argument scv
one-dimensional in membrane
:
subroutine membrane (tsk, scv, sty) ... logical, intent (in), optional :: scv(:) ... select case (tsk) case ("set") call set (tsk, scv(:), sty) ...
note that complete array passed set
.
alternatively, pass complete 2d array membrane
along counter i
, , pass i
-th row set
.
Comments
Post a Comment