comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Linking IDL with FORTRAN routines under UNIX: interpol.f
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Linking IDL with FORTRAN routines under UNIX: interpol.f [message #175] Tue, 24 September 1991 13:34
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
In article <1991Sep24.185544.10439@nsisrv.gsfc.nasa.gov>, I wrote

> Please note that I have not been able to use CALL_EXTERNAL with FORTRAN
> subroutines on the SUN.

This is a typo. I meant to say that I have not been able to use CALL_EXTERNAL
with FORTRAN *functions* on the SUN. Calling subroutines was what the example
was all about.

Mea culpa.

Bill Thompson
Re: Linking IDL with FORTRAN routines under UNIX: interpol.f [message #180 is a reply to message #175] Tue, 24 September 1991 12:54 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
This is the FORTRAN source code for the sample program on a Sun workstation.
Please note that I have not been able to use CALL_EXTERNAL with FORTRAN
subroutines on the SUN.

SUBROUTINE INTERPOL(X_IN,Y_IN,N_IN,X_OUT,Y_OUT,N_OUT)
C+
C NAME:
C INTERPOL
C PURPOSE:
C Perform bilinear interpolation. Called using CALL_EXTERNAL from the
C IDL routine INTERPOL.
C CALLING SEQUENCE:
C CALL INTERPOL(X_IN,Y_IN,N_IN,X_OUT,Y_OUT,N_OUT)
C INPUT PARAMETERS:
C X_IN = Input array of X values.
C Y_IN = Input array of Y values.
C N_IN = Number of elements in X_IN, Y_IN.
C X_OUT = Array of points along the X axis to interpolate to.
C N_OUT = Number of points in X_OUT, Y_OUT.
C OUTPUT PARAMETERS:
C Y_OUT = Array of interpolated points.
C COMMON BLOCKS:
C None.
C SIDE EFFECTS:
C None.
C RESTRICTIONS:
C None.
C PROCEDURE:
C Straightforward.
C MODIFICATION HISTORY:
C William Thompson, August 1991.
C-
C
DIMENSION X_OUT(N_OUT),Y_OUT(N_OUT),X_IN(N_IN),Y_IN(N_IN)
C
C Find the interval in the input arrays that corresponds to the point to be
C interpolated to.
C
DO I = 1,N_OUT
J = 2
IF (X_IN(2) .GT. X_IN(1)) THEN
DO WHILE ((X_IN(J) .LT. X_OUT(I)) .AND. (J .LT. N_IN))
J = J + 1
ENDDO
ELSE
DO WHILE ((X_IN(J) .GT. X_OUT(I)) .AND. (J .LT. N_IN))
J = J + 1
ENDDO
ENDIF
C
C Calculate the slope and intercept of the line connecting the two points
C defining the interval found above, and perform the interpolation.
C
SLOPE = (Y_IN(J) - Y_IN(J-1))/(X_IN(J) - X_IN(J-1))
Y_OUT(I) = Y_IN(J-1) + SLOPE*(X_OUT(I) - X_IN(J-1))
C
ENDDO
C
RETURN
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: On the differences between idl and pvwave
Next Topic: Calling external C or FORTRAN routines from IDL on RS6000

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:05:54 PDT 2025

Total time taken to generate the page: 0.00504 seconds