Fix CUDA clang-tidy complaints
[alexxy/gromacs.git] / src / gromacs / coordinateio.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2019, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*! \defgroup module_coordinateio Handling of writing new coordinate files
36  * \ingroup group_analysismodules
37  * \brief
38  * Provides basic functions to handle writing of new coordinate files.
39  *
40  * The methods included in the coordinateio module implement the basics
41  * for manipulating and writing coordinate trajectory files
42  * and changing metadata in the underlying datastructures. Included are a container for storing
43  * modules that change trajectory data, as well as a manager to write output files that uses
44  * those methods. It can be used from within \ref module_trajectoryanalysis, and uses
45  * methods from:
46  * - \ref module_options
47  * - \ref module_selection
48  *
49  * <H3>Overview</H3>
50  * The methods in coordinateio provide the infrastructure to perform operations on coordinate data files
51  * and structures during data analysis. It implements ways to change the information
52  * in coordinate data structures as well as checking that both input data and output
53  * method are matching for a given coordinate file writing operation. For this
54  * components verify first that all the requirements can be satisfied. Then
55  * components are build that will change the coordinate information accordingly.
56  *
57  * The main parts are the outputadapters implemented using the
58  * IOutputAdapter interface to change information in a local (deep) copy of t_trxframes
59  * stored in the coordinatefile.
60  *
61  * <H3>Outputadapter</H3>
62  * Each OutputAdapter module implements the same IOutputAdapter interface and
63  * has to set its requirements for final
64  * processing as a flag from the enum in requirementflags. During processing, they implement a custom
65  * version of the processFrame directive that modifies the stored trajectory data before writing
66  * a new file to disk.
67  *
68  *
69  * The interaction between the CoordinateFile and the OutputAdapter modules derived from
70  * IOutputAdapter is shown in the diagram below.
71  *
72  * \msc
73    wordwraparcs=true,
74    hscale="2";
75
76    analysistool,
77    builder [ label="CoordinateFileBuilder" ],
78    coordinatefile [ label="CoordinateFile" ],
79    container [ label="OutputAdapterStorage" ],
80    outputadapters [ label="OutputAdapters" ];
81
82    analysistool => builder [ label="Requests new coordinate output" ];
83    analysistool => builder [ label="Specifies required OutputAdapters" ];
84    builder => outputadapters [ label="Tries to construct new outputadapters" ];
85    outputadapters => builder [ label="Return or give error for wrong preconditions" ];
86    outputadapters => container [ label="Outputadapters are stored" ];
87    container => builder [ label="Gives error if storage conditions are violated" ];
88    builder => coordinatefile [ label="Constructs new manager according to specifications" ];
89    builder => container [ label="Requests storage object with registered outputadapters" ];
90    container => builder [ label="Gives ownership of stored outputadapters" ];
91    builder box builder [ label="Tests preconditions of storage object and new coordinatefile" ];
92    builder => analysistool [ label="Raise error if preconditions don't match" ];
93    builder => coordinatefile [ label="Add storage object to new coordinatefile" ];
94    coordinatefile => analysistool [ label="Returns finished coordinatefile" ];
95    builder box builder [ label="coordinatefile created, can start to work on input data" ];
96
97  * \endmsc
98  *
99  * Once the CoordinateFile object and its registered modules are created, they can be used to
100  * iterate over input data to write new coordinate frames.
101  *
102  * \msc
103    wordwraparcs=true,
104    hscale="2";
105
106    analysistool,
107    analysisloop,
108    coordinatefile [ label="CoordinateFile" ],
109    outputadapters [ label="OutputAdapters" ] ,
110    filewriting;
111
112    --- [ label="Setup of coordinatefile complete, analysis phase begins" ];
113     analysistool   => analysisloop [ label="Starts iteration over frames" ];
114     analysisloop   => coordinatefile [ label="Provides coordinates" ];
115     coordinatefile  => outputadapters [ label="Provide coordinate frames for changing" ];
116     outputadapters => coordinatefile [ label="Return after changing data" ];
117     coordinatefile  => filewriting [ label="Send new coordinates for writing" ];
118     filewriting    => coordinatefile [ label="Continue after writing to disk" ];
119     coordinatefile  => analysisloop [ label="Returns after writing" ];
120     analysisloop box analysisloop [ label="Iterates over frames" ];
121     --- [ label="Analysis complete, object is destructed and files are closed" ];
122
123  *  \endmsc
124  *
125  *
126  *
127  * \if libapi
128  * <H3>Preparing new OutputAdapters</H3>
129  *
130  * If additional methods are needed to perform changes to the t_trxframe metadata,
131  * new OutputAdapters can be written that again implement the IOutputAdapter interface.
132  * The new method should follow the approach of the other modules that are present
133  * in changing a minimal set of t_trxframe data.
134  * \endif
135  *
136  * \author Paul Bauer <paul.bauer.q@gmail.com>
137  */
138 /*! \file
139  * \libinternal
140  * \brief
141  * Public API convenience header for coordinate file output.
142  *
143  * \author Paul Bauer <paul.bauer.q@gmail.com>
144  * \inlibraryapi
145  * \ingroup module_coordinateio
146  */
147 #ifndef GMX_COORDINATEIO_H
148 #define GMX_COORDINATEIO_H
149
150 #include "gromacs/coordinateio/coordinatefile.h"
151 #include "gromacs/coordinateio/ioutputadapter.h"
152 #include "gromacs/coordinateio/outputadaptercontainer.h"
153 #include "gromacs/coordinateio/outputadapters.h"
154 #include "gromacs/coordinateio/outputadapters/outputselector.h"
155 #include "gromacs/coordinateio/outputadapters/setatoms.h"
156 #include "gromacs/coordinateio/outputadapters/setbox.h"
157 #include "gromacs/coordinateio/outputadapters/setforces.h"
158 #include "gromacs/coordinateio/outputadapters/setprecision.h"
159 #include "gromacs/coordinateio/outputadapters/setstarttime.h"
160 #include "gromacs/coordinateio/outputadapters/settimestep.h"
161 #include "gromacs/coordinateio/outputadapters/setvelocities.h"
162
163 #include "coordinateio/enums.h"
164
165 #endif