Update copyright statements and change license to LGPL
[alexxy/gromacs.git] / src / gmxlib / selection / selcollection.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2009, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012, by the GROMACS development team, led by
8  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9  * others, as listed in the AUTHORS file in the top-level source
10  * directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38 /*! \internal \file
39  * \brief Definition of \c gmx_ana_selcollection_t.
40  *
41  * This is an implementation header: there should be no need to use it outside
42  * this directory.
43  */
44 #ifndef SELECTION_COLLECTION_H
45 #define SELECTION_COLLECTION_H
46
47 #include <typedefs.h>
48
49 #include <indexutil.h>
50
51 /*! \internal
52  * \brief
53  * Information for a collection of selections.
54  *
55  * The functions to deal with the structure are defined in selection.h.
56  * The structure is allocated with gmx_ana_selcollection_create() and
57  * freed with gmx_ana_selcollection_free().
58  * Some default values must then be set with
59  * gmx_ana_selcollection_set_refpostype() and
60  * gmx_ana_selcollection_set_outpostype().
61  *
62  * After setting the default values, one or more selections can be parsed
63  * with gmx_ana_selcollection_parse_*().
64  * At latest at this point, the topology must be set with
65  * gmx_ana_selcollection_set_topology() unless
66  * gmx_ana_selcollection_requires_top() returns FALSE.
67  * Once all selections are parsed, they must be compiled all at once using
68  * gmx_ana_selcollection_compile().
69  * After these calls, gmx_ana_selcollection_get_count() and 
70  * gmx_ana_selcollection_get_selections() can be used
71  * to get the compiled selections.
72  * gmx_ana_selcollection_evaluate() can be used to update the selections for a
73  * new frame.
74  * gmx_ana_selcollection_evaluate_fin() can be called after all the frames have
75  * been processed to restore the selection values back to the ones they were
76  * after gmx_ana_selcollection_compile(), i.e., dynamic selections have the
77  * maximal index group as their value.
78  *
79  * At any point, gmx_ana_selcollection_requires_top() can be called to see
80  * whether the information provided so far requires loading the topology.
81  * gmx_ana_selcollection_print_tree() can be used to print the internal
82  * representation of the selections (mostly useful for debugging).
83  */
84 struct gmx_ana_selcollection_t
85 {
86     /** Default reference position type for selections. */
87     const char                 *rpost;
88     /** Default output position type for selections. */
89     const char                 *spost;
90     /** TRUE if \ref POS_MASKONLY should be used for output position evaluation. */
91     gmx_bool                        bMaskOnly;
92     /** TRUE if velocities should be evaluated for output positions. */
93     gmx_bool                        bVelocities;
94     /** TRUE if forces should be evaluated for output positions. */
95     gmx_bool                        bForces;
96     /** TRUE if debugging output should be printed during compilation. */
97     gmx_bool                        bDebugCompile;
98
99     /** Root of the selection element tree. */
100     struct t_selelem           *root;
101     /** Number of selections in \p sel. */
102     int                         nr;
103     /** Array of compiled selections. */
104     struct gmx_ana_selection_t **sel;
105     /** Number of variables defined. */
106     int                            nvars;
107     /** Selection strings for variables. */
108     char                         **varstrs;
109
110     /** Topology for the collection. */
111     t_topology                    *top;
112     /** Index group that contains all the atoms. */
113     struct gmx_ana_index_t         gall;
114     /** Position calculation collection used for selection position evaluation. */
115     struct gmx_ana_poscalc_coll_t *pcc;
116     /** Memory pool used for selection evaluation. */
117     struct gmx_sel_mempool_t      *mempool;
118     /** Parser symbol table. */
119     struct gmx_sel_symtab_t     *symtab;
120 };
121
122 /** Clears the symbol table in the collection */
123 void
124 _gmx_selcollection_clear_symtab(struct gmx_ana_selcollection_t *sc);
125
126 #endif