jlhaferman@l_eld01.icaen.uiowa.edu (Jeff Haferman) (01/30/91)
I would like to pass an array via a subroutine call,
i.e. DIMENSION A(N)
CALL SUB1(A,N) (this stuff is in module 1)
and from that subroutine, have an auxiliary subroutine
which operates on that array -without- having to pass the
array in the call.
SUBROUTINE SUB1(A,N) (defined in module 2)
c this sub doesn't use A, but FCN does.
DIMENSION A(N)
EXTERNAL FCN
SUM = INTEGRAL(X1,X2,FCN)
C
REAL FUNCTION INTEGRAL(X1,X2,FCN) (defined in module 3)
C SUM FCN(X) FROM X = X1 to X = X2
REAL FUNCTION FCN(X) (defined in module 2)
FCN = X * <some element of A>
However, FCN does not know about A. I could make A part of a common
block in module 1, but that is not an elegant solution from my point of
view, because I don't want to include a module 1 common block in
module 2.
Also, the definition of INTEGRAL is fixed (cannot change).
Is this explanation clear? How can I solve this problem? Sorry
if it is trivial, but I am not a power-fortran programmer.
Jeff Haferman internet: jlhaferman@icaen.uiowa.edu
Department of Mechanical Engineering DoD 0186 BMWMOA 44469 AMA 460140
University of Iowa
Iowa City IA 52242