Re: Calling IDL from Fortran called by IDL [message #28279 is a reply to message #28247] |
Fri, 30 November 2001 13:12  |
Stein Vidar Hagfors H[1]
Messages: 56 Registered: February 2000
|
Member |
|
|
Craig Markwardt <craigmnet@cow.physics.wisc.edu> writes:
> "Kevin A. Park" <kpark@prism-cs.com> writes:
>> Hi,
>>
>> I have an IDL GUI which sits on top of a calculation engine which
>> is written in Fortran 90. Currently IDL accesses the calculation engine
>> by calling C wrapper functions via CALL_EXTERNAL. These C wrappers then
>> call Fortran routines. The system runs both on Solaris and Windows
>> platforms. I am currently using IDL 5.4, but will upgrade to IDL 5.5
>> soon.
>>
>> Some of the calculations in the Fortran take a long time, so what I
>> would like to do is have IDL create a progress bar which can be updated
>> from the Fortran. Having waded through the IDL External Development
>> Guide, I have a few questions.
>
> Kevin! Good to see you alive and kicking. [ In case you don't
> remember me I was Ben's roommate. ]
>
> You've gotten some good suggestions from other replies to your
> request, and they are worth considering.
>
> Personally I would say that you may be asking too much, to make an
> IDL-to-FORTRAN-to-IDL call chain. It must be possible, because
> several routines do allow such an operation. Consider
> CONSTRAINED_MIN.
>
> You are probably looking into using the internal C functions
> IDL_Execute() or IDL_ExecuteStr(), which may be exactly what you are
> looking for. What you would do is call these functions from within
> your FORTRAN subroutine, with the name of an IDL procedure that would
> update the GUI. While these functions are documented under the
> "Callable IDL" section, I do not see why these couldn't be used in
> your case.
I seem to remember that this *is* possible, but one problem is in
passing parameters in a clean way.. If you create variables inside the
C/Fortran routines, you've got either $MAIN$ scope or the scope of the
IDL routine calling the DLM (or using CALL_EXTERNAL).. Have to be
careful not to overwrite existing variable names when you're about to
construct a call string like "update_progress,n_percent"... As far as
I remember, anyway..
If you're doing your own "dirty work", however, you'll have the
knowledge you need to avoid those problems.
I think also that someone (from RSI?) said one couldn't expect this to
be functional, because the IDL_Execute() and IDL_ExecuteStr()
functions are meant to be used *only* in callable idl scenarios, not
by DLMs/call_external code..
But I do wish they'd release the documentation to do it cleanly, like
CONSTRAINED_MIN..
--
------------------------------------------------------------ --------------
Stein Vidar Hagfors Haugan
ESA SOHO SOC/European Space Agency Science Operations Coordinator for SOHO
NASA Goddard Space Flight Center, Email: shaugan@esa.nascom.nasa.gov
Mail Code 682.3, Bld. 26, Room G-1, Tel.: 1-301-286-9028/240-354-6066
Greenbelt, Maryland 20771, USA. Fax: 1-301-286-0264
------------------------------------------------------------ --------------
|
|
|