Removed some legacy "#if 0" code.
[gromacs/rigid-bodies.git] / include / matio.h
blob01d81a6faeb81377d198e5942110a972a18cc935
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 _matio_h
37 #define _matio_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include "typedefs.h"
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 extern bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2);
51 extern t_matelmt searchcmap(int n,t_mapping map[],t_xpmelmt c);
52 /* Seach in the map for code 'c' and return entry number.
53 * return -1 if not found
56 extern int getcmap(FILE *in,const char *fn,t_mapping **map);
57 /* Read the mapping table from in, return number of entries */
59 extern int readcmap(const char *fn,t_mapping **map);
60 /* Read the mapping table from fn, return number of entries */
62 extern void printcmap(FILE *out,int n,t_mapping map[]);
63 /* print mapping table to out */
65 extern void writecmap(const char *fn,int n,t_mapping map[]);
66 /* print mapping table to fn */
68 extern int read_xpm_matrix(const char *fnm, t_matrix **matrix);
69 /* Reads a number of matrices from .xpm file fnm and returns this number */
71 extern real **matrix2real(t_matrix *matrix,real **mat);
72 /* Converts an matrix in a t_matrix struct to a matrix of reals
73 * When mat==NULL memory will be allocated
74 * Returns NULL when something went wrong
77 extern void write_xpm_m(FILE *out, t_matrix m);
78 /* Writes a t_matrix struct to .xpm file */
80 extern void write_xpm3(FILE *out,unsigned int flags,
81 const char *title,const char *legend,
82 const char *label_x,const 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.
89 extern void write_xpm_split(FILE *out,unsigned int flags,
90 const char *title,const char *legend,
91 const char *label_x,const char *label_y,
92 int n_x,int n_y,real axis_x[],real axis_y[],
93 real *matrix[],
94 real lo_top,real hi_top,int *nlevel_top,
95 t_rgb rlo_top,t_rgb rhi_top,
96 real lo_bot,real hi_bot,int *nlevel_bot,
97 bool bDiscreteColor,
98 t_rgb rlo_bot,t_rgb rhi_bot);
99 /* See write_xpm.
100 * Writes a colormap with separate above and below diagonal colormaps.
101 * If bDiscrete then a colormap with 16 fixed colors is used, first of
102 * which is white.
105 extern void write_xpm(FILE *out,unsigned int flags,
106 const char *title,const char *legend,
107 const char *label_x,const char *label_y,
108 int n_x,int n_y,real t_x[],real t_y[],
109 real *matrix[],real lo,real hi,
110 t_rgb rlo,t_rgb rhi,int *nlevels);
111 /* out xpm file
112 * flags flags, defined types/matrix.h
113 * MAT_SPATIAL_X
114 * MAT_SPATIAL_Y
115 * Defines if x and y are spatial dimensions,
116 * when not, there are n axis ticks at the middle of the elements,
117 * when set, there are n+1 axis ticks at the edges of the elements.
118 * title matrix title
119 * legend label for the continuous legend
120 * label_x label for the x-axis
121 * label_y label for the y-axis
122 * n_x, n_y size of the matrix
123 * axis_x[] the x-ticklabels (n_x or n_x+1)
124 * axis_y[] the y-ticklables (n_y or n_y+1)
125 * *matrix[] element x,y is matrix[x][y]
126 * lo output lower than lo is set to lo
127 * hi output higher than hi is set to hi
128 * rlo rgb value for level lo
129 * rhi rgb value for level hi
130 * nlevels number of color levels for the output
133 extern real **mk_matrix(int nx, int ny, bool b1D);
135 extern void done_matrix(int nx, real ***m);
137 extern void clear_matrix(int nx, int ny, real **m);
139 #ifdef __cplusplus
141 #endif
143 #endif /* _matio_h */