| New Reply |
Fortran, subroutine with allocatable, intent(out) array |
Share Thread |
| Mar16-11, 06:17 AM | #1 |
|
|
Fortran, subroutine with allocatable, intent(out) array
Hi,
I have a rather large program written in fortran 77/90. In one of the subroutines a lot of local dynamic arrays are declared. In order to make this program able to calculate more stuff, I need to bring these dynamic arrays back into the main program. I have tried to define the arrays allocatable in the main program and then passing them on to the subroutine which sets them as allocatable. But when I allocate them in the subroutine the program crashes. I have tried to do it with common blocks, but as far as I can see thats a dead end. I have considered trying interface blocks, but I am still a bit uncertain as to how they work and if it is possible to do it with those. Does anyone know a way to do this, I have been stuck with this problem for 2 days now, so any help would be much appreciated. A short example of what I am trying to do Main.f90 Program main double complex, allocatable :: Vlm(:) ... Call init_potential(input,output,Vlm) ... End main init_potential.f90 subroutine init_potential(input,output,Vlm) double complex, allocatable, intent(out) :: Vlm(:) ... allocate(Vlm(sizeofVlm)) ... end init_potential |
| Mar16-11, 06:58 AM | #2 |
|
Recognitions:
|
If you're allocating in the main program, have you tried defining it as INTENT(INOUT) in the subroutine?
|
| Mar16-11, 11:32 AM | #3 |
|
|
|
| New Reply |
Similar Threads for: Fortran, subroutine with allocatable, intent(out) array
|
||||
| Thread | Forum | Replies | ||
| Fortran 77 - subroutine in separate file | Programming & Comp Sci | 3 | ||
| How to pass array element form a subroutine to main function | Programming & Comp Sci | 14 | ||
| Printing 1D array in Fortran as 2D array... | Programming & Comp Sci | 7 | ||
| Looking for fortran code or subroutine ,please help!!! | Programming & Comp Sci | 0 | ||
| Quantile subroutine, Fortran 90 | Programming & Comp Sci | 2 | ||