Update copyright statements and change license to LGPL
[alexxy/gromacs.git] / include / xdrf.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012, by the GROMACS development team, led by
8  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9  * others, as listed in the AUTHORS file in the top-level source
10  * directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38
39 #ifndef _xdrf_h
40 #define _xdrf_h
41
42
43 #include <stdio.h>
44 #include "visibility.h"
45 #include "typedefs.h"
46
47 #ifdef __PGI    /*Portland group compiler*/
48 #define int64_t long long
49 #endif
50
51 #include "gmx_header_config.h"
52 #if (defined GMX_NATIVE_WINDOWS || defined GMX_CYGWIN || defined GMX_INTERNAL_XDR)
53 #include "gmx_system_xdr.h"
54 #else
55 #include <rpc/rpc.h>
56 #include <rpc/xdr.h>
57 #endif
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63
64 /* THESE 3 FUNCTIONS (xdropen, xdrclose and xdr_get_fp) ARE NOW OBSOLETE 
65    AND ONLY PROVIDED FOR BACKWARD COMPATIBILITY OF 3D PARTY TOOLS. 
66    THEY SHOULD NOT BE USED ANYWHERE IN GROMACS ITSELF. 
67 int xdropen(XDR *xdrs, const char *filename, const char *type);
68 int xdrclose(XDR *xdrs);
69 */
70
71 /* the xdr data types; note that there is no data type 'real' because
72    here we deal with the types as they are actually written to disk.  */
73 typedef enum
74 {
75     xdr_datatype_int,
76     xdr_datatype_float,
77     xdr_datatype_double,
78     xdr_datatype_large_int,
79     xdr_datatype_char,
80     xdr_datatype_string
81 } xdr_datatype;
82
83 /* names corresponding to the xdr_datatype enum */
84 GMX_LIBGMX_EXPORT
85 extern const char *xdr_datatype_names[];
86
87 /* Read or write reduced precision *float* coordinates */
88 int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision);
89
90
91 /* Read or write a *real* value (stored as float) */
92 int xdr_real(XDR *xdrs,real *r); 
93
94
95 /* Read or write reduced precision *real* coordinates */
96 int xdr3drcoord(XDR *xdrs,real *fp,int *size,real *precision);
97
98
99 int xdr_gmx_large_int(XDR *xdrs,gmx_large_int_t *i,const char *warn);
100 /* Read or write a gmx_large_int_t value.
101  * 32bit code reading a 64bit gmx_large_int_t value from xdrs could
102  * lead to values out of int range.
103  * When warn!=NULL a warning will be written to stderr
104  * when a value does not fit,
105  * the first line is:
106  * "WARNING during %s:", where warn is printed in %s.
107  */
108
109 int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms,gmx_bool bSeekForwardOnly);
110
111
112 int xdr_xtc_seek_frame(int frame, FILE *fp, XDR *xdrs, int natoms);
113
114
115 GMX_LIBGMX_EXPORT
116 float xdr_xtc_get_last_frame_time(FILE *fp, XDR *xdrs, int natoms, gmx_bool * bOK);
117
118
119 int xdr_xtc_get_last_frame_number(FILE *fp, XDR *xdrs, int natoms, gmx_bool * bOK);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif
126
127