Split lines with many copyright years
[gromacs.git] / src / gromacs / selection / selectionenums.h
blob3122231119c12a382ecee01b3cea920119dec690
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2010,2012,2013,2014,2015 by the GROMACS development team.
5 * Copyright (c) 2016,2018,2019,2020, 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.
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.
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.
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.
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.
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.
36 /*! \file
37 * \brief
38 * Declares common types used in selections.
40 * \author Teemu Murtola <teemu.murtola@gmail.com>
41 * \ingroup module_selection
43 #ifndef GMX_SELECTION_SELECTIONENUMS_H
44 #define GMX_SELECTION_SELECTIONENUMS_H
46 #include "gromacs/utility/flags.h"
48 /*! \brief
49 * Defines the type of covered fraction.
51 * \inpublicapi
53 typedef enum
55 CFRAC_NONE, /**< No covered fraction (everything covered). */
56 CFRAC_SOLIDANGLE /**< Fraction of a solid (3D) angle covered. */
57 } e_coverfrac_t;
59 namespace gmx
62 /*! \cond internal */
63 /*! \brief
64 * Flags for options.
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.
69 enum SelectionFlag
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,
84 //! Holds a collection of ::SelectionFlag values.
85 typedef FlagsTemplate<SelectionFlag> SelectionFlags;
86 //! \endcond
88 /*! \brief
89 * Describes topology properties required for selection evaluation.
91 * See SelectionCollection::requiredTopologyProperties().
93 * \inpublicapi
94 * \ingroup module_selection
96 struct SelectionTopologyProperties
98 //! Returns a property object that requires generic topology info.
99 static SelectionTopologyProperties topology()
101 return SelectionTopologyProperties(true, false);
103 //! Returns a property object that requires atom masses.
104 static SelectionTopologyProperties masses() { return SelectionTopologyProperties(true, true); }
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),
111 needsMasses(needsMasses)
115 //! Combines flags from another properties object to this.
116 void merge(const SelectionTopologyProperties& other)
118 needsTopology = needsTopology || other.needsTopology;
119 needsMasses = needsMasses || other.needsMasses;
121 //! Whether all flags are `true` (for short-ciruiting logic).
122 bool hasAll() const { return needsTopology && needsMasses; }
123 //! Whether any flag is `true`.
124 bool hasAny() const { return needsTopology || needsMasses; }
126 //! Whether topology information is needed for selection evaluation.
127 bool needsTopology;
128 //! Whether atom masses are needed for selection evaluation.
129 bool needsMasses;
132 } // namespace gmx
134 #endif