SYCL: Avoid using no_init read accessor in rocFFT
[alexxy/gromacs.git] / src / gromacs / selection / selectionenums.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
5  * Copyright (c) 2016,2018,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 /*! \file
37  * \brief
38  * Declares common types used in selections.
39  *
40  * \author Teemu Murtola <teemu.murtola@gmail.com>
41  * \ingroup module_selection
42  */
43 #ifndef GMX_SELECTION_SELECTIONENUMS_H
44 #define GMX_SELECTION_SELECTIONENUMS_H
45
46 #include "gromacs/utility/flags.h"
47
48 /*! \brief
49  * Defines the type of covered fraction.
50  *
51  * \inpublicapi
52  */
53 typedef enum
54 {
55     CFRAC_NONE,      /**< No covered fraction (everything covered). */
56     CFRAC_SOLIDANGLE /**< Fraction of a solid (3D) angle covered. */
57 } e_coverfrac_t;
58
59 namespace gmx
60 {
61
62 /*! \cond internal */
63 /*! \brief
64  * Flags for options.
65  *
66  * These flags are not part of the public interface, even though they are in an
67  * installed header.  They are needed in the implementation of SelectionOption.
68  */
69 enum SelectionFlag : uint64_t
70 {
71     efSelection_OnlyStatic = 1 << 0,
72     efSelection_OnlyAtoms  = 1 << 1,
73     efSelection_OnlySorted = 1 << 2,
74     //! Whether ::POS_MASKONLY should be used for output position evaluation.
75     efSelection_DynamicMask = 1 << 3,
76     //! If set, unconditionally empty selections result in compilation errors.
77     efSelection_DisallowEmpty = 1 << 4,
78     //! Whether velocities of output positions should be evaluated.
79     efSelection_EvaluateVelocities = 1 << 5,
80     //! Whether forces on output positions should be evaluated.
81     efSelection_EvaluateForces = 1 << 6,
82 };
83
84 //! Holds a collection of ::SelectionFlag values.
85 typedef FlagsTemplate<SelectionFlag> SelectionFlags;
86 //! \endcond
87
88 /*! \brief
89  * Describes topology properties required for selection evaluation.
90  *
91  * See SelectionCollection::requiredTopologyProperties().
92  *
93  * \inpublicapi
94  * \ingroup module_selection
95  */
96 struct SelectionTopologyProperties
97 {
98     //! Returns a property object that requires generic topology info.
99     static SelectionTopologyProperties topology()
100     {
101         return SelectionTopologyProperties(true, false);
102     }
103     //! Returns a property object that requires atom masses.
104     static SelectionTopologyProperties masses() { return SelectionTopologyProperties(true, true); }
105
106     //! Initializes properties that does not require anything.
107     SelectionTopologyProperties() : needsTopology(false), needsMasses(false) {}
108     //! Initializes properties with the given flags.
109     SelectionTopologyProperties(bool needsTopology, bool needsMasses) :
110         needsTopology(needsTopology), needsMasses(needsMasses)
111     {
112     }
113
114     //! Combines flags from another properties object to this.
115     void merge(const SelectionTopologyProperties& other)
116     {
117         needsTopology = needsTopology || other.needsTopology;
118         needsMasses   = needsMasses || other.needsMasses;
119     }
120     //! Whether all flags are `true` (for short-ciruiting logic).
121     bool hasAll() const { return needsTopology && needsMasses; }
122     //! Whether any flag is `true`.
123     bool hasAny() const { return needsTopology || needsMasses; }
124
125     //! Whether topology information is needed for selection evaluation.
126     bool needsTopology;
127     //! Whether atom masses are needed for selection evaluation.
128     bool needsMasses;
129 };
130
131 } // namespace gmx
132
133 #endif