Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / coordinateio / requirements.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 /*!\file
36  * \brief
37  * Storage object for requirements to build coordinate file writer.
38  *
39  * \author Paul Bauer <paul.bauer.q@gmail.com>
40  * \ingroup module_coordinateio
41  * \inlibraryapi
42  */
43 #ifndef GMX_COORDINATEIO_OUTPUTREQUIREMENTS_H
44 #define GMX_COORDINATEIO_OUTPUTREQUIREMENTS_H
45
46 #include <vector>
47
48 #include "gromacs/math/vec.h"
49 #include "gromacs/options/ioptionscontainer.h"
50
51 #include "enums.h"
52
53 namespace gmx
54 {
55
56 /*!\brief
57  * Container for the user input values that will be used by the builder
58  * to determine which OutputAdapters should/could/will be registered
59  * to the coordinate file writer.
60  */
61 class OutputRequirementOptionDirector
62 {
63 public:
64     /*! \brief
65      * Populate requirements from option interface.
66      *
67      * \param[in] options Pointer to global options framework.
68      */
69     void initOptions(IOptionsContainer* options);
70
71     /*! \brief
72      * Provide processed requirements to create on coordinate file writing method.
73      */
74     struct OutputRequirements process() const;
75
76 private:
77     //! Should velocities be written.
78     ChangeSettingType velocity_ = ChangeSettingType::PreservedIfPresent;
79     //! Should forces be written.
80     ChangeSettingType force_ = ChangeSettingType::PreservedIfPresent;
81     //! Precision used in output file.
82     int prec_ = 3;
83     //! If a new precision value has been set.
84     bool setNewPrecision_ = false;
85     //! Time for first frame to start.
86     real startTimeValue_ = 0;
87     //! Time step to use between frames.
88     real timeStepValue_ = 0;
89     //! If start time value has been assigned.
90     bool setNewStartTime_ = false;
91     //! If a new time step value has been assigned.
92     bool setNewTimeStep_ = false;
93     //! User supplied diagonal box vector.
94     std::vector<real> newBoxVector_;
95     //! If a new box vector has been set.
96     bool setNewBox_ = false;
97     //! Should frame atom setting be changed.
98     ChangeAtomsType atoms_ = ChangeAtomsType::PreservedIfPresent;
99 };
100
101 /*! \brief
102  * Finalized version of requirements after processing.
103  */
104 struct OutputRequirements
105 {
106     //! Should velocities be written.
107     ChangeSettingType velocity = ChangeSettingType::PreservedIfPresent;
108     //! Should forces be written.
109     ChangeSettingType force = ChangeSettingType::PreservedIfPresent;
110     //! Should precision be changed.
111     ChangeFrameInfoType precision = ChangeFrameInfoType::PreservedIfPresent;
112     //! Precision used in output file.
113     int prec = 3;
114     //! Should frame start time be changed.
115     ChangeFrameTimeType frameTime = ChangeFrameTimeType::PreservedIfPresent;
116     //! Time for first frame to start.
117     real startTimeValue = 0;
118     //! Time step to use between frames.
119     real timeStepValue = 0;
120     //! Box vector converted to matrix format.
121     matrix newBox = { { 0 } };
122     //! Should frame box be changed.
123     ChangeFrameInfoType box = ChangeFrameInfoType::PreservedIfPresent;
124     //! Should frame atom setting be changed.
125     ChangeAtomsType atoms = ChangeAtomsType::PreservedIfPresent;
126 };
127
128 } // namespace gmx
129
130 #endif