Gromacs  2021.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
#include "gromacs/selection/indexutil.h"
#include "selvalue.h"
+ Include dependency graph for selparam.h:
+ This graph shows which files directly or indirectly include this file:

Description

API for handling parameters used in selections.

There should be no need to use the data structures or call the functions in this file directly unless implementing a custom selection method.

More details can be found on the page discussing custom selection methods.

Author
Teemu Murtola teemu.nosp@m..mur.nosp@m.tola@.nosp@m.gmai.nosp@m.l.com

Classes

struct  gmx_ana_selparam_t
 Describes a single parameter for a selection method. More...
 

Macros

Parameter flags

#define SPAR_SET   1
 This flag is set if the user has provided the parameter. More...
 
#define SPAR_OPTIONAL   2
 If not set, an error is reported if the parameter is not specified by the user.
 
#define SPAR_DYNAMIC   4
 If set, the parameter value can be dynamic, i.e., be different for different frames. More...
 
#define SPAR_RANGES   8
 If set, the parameter value is parsed into sorted ranges. More...
 
#define SPAR_VARNUM   16
 If set, the parameter can have any number of values. More...
 
#define SPAR_ATOMVAL   32
 If set, the parameter can have a separate value for each atom. More...
 
#define SPAR_ENUMVAL   128
 If set, the parameter takes one of a set of predefined strings. More...
 

Typedefs

typedef struct gmx_ana_selparam_t gmx_ana_selparam_t
 Describes a single parameter for a selection method. More...
 

Functions

gmx_ana_selparam_tgmx_ana_selparam_find (const char *name, int nparam, gmx_ana_selparam_t *param)
 Finds a parameter from an array by name. More...
 

Macro Definition Documentation

#define SPAR_ATOMVAL   32

If set, the parameter can have a separate value for each atom.

The flag is cleared before sel_initfunc() if the value provided is actually a single value.

Cannot be combined with POS_VALUE or GROUP_VALUE parameters.

#define SPAR_DYNAMIC   4

If set, the parameter value can be dynamic, i.e., be different for different frames.

If set, the parameter value should only be accessed in the update function of gmx_ana_selmethod_t. The flag is cleared before sel_initfunc() if the value provided is actually static.

#define SPAR_ENUMVAL   128

If set, the parameter takes one of a set of predefined strings.

Can only be specified for a STR_VALUE parameter that takes a single string. The data pointer in gmx_ana_selparam_t::val should be initialized into an array of strings such that the first and last elements are NULL, and the rest give the possible values. For optional values, the second element in the array should give the default value. The string given by the user is matched against the beginnings of the given strings, and if a unique match is found, the first pointer in the array will be initialized to point to the matching string. The data pointer can be initialized as a static array; duplication of the array for multiple instances of the same method is automatically taken care of.

#define SPAR_RANGES   8

If set, the parameter value is parsed into sorted ranges.

Can only be specified for integer parameters. If specified, the value of the parameter (gmx_ana_selparam_t::val) consists of sets of two integers, each specifying a range. The values give the endpoints of the ranges (inclusive). The ranges are sorted and overlapping/continuous ranges are merged into a single range to minimize the number of ranges.

If this flag is specified, gmx_ana_selparam_t::nval gives the number of ranges. gmx_ana_selparam_t::nval should be 1 or SPAR_VARNUM should be specified; other values would lead to unpredictable behavior.

#define SPAR_SET   1

This flag is set if the user has provided the parameter.

This flag is set automatically, and should not be set by the user.

#define SPAR_VARNUM   16

If set, the parameter can have any number of values.

If specified, the data pointer in gmx_ana_selparam_t::val should be NULL; the memory is allocated by the parameter parser. The implementation of the method should ensure that the pointer to the allocated memory is stored somewhere in sel_initfunc(); otherwise, the memory is lost.

The initial value of gmx_ana_selparam_t::nval is not used with this flag. Instead, it will give the number of actual values provided by the user after the parameters have been parsed. For consistency, it should be initialized to -1.

Cannot be combined with GROUP_VALUE parameters.

Typedef Documentation

Describes a single parameter for a selection method.

Function Documentation

gmx_ana_selparam_t* gmx_ana_selparam_find ( const char *  name,
int  nparam,
gmx_ana_selparam_t param 
)

Finds a parameter from an array by name.

Parameters
[in]nameName of the parameter to search.
[in]nparamNumber of parameters in the param array.
[in]paramParameter array to search.
Returns
Pointer to the parameter in the param or NULL if no parameter with name name was found.

The comparison is case-sensitive.