/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012, 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
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_selection
*/
-#include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/smalloc.h"
-#include "gromacs/legacyheaders/string2.h"
+#include "gmxpre.h"
+#include "gromacs/legacyheaders/macros.h"
#include "gromacs/selection/indexutil.h"
-#include "gromacs/selection/poscalc.h"
#include "gromacs/selection/position.h"
-#include "gromacs/selection/selmethod.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/smalloc.h"
#include "keywords.h"
+#include "poscalc.h"
#include "selelem.h"
+#include "selmethod.h"
/*! \internal \brief
* Data structure for position keyword evaluation.
/** Sets the position calculation collection for position evaluation selection methods. */
static void
set_poscoll_pos(gmx::PositionCalculationCollection *pcc, void *data);
-/** Initializes position evaluation keywords. */
+/*! \brief
+ * Initializes position evaluation keywords.
+ *
+ * \param[in] top Not used.
+ * \param[in] npar Not used.
+ * \param[in] param Not used.
+ * \param[in,out] data Should point to \c t_methoddata_pos.
+ * \returns 0 on success, a non-zero error code on error.
+ *
+ * The \c t_methoddata_pos::type field should have been initialized
+ * externally using _gmx_selelem_set_kwpos_type().
+ */
static void
init_kwpos(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Initializes the \p cog selection method. */
+/*! \brief
+ * Initializes the \p cog selection method.
+ *
+ * \param[in] top Topology data structure.
+ * \param[in] npar Not used.
+ * \param[in] param Not used.
+ * \param[in,out] data Should point to \c t_methoddata_pos.
+ * \returns 0 on success, a non-zero error code on error.
+ */
static void
init_cog(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Initializes the \p cog selection method. */
+/*! \brief
+ * Initializes the \p cog selection method.
+ *
+ * \param[in] top Topology data structure.
+ * \param[in] npar Not used.
+ * \param[in] param Not used.
+ * \param[in,out] data Should point to \c t_methoddata_pos.
+ * \returns 0 on success, a non-zero error code on error.
+ */
static void
init_com(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Initializes output for position evaluation selection methods. */
+/*! \brief
+ * Initializes output for position evaluation selection methods.
+ *
+ * \param[in] top Topology data structure.
+ * \param[in,out] out Pointer to output data structure.
+ * \param[in,out] data Should point to \c t_methoddata_pos.
+ * \returns 0 for success.
+ */
static void
init_output_pos(t_topology *top, gmx_ana_selvalue_t *out, void *data);
/** Frees the data allocated for position evaluation selection methods. */
free_data_pos(void *data);
/** Evaluates position evaluation selection methods. */
static void
-evaluate_pos(t_topology *top, t_trxframe *fr, t_pbc *pbc,
- gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
+evaluate_pos(t_topology * /* top */, t_trxframe *fr, t_pbc *pbc, gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void *data);
/** Parameters for position keyword evaluation. */
static gmx_ana_selparam_t smparams_keyword_pos[] = {
{"pbc", {NO_VALUE, 0, {NULL}}, NULL, 0},
};
-/** \internal Selection method data for position keyword evaluation. */
+/** Selection method data for position keyword evaluation. */
gmx_ana_selmethod_t sm_keyword_pos = {
- "kw_pos", POS_VALUE, SMETH_DYNAMIC | SMETH_VARNUMVAL,
+ "kw_pos", POS_VALUE, SMETH_DYNAMIC | SMETH_VARNUMVAL | SMETH_ALLOW_UNSORTED,
asize(smparams_keyword_pos), smparams_keyword_pos,
&init_data_pos,
&set_poscoll_pos,
{NULL, 0, NULL},
};
-/** \internal Selection method data for the \p cog method. */
+/** Selection method data for the \p cog method. */
gmx_ana_selmethod_t sm_cog = {
"cog", POS_VALUE, SMETH_DYNAMIC | SMETH_SINGLEVAL,
asize(smparams_com), smparams_com,
{"cog of ATOM_EXPR [pbc]", 0, NULL},
};
-/** \internal Selection method data for the \p com method. */
+/** Selection method data for the \p com method. */
gmx_ana_selmethod_t sm_com = {
"com", POS_VALUE, SMETH_REQTOP | SMETH_DYNAMIC | SMETH_SINGLEVAL,
asize(smparams_com), smparams_com,
}
if (!d->type && type)
{
- d->type = strdup(type);
+ d->type = gmx_strdup(type);
/* FIXME: It would be better not to have the string here hardcoded. */
if (type[0] != 'a')
{
}
}
-/*!
- * \param[in] top Not used.
- * \param[in] npar Not used.
- * \param[in] param Not used.
- * \param[in,out] data Should point to \c t_methoddata_pos.
- * \returns 0 on success, a non-zero error code on error.
- *
- * The \c t_methoddata_pos::type field should have been initialized
- * externally using _gmx_selelem_set_kwpos_type().
- */
static void
-init_kwpos(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_kwpos(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
{
t_methoddata_pos *d = (t_methoddata_pos *)data;
gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
}
-/*!
- * \param[in] top Topology data structure.
- * \param[in] npar Not used.
- * \param[in] param Not used.
- * \param[in,out] data Should point to \c t_methoddata_pos.
- * \returns 0 on success, a non-zero error code on error.
- */
static void
-init_cog(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_cog(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
{
t_methoddata_pos *d = (t_methoddata_pos *)data;
gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
}
-/*!
- * \param[in] top Topology data structure.
- * \param[in] npar Not used.
- * \param[in] param Not used.
- * \param[in,out] data Should point to \c t_methoddata_pos.
- * \returns 0 on success, a non-zero error code on error.
- */
static void
-init_com(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_com(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
{
t_methoddata_pos *d = (t_methoddata_pos *)data;
gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
}
-/*!
- * \param[in] top Topology data structure.
- * \param[in,out] out Pointer to output data structure.
- * \param[in,out] data Should point to \c t_methoddata_pos.
- * \returns 0 for success.
- */
static void
-init_output_pos(t_topology *top, gmx_ana_selvalue_t *out, void *data)
+init_output_pos(t_topology * /* top */, gmx_ana_selvalue_t *out, void *data)
{
t_methoddata_pos *d = (t_methoddata_pos *)data;
gmx_ana_poscalc_init_pos(d->pc, out->u.p);
- gmx_ana_pos_set_evalgrp(out->u.p, &d->g);
}
/*!
* in \c t_methoddata_pos::g and stores the results in \p out->u.p.
*/
static void
-evaluate_pos(t_topology *top, t_trxframe *fr, t_pbc *pbc,
- gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_pos(t_topology * /* top */, t_trxframe *fr, t_pbc *pbc,
+ gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void *data)
{
t_methoddata_pos *d = (t_methoddata_pos *)data;