#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;
namespace gmx
{
+class ExceptionInitializer;
+
/*! \brief
* Function pointer for evaluating a gmx::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;