Tagged files with gromacs 3.0 header and added some license info
[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 3.0
11  * 
12  * Copyright (c) 1991-2001
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  * 
21  * If you want to redistribute modifications, please consider that
22  * scientific software is very special. Version control is crucial -
23  * bugs must be traceable. We will be happy to consider code for
24  * inclusion in the official distribution, but derived work must not
25  * be called official GROMACS. Details are found in the README & COPYING
26  * files - if they are missing, get the official version at www.gromacs.org.
27  * 
28  * To help us fund GROMACS development, we humbly ask that you cite
29  * the papers on the package - you can find them in the top README file.
30  * 
31  * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
32  * 
33  * And Hey:
34  * Giving Russians Opium May Alter Current Situation
35  */
36
37 #ifndef _matio_h
38 #define _matio_h
39
40 static char *SRCID_matio_h = "$Id$";
41 #ifdef HAVE_CONFIG_H
42 #include <config.h>
43 #endif
44
45 #ifdef HAVE_IDENT
46 #ident  "@(#) matio.h 1.11 5/20/97"
47 #endif /* HAVE_IDENT */
48 #include "typedefs.h"
49
50 extern bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2);
51
52 extern t_matelmt searchcmap(int n,t_mapping map[],t_xpmelmt c);
53 /* Seach in the map for code 'c' and return entry number. 
54  * return -1 if not found
55  */
56
57 extern int getcmap(FILE *in,char *fn,t_mapping **map);
58 /* Read the mapping table from in, return number of entries */
59
60 extern int readcmap(char *fn,t_mapping **map);
61 /* Read the mapping table from fn, return number of entries */
62
63 extern void printcmap(FILE *out,int n,t_mapping map[]);
64 /* print mapping table to out */
65
66 extern void writecmap(char *fn,int n,t_mapping map[]);
67 /* print mapping table to fn */
68
69 extern int read_xpm_matrix(char *fnm, t_matrix **matrix);
70 /* Reads a number of matrices from .xpm file fnm and returns this number */
71
72 extern real **matrix2real(t_matrix *matrix,real **mat);
73 /* Converts an matrix in a t_matrix struct to a matrix of reals
74  * When mat==NULL memory will be allocated 
75  * Returns NULL when something went wrong
76  */
77
78 extern void write_xpm_m(FILE *out, t_matrix m);
79 /* Writes a t_matrix struct to .xpm file */ 
80
81 extern void write_xpm3(FILE *out,
82                        char *title,char *legend,char *label_x,char *label_y,
83                        int n_x,int n_y,real axis_x[],real axis_y[],
84                        real *matrix[],real lo,real mid,real hi,
85                        t_rgb rlo,t_rgb rmid,t_rgb rhi,int *nlevels);
86 /* See write_xpm.
87  * Writes a colormap varying as rlo -> rmid -> rhi.
88  */
89
90 extern void write_xpm(FILE *out,
91                       char *title,char *legend,char *label_x,char *label_y,
92                       int n_x,int n_y,real t_x[],real t_y[],
93                       real *matrix[],real lo,real hi,
94                       t_rgb rlo,t_rgb rhi,int *nlevels);
95 /* out        xpm file
96  * title      matrix title
97  * legend     label for the continuous legend
98  * label_x    label for the x-axis
99  * label_y    label for the y-axis
100  * n_x, n_y   size of the matrix
101  * axis_x[]   the x-ticklabels
102  * axis_y[]   the y-ticklables
103  * *matrix[]  element x,y is matrix[x][y]
104  * lo         output lower than lo is set to lo
105  * hi         output higher than hi is set to hi
106  * rlo        rgb value for level lo
107  * rhi        rgb value for level hi
108  * nlevels    number of color levels for the output
109  */
110
111 #endif  /* _matio_h */