3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
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
33 * Gromacs Runs On Most of All Computer Systems
45 extern bool matelmt_cmp(t_xpmelmt e1
, t_xpmelmt e2
);
47 extern t_matelmt
searchcmap(int n
,t_mapping map
[],t_xpmelmt c
);
48 /* Seach in the map for code 'c' and return entry number.
49 * return -1 if not found
52 extern int getcmap(FILE *in
,const char *fn
,t_mapping
**map
);
53 /* Read the mapping table from in, return number of entries */
55 extern int readcmap(const char *fn
,t_mapping
**map
);
56 /* Read the mapping table from fn, return number of entries */
58 extern void printcmap(FILE *out
,int n
,t_mapping map
[]);
59 /* print mapping table to out */
61 extern void writecmap(const char *fn
,int n
,t_mapping map
[]);
62 /* print mapping table to fn */
64 extern int read_xpm_matrix(const char *fnm
, t_matrix
**matrix
);
65 /* Reads a number of matrices from .xpm file fnm and returns this number */
67 extern real
**matrix2real(t_matrix
*matrix
,real
**mat
);
68 /* Converts an matrix in a t_matrix struct to a matrix of reals
69 * When mat==NULL memory will be allocated
70 * Returns NULL when something went wrong
73 extern void write_xpm_m(FILE *out
, t_matrix m
);
74 /* Writes a t_matrix struct to .xpm file */
76 extern void write_xpm3(FILE *out
,unsigned int flags
,
77 const char *title
,const char *legend
,
78 const char *label_x
,const char *label_y
,
79 int n_x
,int n_y
,real axis_x
[],real axis_y
[],
80 real
*matrix
[],real lo
,real mid
,real hi
,
81 t_rgb rlo
,t_rgb rmid
,t_rgb rhi
,int *nlevels
);
83 * Writes a colormap varying as rlo -> rmid -> rhi.
85 extern void write_xpm_split(FILE *out
,unsigned int flags
,
86 const char *title
,const char *legend
,
87 const char *label_x
,const char *label_y
,
88 int n_x
,int n_y
,real axis_x
[],real axis_y
[],
90 real lo_top
,real hi_top
,int *nlevel_top
,
91 t_rgb rlo_top
,t_rgb rhi_top
,
92 real lo_bot
,real hi_bot
,int *nlevel_bot
,
94 t_rgb rlo_bot
,t_rgb rhi_bot
);
96 * Writes a colormap with separate above and below diagonal colormaps.
97 * If bDiscrete then a colormap with 16 fixed colors is used, first of
101 extern void write_xpm(FILE *out
,unsigned int flags
,
102 const char *title
,const char *legend
,
103 const char *label_x
,const char *label_y
,
104 int n_x
,int n_y
,real t_x
[],real t_y
[],
105 real
*matrix
[],real lo
,real hi
,
106 t_rgb rlo
,t_rgb rhi
,int *nlevels
);
108 * flags flags, defined types/matrix.h
111 * Defines if x and y are spatial dimensions,
112 * when not, there are n axis ticks at the middle of the elements,
113 * when set, there are n+1 axis ticks at the edges of the elements.
115 * legend label for the continuous legend
116 * label_x label for the x-axis
117 * label_y label for the y-axis
118 * n_x, n_y size of the matrix
119 * axis_x[] the x-ticklabels (n_x or n_x+1)
120 * axis_y[] the y-ticklables (n_y or n_y+1)
121 * *matrix[] element x,y is matrix[x][y]
122 * lo output lower than lo is set to lo
123 * hi output higher than hi is set to hi
124 * rlo rgb value for level lo
125 * rhi rgb value for level hi
126 * nlevels number of color levels for the output
129 extern real
**mk_matrix(int nx
, int ny
, bool b1D
);
131 extern void done_matrix(int nx
, real
***m
);
133 extern void clear_matrix(int nx
, int ny
, real
**m
);
135 #endif /* _matio_h */