Diffpack Documentation
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Search
CurvePlot Class Reference
general plot (file) format for y=f(x) curves.
More...
#include <CurvePlot.h>
List of all members.
Public Methods |
| | CurvePlot (CurvePlotFile &file) |
| | CurvePlot () |
| void | bind (CurvePlotFile &file) |
| | ~CurvePlot () |
| bool | ok () const |
| String | initPair (const String &plot_title, const String &name_of_function, const String &name_of_independent_variable, const String &comment, Format_type formatting=ASCII, int npoints=0) |
| void | addPair (real x, real f) |
| String | plotPairs (const VecSimple(real) &x, const VecSimple(real) &f, const String &plot_title, const String &name_of_function, const String &name_of_independent_variable, const String &comment, Format_type formatting=ASCII) |
| void | finish () |
| const VecSimple(real)& | x () const |
| const VecSimple(real)& | y () const |
| void | popUpPlot (const char *program="xmgr", const char *geometry="600x400") |
Static Public Methods |
| void | popUpPlot (const VecSimple(real) &x, const VecSimple(real) &y, const char *program="xmgr", const char *geometry=NULL, const char *title=NULL, const char *funcname=NULL, const char *comment=NULL) |
| void | popUpPlot (real xmin, real xmax, const VecSimple(real) &y, const char *program="xmgr", const char *geometry=NULL, const char *title=NULL, const char *funcname=NULL, const char *comment=NULL) |
| void | popUpPlot (const String &filename, const char *program="xmgr", const char *geometry="800x600", const char *title=NULL, const char *funcname=NULL, const char *comment=NULL) |
Detailed Description
general plot (file) format for y=f(x) curves.
NAME: CurvePlot - general plot (file) format for y=f(x) curves
DESCRIPTION:
The class offers an interface for storing curve data in files. Each curve is in the C++ program represented by a "CurvePlot" object. These objects are administered by a "CurvePlotFile" object. The "CurvePlotFile" object generates a map of all the various curves, their filenames, their titles, function names and comments.
The most common use of "CurvePlot" and "CurvePlotFile" is through class "SaveSimRes", which has an internal "CurvePlotFile" object. THrough this object, the curve plot facility is immediately available in a simulator.
Detailed information on curve plot functionality is provided in of H.P. Langtangen, Computational Partial Differential Equations, Springer, (esp. Appendix B.4).
The cleanes way to handle multiple curves at the same time is to allocate a "VecSimplest(CurvePlot)" object, and treat each entry in this vector object as individual curves.
Constructor & Destructor Documentation
|
|
There is one "CurvePlot" constructur that takes an existing "CurvePlotFile" object as argument. Equivalently, one can call the constructor without arguments and thereafter initialize the "CurvePlot" object by calling "bind". No further initialization is necessary before the "init", "add" and "finish" functions can be called for a curve. |
|
|
See documentation of one of the overloaded constructor. |
|
CurvePlot::~CurvePlot (
|
)
|
|
Member Function Documentation
|
void CurvePlot::addPair (
|
real x,
|
|
real f )
|
|
|
|
adds a single data point on a curve (pair format). |
|
void CurvePlot::finish (
|
)
|
|
|
|
indicates that no more data points will be added. In other words, the curve is completely defined. |
|
String CurvePlot::initPair (
|
const String & plot_title,
|
|
const String & name_of_function,
|
|
const String & name_of_independent_variable,
|
|
const String & comment,
|
|
Format_type formatting = ASCII,
|
|
int npoints = 0 )
|
|
|
|
initializes a curve. One must give the title of the plot, the name of the function (curve), the name of the independent variable, and a comment. The comment usually reflects values of numerical parameters that were used to compute the curve data. The final argument, "npoints", can be used to allocate internal arrays where the data are stored, in addition to the storage on file (which is always done). The internal data structures can be accessed by the "x" and "y" functions and gives possibilities for feeding data into visualization systems at run-time. If "npoints" is 0 (default), no allocation of internal storage of plot data takes place.
The "initPair" function returns a string containg basic information about the plotfile. The syntax of the string is the same as the beginning of the line in the mapfile. That is, the string looks like
"filename@plot title@curvename@comment"
The calling program can then know the name of the file, curve etc. This allows an immediate call (after the plot is finished) to a plotting program, thus enabling run-time visualization. The returned string is particularly useful when the simulator is steered from an external environment (e.g. a script with direct calls to Diffpack functions). |
|
bool CurvePlot::ok (
|
) const
|
|
|
|
returns true if this object is connected to a manager ("CurvePlotFile") object, otherwise it returns false. |
|
|
performs the "initPair", "addPair" and "finish" steps in case the pairs are available from two arrays. The returned string has the same syntax as explained under "initPair". |
|
static void CurvePlot::popUpPlot (
|
const String & filename,
|
|
const char * program = "xmgr",
|
|
const char * geometry = "800x600",
|
|
const char * title = NULL,
|
|
const char * funcname = NULL,
|
|
const char * comment = NULL ) [static]
|
|
|
|
See documentation of one of the overloaded functions. |
|
static void CurvePlot::popUpPlot (
|
real xmin,
|
|
real xmax,
|
|
const VecSimple(real) & y,
|
|
const char * program = "xmgr",
|
|
const char * geometry = NULL,
|
|
const char * title = NULL,
|
|
const char * funcname = NULL,
|
|
const char * comment = NULL ) [static]
|
|
|
|
See documentation of one of the overloaded functions. |
|
static void CurvePlot::popUpPlot (
|
const VecSimple(real) & x,
|
|
const VecSimple(real) & y,
|
|
const char * program = "xmgr",
|
|
const char * geometry = NULL,
|
|
const char * title = NULL,
|
|
const char * funcname = NULL,
|
|
const char * comment = NULL ) [static]
|
|
|
|
See documentation of one of the overloaded functions. |
|
void CurvePlot::popUpPlot (
|
const char * program = "xmgr",
|
|
const char * geometry = "600x400" )
|
|
|
|
pops up a plot on the screen using "gnuplot", "xmgr", "xgrahp" or "plotmtv" plotting programs. There are several static "popUpPlot" functions as well. NB! This functionality will not work unless the releavnt plotting program has already been installed on the target computer and this program is accessible from the user's PATH variable. |
|
const VecSimple(real) & CurvePlot::x (
|
) const [inline]
|
|
|
|
returns access to the x values of the xy-plot data, provided that "initPair" was called with the final argument "npoints" greater than zero. |
|
const VecSimple(real) & CurvePlot::y (
|
) const [inline]
|
|
|
|
returns access to the y values of the xy-plot data, provided that "initPair" was called with the final argument "npoints" greater than zero. |
The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.