Quote:>I have various C++ programs which generate numerical output,
>and I would like to be able to see a visualisation of this
>output on the screen as my programs run.
>I have done such things previously under DOS using the graphics
>routines which came with Turbo C++, but I would like
been there, done that
Quote:>to know the best way to do it under X-windows.
>I am using g++-2.7.0 on a 486 running Linux.
Identical to my current system.
Quote:>The Slackware distribution
>(which I installed) included the InterViews 3.1 class libraries.
>Would these be an appropriate tool ?
More complicated than my solution below.
Quote:>I was unable to get a simple example program from the manual to
>link - it gave me 'undefined reference' errors. Does anybody
>know how to setup InterViews on Linux correctly so that it finds
>the relevant libraries and include files ?
Not me.
Quick answer: Open a pipe to gnuplot.
1) write your data to a temp file.
2) open a pipe to gnuplot, From memory:
opfstream plotpipe("|gnuplot");
plotpipe << "plot '" << tempFileName <<"'" << endl;
3) Send replot commands to the pipe each time the data is updated.
Classes with data you want to plot, can be derived from an interface
class Plotable which has a DumpData()=0; member function which returns
"String" containing the temp file name. Then make a Plotter class
which opens the pipe and sends appropriate commands to gnuplot.
Each instance of Plotter opens another gnuplot window. So you can
have numerous plots of different data being updated live. It looks
very impressive and all you have to do is learn some simple gnuplot
commands. No wheel re-invension nessecary!
Plotter and Plotable should be re-usable in many applications.
I don't know how experienced you are with unix, so if you need more
details let me know.
--
+--------------------------------------+-------------------------------------+
| Jan N. Reimers, Research Scientist | Sorry, Don't have time to write the |
| Moli Energy (1990) Ltd. B.C. Canada | usual clever stuff in this spot. |