Partial commit of the project to remove all static variables.
[gromacs.git] / include / matio.h
blob7c9cfe5964fb559b23639bf56219f18e014acd7c
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.1
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
29 * And Hey:
30 * Getting the Right Output Means no Artefacts in Calculating Stuff
33 #ifndef _matio_h
34 #define _matio_h
36 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
40 #include "typedefs.h"
42 extern bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2);
44 extern t_matelmt searchcmap(int n,t_mapping map[],t_xpmelmt c);
45 /* Seach in the map for code 'c' and return entry number.
46 * return -1 if not found
49 extern int getcmap(FILE *in,char *fn,t_mapping **map);
50 /* Read the mapping table from in, return number of entries */
52 extern int readcmap(char *fn,t_mapping **map);
53 /* Read the mapping table from fn, return number of entries */
55 extern void printcmap(FILE *out,int n,t_mapping map[]);
56 /* print mapping table to out */
58 extern void writecmap(char *fn,int n,t_mapping map[]);
59 /* print mapping table to fn */
61 extern int read_xpm_matrix(char *fnm, t_matrix **matrix);
62 /* Reads a number of matrices from .xpm file fnm and returns this number */
64 extern real **matrix2real(t_matrix *matrix,real **mat);
65 /* Converts an matrix in a t_matrix struct to a matrix of reals
66 * When mat==NULL memory will be allocated
67 * Returns NULL when something went wrong
70 extern void write_xpm_m(FILE *out, t_matrix m);
71 /* Writes a t_matrix struct to .xpm file */
73 extern void write_xpm3(FILE *out,
74 char *title,char *legend,char *label_x,char *label_y,
75 int n_x,int n_y,real axis_x[],real axis_y[],
76 real *matrix[],real lo,real mid,real hi,
77 t_rgb rlo,t_rgb rmid,t_rgb rhi,int *nlevels);
78 /* See write_xpm.
79 * Writes a colormap varying as rlo -> rmid -> rhi.
82 extern void write_xpm(FILE *out,
83 char *title,char *legend,char *label_x,char *label_y,
84 int n_x,int n_y,real t_x[],real t_y[],
85 real *matrix[],real lo,real hi,
86 t_rgb rlo,t_rgb rhi,int *nlevels);
87 /* out xpm file
88 * title matrix title
89 * legend label for the continuous legend
90 * label_x label for the x-axis
91 * label_y label for the y-axis
92 * n_x, n_y size of the matrix
93 * axis_x[] the x-ticklabels
94 * axis_y[] the y-ticklables
95 * *matrix[] element x,y is matrix[x][y]
96 * lo output lower than lo is set to lo
97 * hi output higher than hi is set to hi
98 * rlo rgb value for level lo
99 * rhi rgb value for level hi
100 * nlevels number of color levels for the output
103 extern real **mk_matrix(int nx, int ny, bool b1D);
105 extern void done_matrix(int nx, real ***m);
107 extern void clear_matrix(int nx, int ny, real **m);
109 #endif /* _matio_h */