> > Hi Arjen: > > If you have not done so already, you might want to look at what our > Fortran > bindings do for plcont, plshade, and plshades. We have special fortran > API > in all those cases because of the problems (I assume) of passing arbitrary > data for the call back function like is possible with C. > > Come to think of it, though, none of these solutions are very satisfying. > I > recently had a similar problem with FreeEOS where I was writing a > generalized BFGS minimization routine to work properly for a huge variety > of > different functions to be minimized with a large variety of argument > lists. > The solution was to use reverse communication, a Fortran engineering > technique invented to just solve this problem. With this technique the > generalized routine completely avoids using a callback function. Instead > it > communicates with the outside world with a all-purpose integer or > character-string switch which tells the calling routine please call me > again > with such-and-such requested data (function value, gradient value, or > whatever depending on the switch) supplied for this independent variable > (or > variables). Then the calling routine calls any routine it likes with the > supplied independent variables and feeds back the requested results to the > generalized routine (say plcont) which then does something with those > results (such as plotting them). > > Reverse communication is a common technique used for many Fortran > numerical > libraries (see results of a google search for the two terms > fortran and "reverse communication"). It worked well for my BFGS > minimization > problem, and I think it may be the answer to our fortran troubles with > plcont, plshade, plshades, and plvect. >
Hi Alan, you are absolutely right! Why didn't I think of that? Sometimes you get stuck in a particular line of thinking, I suppose. I will think about such a solution. It seems the most flexible method, without having to resort to obscure language tricks (and therefore applicable to more languages) Regards, Arjen ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel