>Is NCL able to incorporate a complicated fortran subroutine where within
>the fortran subroutine code another self-defined subroutine or
>function/procedure from e.g., LAPACK or IMSL library is called?
yes ....
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml#WRAPIT
Let's say you want to use the "rcurv" subroutine from IMSL.
[1] Create a wrapper that include the
C NCLFORTSTART and C NCLEND delimeter.
Let's say the following is called "foo_rcurv.f"
C NCLFORTSTART
subroutine rcurvwrap (nobs,x, y, ndeg, b, sspoly, stat, ndeg1)
implicit none
integer nobs, ndeg, ndeg1
real x(nobs), y(nobs), stat(10)
real b(ndeg1), sspoly(ndeg1)
C NCLEND
call rcurv (nobs, x, y, ndeg, b, sspoly, stat)
return
end
[2] Create a shared object using WRAPIT. The user must tell
WRAPIT where the appropriate IMSL libraries are located.
The example is for the SCD machine called "tempest"
WRAPIT -l blas_mp -L /usr/local/lib64/r4i4 -l imsl_mp foo_rcurv.f
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[3] execute NCL script with external
external IMSL "./foo_rcurv.so"
begin
x = (/0., 0., 1., 1., 2., 2., 4., 4., 5., 5., 6., 6., 7., 7./)
y = (/508.1, 498.4, 568.2, 577.3, 651.7, 657.0, 755.3 \
,758.9, 787.6, 792.1, 841.4, 831.8, 854.7, 871.4/)
nobs = dimsizes(y)
ndeg = 2
ndeg1 = ndeg+1
b = new ( ndeg+1, typeof(y))
sspoly = new ( ndeg+1, typeof(y))
stat = new ( 10 , typeof(y))
IMSL::rcurvwrap (nobs,x, y, ndeg, b, sspoly, stat, ndeg1)
print(" ")
print("B: "+b)
print(" ")
print("SSPLOY:"+sspoly)
print(" ")
print("stat:"+stat)
end
=============
Let's say you have LAPACK code someehere. The same model
would be used.
==============
You could have one or nore files with many fortran subroutines.
The NCLFORTSTART and C NCLEND delimwters must be in
only those subroutines invoked from NCL.
goos luck
D
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 16 2005 - 14:09:24 MST
This archive was generated by hypermail 2.2.0 : Tue Dec 20 2005 - 11:10:18 MST