Merge "Converted macro usage for readability" into release-4-6
[gromacs.git] / include / xvgr.h
blobdeb53c37800bfd5a2829d4700333a00b42078653
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _xvgr_h
37 #define _xvgr_h
39 #include "sysstuff.h"
40 #include "typedefs.h"
41 #include "viewit.h"
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 /***************************************************
48 * XVGR DEFINITIONS
49 ***************************************************/
50 enum {
51 elNone, elSolid, elDotted, elDashed,
52 elLongDashed, elDotDashed, elNR
54 /* xvgr line-styles */
56 enum {
57 ecWhite, ecFrank, ecBlack=ecFrank,
58 ecRed, ecGreen, ecBlue, ecYellow, ecBrown, ecGray,
59 ecPurple, ecLightBlue, ecViolet, ecHolland, ecLila, ecDarkGray,
60 ecAquamarine, ecOlive, ecNR
62 /* xvgr line-colors */
64 enum {
65 eppNone, eppColor, eppPattern, eppNR
67 /* xvgr pattern type */
69 enum {
70 evView, evWorld, evNR
72 /* view type */
74 /***************************************************
75 * XVGR ROUTINES
76 ***************************************************/
78 /* Strings such as titles, lables and legends can contain escape sequences
79 * for formatting. Currently supported are:
80 * \s : start subscript
81 * \S : start superscript
82 * \N : end sub/superscript
83 * \symbol : where symbol is the full name of a greek letter
84 * (see the xvgrstr function in xvgr.c for the full list)
85 * when starting with a capital, a capital symbol will be printed,
86 * note that symbol does not need to be followed by a space
87 * \8 : (deprecated) start symbol font
88 * \4 : (deprecated) end symbol font
91 gmx_bool output_env_get_print_xvgr_codes(const output_env_t oenv);
92 /* Returns if we should print xmgrace or xmgr codes */
94 enum {
95 exvggtNONE, exvggtXNY, exvggtXYDY, exvggtXYDYDY, exvggtNR
98 void xvgr_header(FILE *fp,const char *title,const char *xaxis,
99 const char *yaxis,int exvg_graph_type,
100 const output_env_t oenv);
101 /* In most cases you want to use xvgropen_type, which does the same thing
102 * but takes a filename and opens it.
105 FILE *xvgropen_type(const char *fn,const char *title,const char *xaxis,
106 const char *yaxis,int exvg_graph_type,
107 const output_env_t oenv);
108 /* Open a file, and write a title, and axis-labels in Xvgr format
109 * or write nothing when oenv specifies so.
110 * The xvgr graph type enum is defined above.
113 FILE *xvgropen(const char *fn,const char *title,const char *xaxis,
114 const char *yaxis,const output_env_t oenv);
115 /* Calls xvgropen_type with graph type xvggtXNY. */
117 /* Close xvgr file, and clean up internal file buffers correctly */
118 void xvgrclose(FILE *fp);
120 void xvgr_subtitle(FILE *out,const char *subtitle,
121 const output_env_t oenv);
122 /* Set the subtitle in xvgr */
124 void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax,
125 const output_env_t oenv);
126 /* Set the view in xvgr */
128 void xvgr_world(FILE *out,real xmin,real ymin,real xmax,real ymax,
129 const output_env_t oenv);
130 /* Set the world in xvgr */
132 void xvgr_legend(FILE *out,int nsets,const char** setnames,
133 const output_env_t oenv);
134 /* Make a legend box, and also modifies the view to make room for the legend */
137 void xvgr_new_dataset(FILE *out,
138 int nr_first, int nsets, const char **setnames,
139 const output_env_t oenv);
140 /* End the previous data set(s) and start new one(s).
141 nr_first = the global set number of the first new set (or 0 if no legend)
142 nsets = the number of sets (or 0 if no legends)
143 setnames = the set names (or NULL if no legends)
146 void xvgr_line_props(FILE *out,int NrSet,int LineStyle,int LineColor,
147 const output_env_t oenv);
148 /* Set xvgr line styles and colors */
150 void xvgr_box(FILE *out,
151 int LocType,
152 real xmin,real ymin,real xmax,real ymax,
153 int LineStyle,int LineWidth,int LineColor,
154 int BoxFill,int BoxColor,int BoxPattern,
155 const output_env_t oenv);
156 /* Make a box */
158 int read_xvg_legend(const char *fn,double ***y,int *ny,
159 char **subtitle,char ***legend);
160 /* Read an xvg file for post processing. The number of rows is returned
161 * fn is the filename, y is a pointer to a 2D array (to be allocated by
162 * the routine) ny is the number of columns (including X if appropriate).
163 * If subtitle!=NULL, read the subtitle (when present),
164 * the subtitle string will be NULL when not present.
165 * If legend!=NULL, read the legends for the sets (when present),
166 * 0 is the first y legend, the legend string will be NULL when not present.
169 int read_xvg(const char *fn,double ***y,int *ny);
170 /* As read_xvg_legend, but does not read legends. */
172 void write_xvg(const char *fn,const char *title,int nx,int ny,real **y,
173 const char** leg, const output_env_t oenv);
174 /* Write a two D array (y) of dimensions nx rows times
175 * ny columns to a file. If leg != NULL it will be written too.
179 /* This function reads ascii (xvg) files and extracts the data sets to a
180 * two dimensional array which is returned.
182 real **read_xvg_time(const char *fn,
183 gmx_bool bHaveT,
184 gmx_bool bTB,real tb,
185 gmx_bool bTE,real te,
186 int nsets_in,int *nset,int *nval,
187 real *dt,real **t);
188 #ifdef __cplusplus
190 #endif
192 #endif /* _xvgr_h */