SYCL: Avoid using no_init read accessor in rocFFT
[alexxy/gromacs.git] / src / gromacs / utility.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2010-2018, The GROMACS development team.
5  * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
6  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7  * and including many others, as listed in the AUTHORS file in the
8  * top-level source directory and at http://www.gromacs.org.
9  *
10  * GROMACS is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * as published by the Free Software Foundation; either version 2.1
13  * of the License, or (at your option) any later version.
14  *
15  * GROMACS is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with GROMACS; if not, see
22  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
24  *
25  * If you want to redistribute modifications to GROMACS, please
26  * consider that scientific software is very special. Version
27  * control is crucial - bugs must be traceable. We will be happy to
28  * consider code for inclusion in the official distribution, but
29  * derived work must not be called official GROMACS. Details are found
30  * in the README & COPYING files - if they are missing, get the
31  * official version at http://www.gromacs.org.
32  *
33  * To help us fund GROMACS development, we humbly ask that you cite
34  * the research papers on the package. Check out http://www.gromacs.org.
35  */
36 /*! \defgroup module_utility Low-Level Utilities (utility)
37  * \ingroup group_utilitymodules
38  * \brief
39  * Provides low-level utilities for error handling and other tasks.
40  *
41  * This module provides various low-level utilities for tasks such as error
42  * handling and string formatting, as well as helper classes and common custom
43  * containers to simplify implementation of other code.  Contents of the module
44  * are discussed in more details under the different headings below.
45  * Some of the code in installed headers in the module is intended for use
46  * directly from code outside the \Gromacs library, but a significant portion
47  * is exposed only because other public headers depend on it.
48  *
49  * Since this module implements error handling, it should be at the lowest
50  * level: it should not depend on other modules.  Any functionality needed by
51  * the error handling code should also be kept in this module.
52  *
53  * <H3>Error handling</H3>
54  *
55  * Exception classes used in the library are declared in the exceptions.h header
56  * file.  Most \Gromacs-specific exceptions derive from gmx::GromacsException.
57  *
58  * This header also declares a ::GMX_THROW macro that should be used for
59  * throwing exceptions.  ::GMX_THROW_WITH_ERRNO is also provided for reporting
60  * syscall errors, but its use should be mostly limited to within the library.
61  * This header also declares helper functions printFatalErrorMessage(),
62  * formatExceptionMessageToString(), and formatExceptionMessageToFile() for
63  * creating standard error messages.  processExceptionAtExit() provides
64  * clean-up code before exiting the program after an exception.
65  * To help in cases where bottom-up conversion to C++ is appropriate, macro
66  * ::GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR is also provided to catch all
67  * exceptions at C++ to C boundary.
68  *
69  * Header file gmxassert.h is also provided for assertions.  It declares macros
70  * ::GMX_ASSERT and ::GMX_RELEASE_ASSERT that should be used for assertions.
71  *
72  * \if internal
73  * Internally, functions from errorformat.h are used for all the above cases to
74  * format error messages to \c stderr.  errorcodes.h provides some common
75  * functionality for classifying errors.
76  * \endif
77  *
78  *
79  * \if libapi
80  *
81  * <H3>Basic file handling and streams</H3>
82  *
83  * The header textstream.h declares interfaces for simple text format streams.
84  * Headers filestream.h and stringstream.h provide implementations for these
85  * streams for reading/writing files and for writing to in-memory strings.
86  *
87  * The header fileredirector.h provides interfaces for redirecting file input
88  * and/or output to alternative streams, for use in testing, as well as default
89  * implementations for these interfaces that just use the file system.
90  *
91  * The header textwriter.h provides gmx::TextWriter for more formatting support
92  * when writing to a text stream.  Similarly, textreader.h provides more
93  * formatting support when reading from a text stream.
94  *
95  * The header path.h declares helpers for manipulating paths as strings and for
96  * managing directories and files.
97  * The fate of this header depends on what is decided in Issue #950.
98  *
99  * <H3>Logging</H3>
100  *
101  * The headers logger.h and loggerbuilder.h provide interfaces and classes for
102  * writing log files (or logging to other targets).  See \ref page_logging for
103  * an overview.
104  *
105  * \endif
106  *
107  * <H3>Implementation helpers</H3>
108  *
109  * The header basedefinitions.h contains common definitions and macros used
110  * throughout \Gromacs. It includes `gmx_bool` for C code, some macros for
111  * compiler-specific attributes, and ::GMX_UNUSED_VALUE and ::GMX_IGNORE_RETURN_VALUE
112  * for handling warnings about unused values.
113  *
114  * The header classhelpers.h declares ::GMX_DISALLOW_COPY_AND_ASSIGN,
115  * ::GMX_DISALLOW_COPY_MOVE_AND_ASSIGN, ::GMX_DISALLOW_ASSIGN, and
116  * ::GMX_DEFAULT_CONSTRUCTORS macros for class declarations.
117  *
118  * The header flags.h implements a gmx::FlagsTemplate template for better type
119  * safety when using bit flag fields.
120  *
121  *
122  * <H3>Other functionality</H3>
123  *
124  * The header init.h declares gmx::init() and gmx::finalize() for initializing
125  * and deinitializing the \Gromacs library.
126  *
127  * The header arrayref.h implements a gmx::ArrayRef class for exposing a
128  * C array or part of a std::vector (basically, any continuous stretch of
129  * memory) throuh a std::vector-like interface.
130  *
131  * The header stringutil.h declares various string utility routines.
132  *
133  * \if libapi
134  *
135  * The header strconvert.h declares string parsing routines.
136  *
137  * The header gmxmpi.h abstracts away the mechanism of including either MPI or
138  * thread-MPI headers depending on compilation options.
139  * Similarly, gmxomp.h removes the need to use conditional compilation for code
140  * that needs to include omp.h for OpenMP functions.
141  *
142  * The header message_string_collector.h declares a gmx::MessageStringCollector
143  * class for composing messages with context information.
144  *
145  * The header sysinfo.h declares gmx_getpid() for getting the current process
146  * id.
147  *
148  * The header programcontext.h declares a gmx::IProgramContext that is
149  * used to
150  * initialize and access information about the running program, such as the
151  * name and path of the executable.  This information is used, e.g., by the
152  * error handling code in formatting standard error messages.
153  *
154  * The header qsort_threadsafe.h provides a guaranteed threadsafe
155  * implementation for qsort().
156  *
157  * \endif
158  *
159  * \author Teemu Murtola <teemu.murtola@gmail.com>
160  */
161 /*! \file
162  * \brief
163  * Public API convenience header for low-level utilities.
164  *
165  * \author Teemu Murtola <teemu.murtola@gmail.com>
166  * \inpublicapi
167  * \ingroup module_utility
168  */
169 #ifndef GMX_UTILITY_H
170 #define GMX_UTILITY_H
171
172 #include "gromacs/utility/baseversion.h"
173 #include "gromacs/utility/exceptions.h"
174 #include "gromacs/utility/gmxassert.h"
175 #include "gromacs/utility/init.h"
176 #include "gromacs/utility/programcontext.h"
177
178 #endif