Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / selection / indexutil.h
index 52d99f6bdfdf5572eb2632cf95eab23ed2797551..dbfe7e77cf0ac6c43df66ea0e1477ed279a9e02b 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
  *
  * GROMACS is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
 #ifndef GMX_SELECTION_INDEXUTIL_H
 #define GMX_SELECTION_INDEXUTIL_H
 
+#include <cstdio>
+
 #include <string>
 
-#include "../legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/simple.h"
+#include "gromacs/topology/block.h"
+
+struct t_topology;
 
 /** Stores a set of index groups. */
-typedef struct gmx_ana_indexgrps_t gmx_ana_indexgrps_t;
+struct gmx_ana_indexgrps_t;
 
 /*! \brief
  * Specifies the type of index partition or index mapping in several contexts.
@@ -85,7 +90,7 @@ typedef enum
 /*! \brief
  * Stores a single index group.
  */
-typedef struct gmx_ana_index_t
+struct gmx_ana_index_t
 {
     /** Number of atoms. */
     int                 isize;
@@ -93,25 +98,15 @@ typedef struct gmx_ana_index_t
     atom_id            *index;
     /** Number of items allocated for \p index. */
     int                 nalloc_index;
-} gmx_ana_index_t;
+};
 
 /*! \brief
  * Data structure for calculating index group mappings.
  */
-typedef struct gmx_ana_indexmap_t
+struct gmx_ana_indexmap_t
 {
     /** Type of the mapping. */
     e_index_t           type;
-    /*! \brief
-     * Current number of mapped values.
-     *
-     * This is the current number of values in the \p refid and \p mapid
-     * arrays.
-     * If \p bMaskOnly is provided to gmx_ana_indexmap_update(), this
-     * is always equal to \p b.nr, i.e., the number of blocks in the
-     * original index group.
-     */
-    int                 nr;
     /*! \brief
      * Current reference IDs.
      *
@@ -178,7 +173,7 @@ typedef struct gmx_ana_indexmap_t
      * actually static.
      */
     bool                bStatic;
-} gmx_ana_indexmap_t;
+};
 
 
 /*! \name Functions for handling gmx_ana_indexgrps_t
@@ -241,9 +236,27 @@ gmx_ana_index_copy(gmx_ana_index_t *dest, gmx_ana_index_t *src, bool bAlloc);
 void
 gmx_ana_index_dump(FILE *fp, gmx_ana_index_t *g, int maxn);
 
+/*! \brief
+ * Returns maximum atom index that appears in an index group.
+ *
+ * \param[in]  g      Index group to query.
+ * \returns    Largest atom index that appears in \p g, or zero if \p g is empty.
+ */
+int
+gmx_ana_index_get_max_index(gmx_ana_index_t *g);
 /** Checks whether an index group is sorted. */
 bool
 gmx_ana_index_check_sorted(gmx_ana_index_t *g);
+/*! \brief
+ * Checks whether an index group has atoms from a defined range.
+ *
+ * \param[in]  g      Index group to check.
+ * \param[in]  natoms Largest atom number allowed.
+ * \returns    true if all atoms in the index group are in the
+ *     range 0 to \p natoms (i.e., no atoms over \p natoms are referenced).
+ */
+bool
+gmx_ana_index_check_range(gmx_ana_index_t *g, int natoms);
 /*@}*/
 
 /*! \name Functions for set operations on gmx_ana_index_t