Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / selection / sm_keywords.cpp
index dd0124dd5d555d2504a3433efc47972d1dfae3f8..32d478ed00bfd63ae5f1de79aba80027d0721198 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
@@ -40,6 +40,8 @@
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_selection
  */
+#include "gmxpre.h"
+
 #include <cctype>
 #include <cstring>
 
 #include <boost/shared_ptr.hpp>
 
 #include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/smalloc.h"
-#include "gromacs/legacyheaders/string2.h"
-
-#include "gromacs/selection/selmethod.h"
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxregex.h"
 #include "gromacs/utility/messagestringcollector.h"
+#include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/stringutil.h"
 
 #include "keywords.h"
 #include "parsetree.h"
 #include "scanner.h"
 #include "selelem.h"
+#include "selmethod.h"
 
-/** Allocates data for integer keyword evaluation. */
+/*! \brief
+ * Allocates data for integer keyword evaluation.
+ *
+ * \param[in] npar  Not used.
+ * \param     param Not used.
+ * \returns   Pointer to the allocated data (\ref t_methoddata_kwint).
+ *
+ * Allocates memory for a \ref t_methoddata_kwint structure.
+ */
 static void *
-init_data_kwint(int npar, gmx_ana_selparam_t *param);
-/** Allocates data for real keyword evaluation. */
+init_data_kwint(int  npar, gmx_ana_selparam_t * param);
+/*! \brief
+ * Allocates data for real keyword evaluation.
+ *
+ * \param[in] npar  Not used.
+ * \param     param Not used.
+ * \returns   Pointer to the allocated data (\ref t_methoddata_kwreal).
+ *
+ * Allocates memory for a \ref t_methoddata_kwreal structure.
+ */
 static void *
-init_data_kwreal(int npar, gmx_ana_selparam_t *param);
-/** Allocates data for string keyword evaluation. */
+init_data_kwreal(int npar, gmx_ana_selparam_t * param);
+/*! \brief
+ * Allocates data for string keyword evaluation.
+ *
+ * \param[in] npar  Not used.
+ * \param     param Not used.
+ * \returns Pointer to the allocated data (t_methoddata_kwstr).
+ *
+ * Allocates memory for a t_methoddata_kwstr structure.
+ */
 static void *
-init_data_kwstr(int npar, gmx_ana_selparam_t *param);
-/** Initializes data for integer keyword evaluation. */
+init_data_kwstr(int npar, gmx_ana_selparam_t * param);
+/** /brief Initializes data for integer keyword evaluation.
+ *
+ * \param[in] top   Not used.
+ * \param[in] npar  Not used (should be 2).
+ * \param[in] param Method parameters (should point to \ref smparams_keyword_int).
+ * \param[in] data  Should point to \ref t_methoddata_kwint.
+ */
 static void
 init_kwint(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Initializes data for real keyword evaluation. */
+/*! \brief
+ * Initializes data for real keyword evaluation.
+ *
+ * \param[in] top   Not used.
+ * \param[in] npar  Not used (should be 2).
+ * \param[in] param Method parameters (should point to \ref smparams_keyword_real).
+ * \param[in] data  Should point to \ref t_methoddata_kwreal.
+ * \returns   0 (the initialization always succeeds).
+ */
 static void
 init_kwreal(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Initializes data for string keyword evaluation. */
+/*! \brief
+ * Initializes data for string keyword evaluation.
+ *
+ * \param[in] top   Not used.
+ * \param[in] npar  Not used (should be 2).
+ * \param[in] param Method parameters (should point to \ref smparams_keyword_str).
+ * \param[in] data  Should point to t_methoddata_kwstr.
+ */
 static void
 init_kwstr(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
 /** Frees the memory allocated for string keyword evaluation. */
@@ -85,15 +131,15 @@ static void
 free_data_kwstr(void *data);
 /** Evaluates integer selection keywords. */
 static void
-evaluate_keyword_int(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_keyword_int(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
                      gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
 /** Evaluates real selection keywords. */
 static void
-evaluate_keyword_real(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_keyword_real(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
                       gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
 /** Evaluates string selection keywords. */
 static void
-evaluate_keyword_str(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_keyword_str(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
                      gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
 
 /*! \internal \brief
@@ -243,7 +289,7 @@ static gmx_ana_selparam_t smparams_keyword_str[] = {
     {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_VARNUM},
 };
 
-/** \internal Selection method data for integer keyword evaluation. */
+/** Selection method data for integer keyword evaluation. */
 gmx_ana_selmethod_t sm_keyword_int = {
     "kw_int", GROUP_VALUE, SMETH_SINGLEVAL,
     asize(smparams_keyword_int), smparams_keyword_int,
@@ -258,7 +304,7 @@ gmx_ana_selmethod_t sm_keyword_int = {
     {NULL, 0, NULL},
 };
 
-/** \internal Selection method data for real keyword evaluation. */
+/** Selection method data for real keyword evaluation. */
 gmx_ana_selmethod_t sm_keyword_real = {
     "kw_real", GROUP_VALUE, SMETH_SINGLEVAL,
     asize(smparams_keyword_real), smparams_keyword_real,
@@ -273,7 +319,7 @@ gmx_ana_selmethod_t sm_keyword_real = {
     {NULL, 0, NULL},
 };
 
-/** \internal Selection method data for string keyword evaluation. */
+/** Selection method data for string keyword evaluation. */
 gmx_ana_selmethod_t sm_keyword_str = {
     "kw_str", GROUP_VALUE, SMETH_SINGLEVAL,
     asize(smparams_keyword_str), smparams_keyword_str,
@@ -288,10 +334,27 @@ gmx_ana_selmethod_t sm_keyword_str = {
     {NULL, 0, NULL},
 };
 
-/** Initializes keyword evaluation for an arbitrary group. */
+/*! \brief
+ * Initializes keyword evaluation for an arbitrary group.
+ *
+ * \param[in] top   Not used.
+ * \param[in] npar  Not used.
+ * \param[in] param Not used.
+ * \param[in] data  Should point to \ref t_methoddata_kweval.
+ * \returns   0 on success, a non-zero error code on return.
+ *
+ * Calls the initialization method of the wrapped keyword.
+ */
 static void
-init_kweval(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Initializes output for keyword evaluation in an arbitrary group. */
+init_kweval(t_topology *top, int npar, gmx_ana_selparam_t * param, void *data);
+/*! \brief
+ * Initializes output for keyword evaluation in an arbitrary group.
+ *
+ * \param[in]     top   Not used.
+ * \param[in,out] out   Pointer to output data structure.
+ * \param[in,out] data  Should point to \c t_methoddata_kweval.
+ * \returns       0 for success.
+ */
 static void
 init_output_kweval(t_topology *top, gmx_ana_selvalue_t *out, void *data);
 /** Frees the data allocated for keyword evaluation in an arbitrary group. */
@@ -302,8 +365,7 @@ static void
 init_frame_kweval(t_topology *top, t_trxframe *fr, t_pbc *pbc, void *data);
 /** Evaluates keywords in an arbitrary group. */
 static void
-evaluate_kweval(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
+evaluate_kweval(t_topology *top, t_trxframe *fr, t_pbc *pbc, gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void *data);
 
 /*! \internal \brief
  * Data structure for keyword evaluation in arbitrary groups.
@@ -328,15 +390,8 @@ static gmx_ana_selparam_t smparams_kweval[] = {
  * INTEGER KEYWORD EVALUATION
  ********************************************************************/
 
-/*!
- * \param[in] npar  Not used.
- * \param     param Not used.
- * \returns   Pointer to the allocated data (\ref t_methoddata_kwint).
- *
- * Allocates memory for a \ref t_methoddata_kwint structure.
- */
 static void *
-init_data_kwint(int npar, gmx_ana_selparam_t *param)
+init_data_kwint(int  /* npar */, gmx_ana_selparam_t * /* param */)
 {
     t_methoddata_kwint *data;
 
@@ -344,14 +399,8 @@ init_data_kwint(int npar, gmx_ana_selparam_t *param)
     return data;
 }
 
-/*!
- * \param[in] top   Not used.
- * \param[in] npar  Not used (should be 2).
- * \param[in] param Method parameters (should point to \ref smparams_keyword_int).
- * \param[in] data  Should point to \ref t_methoddata_kwint.
- */
 static void
-init_kwint(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_kwint(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
 {
     t_methoddata_kwint *d = (t_methoddata_kwint *)data;
 
@@ -369,7 +418,7 @@ init_kwint(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
  * Matching atoms are stored in \p out->u.g.
  */
 static void
-evaluate_keyword_int(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_keyword_int(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
                      gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_kwint *d = (t_methoddata_kwint *)data;
@@ -416,15 +465,8 @@ evaluate_keyword_int(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * REAL KEYWORD EVALUATION
  ********************************************************************/
 
-/*!
- * \param[in] npar  Not used.
- * \param     param Not used.
- * \returns   Pointer to the allocated data (\ref t_methoddata_kwreal).
- *
- * Allocates memory for a \ref t_methoddata_kwreal structure.
- */
 static void *
-init_data_kwreal(int npar, gmx_ana_selparam_t *param)
+init_data_kwreal(int /* npar */, gmx_ana_selparam_t * /* param */)
 {
     t_methoddata_kwreal *data;
 
@@ -432,15 +474,8 @@ init_data_kwreal(int npar, gmx_ana_selparam_t *param)
     return data;
 }
 
-/*!
- * \param[in] top   Not used.
- * \param[in] npar  Not used (should be 2).
- * \param[in] param Method parameters (should point to \ref smparams_keyword_real).
- * \param[in] data  Should point to \ref t_methoddata_kwreal.
- * \returns   0 (the initialization always succeeds).
- */
 static void
-init_kwreal(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_kwreal(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
 {
     t_methoddata_kwreal *d = (t_methoddata_kwreal *)data;
 
@@ -458,7 +493,7 @@ init_kwreal(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
  * Matching atoms are stored in \p out->u.g.
  */
 static void
-evaluate_keyword_real(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_keyword_real(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
                       gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_kwreal *d = (t_methoddata_kwreal *)data;
@@ -505,15 +540,8 @@ evaluate_keyword_real(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * STRING KEYWORD EVALUATION
  ********************************************************************/
 
-/*!
- * \param[in] npar  Not used.
- * \param     param Not used.
- * \returns Pointer to the allocated data (t_methoddata_kwstr).
- *
- * Allocates memory for a t_methoddata_kwstr structure.
- */
 static void *
-init_data_kwstr(int npar, gmx_ana_selparam_t *param)
+init_data_kwstr(int /* npar */, gmx_ana_selparam_t * /* param */)
 {
     t_methoddata_kwstr *data = new t_methoddata_kwstr();
     data->matchType = gmx::eStringMatchType_Auto;
@@ -540,14 +568,8 @@ _gmx_selelem_set_kwstr_match_type(const gmx::SelectionTreeElementPointer &sel,
     d->matchType = matchType;
 }
 
-/*!
- * \param[in] top   Not used.
- * \param[in] npar  Not used (should be 2).
- * \param[in] param Method parameters (should point to \ref smparams_keyword_str).
- * \param[in] data  Should point to t_methoddata_kwstr.
- */
 static void
-init_kwstr(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_kwstr(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
 {
     t_methoddata_kwstr *d = static_cast<t_methoddata_kwstr *>(data);
 
@@ -586,7 +608,7 @@ free_data_kwstr(void *data)
  * Matching atoms are stored in \p out->u.g.
  */
 static void
-evaluate_keyword_str(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_keyword_str(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
                      gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_kwstr *d = static_cast<t_methoddata_kwstr *>(data);
@@ -610,31 +632,16 @@ evaluate_keyword_str(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * KEYWORD EVALUATION FOR ARBITRARY GROUPS
  ********************************************************************/
 
-/*!
- * \param[in] top   Not used.
- * \param[in] npar  Not used.
- * \param[in] param Not used.
- * \param[in] data  Should point to \ref t_methoddata_kweval.
- * \returns   0 on success, a non-zero error code on return.
- *
- * Calls the initialization method of the wrapped keyword.
- */
 static void
-init_kweval(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_kweval(t_topology *top, int /* npar */, gmx_ana_selparam_t * /* param */, void *data)
 {
     t_methoddata_kweval *d = (t_methoddata_kweval *)data;
 
     d->kwmethod->init(top, 0, NULL, d->kwmdata);
 }
 
-/*!
- * \param[in]     top   Not used.
- * \param[in,out] out   Pointer to output data structure.
- * \param[in,out] data  Should point to \c t_methoddata_kweval.
- * \returns       0 for success.
- */
 static void
-init_output_kweval(t_topology *top, gmx_ana_selvalue_t *out, void *data)
+init_output_kweval(t_topology * /* top */, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_kweval *d = (t_methoddata_kweval *)data;
 
@@ -684,7 +691,7 @@ init_frame_kweval(t_topology *top, t_trxframe *fr, t_pbc *pbc, void *data)
  */
 static void
 evaluate_kweval(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+                gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void *data)
 {
     t_methoddata_kweval *d = (t_methoddata_kweval *)data;