Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: Problems in...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 17 Topic 8147 of 8775
Post > Topic >>

Re: Problems in passing a function to a subroutine

by glen herrmannsfeldt <gah@[EMAIL PROTECTED] > Apr 17, 2008 at 12:02 PM

Richard Maine wrote:

(snip regarding passing data through a generic integration routine)

> Oh, but I forgot to mention on somewhat related method that I've used in
> comparable situations. Pass a single adjustable-size array for such
> auxillary data. I've normally used an array of reals, as much of the
> auxillary data of interest is real, and much of the rest can be easily
> converted to real. It isn't quite as "clean" as the void pointer or
> polymorphic approaches in that you have to pack all the relevant data
> into a suitable array, which then likely needs to be unpacked in the
> called routine. On the other hand, it is perfectly standard f90 (and
> almost standard f77, as long as you special-case the zero-sized case by
> padding it to size 1 because zero-sized arrays aren't allowed in f77).

That should work well for integration, which usually uses real
data.  (I might even go for double precision.)  That last time I
wanted to do this was with a generic sort routine like C's
qsort.  qsort does not provide this ability.  Also, passing real
data to a sort routine is less likely to be useful than to an
integration routine.

Also, that should have worked even in Fortran 66, though I don't
know any that did it.

-- glen
 




 17 Posts in Topic:
Problems in passing a function to a subroutine
deltaquattro <deltaqua  2008-04-17 03:00:56 
Re: Problems in passing a function to a subroutine
Arjen Markus <arjen.ma  2008-04-17 04:26:52 
Re: Problems in passing a function to a subroutine
deltaquattro <deltaqua  2008-04-17 04:55:53 
Re: Problems in passing a function to a subroutine
Arjen Markus <arjen.ma  2008-04-17 05:12:26 
Re: Problems in passing a function to a subroutine
Ron Shepard <ron-shepa  2008-04-17 11:53:52 
Re: Problems in passing a function to a subroutine
glen herrmannsfeldt <g  2008-04-17 10:31:11 
Re: Problems in passing a function to a subroutine
nospam@[EMAIL PROTECTED]   2008-04-17 12:07:48 
Re: Problems in passing a function to a subroutine
nospam@[EMAIL PROTECTED]   2008-04-17 12:31:54 
Re: Problems in passing a function to a subroutine
glen herrmannsfeldt <g  2008-04-17 12:02:53 
Re: Problems in passing a function to a subroutine
"jamesgiles@[EMAIL P  2008-04-17 12:50:54 
Re: Problems in passing a function to a subroutine
deltaquattro <deltaqua  2008-04-18 05:08:42 
Re: Problems in passing a function to a subroutine
nospam@[EMAIL PROTECTED]   2008-04-18 08:26:29 
Re: Problems in passing a function to a subroutine
deltaquattro <deltaqua  2008-04-18 07:01:08 
Re: Problems in passing a function to a subroutine
pa@[EMAIL PROTECTED] (Pi  2008-04-19 13:45:06 
Re: Problems in passing a function to a subroutine
Charles Coldwell <cold  2008-04-18 14:03:31 
Re: Problems in passing a function to a subroutine
nospam@[EMAIL PROTECTED]   2008-04-18 08:41:23 
Re: Problems in passing a function to a subroutine
glen herrmannsfeldt <g  2008-04-18 08:15:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 3:09:50 CDT 2008.