Update instructions in containers.rst
[gromacs.git] / src / gromacs / selection / keywords.h
blobc6060d0afae0d8506ba3d53d8cb15c63091e9280
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2009,2010,2012,2014,2015 by the GROMACS development team.
5 * Copyright (c) 2019,2020, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
36 /*! \internal \file
37 * \brief Definitions of generic keyword evaluation structures.
39 * This is an implementation header: there should be no need to use it outside
40 * this directory.
42 * \author Teemu Murtola <teemu.murtola@gmail.com>
43 * \ingroup module_selection
45 #ifndef GMX_SELECTION_KEYWORDS_H
46 #define GMX_SELECTION_KEYWORDS_H
48 #include "parsetree.h"
49 #include "selelem.h"
51 struct gmx_ana_selmethod_t;
53 /** Selection method data for comparison expression evaluation. */
54 extern struct gmx_ana_selmethod_t sm_compare;
56 /** Selection method data for integer keyword evaluation. */
57 extern struct gmx_ana_selmethod_t sm_keyword_int;
58 /** Selection method data for real keyword evaluation. */
59 extern struct gmx_ana_selmethod_t sm_keyword_real;
60 /** Selection method data for string keyword evaluation. */
61 extern struct gmx_ana_selmethod_t sm_keyword_str;
62 /** Selection method data for position keyword evaluation. */
63 extern struct gmx_ana_selmethod_t sm_keyword_pos;
65 /** Prints information about a comparison expression. */
66 void _gmx_selelem_print_compare_info(FILE* fp, void* data);
68 /*! \brief
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.
77 bool _gmx_selelem_is_default_kwpos(const gmx::SelectionTreeElement& sel);
78 /** Sets the position type for position keyword evaluation. */
79 void _gmx_selelem_set_kwpos_type(gmx::SelectionTreeElement* sel, const char* type);
80 /** Sets the flags for position keyword evaluation. */
81 void _gmx_selelem_set_kwpos_flags(gmx::SelectionTreeElement* sel, int flags);
83 /** Sets the string match type for string keyword evaluation. */
84 void _gmx_selelem_set_kwstr_match_type(const gmx::SelectionTreeElementPointer& sel,
85 gmx::SelectionStringMatchType matchType);
87 /** Does custom processing for parameters of the \c same selection method. */
88 void _gmx_selelem_custom_init_same(struct gmx_ana_selmethod_t** method,
89 const gmx::SelectionParserParameterListPointer& params,
90 void* scanner);
92 /*! \brief
93 * Initializes a selection element for evaluating a keyword in a given group.
95 * \param[in] method Keyword selection method to evaluate.
96 * \param[in] child The group/positions to evaluate \p method in.
97 * \param[in] scanner Scanner data structure.
98 * \returns Pointer to the created selection element.
100 * Creates a \ref SEL_EXPRESSION selection element that evaluates the keyword
101 * method given by \p method in the group/positions given by \p child.
103 * \p child should be a selection tree that evaluates to \ref GROUP_VALUE or
104 * \ref POS_VALUE.
106 gmx::SelectionTreeElementPointer _gmx_sel_init_keyword_evaluator(struct gmx_ana_selmethod_t* method,
107 const gmx::SelectionTreeElementPointer& child,
108 void* scanner);
110 #endif