Merge branch 'master' of git@git.gromacs.org:gromacs
[gromacs/rigid-bodies.git] / include / xvgr.h
blob03670f30434beb230afdafa84714c10ca0f79dcb
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 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include "sysstuff.h"
44 #include "typedefs.h"
45 #include "viewit.h"
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
51 /***************************************************
52 * XVGR DEFINITIONS
53 ***************************************************/
54 enum {
55 elNone, elSolid, elDotted, elDashed,
56 elLongDashed, elDotDashed, elNR
58 /* xvgr line-styles */
60 enum {
61 ecWhite, ecFrank, ecBlack=ecFrank,
62 ecRed, ecGreen, ecBlue, ecYellow, ecBrown, ecGray,
63 ecPurple, ecLightBlue, ecViolet, ecHolland, ecLila, ecDarkGray,
64 ecAquamarine, ecOlive, ecNR
66 /* xvgr line-colors */
68 enum {
69 eppNone, eppColor, eppPattern, eppNR
71 /* xvgr pattern type */
73 enum {
74 evView, evWorld, evNR
76 /* view type */
78 /***************************************************
79 * XVGR ROUTINES
80 ***************************************************/
82 /* Strings such as titles, lables and legends can contain escape sequences
83 * for formatting. Currently supported are:
84 * \s : start subscript
85 * \S : start superscript
86 * \N : end sub/superscript
87 * \symbol : where symbol is the full name of a greek letter
88 * (see the xvgrstr function in xvgr.c for the full list)
89 * when starting with a capital, a capital symbol will be printed,
90 * note that symbol does not need to be followed by a space
91 * \8 : (deprecated) start symbol font
92 * \4 : (deprecated) end symbol font
95 extern bool output_env_get_print_xvgr_codes(const output_env_t oenv);
96 /* Returns if we should print xmgrace or xmgr codes */
98 enum {
99 exvggtNONE, exvggtXNY, exvggtXYDY, exvggtXYDYDY, exvggtNR
102 extern void xvgr_header(FILE *fp,const char *title,const char *xaxis,
103 const char *yaxis,int exvg_graph_type,
104 const output_env_t oenv);
105 /* In most cases you want to use xvgropen_type, which does the same thing
106 * but takes a filename and opens it.
109 extern FILE *xvgropen_type(const char *fn,const char *title,const char *xaxis,
110 const char *yaxis,int exvg_graph_type,
111 const output_env_t oenv);
112 /* Open a file, and write a title, and axis-labels in Xvgr format
113 * or write nothing when oenv specifies so.
114 * The xvgr graph type enum is defined above.
117 extern FILE *xvgropen(const char *fn,const char *title,const char *xaxis,
118 const char *yaxis,const output_env_t oenv);
119 /* Calls xvgropen_type with graph type xvggtXNY. */
121 /* Close xvgr file, and clean up internal file buffers correctly */
122 extern void xvgrclose(FILE *fp);
124 extern void xvgr_subtitle(FILE *out,const char *subtitle,
125 const output_env_t oenv);
126 /* Set the subtitle in xvgr */
128 extern void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax,
129 const output_env_t oenv);
130 /* Set the view in xvgr */
132 extern void xvgr_world(FILE *out,real xmin,real ymin,real xmax,real ymax,
133 const output_env_t oenv);
134 /* Set the world in xvgr */
136 extern void xvgr_legend(FILE *out,int nsets,char **setnames,
137 const output_env_t oenv);
138 /* Make a legend box, and also modifies the view to make room for the legend */
140 extern void xvgr_line_props(FILE *out,int NrSet,int LineStyle,int LineColor,
141 const output_env_t oenv);
142 /* Set xvgr line styles and colors */
144 extern void xvgr_box(FILE *out,
145 int LocType,
146 real xmin,real ymin,real xmax,real ymax,
147 int LineStyle,int LineWidth,int LineColor,
148 int BoxFill,int BoxColor,int BoxPattern,
149 const output_env_t oenv);
150 /* Make a box */
152 extern int read_xvg_legend(const char *fn,double ***y,int *ny,
153 char **subtitle,char ***legend);
154 /* Read an xvg file for post processing. The number of rows is returned
155 * fn is the filename, y is a pointer to a 2D array (to be allocated by
156 * the routine) ny is the number of columns (including X if appropriate).
157 * If subtitle!=NULL, read the subtitle (when present),
158 * the subtitle string will be NULL when not present.
159 * If legend!=NULL, read the legends for the sets (when present),
160 * 0 is the first y legend, the legend string will be NULL when not present.
163 extern int read_xvg(const char *fn,double ***y,int *ny);
164 /* As read_xvg_legend, but does not read legends. */
166 extern void write_xvg(const char *fn,const char *title,int nx,int ny,real **y,
167 char **leg, const output_env_t oenv);
168 /* Write a two D array (y) of dimensions nx rows times
169 * ny columns to a file. If leg != NULL it will be written too.
173 /* This function reads ascii (xvg) files and extracts the data sets to a
174 * two dimensional array which is returned.
176 extern real **read_xvg_time(const char *fn,
177 bool bHaveT,
178 bool bTB,real tb,
179 bool bTE,real te,
180 int nsets_in,int *nset,int *nval,
181 real *dt,real **t);
182 #ifdef __cplusplus
184 #endif
186 #endif /* _xvgr_h */