/*
* 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
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_selection
*/
-#include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/pbc.h"
-#include "gromacs/legacyheaders/vec.h"
+#include "gmxpre.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/math/vec.h"
#include "gromacs/selection/nbsearch.h"
#include "gromacs/selection/position.h"
-#include "gromacs/selection/selmethod.h"
#include "gromacs/utility/exceptions.h"
+#include "selmethod.h"
+
/*! \internal
* \brief
* Data structure for distance-based selection method.
gmx::AnalysisNeighborhoodSearch nbsearch;
};
-/** Allocates data for distance-based selection methods. */
+/*! \brief
+ * Allocates data for distance-based selection methods.
+ *
+ * \param[in] npar Not used (should be 2).
+ * \param[in,out] param Method parameters (should point to one of the distance
+ * parameter arrays).
+ * \returns Pointer to the allocated data (\c t_methoddata_distance).
+ *
+ * Allocates memory for a \c t_methoddata_distance structure and
+ * initializes the parameter as follows:
+ * - the first parameter defines the value for
+ * \c t_methoddata_distance::cutoff.
+ * - the second parameter defines the reference positions and the value is
+ * stored in \c t_methoddata_distance::p.
+ */
static void *
init_data_common(int npar, gmx_ana_selparam_t *param);
-/** Initializes a distance-based selection method. */
+/*! \brief
+ * Initializes a distance-based selection method.
+ *
+ * \param top Not used.
+ * \param npar Not used (should be 2).
+ * \param param Method parameters (should point to one of the distance
+ * parameter arrays).
+ * \param data Pointer to \c t_methoddata_distance to initialize.
+ * \returns 0 on success, a non-zero error code on failure.
+ *
+ * Initializes the neighborhood search data structure
+ * (\c t_methoddata_distance::nb).
+ * Also checks that the cutoff is valid.
+ */
static void
init_common(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
/** Frees the data allocated for a distance-based selection method. */
static void
free_data_common(void *data);
-/** Initializes the evaluation of a distance-based within selection method for a frame. */
+/*! \brief
+ * Initializes the evaluation of a distance-based within selection method for a
+ * frame.
+ *
+ * \param[in] top Not used.
+ * \param[in] fr Current frame.
+ * \param[in] pbc PBC structure.
+ * \param data Should point to a \c t_methoddata_distance.
+ * \returns 0 on success, a non-zero error code on error.
+ *
+ * Initializes the neighborhood search for the current frame.
+ */
static void
-init_frame_common(t_topology *top, t_trxframe *fr, t_pbc *pbc, void *data);
+init_frame_common(t_topology *top, t_trxframe * fr, t_pbc *pbc, void *data);
/** Evaluates the \p distance selection method. */
static void
-evaluate_distance(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_distance(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data);
/** Evaluates the \p within selection method. */
static void
-evaluate_within(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_within(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data);
/** Parameters for the \p distance selection method. */
"returned as equal to the cutoff.",
};
-/** \internal Selection method data for the \p distance method. */
+/** Selection method data for the \p distance method. */
gmx_ana_selmethod_t sm_distance = {
"distance", REAL_VALUE, SMETH_DYNAMIC,
asize(smparams_distance), smparams_distance,
{"distance from POS [cutoff REAL]", asize(help_distance), help_distance},
};
-/** \internal Selection method data for the \p distance method. */
+/** Selection method data for the \p distance method. */
gmx_ana_selmethod_t sm_mindistance = {
"mindistance", REAL_VALUE, SMETH_DYNAMIC,
asize(smparams_mindistance), smparams_mindistance,
{"mindistance from POS_EXPR [cutoff REAL]", asize(help_distance), help_distance},
};
-/** \internal Selection method data for the \p within method. */
+/** Selection method data for the \p within method. */
gmx_ana_selmethod_t sm_within = {
"within", GROUP_VALUE, SMETH_DYNAMIC,
asize(smparams_within), smparams_within,
{"within REAL of POS_EXPR", asize(help_distance), help_distance},
};
-/*!
- * \param[in] npar Not used (should be 2).
- * \param[in,out] param Method parameters (should point to one of the distance
- * parameter arrays).
- * \returns Pointer to the allocated data (\c t_methoddata_distance).
- *
- * Allocates memory for a \c t_methoddata_distance structure and
- * initializes the parameter as follows:
- * - the first parameter defines the value for
- * \c t_methoddata_distance::cutoff.
- * - the second parameter defines the reference positions and the value is
- * stored in \c t_methoddata_distance::p.
- */
static void *
-init_data_common(int npar, gmx_ana_selparam_t *param)
+init_data_common(int /* npar */, gmx_ana_selparam_t *param)
{
t_methoddata_distance *data = new t_methoddata_distance();
param[0].val.u.r = &data->cutoff;
return data;
}
-/*!
- * \param top Not used.
- * \param npar Not used (should be 2).
- * \param param Method parameters (should point to one of the distance
- * parameter arrays).
- * \param data Pointer to \c t_methoddata_distance to initialize.
- * \returns 0 on success, a non-zero error code on failure.
- *
- * Initializes the neighborhood search data structure
- * (\c t_methoddata_distance::nb).
- * Also checks that the cutoff is valid.
- */
static void
-init_common(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+init_common(t_topology * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
{
- t_methoddata_distance *d = (t_methoddata_distance *)data;
+ t_methoddata_distance *d = static_cast<t_methoddata_distance *>(data);
if ((param[0].flags & SPAR_SET) && d->cutoff <= 0)
{
delete static_cast<t_methoddata_distance *>(data);
}
-/*!
- * \param[in] top Not used.
- * \param[in] fr Current frame.
- * \param[in] pbc PBC structure.
- * \param data Should point to a \c t_methoddata_distance.
- * \returns 0 on success, a non-zero error code on error.
- *
- * Initializes the neighborhood search for the current frame.
- */
static void
-init_frame_common(t_topology *top, t_trxframe *fr, t_pbc *pbc, void *data)
+init_frame_common(t_topology * /* top */, t_trxframe * /* fr */, t_pbc *pbc, void *data)
{
- t_methoddata_distance *d = (t_methoddata_distance *)data;
+ t_methoddata_distance *d = static_cast<t_methoddata_distance *>(data);
d->nbsearch.reset();
gmx::AnalysisNeighborhoodPositions pos(d->p.x, d->p.count());
* and puts them in \p out->u.r.
*/
static void
-evaluate_distance(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_distance(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data)
{
- t_methoddata_distance *d = (t_methoddata_distance *)data;
+ t_methoddata_distance *d = static_cast<t_methoddata_distance *>(data);
out->nr = pos->m.mapb.nra;
for (int b = 0; b < pos->count(); ++b)
* \c t_methoddata_distance::xref and puts them in \p out.g.
*/
static void
-evaluate_within(t_topology *top, t_trxframe *fr, t_pbc *pbc,
+evaluate_within(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data)
{
- t_methoddata_distance *d = (t_methoddata_distance *)data;
+ t_methoddata_distance *d = static_cast<t_methoddata_distance *>(data);
out->u.g->isize = 0;
for (int b = 0; b < pos->count(); ++b)