| 1 | /* |
| 2 | * Declaration of elementary graphical functions |
| 3 | */ |
| 4 | |
| 5 | /* |
| 6 | * Copyright (c) 2005 Eric Gourgoulhon |
| 7 | * |
| 8 | * This file is part of LORENE. |
| 9 | * |
| 10 | * LORENE is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * LORENE is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with LORENE; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | * $Id: plot.h,v 1.1 2005/11/14 01:57:00 e_gourgoulhon Exp $ |
| 28 | * $Log: plot.h,v $ |
| 29 | * Revision 1.1 2005/11/14 01:57:00 e_gourgoulhon |
| 30 | * First version |
| 31 | * |
| 32 | * |
| 33 | * $Header: /cvsroot/Lorene/School05/Monday/plot.h,v 1.1 2005/11/14 01:57:00 e_gourgoulhon Exp $ |
| 34 | * |
| 35 | */ |
| 36 | |
| 37 | #ifndef __PLOT_H_ |
| 38 | #define __PLOT_H_ |
| 39 | |
| 40 | /** |
| 41 | * \defgroup graphbasic Basic graphical routines. |
| 42 | * Different figures can created simultaneously. They are characterized |
| 43 | * by the label \c nfig. |
| 44 | * |
| 45 | * @{ |
| 46 | */ |
| 47 | |
| 48 | /** Drawing a point as a small circle. |
| 49 | * |
| 50 | * @param x point abscissa |
| 51 | * @param y point ordinate |
| 52 | * @param color color of the small circle: \anchor color_list |
| 53 | * \li 0 : black (background) |
| 54 | * \li 1 : white (default) |
| 55 | * \li 2 : red |
| 56 | * \li 3 : green |
| 57 | * \li 4 : blue |
| 58 | * \li 5 : cyan |
| 59 | * \li 6 : magenta |
| 60 | * \li 7 : yellow |
| 61 | * \li 8 : orange |
| 62 | * \li 9 : green + yellow |
| 63 | * \li 10 : green + cyan |
| 64 | * \li 11 : blue + cyan |
| 65 | * \li 12 : blue + magenta |
| 66 | * \li 13 : red + magenta |
| 67 | * \li 14 : dark gray |
| 68 | * \li 15 : light gray |
| 69 | * @param nfig index of the figure (in the range [0,99]) |
| 70 | * to be used for the plot: if this figure does not exist, |
| 71 | * it will be created with the device name \c device provided by the last |
| 72 | * argument. |
| 73 | * @param ymin lower bound on y of the graphical window (used only if a new |
| 74 | * figure must be created) |
| 75 | * @param ymax upper bound on y of the graphical window (used only if a new |
| 76 | * figure must be created) |
| 77 | * @param title title of the figure (used only if a new figure must be created) |
| 78 | * @param label_y y legend of the figure (used only if a new |
| 79 | * figure must be created) |
| 80 | * @param device type of graphical device (default value = 0x0, will result in |
| 81 | * interactive choice) (used only if a new |
| 82 | * figure must be created) |
| 83 | */ |
| 84 | void plot_point(double x, double y, int color = 1, int nfig = 0, |
| 85 | double ymin = -1., double ymax = 1., const char* title = 0x0, |
| 86 | const char* label_y = 0x0, const char* device = 0x0) ; |
| 87 | |
| 88 | /** Drawing a set of points as small circles. |
| 89 | * |
| 90 | * @param np Number of points |
| 91 | * @param xx Array (size: \c np ) of abscissas of the points |
| 92 | * @param yy Array (size: \c np ) of ordinates of the points |
| 93 | * @param color color of the small circles: see \ref color_list |
| 94 | * @param nfig index of the figure (in the range [0,99]) |
| 95 | * to be used for the plot: if this figure does not exist, |
| 96 | * it will be created with the device name \c device provided by the last |
| 97 | * argument. |
| 98 | * @param ymin lower bound on y of the graphical window (used only if a new |
| 99 | * figure must be created) |
| 100 | * @param ymax upper bound on y of the graphical window (used only if a new |
| 101 | * figure must be created) |
| 102 | * @param title title of the figure (used only if a new figure must be created) |
| 103 | * @param label_y y legend of the figure (used only if a new |
| 104 | * figure must be created) |
| 105 | * @param device type of graphical device (default value = 0x0, will result in |
| 106 | * interactive choice) (used only if a new |
| 107 | * figure must be created) |
| 108 | */ |
| 109 | void plot_point_set(int np, const double* xx, const double* yy, int color = 1, |
| 110 | int nfig = 0, double ymin = -1., double ymax = 1., |
| 111 | const char* title = 0x0, const char* label_y = 0x0, |
| 112 | const char* device = 0x0) ; |
| 113 | |
| 114 | /** Drawing a profile with uniform x sampling. |
| 115 | * A profile is a curve y=y(x). It is drawn on the specified figure. If the |
| 116 | * latter is not opened, it will be opened with the device name \c device |
| 117 | * provided by the last argument. |
| 118 | * |
| 119 | * @param yy Array (size: \c nx ) of y values to be drawn |
| 120 | * (the x sampling is supposed to be uniform in [-1,1]). |
| 121 | * @param nx Number of points |
| 122 | * @param color color of the profile: see \ref color_list |
| 123 | * @param style style of the profile: |
| 124 | * the possible values are \c line_style[i] = 1 |
| 125 | * (full line), 2 (dashed), 3 (dot-dash-dot-dash), 4 (dotted), 5 |
| 126 | * (dash-dot-dot-dot). |
| 127 | * @param nfig index of the figure (in the range [0,99]) |
| 128 | * to be used for the plot: if this figure does not exist, |
| 129 | * it will be created with the device name \c device provided by the last |
| 130 | * argument. |
| 131 | * @param ymin lower bound on y of the graphical window (used only if a new |
| 132 | * figure must be created) |
| 133 | * @param ymax upper bound on y of the graphical window (used only if a new |
| 134 | * figure must be created) |
| 135 | * @param title title of the figure (used only if a new figure must be created) |
| 136 | * @param label_y y legend of the figure (used only if a new |
| 137 | * figure must be created) |
| 138 | * @param device type of graphical device (default value = 0x0, will result in |
| 139 | * interactive choice) (used only if a new |
| 140 | * figure must be created) |
| 141 | */ |
| 142 | void plot_profile(const double* yy, int nx, int color = 1, int style = 1, |
| 143 | int nfig = 0, double ymin = -1., double ymax = 1., |
| 144 | const char* title = 0x0, const char* label_y = 0x0, |
| 145 | const char* device = 0x0) ; |
| 146 | |
| 147 | /** Closing a figure. |
| 148 | * |
| 149 | * @param nfig [input] Index of the figure (in the range [0,99]) |
| 150 | * |
| 151 | */ |
| 152 | void plot_close(int nfig = 0) ; |
| 153 | |
| 154 | /** Closing all opened figures. |
| 155 | * |
| 156 | */ |
| 157 | void plot_close_all() ; |
| 158 | |
| 159 | |
| 160 | /** @} */ |
| 161 | |
| 162 | /** Initialization of the graphical displays. |
| 163 | * This function is called only by the other graphical routines |
| 164 | * and is required if the graphical engine is PGPLOT. |
| 165 | */ |
| 166 | void plot_init() ; |
| 167 | |
| 168 | /** Opening a figure. |
| 169 | * To be called only by the other graphical routines |
| 170 | * |
| 171 | */ |
| 172 | void plot_open(int nfig, double ymin, double ymax, const char* title, |
| 173 | const char* label_y, const char* device) ; |
| 174 | |
| 175 | #endif |