Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / selection / selelem.h
index d5f44a9156ffcb9e01dc31e549ae9734d30ff38e..ddc429850f7f3e8d7d2a89a33a72afad46d54e37 100644 (file)
 
 #include <boost/shared_ptr.hpp>
 
-#include "gromacs/legacyheaders/types/simple.h"
+#include "gromacs/selection/indexutil.h"
 #include "gromacs/utility/common.h"
+#include "gromacs/utility/real.h"
 
-#include "indexutil.h"
 #include "selvalue.h"
 
 struct gmx_ana_poscalc_t;
@@ -167,6 +167,10 @@ _gmx_sel_value_type_str(const gmx_ana_selvalue_t *val);
  * The element (or one of its children) is dynamic.
  */
 #define SEL_DYNAMIC     16
+/*! \brief
+ * The element may contain atom indices in an unsorted order.
+ */
+#define SEL_UNSORTED    32
 /*! \brief
  * Mask that covers the flags that describe the number of values.
  */
@@ -233,6 +237,8 @@ _gmx_sel_value_type_str(const gmx_ana_selvalue_t *val);
 namespace gmx
 {
 
+class ExceptionInitializer;
+
 /*! \brief
  * Function pointer for evaluating a gmx::SelectionTreeElement.
  */
@@ -320,14 +326,37 @@ class SelectionTreeElement
         void fillNameIfMissing(const char *selectionText);
 
         /*! \brief
-         * Resolved an unresolved reference to an index group.
+         * Checks that this element and its children do not contain unsupported
+         * elements with unsorted atoms.
+         *
+         * \param[in] bUnsortedAllowed Whether this element's parents allow it
+         *     to have unsorted atoms.
+         * \param     errors           Object for reporting any error messages.
+         * \throws    std::bad_alloc if out of memory.
+         *
+         * Errors are reported as nested exceptions in \p errors.
+         */
+        void checkUnsortedAtoms(bool                  bUnsortedAllowed,
+                                ExceptionInitializer *errors) const;
+        /*! \brief
+         * Resolves an unresolved reference to an index group.
          *
-         * \param[in] grps  Index groups to use to resolve the reference.
+         * \param[in] grps   Index groups to use to resolve the reference.
+         * \param[in] natoms Maximum number of atoms the selections can evaluate to
+         *     (zero if the topology/atom count is not set yet).
          * \throws    std::bad_alloc if out of memory.
          * \throws    InconsistentInputError if the reference cannot be
          *     resolved.
          */
-        void resolveIndexGroupReference(gmx_ana_indexgrps_t *grps);
+        void resolveIndexGroupReference(gmx_ana_indexgrps_t *grps, int natoms);
+        /*! \brief
+         * Checks that an index group has valid atom indices.
+         *
+         * \param[in] natoms Maximum number of atoms the selections can evaluate to.
+         * \throws    std::bad_alloc if out of memory.
+         * \throws    InconsistentInputError if there are invalid atom indices.
+         */
+        void checkIndexGroup(int natoms);
 
         //! Type of the element.
         e_selelem_t                         type;