Gromacs
2022.2
|
#include "gmxpre.h"
#include <cstdlib>
#include <cstring>
#include "gromacs/utility/arraysize.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/smalloc.h"
#include "keywords.h"
#include "parsetree.h"
#include "selelem.h"
#include "selmethod.h"
#include "selmethod_impl.h"
Implements the same
selection method.
Classes | |
struct | t_methoddata_same |
Data structure for the same selection method. More... | |
Functions | |
static void * | init_data_same (int npar, gmx_ana_selparam_t *param) |
Allocates data for the same selection method. More... | |
static void | init_same (const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data) |
Initializes the same selection method. More... | |
static void | free_data_same (void *data) |
Frees the data allocated for the same selection method. More... | |
static void | init_frame_same_int (const gmx::SelMethodEvalContext &context, void *data) |
Initializes the evaluation of the same selection method for a frame. More... | |
static void | evaluate_same_int (const gmx::SelMethodEvalContext &context, gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data) |
Evaluates the same selection method. More... | |
static void | init_frame_same_str (const gmx::SelMethodEvalContext &context, void *data) |
Initializes the evaluation of the same selection method for a frame. More... | |
static void | evaluate_same_str (const gmx::SelMethodEvalContext &context, gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data) |
Evaluates the same selection method. More... | |
void | _gmx_selelem_custom_init_same (gmx_ana_selmethod_t **method, const gmx::SelectionParserParameterListPointer ¶ms, void *scanner) |
Does custom processing for parameters of the same selection method. More... | |
static int | cmp_int (const void *a, const void *b) |
Helper function for comparison of two integers. | |
static int | cmp_str (const void *a, const void *b) |
Helper function for comparison of two strings. | |
Variables | |
static gmx_ana_selparam_t | smparams_same_int [] |
Parameters for the same selection method. More... | |
static gmx_ana_selparam_t | smparams_same_str [] |
Parameters for the same selection method. More... | |
static const char *const | help_same [] |
Help text for the same selection method. More... | |
gmx_ana_selmethod_t | sm_same |
Selection method data for the same method. More... | |
static gmx_ana_selmethod_t | sm_same_str |
Selection method data for the same method. More... | |
void _gmx_selelem_custom_init_same | ( | gmx_ana_selmethod_t ** | method, |
const gmx::SelectionParserParameterListPointer & | params, | ||
void * | scanner | ||
) |
Does custom processing for parameters of the same
selection method.
[in,out] | method | The method to initialize. |
[in,out] | params | Pointer to the first parameter. |
[in] | scanner | Scanner data structure. |
If *method
is not a same
method, this function returns immediately.
|
static |
Evaluates the same
selection method.
See sel_updatefunc() for description of the parameters. data
should point to a t_methoddata_same
.
Calculates which values in data->val.i
can be found in data->as.i
(assumed sorted), and writes the corresponding atoms to output. If data->val
is sorted, uses a linear scan of both arrays, otherwise a binary search of data->as
is performed for each block of values in data->val
.
|
static |
Evaluates the same
selection method.
See sel_updatefunc() for description of the parameters. data
should point to a t_methoddata_same
.
Calculates which strings in data->val.s
can be found in data->as.s
(assumed sorted), and writes the corresponding atoms to output. A binary search of data->as
is performed for each block of values in data->val
.
|
static |
Frees the data allocated for the same
selection method.
data | Data to free (should point to a t_methoddata_same). |
|
static |
Allocates data for the same
selection method.
[in] | npar | Not used (should be 2). |
[in,out] | param | Method parameters (should point to a copy of smparams_same_int or smparams_same_str). |
|
static |
Initializes the evaluation of the same
selection method for a frame.
[in] | context | Not used. |
data | Should point to a t_methoddata_same. |
Sorts the data->as.i
array and removes identical values for faster and simpler lookup.
|
static |
Initializes the evaluation of the same
selection method for a frame.
[in] | context | Not used. |
data | Should point to a t_methoddata_same. |
Sorts the data->as.s
array and removes identical values for faster and simpler lookup.
|
static |
Initializes the same
selection method.
top | Not used. |
npar | Not used (should be 2). |
param | Initialized method parameters (should point to a copy of smparams_same_int or smparams_same_str). |
data | Pointer to t_methoddata_same to initialize. |
|
static |
Help text for the same
selection method.
gmx_ana_selmethod_t sm_same |
Selection method data for the same
method.
|
static |
Selection method data for the same
method.
This selection method is used for matching string keywords. The parser never sees this method; _gmx_selelem_custom_init_same() replaces sm_same with this method in cases where it is required.
|
static |
|
static |