Code beautification with uncrustify
[alexxy/gromacs.git] / src / gromacs / selection / evaluate.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11  * Copyright (c) 2001-2009, The GROMACS development team,
12  * check out http://www.gromacs.org for more information.
13
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * If you want to redistribute modifications, please consider that
20  * scientific software is very special. Version control is crucial -
21  * bugs must be traceable. We will be happy to consider code for
22  * inclusion in the official distribution, but derived work must not
23  * be called official GROMACS. Details are found in the README & COPYING
24  * files - if they are missing, get the official version at www.gromacs.org.
25  *
26  * To help us fund GROMACS development, we humbly ask that you cite
27  * the papers on the package - you can find them in the top README file.
28  *
29  * For more info, check our website at http://www.gromacs.org
30  */
31 /*! \internal \file
32  * \brief Evaluation functions for sel_evalfunc().
33  *
34  * This is an implementation header: there should be no need to use it outside
35  * this directory.
36  * Users should only use SelectionCollection::evaluate() to evaluate
37  * selections.
38  *
39  * The functions defined in this header file are all the possible values
40  * for the gmx::SelectionTreeElement::evaluate field (in addition to NULL).
41  *
42  * \author Teemu Murtola <teemu.murtola@cbr.su.se>
43  * \ingroup module_selection
44  */
45 #ifndef GMX_SELECTION_EVALUATE_H
46 #define GMX_SELECTION_EVALUATE_H
47
48 #include "gromacs/legacyheaders/typedefs.h"
49
50 #include "gromacs/selection/indexutil.h"
51
52 #include "selelem.h"
53
54 struct gmx_sel_mempool_t;
55
56 /*! \internal \brief
57  * Data structure for passing information required during evaluation.
58  */
59 typedef struct gmx_sel_evaluate_t
60 {
61     /** Memory pool for intermediate values. */
62     struct gmx_sel_mempool_t *mp;
63     /** Index group that contains all the atoms. */
64     gmx_ana_index_t          *gall;
65     /** Topology information. */
66     t_topology               *top;
67     /** Current frame. */
68     t_trxframe               *fr;
69     /** PBC data. */
70     t_pbc                    *pbc;
71 } gmx_sel_evaluate_t;
72
73 /*! \name Utility functions
74  */
75 /*@{*/
76 /** Initializes an evaluation data structure. */
77 void
78 _gmx_sel_evaluate_init(gmx_sel_evaluate_t *data,
79                        struct gmx_sel_mempool_t *mp, gmx_ana_index_t *gall,
80                        t_topology *top, t_trxframe *fr, t_pbc *pbc);
81 /** Evaluates the children of a general selection element. */
82 void
83 _gmx_sel_evaluate_children(gmx_sel_evaluate_t                     *data,
84                            const gmx::SelectionTreeElementPointer &sel,
85                            gmx_ana_index_t                        *g);
86 /** Evaluates the children of a \ref SEL_EXPRESSION element. */
87 void
88 _gmx_sel_evaluate_method_params(gmx_sel_evaluate_t                     *data,
89                                 const gmx::SelectionTreeElementPointer &sel,
90                                 gmx_ana_index_t                        *g);
91 /*@}*/
92
93 /*! \name Misc. evaluation functions
94  */
95 /*@{*/
96 /** Evaluates a root selection element. */
97 void
98 _gmx_sel_evaluate_root(gmx_sel_evaluate_t                     *data,
99                        const gmx::SelectionTreeElementPointer &sel,
100                        gmx_ana_index_t                        *g);
101 /** Evaluates a static group selection element. */
102 void
103 _gmx_sel_evaluate_static(gmx_sel_evaluate_t                     *data,
104                          const gmx::SelectionTreeElementPointer &sel,
105                          gmx_ana_index_t                        *g);
106 /** Evaluates an arithmetic expression element. */
107 void
108 _gmx_sel_evaluate_arithmetic(gmx_sel_evaluate_t                     *data,
109                              const gmx::SelectionTreeElementPointer &sel,
110                              gmx_ana_index_t                        *g);
111 /*@}*/
112
113 /*! \name Subexpression evaluation functions
114  */
115 /*@{*/
116 /** Evaluates a subexpression when there is only one reference. */
117 void
118 _gmx_sel_evaluate_subexpr_simple(gmx_sel_evaluate_t                     *data,
119                                  const gmx::SelectionTreeElementPointer &sel,
120                                  gmx_ana_index_t                        *g);
121 /** Evaluates a subexpression when the evaluation group is static. */
122 void
123 _gmx_sel_evaluate_subexpr_staticeval(gmx_sel_evaluate_t                     *data,
124                                      const gmx::SelectionTreeElementPointer &sel,
125                                      gmx_ana_index_t                        *g);
126 /** Evaluates a subexpression. */
127 void
128 _gmx_sel_evaluate_subexpr(gmx_sel_evaluate_t                     *data,
129                           const gmx::SelectionTreeElementPointer &sel,
130                           gmx_ana_index_t                        *g);
131 /** Evaluates a subexpression reference when there are no other references. */
132 void
133 _gmx_sel_evaluate_subexprref_simple(gmx_sel_evaluate_t                     *data,
134                                     const gmx::SelectionTreeElementPointer &sel,
135                                     gmx_ana_index_t                        *g);
136 /** Evaluates a subexpression reference. */
137 void
138 _gmx_sel_evaluate_subexprref(gmx_sel_evaluate_t                     *data,
139                              const gmx::SelectionTreeElementPointer &sel,
140                              gmx_ana_index_t                        *g);
141 /*@}*/
142
143 /*! \name Method evaluation functions
144  */
145 /*@{*/
146
147 /** Evaluates a method expression. */
148 void
149 _gmx_sel_evaluate_method(gmx_sel_evaluate_t                     *data,
150                          const gmx::SelectionTreeElementPointer &sel,
151                          gmx_ana_index_t                        *g);
152 /** Evaluates a modifier expression. */
153 void
154 _gmx_sel_evaluate_modifier(gmx_sel_evaluate_t                     *data,
155                            const gmx::SelectionTreeElementPointer &sel,
156                            gmx_ana_index_t                        *g);
157 /*@}*/
158
159 /*! \name Boolean evaluation functions
160  */
161 /*@{*/
162 /** Evaluates a boolean NOT element. */
163 void
164 _gmx_sel_evaluate_not(gmx_sel_evaluate_t                     *data,
165                       const gmx::SelectionTreeElementPointer &sel,
166                       gmx_ana_index_t                        *g);
167 /** Evaluates a boolean AND element with short-circuiting. */
168 void
169 _gmx_sel_evaluate_and(gmx_sel_evaluate_t                     *data,
170                       const gmx::SelectionTreeElementPointer &sel,
171                       gmx_ana_index_t                        *g);
172 /** Evaluates a boolean OR element with short-circuiting. */
173 void
174 _gmx_sel_evaluate_or(gmx_sel_evaluate_t                     *data,
175                      const gmx::SelectionTreeElementPointer &sel,
176                      gmx_ana_index_t                        *g);
177 /*@}*/
178
179 #endif