fortran 90 user defined type, passing by value ?

Posted by user279137 on Stack Overflow See other posts from Stack Overflow or by user279137
Published on 2010-03-18T20:27:47Z Indexed on 2010/03/18 20:31 UTC
Read the original article Hit count: 754

Filed under:
|

I have an issue in fortran 90.

I have a user defined type and when I call one of the MPI subroutines the data looks to be passed by values (not address, as I thought it should). The output arguments aren't modified. It seems to be specific to the MPI calls I tried the same thing in a simple test, and I can change the passed in values in the calling scope. I'm not sure why this is because I thought fortran always pass by address. Any idea what could be going on? Just to be clear the commented snippet shows how the calls are made. The in the first call, c%NSubDomains, is an output argument and should be modified in the calling scope, but its not. WHen I call with an array rather than a member of user defined type it works, in the uncommented snippet.

! ! This doesn't work output values aren't modified ??
! call MPI_Dims_create(c%NProcs,c%NDims,c%NSubDomains,iErr)

nsubs(:)=0
call MPI_Dims_create(c%NProcs,c%NDims,nsubs,iErr)
c%NSubDomains=nsubs

Thanks

© Stack Overflow or respective owner

Related posts about fortran

Related posts about fortran90