Merge branch release-2016 into release-2018
[gromacs.git] / src / gromacs / utility / txtdump.h
blobd8b5b42d197b07f1f6ec3d6c0f2ba92143d57c6f
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
37 /*! \libinternal \file
38 * \brief
39 * Declares helper functions for dumping basic data structures as text.
41 * \inlibraryapi
42 * \ingroup module_utility
44 #ifndef GMX_FILEIO_TXTDUMP_H
45 #define GMX_FILEIO_TXTDUMP_H
47 #include <cstdio>
49 #include "gromacs/utility/basedefinitions.h"
50 #include "gromacs/utility/real.h"
52 //! Line width for text dump output.
53 #define LINE_WIDTH 80
54 //! Right margin for text dump output.
55 #define RMARGIN 10
56 //! Actual line length for text dump output.
57 #define USE_WIDTH ((LINE_WIDTH)-(RMARGIN))
58 //! Default indentation for text dump output.
59 #define INDENT 3
61 //! Prints an initial indentation for a line.
62 int pr_indent(FILE *fp, int n);
63 //! Returns whether \p is available (not null), and prints a note if it is not.
64 int available(FILE *fp, const void *p, int indent, const char *title);
65 //! Prints a title for a dumped section.
66 int pr_title(FILE *fp, int indent, const char *title);
67 //! Prints a title for a dumped section with a number suffixed.
68 int pr_title_n(FILE *fp, int indent, const char *title, int n);
69 //! Prints a title for a dumped section with two numbers suffixed (in NxM format).
70 int pr_title_nxn(FILE *fp, int indent, const char *title, int n1, int n2);
71 //! Prints an array of reals.
72 void pr_reals(FILE *fp, int indent, const char *title, const real vec[], int n);
73 //! Prints an array of doubles.
74 void pr_doubles(FILE *fp, int indent, const char *title, const double *vec, int n);
75 //! Prints an array of reals as a matrix with inner dimension dim.
76 void pr_reals_of_dim(FILE *fp, int indent, const char *title, const real *vec, int n, int dim);
77 //! Prints an integer value.
78 void pr_int(FILE *fp, int indent, const char *title, int i);
79 //! Prints a gmx_int64_t value.
80 void pr_int64(FILE *fp, int indent, const char *title, gmx_int64_t i);
81 //! Prints a floating-point value.
82 void pr_real(FILE *fp, int indent, const char *title, real r);
83 //! Prints a double-precision floating-point value.
84 void pr_double(FILE *fp, int indent, const char *title, double d);
85 //! Prints a string value.
86 void pr_str(FILE *fp, int indent, const char *title, const char *s);
87 //! Prints strings as a section; intended to be used for an array of names.
88 void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int n, gmx_bool bShowNumbers);
90 #endif