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


|