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

Home » Public Forums » archive » Re: IDL calls C calls IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL calls C calls IDL? [message #62515 is a reply to message #62473] Thu, 11 September 2008 05:42 Go to previous messageGo to previous message
Joost Aan de Brugh is currently offline  Joost Aan de Brugh
Messages: 16
Registered: July 2008
Junior Member
On Sep 11, 11:53 am, "hotplainr...@gmail.com" <hotplainr...@gmail.com>
wrote:
> Hey again,
>
> I've been thinking, I have code that does
>
> LINKIMAGE 'func' ,.....
>
> for t=0,tmax-1
>   func(data)
>   idl_function(data)
> endfor
>
> Is it possible to call idl_function from within C ?
>
> I want it to be like this
>
> In IDL:
> func(data)
>
> Then it passes onto C which does
> for (t=0; t<tmax;t++)
> {
>    do whatever it does with data
>    CALL IDL_FUNCTION(data)
>
> }
>
> This eliminates me calling func a few million times
>
> Can it be done?

Hello,

And in the above example, IDL takes the initiative, calls func (which
is, if I am right, a C function) and does its own IDL function. (IDL
calls C a million times).

Below, C takes the initiative, creates a forloop, and in each
iteration it does something with data and then has IDL do something
with data by calling IDL_FUNCTION. (C calls IDL a million times).

Which of them is less nasty is not easy to say. To figure out how to
call IDL from C is better known by C-people. So that could better be
asked in C-groups.

I do not know what your functions do with the data. But if the order
is not so important, you could try to do somthing like.

In C:
(t=0; t<tmax;t++)
{
C-code(data);
}

and in IDL:

Call_C_Code(data)

; Now it's IDL time.
for t=0,tmax-1 do IDL_FUNCTION,data

But here, C does its whole task before IDL starts. This may be a
problem depending on the actions. It may be possible that C can
generate the actions that IDL can perform. For example:

In C:

(t=0; t<tmax;t++)
{
C-code(data,actions); // Actions is an output by C passed back to
IDL. Data is left unharmed.
}

in IDL:

Call_C_Code(data,actions)

; Now it's IDL time.
for t=0,tmax-1 do begin
IDL_PERMORM_ACTION,actions,data
IDL_FUNCTION,data
End

Best regards,
Joost
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: IDL is not accurate enough!
Next Topic: Re: How do I return a 2d array in a system routine?

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

Current Time: Sun Oct 12 04:24:16 PDT 2025

Total time taken to generate the page: 0.88108 seconds