*
* This class provides an interface for reporting non-fatal errors from a
* complex function. Such a function should take a pointer to an
- * AbstractReporter object, and use the provided methods to report any errors
+ * AbstractErrorReporter object, and use the provided methods to report any errors
* it encounters. If the function calls other functions that can also detect
* errors, it can pass the reporter object to these functions as well, possibly
* after adding context information using startContext()/finishContext() or the
ErrorHandlerFunc setFatalErrorHandler(ErrorHandlerFunc handler);
/*! \brief
- * Raises an error.
+ * Raises a fatal error.
+ *
+ * \param[in] retcode Error code to raise.
+ * \param[in] msg More detailed description of the error.
+ * \param[in] file Name of the source file where the error occurred.
+ * \param[in] line Line in \p file on which the error occurred.
*/
void fatalError(int retcode, const char *msg, const char *file, int line);
/*! \brief
::gmx::fatalErrorFormatted(::gmx::eeInvalidInput, GMX_ERRORLOC,
"Invalid command-line argument: %s", argname);
* \endcode
+ *
+ * \param[in] retcode Error code to raise.
+ * \param[in] file Name of the source file where the error occurred.
+ * \param[in] line Line in \p file on which the error occurred.
+ * \param[in] fmt printf format string.
*/
void fatalErrorFormatted(int retcode, const char *file, int line,
const char *fmt, ...);
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ */
+/*! \internal \file
+ * \brief
+ * Dummy header for Doxygen documentation.
+ *
+ * This file just holds the main page for doxygen. When, at some point in the
+ * future, there is an obvious location for this documentation, we should
+ * move it there.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ */
+/*! \mainpage Gromacs
+ * GROMACS is a versatile package to perform molecular dynamics, i.e. simulate
+ * the Newtonian equations of motion for systems with hundreds, to millions
+ * of particles.
+ */
+/*! \defgroup group_publicapi Public API
+ * \brief
+ * Classes and other symbols that are publicly accessible from user code.
+ */
+/*! \defgroup group_libraryapi Library API
+ * \brief
+ * Classes and other symbols that are publicly accessible within the Gromacs
+ * library.
+ *
+ * \see group_publicapi
+ */
+/*! \defgroup group_utilitymodules Utility Modules
+ * \brief
+ * Modules with generic utility functions.
+ */
+/*! \defgroup group_analysismodules Analysis Modules
+ * \brief
+ * Modules used in analysis tools.
+ */
+/*! \namespace gmx
+ * \brief
+ * Generic Gromacs namespace.
+ *
+ * \inpublicapi
+ */
* <H3>Basic Use</H3>
*
* Basic interface for providing options is implemented by the Options class
- * (in options.hpp) and classes defined in basicoptions.hpp for specifying
- * individual options. Only these are needed if a class wants to provide a
- * set of standard options.
+ * and classes defined in basicoptions.h for specifying individual options.
+ * Only these are needed if a class wants to provide a set of standard options.
*
* Values for options can be set using option parsers.
- * Currently, only one is defined: CommandLineParser in cmdlineparser.hpp.
+ * Currently, only one is defined: CommandLineParser.
* As the name suggests, this parser gets values from command-line arguments.
* Multiple parsers can be used in sequence to provide option values from
* multiple sources; in such cases, if an option is provided in multiple
* is possible to add descriptions for individual options as well as for the
* whole set of options. These can then be used to write out a help using one
* of the provided help writers.
- * Currently, only one is defined: AsciiHelpWriter in asciihelpwriter.hpp
+ * Currently, only one is defined: AsciiHelpWriter
* (implementation is not yet complete).
*
* <H3>Advanced Use</H3>
* option values.
*
* To implement new option types, it is necessary to subclass the templates
- * AbstractStorage (abstractstorage.hpp) and SettingsTempl
- * (abstractsettings.hpp) with the type of the values that the option should
- * provide as the template argument. After this is done, it is possible to add
- * options of this new type using Options::addOption().
+ * AbstractOptionStorage and OptionTemplate with the type of the values that
+ * the option should provide as the template argument. After this is done, it
+ * is possible to add options of this new type using Options::addOption().
*
* There is limited support for options that need to share information across
* instances, e.g., to store values in a shared external data structure or to
* provide a global option to set a common setting for all such options,
- * provided by the GlobalProperties class. This mechanism is not generic,
- * meaning that it is required to change the options module to add data to this
- * structure.
+ * provided by the OptionsGlobalProperties class. This mechanism is not
+ * generic, meaning that it is required to change the options module to add
+ * data to this structure.
*
- * To implement new parsers, one can use OptionsAssigner (assigner.hpp),
- * which provides an interface to set values in an Options object.
+ * To implement new parsers, one can use OptionsAssigner, which provides an
+ * interface to set values in an Options object.
*
- * It is possible to iterate over all options in an Options object using
- * classes in visitor.hpp. One should implement the OptionsVisitor interface,
- * and then use OptionsIterator to apply this visitor to the Options object.
+ * There is also an interface to iterate over all options in an Options object.
+ * One should implement the OptionsVisitor interface, and then use
+ * OptionsIterator to apply this visitor to the Options object.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
*/
* These classes also take care of creating and setting up the actual option
* objects.
*
- * This header is needed directly only when implementing new option types.
+ * This header is needed directly only when implementing new option types,
+ * but methods of OptionTemplate are visible even to the normal user through
+ * its subclasses..
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
- * \inpublicapi
+ * \inlibraryapi
* \ingroup module_options
*/
#ifndef GMX_OPTIONS_ABSTRACTOPTION_H
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \file
+/*! \libinternal \file
* \brief
* Defines gmx::AbstractOptionStorage template.
*
* \tparam T Assignable type that stores a single option value.
*
* Provides an implementation of the clear(), finish(), valueCount(), and
- * formatValues() methods of the StorageInterface interface, leaving
+ * formatValues() methods of the OptionStorageInterface interface, leaving
* typeString(), appendValue(), finishSet(), and formatValue() to be
* implemented in derived classes.
*
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \file
+/*! \libinternal \file
* \brief
* Declares gmx::OptionsGlobalProperties.
*
class Options;
class SelectionCollection;
-/*! \brief
+/*! \libinternal \brief
* ID numbers for global properties.
*/
enum OptionGlobalPropertyId
eogpSelectionCollection,
};
-/*! \brief
+/*! \libinternal \brief
* Describes global properties of an Options collection.
*
* These properties are used to implement features that require all options of
_usedProperties |= (1<<id);
}
+ //! Set the selection collection for selection option output.
void setSelectionCollection(SelectionCollection *sc)
{
_selectionCollection = sc;
//! Returns the scaling factor to get times in ps.
double timeScaleFactor() const;
+ //! Returns the selection collection.
SelectionCollection *selectionCollection() const
{
return _selectionCollection;
private:
OptionsGlobalProperties();
+ //! Returns true if request() has been called for the given property.
bool isPropertyUsed(OptionGlobalPropertyId id) const
{
return _usedProperties & (1<<id);
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \file
+/*! \libinternal \file
* \brief
* Declares gmx::OptionsAssigner.
*
class Options;
-/*! \brief
+/*! \libinternal \brief
* Decorator class for assigning values to Options.
*
* This class extends the interface of an Options object by providing methods
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \file
+/*! \libinternal \file
* \brief
* Declares gmx::OptionStorageInterface interface.
*
class AbstractErrorReporter;
-/*! \brief
+/*! \libinternal \brief
* Pure interface for converting, validating, and storing option values.
*
- * The AbstractStorage template provides basic functionality for this
+ * The AbstractOptionStorage template provides basic functionality for this
* interface, only leaving some of the functions to implement in derived
* classes.
* It also integrates well with option settings objects derived from
- * SettingsTempl.
+ * OptionTemplate.
*
* \inlibraryapi
* \ingroup module_options
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \file
+/*! \libinternal \file
* \brief
* Declares gmx::OptionsVisitor interface and supporting classes.
*
class Option;
class Options;
-/*! \brief
+/*! \libinternal \brief
* Wrapper class for accessing option information.
*
* This class isolates the details of the internal option implementation
void operator =(const OptionInfo &);
};
-/*! \brief
+/*! \libinternal \brief
* Pure interface for visiting options in a Options object.
*
* \see OptionsIterator
virtual void visitOption(const OptionInfo &option) = 0;
};
-/*! \brief
+/*! \libinternal \brief
* Decorator class for visiting options in a Options object.
*
* This class provides an interface for looping through subsections and
*/
/*! \internal \file
* \brief
- * Tests gmx::options::CommandLineParser.
+ * Tests gmx::CommandLineParser.
*
* These tests exercise a large fraction of the code, so they may
* catch errors in other parts than just in command-line parsing.
* \brief
* Tests construction of basic option types.
*
- * Most of the tests for the basic options are in assigner_test.cpp.
+ * Most of the tests for the basic options are in optionsassigner.cpp.
* This file only tests behavior that should fail in parameter construction,
* which would result in higher-level code asserting.
*
* Tests option assignment.
*
* In addition to testing gmx::OptionsAssigner, these are the main
- * tests for the classes from basicoptions.hpp and basicstorage.hpp (and their
- * base classes) that actually implement the behavior, as well as for the
- * internal implementation of the gmx::Options and
- * gmx::Option classes.
+ * tests for the classes from basicoptions.h and basicoptionstorage.h (and
+ * their base classes) that actually implement the behavior, as well as for the
+ * internal implementation of the gmx::Options and gmx::Option classes.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
* \ingroup module_options
#include "gromacs/fatalerror/fatalerror.h"
+/*! \brief
+ * Initializes unit testing with Google C++ Testing Framework.
+ */
int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);
* \brief
* Provides functionality for initializing and evaluating selections.
*
+ * \internal
+ * Implementation details of different parts of the module are discussed on
+ * separate pages:
+ * - \ref page_module_selection_custom
+ * - \ref page_module_selection_parser
+ * - \ref page_module_selection_compiler
+ * - \ref page_module_selection_insolidangle
+ */
+/*! \ingroup group_analysismodules
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
*/
/*! \file
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in centerofmass.h.
+ * \brief
+ * Implements functions in centerofmass.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
/*!
* \param[in] top Topology structure with masses
* (can be NULL if \p bMASS==TRUE).
- * \param[in] x Forces on all atoms.
+ * \param[in] f Forces on all atoms.
* \param[in] nrefat Number of atoms in the index.
* \param[in] index Indices of atoms.
* \param[in] bMass If TRUE, force on COM is calculated.
- * \param[out] xout Force on the COM/COG position for the indexed atoms.
+ * \param[out] fout Force on the COM/COG position for the indexed atoms.
* \returns 0 on success, EINVAL if \p top is NULL and \p bMass is FALSE.
*
* Calls either gmx_calc_cog() or gmx_calc_cog_f() depending on the value of
* \param[in] f Forces on all atoms.
* \param[in] block t_block structure that divides \p index into blocks.
* \param[in] index Indices of atoms.
- * \param[out] xout \p block->nr Forces on COG positions.
+ * \param[out] fout \p block->nr Forces on COG positions.
* \returns 0 on success, EINVAL if \p top is NULL.
*/
int
* \param[in] block t_block structure that divides \p index into blocks.
* \param[in] index Indices of atoms.
* \param[in] bMass If TRUE, force on COM is calculated.
- * \param[out] xout \p block->nr forces on the COM/COG positions.
+ * \param[out] fout \p block->nr forces on the COM/COG positions.
* \returns 0 on success, EINVAL if \p top is NULL and \p bMass is TRUE.
*
* Calls either gmx_calc_com_block() or gmx_calc_cog_block() depending on the
*
* Finally, there is a function gmx_calc_comg_blocka() that takes both the
* index group and the partitioning as a single \c t_blocka structure.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-#ifndef CENTEROFMASS_H
-#define CENTEROFMASS_H
+#ifndef GMX_SELECTION_CENTEROFMASS_H
+#define GMX_SELECTION_CENTEROFMASS_H
#include "typedefs.h"
* The memory usage could still be optimized.
* Use of memory pooling could still be extended, and a lot of redundant
* gmin/gmax data could be eliminated for complex arithmetic expressions.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
/*! \internal
- * \page selcompiler Selection compilation
+ * \page page_module_selection_compiler Selection compilation
*
* The compiler takes the selection element tree from the selection parser
- * (see \ref selparser) as input. The selection parser is quite independent of
- * selection evaluation details, and the compiler processes the tree to
- * conform to what the evaluation functions expect.
+ * (see \ref page_module_selection_parser) as input.
+ * The selection parser is quite independent of selection evaluation details,
+ * and the compiler processes the tree to conform to what the evaluation
+ * functions expect.
* For better control and optimization possibilities, the compilation is
* done on all selections simultaneously.
* Hence, all the selections should be parsed before the compiler can be
*
* \todo
* Some combinations of method parameter flags are not yet properly treated by
- * the compiler or the evaluation functions in evaluate.c. All the ones used by
+ * the compiler or the evaluation functions in evaluate.cpp. All the ones used by
* currently implemented methods should work, but new combinations might not.
*
*
********************************************************************/
/*!
- * \param[in,out] sc Selection collection to be compiled.
+ * \param[in,out] coll Selection collection to be compiled.
* \returns 0 on successful compilation, a non-zero error code on error.
*
* Before compilation, the selection collection should have been initialized
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in evaluate.h.
+ * \brief
+ * Implements functions in evaluate.h.
*
* \todo
* One of the major bottlenecks for selection performance is that all the
* something can be evaluated by residue/molecule instead by atom, and
* converting selections by residue/molecule into selections by atom
* when necessary.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
*
* This is an implementation header: there should be no need to use it outside
* this directory.
- * Users should only use gmx_ana_selcollection_evaluate() declared in
- * \ref selection.h to evaluate selections.
+ * Users should only use SelectionCollection::evaluate() to evaluate
+ * selections.
*
* The functions defined in this header file are all the possible values
* for the \c t_selelem::evaluate field (in addition to NULL).
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-#ifndef SELECTION_EVALUATE_H
-#define SELECTION_EVALUATE_H
+#ifndef GMX_SELECTION_EVALUATE_H
+#define GMX_SELECTION_EVALUATE_H
#include <typedefs.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in indexutil.h.
+ * \brief
+ * Implements functions in indexutil.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* check the validity of input groups.
* Also, the mapping functions are useful when dealing with dynamic index
* groups.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-#ifndef INDEXUTIL_H
-#define INDEXUTIL_H
+#ifndef GMX_SELECTION_INDEXUTIL_H
+#define GMX_SELECTION_INDEXUTIL_H
#include "typedefs.h"
*/
/*! \internal \file
* \brief Definitions of generic keyword evaluation structures.
- *
+ *
* This is an implementation header: there should be no need to use it outside
* this directory.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELECTION_KEYWORDS_H
#define SELECTION_KEYWORDS_H
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Memory pooling for selection evaluation.
+ * \brief
+ * Implements functions in mempool.h.
*
- * \todo
- * Document these functions.
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "mempool.h"
+//! Alignment in bytes for all returned blocks.
#define ALIGN_STEP 8
+/*! \internal \brief
+ * Describes a single block allocated from the memory pool.
+ */
typedef struct gmx_sel_mempool_block_t
{
+ //! Pointer to the start of the block (as returned to the user).
void *ptr;
+ //! Size of the block, including padding required to align next block.
size_t size;
} gmx_sel_mempool_block_t;
+/*! \internal \brief
+ * Describes a memory pool.
+ */
struct gmx_sel_mempool_t
{
+ //! Number of bytes currently allocated from the pool.
size_t currsize;
+ //! Number of bytes free in the pool, or 0 if \a buffer is NULL.
size_t freesize;
+ //! Memory area allocated for the pool, or NULL if not yet reserved.
char *buffer;
+ //! Pointer to the first free byte (aligned at ::ALIGN_STEP) in \a buffer.
char *freeptr;
+ //! Number of blocks allocated from the pool.
int nblocks;
+ //! Array describing the allocated blocks.
gmx_sel_mempool_block_t *blockstack;
+ //! Number of elements allocated for the \a blockstack array.
int blockstack_nalloc;
+ /*! \brief
+ * Maximum number of bytes that have been reserved from the pool
+ * simultaneously.
+ */
size_t maxsize;
};
/*! \internal \file
* \brief Declarations for memory pooling functions.
*
+ * \todo
+ * Document these functions.
+ *
* This is an implementation header: there should be no need to use it outside
* this directory.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef GMX_SELECTION_MEMPOOL_H
#define GMX_SELECTION_MEMPOOL_H
struct gmx_ana_index_t;
+/** Opaque struct for memory pooling. */
typedef struct gmx_sel_mempool_t gmx_sel_mempool_t;
/** Create an empty memory pool. */
* without a memory cost.
*/
/*! \internal \file
- * \brief Implementation of functions in nbsearch.h.
+ * \brief
+ * Implements functions in nbsearch.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
/*!
* \param[in] d Neighborhood search data structure.
- * \param[in] n Number of test positions in \p x.
* \param[in] x Test positions.
* \param[out] jp Index of the reference position in the first pair.
* \returns TRUE if there are positions within the cutoff.
* The functions within this file can be used independently of the other parts
* of the library.
* The library also uses the functions internally.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-#ifndef NBSEARCH_H
-#define NBSEARCH_H
+#ifndef GMX_SELECTION_NBSEARCH_H
+#define GMX_SELECTION_NBSEARCH_H
#include "typedefs.h"
*/
/*! \internal \file
* \brief
- * Implementation of functions in selparam.h.
+ * Implements functions in selparam.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
bOk = FALSE;
}
}
-
+
_gmx_selexpr_free_params(pparams);
return bOk;
}
/* Copy the first part of user declarations. */
-#line 34 "parser.y"
+#line 37 "parser.y"
-/*! \internal \file parser.c
+/*! \internal \file parser.cpp
* \brief Generated (from parser.y by Bison) parser for the selection language.
+ *
+ * \ingroup module_selection
*/
/*! \internal \file parser.h
* \brief Generated (from parser.y by Bison) parser include file.
+ *
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 62 "parser.y"
+#line 69 "parser.y"
{
int i;
real r;
struct t_selexpr_param *param;
}
/* Line 187 of yacc.c. */
-#line 212 "parser.c"
+#line 216 "parser.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
/* Line 216 of yacc.c. */
-#line 225 "parser.c"
+#line 229 "parser.cpp"
#ifdef short
# undef short
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 178, 178, 179, 188, 189, 209, 213, 214, 223,
- 233, 235, 237, 239, 241, 247, 248, 251, 252, 256,
- 257, 262, 263, 274, 275, 278, 279, 287, 293, 299,
- 311, 315, 323, 329, 337, 338, 342, 347, 352, 360,
- 372, 379, 389, 394, 402, 404, 406, 408, 410, 412,
- 414, 421, 428, 440, 445, 449, 457, 468, 472, 476,
- 485, 487, 492, 493, 498, 505, 506, 510, 511, 513,
- 517, 519, 521, 523, 525, 530, 535
+ 0, 185, 185, 186, 195, 196, 216, 220, 221, 230,
+ 240, 242, 244, 246, 248, 254, 255, 258, 259, 263,
+ 264, 269, 270, 281, 282, 285, 286, 294, 300, 306,
+ 318, 322, 330, 336, 344, 345, 349, 354, 359, 367,
+ 379, 386, 396, 401, 409, 411, 413, 415, 417, 419,
+ 421, 428, 435, 447, 452, 456, 464, 475, 479, 483,
+ 492, 494, 499, 500, 505, 512, 513, 517, 518, 520,
+ 524, 526, 528, 530, 532, 537, 542
};
#endif
switch (yytype)
{
case 5: /* "HELP_TOPIC" */
-#line 158 "parser.y"
+#line 165 "parser.y"
{ free((yyvaluep->str)); };
-#line 1274 "parser.c"
+#line 1278 "parser.cpp"
break;
case 8: /* "STR" */
-#line 158 "parser.y"
+#line 165 "parser.y"
{ free((yyvaluep->str)); };
-#line 1279 "parser.c"
+#line 1283 "parser.cpp"
break;
case 9: /* "IDENTIFIER" */
-#line 158 "parser.y"
+#line 165 "parser.y"
{ free((yyvaluep->str)); };
-#line 1284 "parser.c"
+#line 1288 "parser.cpp"
break;
case 25: /* "PARAM" */
-#line 159 "parser.y"
+#line 166 "parser.y"
{ if((yyvaluep->str)) free((yyvaluep->str)); };
-#line 1289 "parser.c"
+#line 1293 "parser.cpp"
break;
case 28: /* "CMP_OP" */
-#line 158 "parser.y"
+#line 165 "parser.y"
{ free((yyvaluep->str)); };
-#line 1294 "parser.c"
+#line 1298 "parser.cpp"
break;
case 46: /* "command" */
-#line 160 "parser.y"
+#line 167 "parser.y"
{ if((yyvaluep->sel)) _gmx_selelem_free((yyvaluep->sel)); };
-#line 1299 "parser.c"
+#line 1303 "parser.cpp"
break;
case 47: /* "cmd_plain" */
-#line 160 "parser.y"
+#line 167 "parser.y"
{ if((yyvaluep->sel)) _gmx_selelem_free((yyvaluep->sel)); };
-#line 1304 "parser.c"
+#line 1308 "parser.cpp"
break;
case 50: /* "selection" */
-#line 161 "parser.y"
+#line 168 "parser.y"
{ _gmx_selelem_free_chain((yyvaluep->sel)); };
-#line 1309 "parser.c"
+#line 1313 "parser.cpp"
break;
case 52: /* "string" */
-#line 158 "parser.y"
+#line 165 "parser.y"
{ free((yyvaluep->str)); };
-#line 1314 "parser.c"
+#line 1318 "parser.cpp"
break;
case 53: /* "sel_expr" */
-#line 162 "parser.y"
+#line 169 "parser.y"
{ _gmx_selelem_free((yyvaluep->sel)); };
-#line 1319 "parser.c"
+#line 1323 "parser.cpp"
break;
case 55: /* "num_expr" */
-#line 162 "parser.y"
+#line 169 "parser.y"
{ _gmx_selelem_free((yyvaluep->sel)); };
-#line 1324 "parser.c"
+#line 1328 "parser.cpp"
break;
case 56: /* "str_expr" */
-#line 162 "parser.y"
+#line 169 "parser.y"
{ _gmx_selelem_free((yyvaluep->sel)); };
-#line 1329 "parser.c"
+#line 1333 "parser.cpp"
break;
case 57: /* "pos_expr" */
-#line 162 "parser.y"
+#line 169 "parser.y"
{ _gmx_selelem_free((yyvaluep->sel)); };
-#line 1334 "parser.c"
+#line 1338 "parser.cpp"
break;
case 58: /* "method_params" */
-#line 163 "parser.y"
+#line 170 "parser.y"
{ _gmx_selexpr_free_params((yyvaluep->param)); };
-#line 1339 "parser.c"
+#line 1343 "parser.cpp"
break;
case 59: /* "method_param_list" */
-#line 163 "parser.y"
+#line 170 "parser.y"
{ _gmx_selexpr_free_params((yyvaluep->param)); };
-#line 1344 "parser.c"
+#line 1348 "parser.cpp"
break;
case 60: /* "method_param" */
-#line 163 "parser.y"
+#line 170 "parser.y"
{ _gmx_selexpr_free_params((yyvaluep->param)); };
-#line 1349 "parser.c"
+#line 1353 "parser.cpp"
break;
case 61: /* "value_list" */
-#line 164 "parser.y"
+#line 171 "parser.y"
{ _gmx_selexpr_free_values((yyvaluep->val)); };
-#line 1354 "parser.c"
+#line 1358 "parser.cpp"
break;
case 62: /* "value_list_nonempty" */
-#line 164 "parser.y"
+#line 171 "parser.y"
{ _gmx_selexpr_free_values((yyvaluep->val)); };
-#line 1359 "parser.c"
+#line 1363 "parser.cpp"
break;
case 63: /* "value_item" */
-#line 164 "parser.y"
+#line 171 "parser.y"
{ _gmx_selexpr_free_values((yyvaluep->val)); };
-#line 1364 "parser.c"
+#line 1368 "parser.cpp"
break;
default:
switch (yyn)
{
case 2:
-#line 178 "parser.y"
+#line 185 "parser.y"
{ (yyval.sel) = NULL ;}
break;
case 3:
-#line 180 "parser.y"
+#line 187 "parser.y"
{
(yyval.sel) = _gmx_sel_append_selection((yyvsp[(2) - (2)].sel), (yyvsp[(1) - (2)].sel), scanner);
if (_gmx_sel_parser_should_finish(scanner))
break;
case 4:
-#line 188 "parser.y"
+#line 195 "parser.y"
{ (yyval.sel) = (yyvsp[(1) - (2)].sel); ;}
break;
case 5:
-#line 190 "parser.y"
+#line 197 "parser.y"
{
(yyval.sel) = NULL;
_gmx_selparser_error("invalid selection '%s'",
break;
case 6:
-#line 209 "parser.y"
+#line 216 "parser.y"
{
(yyval.sel) = NULL;
_gmx_sel_handle_empty_cmd(scanner);
break;
case 7:
-#line 213 "parser.y"
+#line 220 "parser.y"
{ (yyval.sel) = NULL; ;}
break;
case 8:
-#line 215 "parser.y"
+#line 222 "parser.y"
{
t_selelem *s, *p;
s = _gmx_sel_init_group_by_id((yyvsp[(1) - (1)].i), scanner);
break;
case 9:
-#line 224 "parser.y"
+#line 231 "parser.y"
{
t_selelem *s, *p;
s = _gmx_sel_init_group_by_name((yyvsp[(1) - (1)].str), scanner);
break;
case 10:
-#line 234 "parser.y"
+#line 241 "parser.y"
{ (yyval.sel) = _gmx_sel_init_selection(NULL, (yyvsp[(1) - (1)].sel), scanner); ;}
break;
case 11:
-#line 236 "parser.y"
+#line 243 "parser.y"
{ (yyval.sel) = _gmx_sel_init_selection((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].sel), scanner); ;}
break;
case 12:
-#line 238 "parser.y"
+#line 245 "parser.y"
{ (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
break;
case 13:
-#line 240 "parser.y"
+#line 247 "parser.y"
{ (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
break;
case 14:
-#line 242 "parser.y"
+#line 249 "parser.y"
{ (yyval.sel) = _gmx_sel_assign_variable((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].sel), scanner); ;}
break;
case 15:
-#line 247 "parser.y"
+#line 254 "parser.y"
{ _gmx_sel_handle_help_cmd(NULL, scanner); ;}
break;
case 17:
-#line 251 "parser.y"
+#line 258 "parser.y"
{ _gmx_sel_handle_help_cmd((yyvsp[(2) - (2)].str), scanner); ;}
break;
case 18:
-#line 252 "parser.y"
+#line 259 "parser.y"
{ _gmx_sel_handle_help_cmd((yyvsp[(2) - (2)].str), scanner); ;}
break;
case 19:
-#line 256 "parser.y"
+#line 263 "parser.y"
{ (yyval.sel) = (yyvsp[(1) - (1)].sel); ;}
break;
case 20:
-#line 258 "parser.y"
+#line 265 "parser.y"
{
(yyval.sel) = _gmx_sel_init_position((yyvsp[(1) - (1)].sel), NULL, scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 21:
-#line 262 "parser.y"
+#line 269 "parser.y"
{ (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
break;
case 22:
-#line 264 "parser.y"
+#line 271 "parser.y"
{
(yyval.sel) = _gmx_sel_init_modifier((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].sel), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 23:
-#line 274 "parser.y"
+#line 281 "parser.y"
{ (yyval.r) = (yyvsp[(1) - (1)].i); ;}
break;
case 24:
-#line 275 "parser.y"
+#line 282 "parser.y"
{ (yyval.r) = (yyvsp[(1) - (1)].r); ;}
break;
case 25:
-#line 278 "parser.y"
+#line 285 "parser.y"
{ (yyval.str) = (yyvsp[(1) - (1)].str); ;}
break;
case 26:
-#line 279 "parser.y"
+#line 286 "parser.y"
{ (yyval.str) = (yyvsp[(1) - (1)].str); ;}
break;
case 27:
-#line 288 "parser.y"
+#line 295 "parser.y"
{
(yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
(yyval.sel)->u.boolt = BOOL_NOT;
break;
case 28:
-#line 294 "parser.y"
+#line 301 "parser.y"
{
(yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
(yyval.sel)->u.boolt = BOOL_AND;
break;
case 29:
-#line 300 "parser.y"
+#line 307 "parser.y"
{
(yyval.sel) = _gmx_selelem_create(SEL_BOOLEAN);
(yyval.sel)->u.boolt = BOOL_OR;
break;
case 30:
-#line 311 "parser.y"
+#line 318 "parser.y"
{ (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
break;
case 31:
-#line 316 "parser.y"
+#line 323 "parser.y"
{
(yyval.sel) = _gmx_sel_init_comparison((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), (yyvsp[(2) - (3)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 32:
-#line 324 "parser.y"
+#line 331 "parser.y"
{
(yyval.sel) = _gmx_sel_init_group_by_name((yyvsp[(2) - (2)].str), scanner);
free((yyvsp[(2) - (2)].str));
break;
case 33:
-#line 330 "parser.y"
+#line 337 "parser.y"
{
(yyval.sel) = _gmx_sel_init_group_by_id((yyvsp[(2) - (2)].i), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 34:
-#line 337 "parser.y"
+#line 344 "parser.y"
{ (yyval.str) = NULL; ;}
break;
case 35:
-#line 338 "parser.y"
+#line 345 "parser.y"
{ (yyval.str) = (yyvsp[(1) - (1)].str); ;}
break;
case 36:
-#line 343 "parser.y"
+#line 350 "parser.y"
{
(yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 37:
-#line 348 "parser.y"
+#line 355 "parser.y"
{
(yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (3)].meth), process_value_list((yyvsp[(3) - (3)].val), NULL), (yyvsp[(1) - (3)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 38:
-#line 353 "parser.y"
+#line 360 "parser.y"
{
(yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (3)].meth), process_value_list((yyvsp[(3) - (3)].val), NULL), (yyvsp[(1) - (3)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 39:
-#line 361 "parser.y"
+#line 368 "parser.y"
{
(yyval.sel) = _gmx_sel_init_method((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 40:
-#line 373 "parser.y"
+#line 380 "parser.y"
{
(yyval.sel) = _gmx_selelem_create(SEL_CONST);
_gmx_selelem_set_vtype((yyval.sel), INT_VALUE);
break;
case 41:
-#line 380 "parser.y"
+#line 387 "parser.y"
{
(yyval.sel) = _gmx_selelem_create(SEL_CONST);
_gmx_selelem_set_vtype((yyval.sel), REAL_VALUE);
break;
case 42:
-#line 390 "parser.y"
+#line 397 "parser.y"
{
(yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 43:
-#line 395 "parser.y"
+#line 402 "parser.y"
{
(yyval.sel) = _gmx_sel_init_method((yyvsp[(2) - (3)].meth), (yyvsp[(3) - (3)].param), (yyvsp[(1) - (3)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 44:
-#line 403 "parser.y"
+#line 410 "parser.y"
{ (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '+', scanner); ;}
break;
case 45:
-#line 405 "parser.y"
+#line 412 "parser.y"
{ (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '-', scanner); ;}
break;
case 46:
-#line 407 "parser.y"
+#line 414 "parser.y"
{ (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '*', scanner); ;}
break;
case 47:
-#line 409 "parser.y"
+#line 416 "parser.y"
{ (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '/', scanner); ;}
break;
case 48:
-#line 411 "parser.y"
+#line 418 "parser.y"
{ (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(2) - (2)].sel), NULL, '-', scanner); ;}
break;
case 49:
-#line 413 "parser.y"
+#line 420 "parser.y"
{ (yyval.sel) = _gmx_sel_init_arithmetic((yyvsp[(1) - (3)].sel), (yyvsp[(3) - (3)].sel), '^', scanner); ;}
break;
case 50:
-#line 414 "parser.y"
+#line 421 "parser.y"
{ (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
break;
case 51:
-#line 422 "parser.y"
+#line 429 "parser.y"
{
(yyval.sel) = _gmx_selelem_create(SEL_CONST);
_gmx_selelem_set_vtype((yyval.sel), STR_VALUE);
break;
case 52:
-#line 429 "parser.y"
+#line 436 "parser.y"
{
(yyval.sel) = _gmx_sel_init_keyword((yyvsp[(2) - (2)].meth), NULL, (yyvsp[(1) - (2)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 53:
-#line 441 "parser.y"
+#line 448 "parser.y"
{ (yyval.sel) = _gmx_sel_init_const_position((yyvsp[(2) - (7)].r), (yyvsp[(4) - (7)].r), (yyvsp[(6) - (7)].r)); ;}
break;
case 54:
-#line 445 "parser.y"
+#line 452 "parser.y"
{ (yyval.sel) = (yyvsp[(2) - (3)].sel); ;}
break;
case 55:
-#line 450 "parser.y"
+#line 457 "parser.y"
{
(yyval.sel) = _gmx_sel_init_method((yyvsp[(1) - (2)].meth), (yyvsp[(2) - (2)].param), NULL, scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 56:
-#line 458 "parser.y"
+#line 465 "parser.y"
{
(yyval.sel) = _gmx_sel_init_position((yyvsp[(3) - (3)].sel), (yyvsp[(1) - (3)].str), scanner);
if ((yyval.sel) == NULL) YYERROR;
break;
case 57:
-#line 469 "parser.y"
+#line 476 "parser.y"
{ (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
break;
case 58:
-#line 473 "parser.y"
+#line 480 "parser.y"
{ (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
break;
case 59:
-#line 477 "parser.y"
+#line 484 "parser.y"
{ (yyval.sel) = _gmx_sel_init_variable_ref((yyvsp[(1) - (1)].sel)); ;}
break;
case 60:
-#line 486 "parser.y"
+#line 493 "parser.y"
{ (yyval.param) = process_param_list((yyvsp[(1) - (1)].param)); ;}
break;
case 61:
-#line 488 "parser.y"
+#line 495 "parser.y"
{ (yyval.param) = process_param_list((yyvsp[(1) - (2)].param)); ;}
break;
case 62:
-#line 492 "parser.y"
+#line 499 "parser.y"
{ (yyval.param) = NULL; ;}
break;
case 63:
-#line 494 "parser.y"
+#line 501 "parser.y"
{ (yyvsp[(2) - (2)].param)->next = (yyvsp[(1) - (2)].param); (yyval.param) = (yyvsp[(2) - (2)].param); ;}
break;
case 64:
-#line 499 "parser.y"
+#line 506 "parser.y"
{
(yyval.param) = _gmx_selexpr_create_param((yyvsp[(1) - (2)].str));
(yyval.param)->value = process_value_list((yyvsp[(2) - (2)].val), &(yyval.param)->nval);
break;
case 65:
-#line 505 "parser.y"
+#line 512 "parser.y"
{ (yyval.val) = NULL; ;}
break;
case 66:
-#line 506 "parser.y"
+#line 513 "parser.y"
{ (yyval.val) = (yyvsp[(1) - (1)].val); ;}
break;
case 67:
-#line 510 "parser.y"
+#line 517 "parser.y"
{ (yyval.val) = (yyvsp[(1) - (1)].val); ;}
break;
case 68:
-#line 512 "parser.y"
+#line 519 "parser.y"
{ (yyvsp[(2) - (2)].val)->next = (yyvsp[(1) - (2)].val); (yyval.val) = (yyvsp[(2) - (2)].val); ;}
break;
case 69:
-#line 514 "parser.y"
+#line 521 "parser.y"
{ (yyvsp[(3) - (3)].val)->next = (yyvsp[(1) - (3)].val); (yyval.val) = (yyvsp[(3) - (3)].val); ;}
break;
case 70:
-#line 518 "parser.y"
+#line 525 "parser.y"
{ (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
break;
case 71:
-#line 520 "parser.y"
+#line 527 "parser.y"
{ (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
break;
case 72:
-#line 522 "parser.y"
+#line 529 "parser.y"
{ (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
break;
case 73:
-#line 524 "parser.y"
+#line 531 "parser.y"
{ (yyval.val) = _gmx_selexpr_create_value_expr((yyvsp[(1) - (1)].sel)); ;}
break;
case 74:
-#line 526 "parser.y"
+#line 533 "parser.y"
{
(yyval.val) = _gmx_selexpr_create_value(INT_VALUE);
(yyval.val)->u.i.i1 = (yyvsp[(1) - (3)].i); (yyval.val)->u.i.i2 = (yyvsp[(3) - (3)].i);
break;
case 75:
-#line 531 "parser.y"
+#line 538 "parser.y"
{
(yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
(yyval.val)->u.r.r1 = (yyvsp[(1) - (3)].i); (yyval.val)->u.r.r2 = (yyvsp[(3) - (3)].r);
break;
case 76:
-#line 536 "parser.y"
+#line 543 "parser.y"
{
(yyval.val) = _gmx_selexpr_create_value(REAL_VALUE);
(yyval.val)->u.r.r1 = (yyvsp[(1) - (3)].r); (yyval.val)->u.r.r2 = (yyvsp[(3) - (3)].r);
/* Line 1267 of yacc.c. */
-#line 2162 "parser.c"
+#line 2166 "parser.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
}
-#line 542 "parser.y"
+#line 549 "parser.y"
static t_selexpr_value *
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 62 "parser.y"
+#line 69 "parser.y"
{
int i;
real r;
*/
/*! \internal \file
* \brief Grammar description and parser for the selection language.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
%{
-/*! \internal \file parser.c
+/*! \internal \file parser.cpp
* \brief Generated (from parser.y by Bison) parser for the selection language.
+ *
+ * \ingroup module_selection
*/
/*! \internal \file parser.h
* \brief Generated (from parser.y by Bison) parser include file.
+ *
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions of in parsetree.h.
+ * \brief
+ * Implements functions in parsetree.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
/*! \internal
- * \page selparser Selection parsing
+ * \page page_module_selection_parser Selection parsing
*
* The selection parser is implemented in the following files:
* - scanner.l:
* Tokenizer implemented using Flex, splits the input into tokens
* (scanner.c and scanner_flex.h are generated from this file).
- * - scanner.h, scanner_internal.h, scanner_internal.c:
+ * - scanner.h, scanner_internal.h, scanner_internal.cpp:
* Helper functions for scanner.l and for interfacing between
* scanner.l and parser.y. Functions in scanner_internal.h are only
* used from scanner.l, while scanner.h is used from the parser.
- * - symrec.h, symrec.c:
+ * - symrec.h, symrec.cpp:
* Functions used by the tokenizer to handle the symbol table, i.e.,
* the recognized keywords. Some basic keywords are hardcoded into
* scanner.l, but all method and variable references go through the
* symbol table, as do position evaluation keywords.
* - parser.y:
* Semantic rules for parsing the grammar
- * (parser.c and parser.h are generated from this file by Bison).
- * - parsetree.h, parsetree.c:
+ * (parser.cpp and parser.h are generated from this file by Bison).
+ * - parsetree.h, parsetree.cpp:
* Functions called from actions in parser.y to construct the
* evaluation elements corresponding to different grammar elements.
- * parsetree.c also defines the external interface of the parser,
- * i.e., the \c gmx_ana_selcollection_parse_*() functions declared
- * in selection.h.
* - params.c:
* Defines a function that processes the parameters of selection
* methods and initializes the children of the method element.
+ * - selectioncollection.h, selectioncollection.cpp:
+ * These files define the high-level public interface to the parser
+ * through SelectionCollection::parseFromStdin(),
+ * SelectionCollection::parseFromFile() and
+ * SelectionCollection::parseFromString().
*
- * The basic control flow in the parser is as follows: when a
- * fmx_ana_selcollection_parse_*() gets called, it performs some
+ * The basic control flow in the parser is as follows: when a parser function
+ * in SelectionCollection gets called, it performs some
* initialization, and then calls the _gmx_sel_yyparse() function generated
* by Bison. This function then calls _gmx_sel_yylex() to repeatedly read
* tokens from the input (more complex tasks related to token recognition
- * and bookkeeping are done by functions in scanner_internal.c) and uses the
+ * and bookkeeping are done by functions in scanner_internal.cpp) and uses the
* grammar rules to decide what to do with them. Whenever a grammar rule
- * matches, a corresponding function in parsetree.c is called to construct
- * either a temporary representation for the object or a \c t_selelem object
+ * matches, a corresponding function in parsetree.cpp is called to construct
+ * either a temporary representation for the object or a ::t_selelem object
* (some simple rules are handled internally in parser.y).
- * When a complete selection has been parsed, the functions in parsetree.c
- * also take care of updating the \c gmx_ana_selcollection_t structure
+ * When a complete selection has been parsed, the functions in parsetree.cpp
+ * also take care of updating the ::gmx_ana_selcollection_t structure
* appropriately.
*
- * The rest of this page describes the resulting \c t_selelem object tree.
+ * The rest of this page describes the resulting ::t_selelem object tree.
* Before the selections can be evaluated, this tree needs to be passed to
* the selection compiler, which is described on a separate page:
- * \ref selcompiler
+ * \ref page_module_selection_compiler
*
*
* \section selparser_tree Element tree constructed by the parser
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Handling of intermediate selection parser data.
+ * \brief
+ * Handling of intermediate selection parser data.
*
* The data types declared in this header are used by the parser to store
* intermediate data when constructing method expressions.
* In particular, the parameters for the method are stored.
* The intermediate data is freed once a \c t_selelem object can be
* constructed.
- *
+ *
* This is an implementation header: there should be no need to use it outside
* this directory.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELECTION_PARSETREE_H
#define SELECTION_PARSETREE_H
e_selvalue_t type;
/** TRUE if the value is the result of an expression. */
gmx_bool bExpr;
+ /** The actual value. */
union {
/** The integer value/range (\p type INT_VALUE); */
struct {
* gmx_ana_poscalc_create_enum() is also provided for convenience.
*/
/*! \internal \file
- * \brief Implementation of functions in poscalc.h.
+ * \brief
+ * Implements functions in poscalc.h.
*
* \todo
* There is probably some room for optimization in the calculation of
* but better heuristics could probably be implemented.
* For best results, the setup should probably be postponed (at least
* partially) to gmx_ana_poscalc_init_eval().
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
/** Collection this calculation belongs to. */
gmx_ana_poscalc_coll_t *coll;
};
-
+
+//! Strings returned by gmx_ana_poscalc_create_type_enum().
static const char *const poscalc_enum_strings[] = {
"atom",
"res_com", "res_cog",
"dyn_mol_com", "dyn_mol_cog",
NULL,
};
+//! Number of elements in ::poscalc_enum_strings.
#define NENUM asize(poscalc_enum_strings)
/*! \brief
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \file
+/*! \internal \file
* \brief API for structured and optimized calculation of positions.
*
* The functions in this header are used internally by the analysis library
* need. Instead, one should write an analysis tool such that it gets all
* positions through selections.
*
- * \internal
- *
* The API is documented in more detail on a separate page:
* \ref poscalcengine.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef POSCALC_H
#define POSCALC_H
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in position.h.
+ * \brief
+ * Implements functions in position.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
*/
/*! \file
* \brief API for handling positions.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef POSITION_H
#define POSITION_H
cd $dirname
fi
-[[ $FORCE || parser.y -nt parser.cpp ]] && bison -d -t -o parser.cpp parser.y
+[[ $FORCE || parser.y -nt parser.cpp ]] && bison -t -o parser.cpp --defines=parser.h parser.y
[[ $FORCE || scanner.l -nt scanner.cpp ]] && flex -o scanner.cpp scanner.l
-#line 2 "scanner.c"
+#line 2 "scanner.cpp"
-#line 4 "scanner.c"
+#line 4 "scanner.cpp"
#define YY_INT_ALIGNED short int
/*! \cond \internal \file scanner.l
* \brief
* Tokenizer for the selection language.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
* \endcond
*/
-/*! \internal \file scanner.c
+/*! \internal \file scanner.cpp
* \brief
* Generated (from scanner.l by Flex) tokenizer for the selection language.
+ *
+ * \ingroup module_selection
*/
-#line 41 "scanner.l"
+#line 46 "scanner.l"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#line 575 "scanner.c"
+#line 580 "scanner.cpp"
#define INITIAL 0
#define matchof 1
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 80 "scanner.l"
+#line 85 "scanner.l"
}
-#line 838 "scanner.c"
+#line 843 "scanner.cpp"
if ( !yyg->yy_init )
{
case 1:
YY_RULE_SETUP
-#line 112 "scanner.l"
+#line 117 "scanner.l"
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 113 "scanner.l"
+#line 118 "scanner.l"
{ yylval->i = strtol(yytext, NULL, 10); ADD_TOKEN; return TOK_INT; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 114 "scanner.l"
+#line 119 "scanner.l"
{ yylval->r = strtod(yytext, NULL); ADD_TOKEN; return TOK_REAL; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 115 "scanner.l"
+#line 120 "scanner.l"
{ yylval->str = gmx_strndup(yytext+1, yyleng-2); ADD_TOKEN; return STR; }
YY_BREAK
case 5:
/* rule 5 can match eol */
YY_RULE_SETUP
-#line 117 "scanner.l"
+#line 122 "scanner.l"
{ _gmx_sel_lexer_add_token(" ", 1, state); }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 118 "scanner.l"
+#line 123 "scanner.l"
{
if (yytext[0] == ';' || state->bInteractive)
{
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 130 "scanner.l"
+#line 135 "scanner.l"
{ BEGIN(help); return HELP; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 132 "scanner.l"
+#line 137 "scanner.l"
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 133 "scanner.l"
+#line 138 "scanner.l"
{ yylval->str = gmx_strndup(yytext, yyleng); return HELP_TOPIC; }
YY_BREAK
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 134 "scanner.l"
+#line 139 "scanner.l"
{ return CMD_SEP; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 135 "scanner.l"
+#line 140 "scanner.l"
{ return INVALID; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 139 "scanner.l"
+#line 144 "scanner.l"
{ ADD_TOKEN; yylval->i = 1; return TOK_INT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 140 "scanner.l"
+#line 145 "scanner.l"
{ ADD_TOKEN; yylval->i = 0; return TOK_INT; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 142 "scanner.l"
+#line 147 "scanner.l"
{ ADD_TOKEN; return GROUP; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 143 "scanner.l"
+#line 148 "scanner.l"
{ ADD_TOKEN; return TO; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 144 "scanner.l"
+#line 149 "scanner.l"
{ ADD_TOKEN; BEGIN(0); return OF; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 145 "scanner.l"
+#line 150 "scanner.l"
{ ADD_TOKEN; return AND; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 146 "scanner.l"
+#line 151 "scanner.l"
{ ADD_TOKEN; return OR; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 147 "scanner.l"
+#line 152 "scanner.l"
{ ADD_TOKEN; return XOR; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 148 "scanner.l"
+#line 153 "scanner.l"
{ ADD_TOKEN; return NOT; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 149 "scanner.l"
+#line 154 "scanner.l"
{ yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return CMP_OP; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 151 "scanner.l"
+#line 156 "scanner.l"
{ return _gmx_sel_lexer_process_identifier(yylval, yytext, yyleng, state); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 153 "scanner.l"
+#line 158 "scanner.l"
{ _gmx_sel_lexer_add_token(" ", 1, state); }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 154 "scanner.l"
+#line 159 "scanner.l"
{ yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return STR; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 155 "scanner.l"
+#line 160 "scanner.l"
{ ADD_TOKEN; return yytext[0]; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 156 "scanner.l"
+#line 161 "scanner.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1064 "scanner.c"
+#line 1069 "scanner.cpp"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(matchof):
case YY_STATE_EOF(matchbool):
#define YYTABLES_NAME "yytables"
-#line 156 "scanner.l"
+#line 161 "scanner.l"
/*! \cond \internal \file scanner.l
* \brief
* Tokenizer for the selection language.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
* \endcond
*/
-/*! \internal \file scanner.c
+/*! \internal \file scanner.cpp
* \brief
* Generated (from scanner.l by Flex) tokenizer for the selection language.
+ *
+ * \ingroup module_selection
*/
%{
#ifdef HAVE_CONFIG_H
#undef YY_DECL
#endif
-#line 156 "scanner.l"
+#line 161 "scanner.l"
#line 349 "scanner_flex.h"
#undef _gmx_sel_yyIN_HEADER
*
* This file implements the functions in the headers scanner.h and
* scanner_internal.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-/*! \internal file scanner_flex.h
+/*! \internal \file scanner_flex.h
* \brief Generated (from scanner.l) header file by Flex.
*
* This file contains definitions of functions that are needed in
- * scanner_internal.c.
+ * scanner_internal.cpp.
+ *
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "scanner.h"
#include "scanner_internal.h"
+//! Step in which the allocated memory for pretty-printed input is incremeted.
#define STRSTORE_ALLOCSTEP 1000
/* These are defined as macros in the generated scanner_flex.h.
*/
/*! \internal \file
* \brief Internal header file used by the selection tokenizer.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELECTION_SCANNER_INTERNAL_H
#define SELECTION_SCANNER_INTERNAL_H
/* We cannot include scanner_flex.h from the scanner itself, because it
* seems to break everything. */
/* And we need to define YY_NO_UNISTD_H here as well, otherwise unistd.h
- * gets included in other files than scanner.c... */
+ * gets included in other files than scanner.cpp... */
#ifndef FLEX_SCANNER
#define YY_NO_UNISTD_H
#include "scanner_flex.h"
#endif
-/*! \brief
+/*! \internal \brief
* Internal data structure for the selection tokenizer state.
*/
typedef struct gmx_sel_lexer_t
{
+ //! Selection collection to put parsed selections in.
struct gmx_ana_selcollection_t *sc;
+ //! External index groups for resolving \c group keywords.
struct gmx_ana_indexgrps_t *grps;
+ //! Number of selections at which the parser should stop.
int nexpsel;
+ //! Whether the parser is interactive.
gmx_bool bInteractive;
+ //! Current input string (line) for an interactive scanner.
char *inputstr;
+ //! Number of bytes allocated for \a inputstr.
int nalloc_input;
+ //! Pretty-printed version of the string parsed since last clear.
char *pselstr;
+ //! Length of the string in \a pselstr.
int pslen;
+ //! Number of bytes allocated for \a pselstr.
int nalloc_psel;
+ //! Stack of methods in which parameters should be looked up.
struct gmx_ana_selmethod_t **mstack;
+ //! Index of the top of the stack in \a mstack.
int msp;
+ //! Number of elements allocated for \a mstack.
int mstack_alloc;
+ //! Number of END_OF_METHOD tokens to return before \a nextparam.
int neom;
+ //! Parameter symbol to return before resuming scanning.
struct gmx_ana_selparam_t *nextparam;
+ //! Whether \a nextparam was a boolean parameter with a 'no' prefix.
gmx_bool bBoolNo;
+ /*! \brief
+ * Method symbol to return before resuming scanning
+ *
+ * Only used when \p nextparam is NULL.
+ */
struct gmx_ana_selmethod_t *nextmethod;
+ //! Used to track whether the previous token was a position modifier.
int prev_pos_kw;
+ //! Whether the 'of' keyword is acceptable as the next token.
gmx_bool bMatchOf;
+ //! Whether boolean values (yes/no/on/off) are acceptable as the next token.
gmx_bool bMatchBool;
+ //! Whether the next token starts a new selection.
gmx_bool bCmdStart;
+ //! Whether an external buffer is set for the scanner.
gmx_bool bBuffer;
+ //! The current buffer for the scanner.
YY_BUFFER_STATE buffer;
} gmx_sel_lexer_t;
*/
/*! \internal \file
* \brief
- * Implementation of functions in selection.h.
+ * Implements gmx::Selection.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
initCoveredFraction(CFRAC_NONE);
}
+
Selection::~Selection()
{
sfree(_sel.name);
sfree(_sel.orgq);
}
+
void
Selection::printInfo() const
{
fprintf(stderr, "\n");
}
-/*!
- * \param[in] type Type of covered fraction required.
- * \returns True if the covered fraction can be calculated for the selection.
- */
+
bool
Selection::initCoveredFraction(e_coverfrac_t type)
{
* For more info, check our website at http://www.gromacs.org
*/
/*! \file
- * \brief API for handling selection (the \c gmx_ana_selection_t structure and related functions).
+ * \brief
+ * Declares gmx::Selection.
*
- * There should be no need to use the data structures or call the
- * functions in this file directly unless using the selection routines outside
- * the main trajectory analysis API.
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \inpublicapi
+ * \ingroup module_selection
*/
#ifndef GMX_SELECTION_SELECTION_H
#define GMX_SELECTION_SELECTION_H
struct t_selelem;
-/*! \brief
+/*! \internal \brief
* Describes a single selection.
+ *
+ * \ingroup module_selection
*/
typedef struct gmx_ana_selection_t
{
class SelectionCollection;
/*! \brief
- * Wrapper class for accessing selection information.
+ * Provides access to a single selection.
+ *
+ * \inpublicapi
+ * \ingroup module_selection
*/
class Selection
{
public:
+ /*! \brief
+ * Creates a new selection object.
+ *
+ * \param[in] elem Root of the evaluation tree for this selection.
+ * \param[in] selstr String that was parsed to produce this selection.
+ */
Selection(t_selelem *elem, const char *selstr);
+ //! Returns the name of the selection.
const char *name() const { return _sel.name; }
+ //! Returns the string that was parsed to produce this selection.
const char *selectionText() const { return _sel.selstr; }
- e_index_t type() const { return _sel.p.m.type; }
+ //! Returns true if the size of the selection (posCount()) is dynamic.
bool isDynamic() const { return _sel.bDynamic; }
+ //! Returns the type of positions in the selection.
+ e_index_t type() const { return _sel.p.m.type; }
+ //! Number of positions in the selection.
int posCount() const { return _sel.p.nr; }
- const gmx_ana_pos_t *positions() const { return &_sel.p; }
+ //! Returns the \p i'th position for the selection.
const rvec &x(int i) const { return _sel.p.x[i]; }
+ //! Returns the velocity for the \p i'th position.
const rvec &v(int i) const { return _sel.p.v[i]; }
+ //! Returns the force for the \p i'th position.
const rvec &f(int i) const { return _sel.p.f[i]; }
+ /*! \brief
+ * Returns the reference ID for the \p i'th position.
+ */
int refId(int i) const { return _sel.p.m.refid[i]; }
+ /*! \brief
+ * Returns the mapped ID for the \p i'th position.
+ */
int mapId(int i) const { return _sel.p.m.mapid[i]; }
+ //! Returns the mass for the \p i'th position.
real mass(int i) const { return _sel.m[i]; }
+ //! Returns the charge for the \p i'th position.
real charge(int i) const { return _sel.q[i]; }
+ //! Returns the number of atoms contributing to the \p i'th position.
int atomCount(int i) const
{ return _sel.p.m.mapb.index[i+1] - _sel.p.m.mapb.index[i]; }
+ //! Returns the atom indices contributing to the \p i'th position.
const int *atomIndices(int i) const
{ return _sel.g ? _sel.g->index + _sel.p.m.mapb.index[i] : NULL; }
- int *mapIds() const { return _sel.p.m.mapid; }
- gmx_ana_index_t *indexGroup() const { return _sel.g; }
+ //! Returns the covered fraction for the current frame.
real cfrac() const { return _sel.cfrac; }
+ //! Deprecated method for direct access to position data.
+ const gmx_ana_pos_t *positions() const { return &_sel.p; }
+ //! Deprecated method for direct access to atom index data.
+ gmx_ana_index_t *indexGroup() const { return _sel.g; }
+ //! Deprecated method for direct access to to mapped ID array.
+ int *mapIds() const { return _sel.p.m.mapid; }
+ /*! \brief
+ * Sets the ID for the \p i'th position for use with mapId().
+ */
void setOriginalId(int i, int id) { _sel.p.m.orgid[i] = id; }
+ /*! \brief
+ * Initializes information about covered fractions.
+ *
+ * \param[in] type Type of covered fraction required.
+ * \returns True if the covered fraction can be calculated for the
+ * selection.
+ */
bool initCoveredFraction(e_coverfrac_t type);
+ //! Prints out one-line description of the selection.
void printInfo() const;
+ /*! \brief
+ * Prints out extended information about the selection for debugging.
+ *
+ * \param[in] nmaxind Maximum number of values to print in lists
+ * (-1 = print all).
+ */
void printDebugInfo(int nmaxind) const;
gmx_ana_selection_t _sel;
class Selection;
}
-/*! \internal
- * \brief
+/*! \internal \brief
* Information for a collection of selections.
*
- * The functions to deal with the structure are defined in selection.h.
- * The structure is allocated with gmx_ana_selcollection_create() and
- * freed with gmx_ana_selcollection_free().
- * Some default values must then be set with
- * gmx_ana_selcollection_set_refpostype() and
- * gmx_ana_selcollection_set_outpostype().
- *
- * After setting the default values, one or more selections can be parsed
- * with gmx_ana_selcollection_parse_*().
- * At latest at this point, the topology must be set with
- * gmx_ana_selcollection_set_topology() unless
- * gmx_ana_selcollection_requires_top() returns FALSE.
- * Once all selections are parsed, they must be compiled all at once using
- * gmx_ana_selcollection_compile().
- * After these calls, gmx_ana_selcollection_get_count() and
- * gmx_ana_selcollection_get_selections() can be used
- * to get the compiled selections.
- * gmx_ana_selcollection_evaluate() can be used to update the selections for a
- * new frame.
- * gmx_ana_selcollection_evaluate_fin() can be called after all the frames have
- * been processed to restore the selection values back to the ones they were
- * after gmx_ana_selcollection_compile(), i.e., dynamic selections have the
- * maximal index group as their value.
- *
- * At any point, gmx_ana_selcollection_requires_top() can be called to see
- * whether the information provided so far requires loading the topology.
- * gmx_ana_selcollection_print_tree() can be used to print the internal
- * representation of the selections (mostly useful for debugging).
+ * \ingroup module_selection
*/
struct gmx_ana_selcollection_t
{
namespace gmx
{
+/*! \internal \brief
+ * Private implemention class for SelectionCollection.
+ *
+ * \ingroup module_selection
+ */
class SelectionCollection::Impl
{
public:
+ //! Shorthand for a list of selections stored internally.
typedef std::vector<Selection *> SelectionList;
+ //! Possibel flags for the selection collection.
enum Flag
{
efOwnPositionCollection = 1<<0
};
- Impl(gmx_ana_poscalc_coll_t *pcc);
+ //! Creates a new selection collection.
+ explicit Impl(gmx_ana_poscalc_coll_t *pcc);
~Impl();
+ //! Returns true if the given flag has been set.
bool hasFlag(Flag flag) const { return _flags & flag; }
+ //! Sets or clears the given flag.
void setFlag(Flag flat, bool bSet);
+ //! Clears the symbol table of the selection collection.
void clearSymbolTable();
+ //! Registers the default selection methods for the collection.
int registerDefaultMethods();
+ /*! \brief
+ * Helper function that runs the parser once the tokenizer has been
+ * initialized.
+ *
+ * \param[in,out] scanner Scanner data structure.
+ * \param[in] maxnr Maximum number of selections to parse
+ * (if -1, parse as many as provided by the user).
+ * \param[out] output Vector to which parsed selections are
+ * appended.
+ * \retval 0 on success.
+ * \retval ::eeInvalidInput on error.
+ *
+ * Does not clear \p output.
+ */
int runParser(void *scanner, int maxnr,
std::vector<Selection *> *output);
+ //! Internal data, used for interfacing with old C code.
gmx_ana_selcollection_t _sc;
+ //! Options object for setting global properties on the collection.
Options _options;
+ //! Default reference position type for selections.
std::string _rpost;
+ //! Default output position type for selections.
std::string _spost;
+ /*! \brief
+ * Debugging level for the collection.
+ *
+ * Possible values:
+ * - 0: no debugging
+ * - 1: print selection trees after parsing and compilation
+ * - 2: like 1, also print intermediate compilation trees
+ * - 3: like 1, also print the tree after evaluation
+ * - 4: combine 2 and 3
+ */
int _debugLevel;
+ //! Flags for various properties of the collection.
unsigned long _flags;
+ //! External index groups (can be NULL).
gmx_ana_indexgrps_t *_grps;
};
} // namespace gmx
-/* In compiler.c */
-/** Prepares the selections for evaluation and performs some optimizations. */
+/*! \addtogroup module_selection
+ * \{
+ */
+
+/* In compiler.cpp */
+/*! \internal \brief
+ * Prepares the selections for evaluation and performs some optimizations.
+ */
int
gmx_ana_selcollection_compile(gmx::SelectionCollection *coll);
-/* In evaluate.c */
-/** Evaluates the selection. */
+/* In evaluate.cpp */
+/*! \internal \brief
+ * Evaluates the selection.
+ */
int
gmx_ana_selcollection_evaluate(gmx_ana_selcollection_t *sc,
t_trxframe *fr, t_pbc *pbc);
-/** Evaluates the largest possible index groups from dynamic selections. */
+/*! \internal \brief
+ * Evaluates the largest possible index groups from dynamic selections.
+ */
int
gmx_ana_selcollection_evaluate_fin(gmx_ana_selcollection_t *sc, int nframes);
+/*!\}*/
+
#endif
* Implements gmx::SelectionCollection.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
_sc.symtab = NULL;
}
+
SelectionCollection::Impl::~Impl()
{
_gmx_selelem_free_chain(_sc.root);
clearSymbolTable();
}
+
void
SelectionCollection::Impl::setFlag(Flag flag, bool bSet)
{
}
}
+
void
SelectionCollection::Impl::clearSymbolTable()
{
}
}
-/*! \brief
- * Internal helper function used by gmx_ana_selcollection_parse_*() to do the actual work.
- *
- * \param[in] maxnr Maximum number of selections to parse
- * (if -1, parse as many as provided by the user).
- * \param[in,out] scanner Scanner data structure.
- * \returns 0 on success, -1 on error.
- */
+
int
SelectionCollection::Impl::runParser(yyscan_t scanner, int maxnr,
std::vector<Selection *> *output)
{
}
+
SelectionCollection::~SelectionCollection()
{
delete _impl;
}
+
int
SelectionCollection::init()
{
return 0;
}
-/*!
- * \param[out] scp Pointer to a newly allocated empty selection collection.
- * \param[in] pcc Position calculation data structure to use for selection
- * position evaluation.
- * \returns 0 on success.
- */
+
int
SelectionCollection::create(SelectionCollection **scp,
gmx_ana_poscalc_coll_t *pcc)
return 0;
}
+
Options *
SelectionCollection::initOptions()
{
return &_impl->_options;
}
-/*!
- * \param[in] type Default selection reference position type
- * (one of the strings acceptable for gmx_ana_poscalc_type_from_enum()).
- *
- * Should be called before calling gmx_ana_selcollection_requires_top() or
- * gmx_ana_selcollection_parse_*().
- */
+
void
SelectionCollection::setReferencePosType(const char *type)
{
_impl->_rpost = type;
}
-/*!
- * \param[in] type Default selection output position type
- * (one of the strings acceptable for gmx_ana_poslcalc_type_from_enum()).
- *
- * Should be called before calling gmx_ana_selcollection_requires_top() or
- * gmx_ana_selcollection_parse_*().
- */
+
void
SelectionCollection::setOutputPosType(const char *type)
{
_impl->_spost = type;
}
-/*!
- * \param[in] bMaskOnly If TRUE, the output positions are initialized
- * using \ref POS_MASKONLY.
- */
+
void
SelectionCollection::setMaskOnly(bool bMaskOnly)
{
_impl->_sc.bMaskOnly = bMaskOnly;
}
-/*!
- * \param[in] bVelOut If TRUE, selections will also evaluate
- * velocities.
- */
+
void
SelectionCollection::setVelocityOutput(bool bVelOut)
{
_impl->_sc.bVelocities = bVelOut;
}
-/*!
- * \param[in] bForceOut If TRUE, selections will also evaluate
- * forces.
- */
+
void
SelectionCollection::setForceOutput(bool bForceOut)
{
_impl->_sc.bForces = bForceOut;
}
-/*!
- * \param[in] bDebug If TRUE, later call to gmx_ana_selcollection_compile()
- * will print out intermediate selection trees.
- */
+
void
SelectionCollection::setDebugLevel(int debuglevel)
{
_impl->_debugLevel = debuglevel;
}
-/*!
- * \param[in] top Topology data.
- * \param[in] natoms Number of atoms. If <=0, the number of atoms in the
- * topology is used.
- * \retval 0 on success.
- * \retval eeInvalidValue if \p top is NULL and \p natoms <= 0.
- *
- * The topology is also set for the position calculation collection
- * associated with \p sc.
- *
- * \p natoms determines the largest atom index that can be selected by the
- * selection: even if the topology contains more atoms, they will not be
- * selected.
- */
+
int
SelectionCollection::setTopology(t_topology *top, int natoms)
{
return 0;
}
-/*!
- * \returns True if any selection in the collection requires topology information.
- *
- * Before gmx_ana_selcollection_parse_*(), the return value is based just on
- * the position types set.
- * After gmx_ana_selcollection_parse_*(), the return value also takes into account the
- * selection keywords used.
- */
+
bool
SelectionCollection::requiresTopology() const
{
- gmx_ana_selcollection_t *sc = &_impl->_sc;
t_selelem *sel;
e_poscalc_t type;
int flags;
int rc;
- if (sc->rpost)
+ if (!_impl->_rpost.empty())
{
flags = 0;
rc = gmx_ana_poscalc_type_from_enum(_impl->_rpost.c_str(), &type, &flags);
return TRUE;
}
}
- if (sc->spost)
+ if (!_impl->_spost.empty())
{
flags = 0;
rc = gmx_ana_poscalc_type_from_enum(_impl->_spost.c_str(), &type, &flags);
}
}
- sel = sc->root;
+ sel = _impl->_sc.root;
while (sel)
{
if (_gmx_selelem_requires_top(sel))
return FALSE;
}
-/*!
- * \param[in] nr Number of selections to parse
- * (if -1, parse as many as provided by the user).
- * \param[in] bInteractive Whether the parser should behave interactively.
- * \returns 0 on success, -1 on error.
- */
+
int
SelectionCollection::parseFromStdin(int nr, bool bInteractive,
std::vector<Selection *> *output)
return _impl->runParser(scanner, nr, output);
}
-/*!
- * \param[in] fnm Name of the file to parse selections from.
- * \returns 0 on success, -1 on error.
- */
+
int
-SelectionCollection::parseFromFile(const std::string &fnm,
+SelectionCollection::parseFromFile(const std::string &filename,
std::vector<Selection *> *output)
{
yyscan_t scanner;
{
return rc;
}
- fp = ffopen(fnm.c_str(), "r");
+ fp = ffopen(filename.c_str(), "r");
_gmx_sel_set_lex_input_file(scanner, fp);
rc = _impl->runParser(scanner, -1, output);
ffclose(fp);
return rc;
}
-/*!
- * \param[in] str String to parse selections from.
- * \returns 0 on success, -1 on error.
- */
+
int
SelectionCollection::parseFromString(const std::string &str,
std::vector<Selection *> *output)
return _impl->runParser(scanner, -1, output);
}
+
int
SelectionCollection::compile()
{
return rc;
}
+
int
SelectionCollection::evaluate(t_trxframe *fr, t_pbc *pbc)
{
return rc;
}
+
int
SelectionCollection::evaluateFinal(int nframes)
{
return gmx_ana_selcollection_evaluate_fin(&_impl->_sc, nframes);
}
-/*!
- * \param[in] fp File handle to receive the output.
- * \param[in] bValues If TRUE, the evaluated values of selection elements
- * are printed as well.
- */
+
void
SelectionCollection::printTree(FILE *fp, bool bValues) const
{
}
}
-/*!
- * \param[in] out Output file.
- * \param[in] oenv Output options structure.
- */
+
void
SelectionCollection::printXvgrInfo(FILE *out, output_env_t oenv) const
{
class Options;
class Selection;
+/*! \libinternal \brief
+ * Collection of selections.
+ *
+ * Some default values must then be set with
+ * gmx_ana_selcollection_set_refpostype() and
+ * gmx_ana_selcollection_set_outpostype().
+ *
+ * After setting the default values, one or more selections can be parsed
+ * with one or more calls to parseFromStdin(), parseFromFile(), and/or
+ * parseFromString(). After all selections are parsed, the topology must be
+ * set with setTopology() unless requiresTopology() returns false (the topology
+ * can also be set earlier). Once all selections are parsed, they must be
+ * compiled all at once using compile().
+ * After compilation, dynamic selections have the maximum number of atoms they
+ * can evaluate to, but positions have undefined values. evaluate() can be
+ * used to update the selections for a new frame.
+ * evaluateFinal() can be called after all the frames have been processed to
+ * restore the selection values back to the ones they were after compile().
+ *
+ * At any point, requiresTopology() can be called to see whether the
+ * information provided so far requires loading the topology.
+ * printTree() can be used to print the internal representation of the
+ * selections (mostly useful for debugging).
+ *
+ * \inlibraryapi
+ * \ingroup module_selection
+ */
class SelectionCollection
{
public:
+ /*! \brief
+ * Creates an empty selection collection.
+ *
+ * \param[in] pcc Position calculation collection to use for selection
+ * evaluation.
+ *
+ * If \p pcc is NULL, an internal collection is created and managed by
+ * the object.
+ */
explicit SelectionCollection(gmx_ana_poscalc_coll_t *pcc);
~SelectionCollection();
+ /*! \brief
+ * Initializes the object.
+ *
+ * \retval 0 on success.
+ *
+ * Should be called immediately after construction.
+ */
int init();
+ /*! \brief
+ * Initializes options for setting global properties on the collection.
+ *
+ * The return value should not be deleted by the caller.
+ */
Options *initOptions();
+ /*! \brief
+ * Convenience function that creates a new selection collection and
+ * calls init().
+ *
+ * \param[out] scp Pointer to a newly created selection collection.
+ * \param[in] pcc Position calculation data structure to use for
+ * selection evaluation.
+ * \returns 0 on success.
+ */
static int create(SelectionCollection **scp, gmx_ana_poscalc_coll_t *pcc);
+ /*! \brief
+ * Sets the default reference position handling for a selection
+ * collection.
+ *
+ * \param[in] type Default selection reference position type
+ * (one of the strings acceptable for gmx_ana_poscalc_type_from_enum()).
+ *
+ * Should be called before calling the parser functions, unless
+ * initOptions() has been called. In the latter case, can still be
+ * used to override the default value and/or the value provided through
+ * the Options object.
+ */
void setReferencePosType(const char *type);
+ /*! \brief
+ * Sets the default reference position handling for a selection
+ * collection.
+ *
+ * \param[in] type Default selection output position type
+ * (one of the strings acceptable for gmx_ana_poscalc_type_from_enum()).
+ *
+ * Should be called before calling the parser functions, unless
+ * initOptions() has been called. In the latter case, can still be
+ * used to override the default value and/or the value provided through
+ * the Options object.
+ */
void setOutputPosType(const char *type);
+ /*! \brief
+ * Requests dynamic selection evaluation using masks.
+ *
+ * \param[in] bMaskOnly If TRUE, the output positions are
+ * initialized using \ref POS_MASKONLY.
+ */
void setMaskOnly(bool bMaskOnly);
+ //! Request evaluation of velocities for selections.
void setVelocityOutput(bool bVelOut);
+ //! Request evaluation of forces for selections.
void setForceOutput(bool bForceOut);
+ /*! \brief
+ * Sets the debugging level for the selection collection.
+ */
void setDebugLevel(int debuglevel);
+ /*! \brief
+ * Returns true if the collection requires topology information for
+ * evaluation.
+ *
+ * \returns true if any selection in the collection requires topology
+ * information.
+ *
+ * Before the parser functions have been called, the return value is
+ * based just on the position types set.
+ * After parser functions have been called, the return value also takes
+ * into account the selection keywords used.
+ */
bool requiresTopology() const;
+ /*! \brief
+ * Sets the topology for the collection.
+ *
+ * \param[in] top Topology data.
+ * \param[in] natoms Number of atoms. If <=0, the number of
+ * atoms in the topology is used.
+ * \retval 0 on success.
+ * \retval ::eeInvalidValue if \p top is NULL and \p natoms <= 0.
+ *
+ * The topology is also set for the position calculation collection
+ * associated with the collection.
+ *
+ * \p natoms determines the largest atom index that can be selected by
+ * the selection: even if the topology contains more atoms, they will
+ * not be selected.
+ */
int setTopology(t_topology *top, int natoms);
+ /*! \brief
+ * Sets the external index groups to use for the selections.
+ */
void setIndexGroups(gmx_ana_indexgrps_t *grps);
+ /*! \brief
+ * Parses selection(s) from standard input.
+ *
+ * \param[in] count Number of selections to parse
+ * (if -1, parse as many as provided by the user).
+ * \param[in] bInteractive Whether the parser should behave
+ * interactively.
+ * \param[out] output Vector to which parsed selections are appended.
+ * \retval 0 on success.
+ * \retval ::eeInvalidInput on syntax error (an interactive parser
+ * only returns this if an incorrect number of selections is
+ * provided).
+ *
+ * Parsed selections are appended to \p output without clearing it
+ * first. If parsing fails, \p output is not modified.
+ *
+ * The objects returned in \p output remain valid for the lifetime of
+ * the selection collection, and should not be freed by the user.
+ * Some information about the selections only becomes available once
+ * compile() has been called.
+ */
int parseFromStdin(int count, bool bInteractive,
std::vector<Selection *> *output);
+ /*! \brief
+ * Parses selection(s) from a file.
+ *
+ * \param[in] filename Name of the file to parse selections from.
+ * \param[out] output Vector to which parsed selections are appended.
+ * \retval 0 on success.
+ * \retval ::eeInvalidInput on syntax error.
+ *
+ * Parsed selections are appended to \p output without clearing it
+ * first. If parsing fails, \p output is not modified.
+ *
+ * The objects returned in \p output remain valid for the lifetime of
+ * the selection collection, and should not be freed by the user.
+ * Some information about the selections only becomes available once
+ * compile() has been called.
+ */
int parseFromFile(const std::string &filename,
std::vector<Selection *> *output);
+ /*! \brief
+ * Parses selection(s) from a string.
+ *
+ * \param[in] str String to parse selections from.
+ * \param[out] output Vector to which parsed selections are appended.
+ * \retval 0 on success.
+ * \retval ::eeInvalidInput on syntax error.
+ *
+ * Parsed selections are appended to \p output without clearing it
+ * first. If parsing fails, \p output is not modified.
+ *
+ * The objects returned in \p output remain valid for the lifetime of
+ * the selection collection, and should not be freed by the user.
+ * Some information about the selections only becomes available once
+ * compile() has been called.
+ */
int parseFromString(const std::string &str,
std::vector<Selection *> *output);
+ /*! \brief
+ * Prepares the selections for evaluation and performs optimizations.
+ *
+ * \retval 0 on successful compilation, a non-zero error code on error.
+ *
+ * Before compilation, selections should have been added to the
+ * collection using the parseFrom*() functions.
+ * The compiled selection collection can be passed to evaluate() to
+ * evaluate the selection for a frame.
+ * If an error occurs, the collection is cleared.
+ *
+ * The covered fraction information is initialized to ::CFRAC_NONE for
+ * all selections.
+ */
int compile();
+ /*! \brief
+ * Evaluates selections in the collection.
+ *
+ * \param[in] fr Frame for which the evaluation should be carried out.
+ * \param[in] pbc PBC data, or NULL if no PBC should be used.
+ * \returns 0 on successful evaluation, a non-zero error code on error.
+ */
int evaluate(t_trxframe *fr, t_pbc *pbc);
+ /*! \brief
+ * Evaluates the largest possible index groups from dynamic selections.
+ *
+ * \param[in] nframes Total number of frames.
+ * \returns 0 on successful evaluation, a non-zero error code on error.
+ */
int evaluateFinal(int nframes);
+ /*! \brief
+ * Prints a human-readable version of the internal selection element
+ * tree.
+ *
+ * \param[in] fp File handle to receive the output.
+ * \param[in] bValues If true, the evaluated values of selection
+ * elements are printed as well.
+ */
void printTree(FILE *fp, bool bValues) const;
+ /*! \brief
+ * Prints the selection strings into an XVGR file as comments.
+ *
+ * \param[in] fp Output file.
+ * \param[in] oenv Output options structure.
+ */
void printXvgrInfo(FILE *fp, output_env_t oenv) const;
class Impl;
* For more info, check our website at http://www.gromacs.org
*/
/*! \file
- * \brief API for handling selection (the \c gmx_ana_selection_t structure and related functions).
+ * \brief
+ * Declares common types used in selections.
*
- * There should be no need to use the data structures or call the
- * functions in this file directly unless using the selection routines outside
- * the main trajectory analysis API.
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef GMX_SELECTION_SELECTIONENUMS_H
#define GMX_SELECTION_SELECTIONENUMS_H
-/** Defines the type of covered fraction. */
+/*! \brief
+ * Defines the type of covered fraction.
+ *
+ * \inpublicapi
+ */
typedef enum
{
CFRAC_NONE, /**< No covered fraction (everything covered). */
namespace gmx
{
+/*! \brief
+ * Flags for options.
+ *
+ * These flags are not part of the public interface, even though they are in an
+ * installed header. They are needed in the implementation of SelectionOption.
+ */
enum SelectionFlag
{
efOnlyStatic = 1<<0,
efCollectRemaining = 1<<4,
};
+//! Holds a collection of ::SelectionFlag values.
typedef unsigned long SelectionFlags;
}
*/
/*! \internal \file
* \brief
- * Implements ::gmx::SelectionOption.
+ * Implements gmx::SelectionOption.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
* \ingroup module_selection
*/
/*! \file
* \brief
+ * Declares gmx::SelectionOption.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
* \inpublicapi
//! Initializes an option with the given name.
explicit SelectionOption(const char *name) : MyBase(name), _flags(0) {}
+ /*! \brief
+ * Only accept selections that evaluate to atom positions.
+ */
MyClass &onlyAtoms() { _flags |= efOnlyAtoms; return me(); }
+ /*! \brief
+ * Only accept static selections for this option.
+ */
MyClass &onlyStatic() { _flags |= efOnlyStatic; return me(); }
+ /*! \brief
+ * Handle dynamic selections for this option with position masks.
+ */
MyClass &dynamicMask() { _flags |= efDynamicMask; return me(); }
+ /*! \brief
+ * Disallow using atom coordinates as the reference positions.
+ */
MyClass &dynamicOnlyWhole() { _flags |= efDynamicOnlyWhole; return me(); }
+ /*! \brief
+ * Mark this option as receiving selections that can't be assigned to
+ * other options.
+ */
MyClass &collectRemaining() { _flags |= efCollectRemaining; return me(); }
private:
*/
/*! \internal \file
* \brief
- * Implements ::gmx::SelectionOptionStorage.
+ * Implements gmx::SelectionOptionStorage.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
* \ingroup module_selection
*/
/*! \internal \file
* \brief
- * Declares storage class for selection options.
+ * Declares gmx::SelectionOptionStorage.
*
* \author Teemu Murtola <teemu.murtola@cbr.su.se>
* \ingroup module_selection
/*! \internal \brief
* Converts, validates, and stores selection values.
+ *
+ * \ingroup module_selection
*/
class SelectionOptionStorage : public AbstractOptionStorage<Selection *>
{
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in selelem.h.
+ * \brief
+ * Implements functions in selelem.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Definition of \c t_selelem and related things.
+ * \brief
+ * Declares ::t_selelem and related things.
*
* The selection element trees constructed by the parser and the compiler
* are described on the respective pages:
- * \ref selparser and \ref selcompiler.
+ * \ref page_module_selection_parser and \ref page_module_selection_compiler.
*
* This is an implementation header: there should be no need to use it outside
* this directory.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELECTION_ELEMENT_H
#define SELECTION_ELEMENT_H
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in selhelp.c.
+ * \brief
+ * Implements functions in selhelp.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "selhelp.h"
#include "symrec.h"
+/*! \internal \brief
+ * Describes a selection help section.
+ */
typedef struct {
+ //! Topic keyword that produces this help.
const char *topic;
+ //! Number of items in the \a text array.
int nl;
+ //! Help text as a list of strings that will be concatenated.
const char **text;
} t_selection_help_item;
/*! \brief
* Prints a brief list of keywords (selection methods) available.
*
- * \param[in] sc Selection collection for which the list should be printed.
+ * \param[in] symtab Symbol table to use to find available keywords.
* \param[in] type Only methods that return this type are printed.
* \param[in] bMod If FALSE, \ref SMETH_MODIFIER methods are excluded, otherwise
* only them are printed.
}
/*!
- * \param[in] sc Selection collection for which help should be printed.
+ * \param[in] symtab Symbol table to use to find available keywords.
* \param[in] topic Topic to print help on, or NULL for general help.
*
* \p sc is used to get information on which keywords are available in the
*
* This is an implementation header: there should be no need to use it outside
* this directory.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-#ifndef SELECTION_HELP_H
-#define SELECTION_HELP_H
+#ifndef GMX_SELECTION_HELP_H
+#define GMX_SELECTION_HELP_H
struct gmx_sel_symtab_t;
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in selmethod.h.
+ * \brief
+ * Implements functions in selmethod.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
/* From sm_permute.c */
extern gmx_ana_selmethod_t sm_permute;
-/*! \brief
+/*! \internal \brief
* Helper structure for defining selection methods.
*/
typedef struct {
}
/*!
- * \param[in,out] sc Selection collection to registered the method to.
+ * \param[in,out] symtab Symbol table to register the method to.
* \param[in] name Name under which the method should be registered.
* \param[in] method Method to register.
* \returns 0 on success, EINVAL if there was something wrong with the
}
/*!
- * \param[in,out] sc Selection collection to registered the methods to.
+ * \param[in,out] symtab Symbol table to register the methods to.
* \returns 0 on success, -1 if any of the default methods could not be
* registered.
*/
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \page selmethods Custom selection methods
+/*! \page page_module_selection_custom Custom selection methods
*
* Custom selection methods are defined by creating a new instance of
* \c gmx_ana_selmethod_t and filling it with the necessary data for handling
* or to control the default behavior of the selection engine
* (currently, such a framework is not implemented, but should be easy to
* implement if required).
- *
+ *
* In addition to restricting the type of the method, selection modifiers
* do not allow the flags \ref SMETH_SINGLEVAL and \ref SMETH_VARNUMVAL
* (they would not make sense).
*
* Parameters and callbacks should be implemented as with normal selection
* method, but beware that very little of the functionality has been tested.
- *
+ *
* \todo
* The modifier handling could be made more flexible and more generic;
* the current implementation does not allow many things which would be
* In analysis programs, this can be done by calling
* gmx_ana_selmethod_register().
* If adding the method to the library, you should add a pointer to the new
- * method structure into the \c smtable_def array (in \ref selmethod.c
- * "selmethod.c"), and it is registered automatically.
+ * method structure into the \c smtable_def array (in selmethod.cpp), and it is
+ * registered automatically.
* In both cases, gmx_ana_selmethod_register() does several checks on the
* structure and reports any errors or inconsistencies it finds.
*/
* method.
*
* Instructions for implementing custom selection methods can be found
- * on a separate page: \ref selmethods
+ * on a separate page: \ref page_module_selection_custom
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
-#ifndef SELMETHOD_H
-#define SELMETHOD_H
+#ifndef GMX_SELECTION_SELMETHOD_H
+#define GMX_SELECTION_SELMETHOD_H
#include "typedefs.h"
*
* See the function pointer type documentation for details of how the
* functions should be implemented.
- * More details on implementing new selection methods can be found on a
- * separate page: \ref selmethods.
+ * More details on implementing new selection methods can be found on a
+ * separate page: \ref page_module_selection_custom.
*/
typedef struct gmx_ana_selmethod_t
{
* method.
*
* More details can be found on the page discussing
- * \ref selmethods "custom selection methods".
+ * \ref page_module_selection_custom "custom selection methods".
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELPARAM_H
#define SELPARAM_H
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in selvalue.h.
+ * \brief
+ * Implements functions in selvalue.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \file
- * \brief Declaration of \c gmx_ana_selvalue_t.
+ * \brief
+ * Declares ::gmx_ana_selvalue_t.
*
* There should be no need to use the data structures in this file directly
* unless implementing a custom selection routine.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELVALUE_H
#define SELVALUE_H
*/
/*! \internal \file
* \brief
- * Implementation of internal selection method for comparison expressions.
+ * Implements internal selection method for comparison expressions.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of distance-based selection methods.
+ * \brief
+ * Implements distance-based selection methods.
*
* This file implements the \p distance, \p mindistance and \p within
* selection methods.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
*
* For more info, check our website at http://www.gromacs.org
*/
-/*! \page sm_insolidangle Selection method: insolidangle
+/*! \page page_module_selection_insolidangle Selection method: insolidangle
*
* This method selects a subset of particles that are located in a solid
* angle defined by a center and a set of points.
* for the averages as well as in cases where the bin size is small.
*/
/*! \internal \file
- * \brief Implementation of the \ref sm_insolidangle "insolidangle"
- * selection method.
+ * \brief
+ * Implements the \ref sm_insolidangle "insolidangle" selection method.
*
* \todo
* The implementation could be optimized quite a bit.
- *
- * \todo Move the covered fraction stuff somewhere else and make it more
- * generic (along the lines it is handled in selection.h and trajana.h).
+ *
+ * \todo
+ * Move the covered fraction stuff somewhere else and make it more generic
+ * (along the lines it is handled in selection.h and trajana.h in the old C
+ * API).
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementations of internal selection methods for numeric and
- * string keyword evaluation.
+ * \brief
+ * Implements internal selection methods for numeric and string keyword
+ * evaluation.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of the merging selection modifier.
+ * \brief
+ * Implements the \p merge and \p plus selection modifiers.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of the \p permute selection modifier.
+ * \brief
+ * Implements the \p permute selection modifier.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of position evaluation selection methods.
+ * \brief
+ * Implements position evaluation selection methods.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of the \p same selection method.
+ * \brief
+ * Implements the \p same selection method.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementations of simple keyword selection methods.
+ * \brief
+ * Implements simple keyword selection methods.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
* For more info, check our website at http://www.gromacs.org
*/
/*! \internal \file
- * \brief Implementation of functions in symrec.h.
+ * \brief
+ * Implements functions in symrec.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
*
* This is an implementation header: there should be no need to use it outside
* this directory.
+ *
+ * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \ingroup module_selection
*/
#ifndef SELECTION_SYMREC_H
#define SELECTION_SYMREC_H
#include "gromacs/fatalerror/fatalerror.h"
+/*! \brief
+ * Initializes unit testing with Google C++ Testing Framework.
+ */
int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);