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

Home » Public Forums » archive » Re: Getting generic routine to call function.
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: Getting generic routine to call function. [message #1413] Fri, 19 November 1993 07:13
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
black@signal.dra.hmg.gb (John Black) writes:

> Ooops, Sorry managed to somehow post a zero length message

> OK that message again.

> Here's the situation. I have a generic numerical routine such as a numerical
> integration routine, or a Newton-Raphson routine. Ideally I'd like to write
> them so that they can operate on any routine that evaluates a function.
> However IDL/WAVE doesn't seem to allow you to pass the name of the routine
> that evaluates a function into the generic routine, so that the generic
> routine can use it. This situation is obviously best if it can be achieved,
> because it means that you don't have to have multiple copies of the generic
> routine all caled something different, but only differ in detail in that they
> call a different function evaluating routine

> So has anyone come up with a way to do this or a way to structure code to
> get around this problem?

> Thanks in advance,

Yeah, that's easy. :^) Simply pass the name of the function as a character
string to the routine and then use EXECUTE to evaluate the function. Here are
the relevant lines from one of my own routines that uses this technique:

PRO LSTSQR,X,Y,FNAME,PARAM,PERR
.
.
.
TEST = EXECUTE('F = ' + FNAME + '(X,PARAM,FDER)')
.
.
.

Bill Thompson
Re: Getting generic routine to call function. [message #1414 is a reply to message #1413] Fri, 19 November 1993 06:09 Go to previous message
saken is currently offline  saken
Messages: 6
Registered: November 1993
Junior Member
In article <2ci6klINNc52@freud.dra.hmg.gb>, black@signal.dra.hmg.gb (John Black) writes:
|> Ooops, Sorry managed to somehow post a zero length message
|>
|> OK that message again.
|>
|> Here's the situation. I have a generic numerical routine such as a numerical
|> integration routine, or a Newton-Raphson routine. Ideally I'd like to write
|> them so that they can operate on any routine that evaluates a function.
|> However IDL/WAVE doesn't seem to allow you to pass the name of the routine
|> that evaluates a function into the generic routine, so that the generic
|> routine can use it. This situation is obviously best if it can be achieved,
|> because it means that you don't have to have multiple copies of the generic
|> routine all caled something different, but only differ in detail in that they
|> call a different function evaluating routine
|>
|> So has anyone come up with a way to do this or a way to structure code to
|> get around this problem?
|>
|> Thanks in advance,


The CALL_FUNCTION command sounds like what you want. Something like
this:

pro generic,p1,p2,p3,...,name=name
.
.
.
result = call_function(name,p1,p2,p3)
.
.
.

"name" would be the name of the evaluating function and "result" would be
the value returned. Is this what you wanted?

jon saken
Re: Getting generic routine to call function. [message #1415 is a reply to message #1414] Fri, 19 November 1993 02:20 Go to previous message
black is currently offline  black
Messages: 39
Registered: August 1992
Member
Ooops, Sorry managed to somehow post a zero length message

OK that message again.

Here's the situation. I have a generic numerical routine such as a numerical
integration routine, or a Newton-Raphson routine. Ideally I'd like to write
them so that they can operate on any routine that evaluates a function.
However IDL/WAVE doesn't seem to allow you to pass the name of the routine
that evaluates a function into the generic routine, so that the generic
routine can use it. This situation is obviously best if it can be achieved,
because it means that you don't have to have multiple copies of the generic
routine all caled something different, but only differ in detail in that they
call a different function evaluating routine

So has anyone come up with a way to do this or a way to structure code to
get around this problem?

Thanks in advance,
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Creating shared libs with gcc ?
Next Topic: HDF's Vdata

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

Current Time: Sat Oct 11 08:03:29 PDT 2025

Total time taken to generate the page: 1.84201 seconds