Hi Karsten,
A simpler implementation would be to wrap up the two Fortran subroutines
with two NCL procedures.
external BLA1 "bla1.so"
external BLA2 "bla2.so"
procedure proc1(args)
begin
BLA1::subroutine_name(args)
end
procedure proc2(args)
begin
BLA2::subroutine_name(args)
end
if super_safe
proc1
else
proc2
end if
saji
-- On Mon, Jan 24, 2011 at 8:12 PM, Karsten Peters <karsten.peters@zmaw.de>wrote: > Dear all, > > I am calling self-written procedures and external Fortran code in > my ncl-code. I have different Fortran codes for different purposes and I > want the procedure to include just the Fotran code that I need. For this > I had some ideas: > > This is just some dummy code to illustrate my approach: > > Flag in the main program: > > super_safe = False > > top of the procedure: > > procedure bla (..,...,..,etc.) > > if (super_safe) then > external BLA "f_BLA1.so" > else > external BLA "f_BLA2.so" > end if > > Unfortunately, this gives a syntax error. Anyone have an idea why this > is ? Is the external command not allowed to be written in an if-loop ? > > Then I had another idea: > > Definition of filenames in the main program: > > if (super_safe) then > extname = "f_BLA1.so" > else > extname = "f_BLA2.so" > end if > > top of the procedure: > > procedure bla (..,...,extname:string,etc.) > > external BLA extname > > Unfortunately, this also gives a syntax error. > > > Now the essence of this mail: Is there any possibility for using the > external command in a generic way like I described ? > > I am happy for any input ! > > Cheers, > Karsten Peters > > -- > Karsten Peters > > Cloud-Climate-Feedbacks Group > Max Planck Institute for Meteorology > Bundesstrasse 53 > D-20146 Hamburg > > ------------------------------------------------------------------ > > Tel.: ++49 (0)40 41173 147 > Fax.: ++49 (0)40 41173 298 > > Email: karsten.peters@zmaw.de > URL: http://www.mpimet.mpg.de/~peters.karsten > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk >
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 24 05:29:51 2011
This archive was generated by hypermail 2.1.8 : Tue Jan 25 2011 - 14:22:15 MST