2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2009,2010,2012,2014,2015, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 * \brief Definitions of generic keyword evaluation structures.
38 * This is an implementation header: there should be no need to use it outside
41 * \author Teemu Murtola <teemu.murtola@gmail.com>
42 * \ingroup module_selection
44 #ifndef GMX_SELECTION_KEYWORDS_H
45 #define GMX_SELECTION_KEYWORDS_H
47 #include "parsetree.h"
50 struct gmx_ana_selmethod_t
;
52 /** Selection method data for comparison expression evaluation. */
53 extern struct gmx_ana_selmethod_t sm_compare
;
55 /** Selection method data for integer keyword evaluation. */
56 extern struct gmx_ana_selmethod_t sm_keyword_int
;
57 /** Selection method data for real keyword evaluation. */
58 extern struct gmx_ana_selmethod_t sm_keyword_real
;
59 /** Selection method data for string keyword evaluation. */
60 extern struct gmx_ana_selmethod_t sm_keyword_str
;
61 /** Selection method data for position keyword evaluation. */
62 extern struct gmx_ana_selmethod_t sm_keyword_pos
;
64 /** Prints information about a comparison expression. */
66 _gmx_selelem_print_compare_info(FILE *fp
, void *data
);
69 * Returns whether the selection element is a default position keyword.
71 * \param[in] sel Selection element to query.
72 * \returns ``true`` if ``sel`` represents a position keyword evaluation that
73 * uses the default (implicit) position keyword.
75 * This method only works before the selection has been compiled.
78 _gmx_selelem_is_default_kwpos(const gmx::SelectionTreeElement
&sel
);
79 /** Sets the position type for position keyword evaluation. */
81 _gmx_selelem_set_kwpos_type(gmx::SelectionTreeElement
*sel
, const char *type
);
82 /** Sets the flags for position keyword evaluation. */
84 _gmx_selelem_set_kwpos_flags(gmx::SelectionTreeElement
*sel
, int flags
);
86 /** Sets the string match type for string keyword evaluation. */
88 _gmx_selelem_set_kwstr_match_type(const gmx::SelectionTreeElementPointer
&sel
,
89 gmx::SelectionStringMatchType matchType
);
91 /** Does custom processing for parameters of the \c same selection method. */
93 _gmx_selelem_custom_init_same(struct gmx_ana_selmethod_t
**method
,
94 const gmx::SelectionParserParameterListPointer
¶ms
,
98 * Initializes a selection element for evaluating a keyword in a given group.
100 * \param[in] method Keyword selection method to evaluate.
101 * \param[in] child The group/positions to evaluate \p method in.
102 * \param[in] scanner Scanner data structure.
103 * \returns Pointer to the created selection element.
105 * Creates a \ref SEL_EXPRESSION selection element that evaluates the keyword
106 * method given by \p method in the group/positions given by \p child.
108 * \p child should be a selection tree that evaluates to \ref GROUP_VALUE or
111 gmx::SelectionTreeElementPointer
112 _gmx_sel_init_keyword_evaluator(struct gmx_ana_selmethod_t
*method
,
113 const gmx::SelectionTreeElementPointer
&child
,