6f93b953efa7104ba730ee28d8312341814494eb
[alexxy/gromacs.git] / include / matio.h
1 /*
2  * $Id$
3  * 
4  *       This source code is part of
5  * 
6  *        G   R   O   M   A   C   S
7  * 
8  * GROningen MAchine for Chemical Simulations
9  * 
10  *               VERSION 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
17  * GROMACS: A message-passing parallel molecular dynamics implementation
18  * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19  * Comp. Phys. Comm. 91, 43-56 (1995)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Good ROcking Metal Altar for Chronical Sinners
28  */
29
30 #ifndef _matio_h
31 #define _matio_h
32
33 static char *SRCID_matio_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) matio.h 1.11 5/20/97"
41 #endif /* HAVE_IDENT */
42 #include "typedefs.h"
43
44 extern bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2);
45
46 extern t_matelmt searchcmap(int n,t_mapping map[],t_xpmelmt c);
47 /* Seach in the map for code 'c' and return entry number. 
48  * return -1 if not found
49  */
50
51 extern int getcmap(FILE *in,char *fn,t_mapping **map);
52 /* Read the mapping table from in, return number of entries */
53
54 extern int readcmap(char *fn,t_mapping **map);
55 /* Read the mapping table from fn, return number of entries */
56
57 extern void printcmap(FILE *out,int n,t_mapping map[]);
58 /* print mapping table to out */
59
60 extern void writecmap(char *fn,int n,t_mapping map[]);
61 /* print mapping table to fn */
62
63 extern int read_xpm_matrix(char *fnm, t_matrix **matrix);
64 /* Reads a number of matrices from .xpm file fnm and returns this number */
65
66 extern real **matrix2real(t_matrix *matrix,real **mat);
67 /* Converts an matrix in a t_matrix struct to a matrix of reals
68  * When mat==NULL memory will be allocated 
69  * Returns NULL when something went wrong
70  */
71
72 extern void write_xpm_m(FILE *out, t_matrix m);
73 /* Writes a t_matrix struct to .xpm file */ 
74
75 extern void write_xpm3(FILE *out,
76                        char *title,char *legend,char *label_x,char *label_y,
77                        int n_x,int n_y,real axis_x[],real axis_y[],
78                        real *matrix[],real lo,real mid,real hi,
79                        t_rgb rlo,t_rgb rmid,t_rgb rhi,int *nlevels);
80 /* See write_xpm.
81  * Writes a colormap varying as rlo -> rmid -> rhi.
82  */
83
84 extern void write_xpm(FILE *out,
85                       char *title,char *legend,char *label_x,char *label_y,
86                       int n_x,int n_y,real t_x[],real t_y[],
87                       real *matrix[],real lo,real hi,
88                       t_rgb rlo,t_rgb rhi,int *nlevels);
89 /* out        xpm file
90  * title      matrix title
91  * legend     label for the continuous legend
92  * label_x    label for the x-axis
93  * label_y    label for the y-axis
94  * n_x, n_y   size of the matrix
95  * axis_x[]   the x-ticklabels
96  * axis_y[]   the y-ticklables
97  * *matrix[]  element x,y is matrix[x][y]
98  * lo         output lower than lo is set to lo
99  * hi         output higher than hi is set to hi
100  * rlo        rgb value for level lo
101  * rhi        rgb value for level hi
102  * nlevels    number of color levels for the output
103  */
104
105 #endif  /* _matio_h */