I avoided this redundant code by defining the function outside the main
program. Next, I declared this function as EXTERNAL in all the subroutines
(and the main program also!). It worked. In your example, the line
REAL(RS), EXTERNAL :: Func1d
can do the job. (Please donot forget to USE the module that defines "RS"
precision in the function definition, i.e. writing USE Num_const line !)
May be there are other more elegant ways of avoiding this, but I didnot
explore further.
Cheers,
MA
> -----Original Message-----
> From: Goeran Klose [SMTP:[log in to unmask]]
> Sent: Friday, August 18, 2000 5:22 PM
> To: comp-fortran-90 of the mailbase service
> Subject: avoiding redundant Fortran 90 coding
>
> Hello,
>
> I am trying to compile a module of different mathematical
> Fortran 90 routines. All routines are supposed to
> evaluate the same type of function. The interface of this
> function is given below.
>
> INTERFACE
> FUNCTION Func1d(x)
> USE Num_const
> REAL(RS), INTENT(IN) :: x
> REAL(RS) :: Func1d
> END FUNCTION Func1d
> END INTERFACE
>
> To reduce redundant Fortran coding, I am looking for a way to
> avoid the interface statement in each routine.
> Does anyone know an elegant way to solve this problem ?
>
> Thanks,
>
> Göran
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|