Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran program structuring

  1. Feb 26, 2007 #1
    basic question really...can you have subroutines nested within subroutines? or are there any other types of subprograms within fortran95 other than functions and subroutines? (need one that can pass back an array)

    if you can [use subs within subs], how do you link them? like in the main program you have to use an INTERFACE-END INTERFACE construction to link to the subroutine...

    ta in advance
  2. jcsd
  3. Feb 26, 2007 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    Not sure about subroutines within a subroutine, gut feeling is that it won't work. As for returning an array, that is possible.
  4. Feb 26, 2007 #3
    erm...could you elaborate? i'm writing a program that solves linear equations with gauss seidel iteration (and gauss/gauss jordan elimination), so there's a main program which calls the various methods as subroutines...

    except within the gauss seidel subroutine I want to seperate a bit which makes the matrix diagonally dominant(ish)...obviously after rearranging the rows the matrix needs to be passed back to the gauss seidel subroutine.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook