//! Number of dimensions per data point.
int ndim;
- //! TRUE if no frames have been read.
+ //! true if no frames have been read.
bool bFirst;
//! Stores the time of the first frame.
real t0;
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==FALSE).
+ * (can be NULL if \p bMASS==false).
* \param[in] x Position vectors of all atoms.
* \param[in] nrefat Number of atoms in the index.
* \param[in] index Indices of atoms.
- * \param[in] bMass If TRUE, mass weighting is used.
+ * \param[in] bMass If true, mass weighting is used.
* \param[out] xout COM/COG position for the indexed atoms.
- * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is TRUE.
+ * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is true.
*
* Calls either gmx_calc_com() or gmx_calc_cog() depending on the value of
* \p bMass.
*/
int
gmx_calc_comg(t_topology *top, rvec x[], int nrefat, atom_id index[],
- gmx_bool bMass, rvec xout)
+ bool bMass, rvec xout)
{
if (bMass)
{
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==TRUE).
+ * (can be NULL if \p bMASS==true).
* \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[in] bMass If true, force on COM is calculated.
* \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.
+ * \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
* \p bMass.
*/
int
gmx_calc_comg_f(t_topology *top, rvec f[], int nrefat, atom_id index[],
- gmx_bool bMass, rvec fout)
+ bool bMass, rvec fout)
{
if (bMass)
{
int nrefat, atom_id index[], rvec xout)
{
const real tol = 1e-4;
- gmx_bool bChanged;
+ bool bChanged;
int m, j, ai, iter;
rvec dx, xtest;
iter = 0;
do
{
- bChanged = FALSE;
+ bChanged = false;
for (m = 0; m < nrefat; ++m)
{
ai = index[m];
/* Here we have used the wrong image for contributing to the COM */
xout[j] += (xtest[j] - x[ai][j]) / nrefat;
x[ai][j] = xtest[j];
- bChanged = TRUE;
+ bChanged = true;
}
}
}
int nrefat, atom_id index[], rvec xout)
{
const real tol = 1e-4;
- gmx_bool bChanged;
+ bool bChanged;
int m, j, ai, iter;
real mass, mtot;
rvec dx, xtest;
iter = 0;
do
{
- bChanged = FALSE;
+ bChanged = false;
for (m = 0; m < nrefat; ++m)
{
ai = index[m];
/* Here we have used the wrong image for contributing to the COM */
xout[j] += mass * (xtest[j] - x[ai][j]);
x[ai][j] = xtest[j];
- bChanged = TRUE;
+ bChanged = true;
}
}
}
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==FALSE).
+ * (can be NULL if \p bMASS==false).
* \param[in] x Position vectors of all atoms.
* \param[in] pbc Periodic boundary conditions structure.
* \param[in] nrefat Number of atoms in the index.
* \param[in] index Indices of atoms.
- * \param[in] bMass If TRUE, mass weighting is used.
+ * \param[in] bMass If true, mass weighting is used.
* \param[out] xout COM/COG position for the indexed atoms.
- * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is TRUE.
+ * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is true.
*
* Calls either gmx_calc_com() or gmx_calc_cog() depending on the value of
* \p bMass.
*/
int
gmx_calc_comg_pbc(t_topology *top, rvec x[], t_pbc *pbc,
- int nrefat, atom_id index[], gmx_bool bMass, rvec xout)
+ int nrefat, atom_id index[], bool bMass, rvec xout)
{
if (bMass)
{
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==FALSE).
+ * (can be NULL if \p bMASS==false).
* \param[in] x Position vectors of all atoms.
* \param[in] block t_block structure that divides \p index into blocks.
* \param[in] index Indices of atoms.
- * \param[in] bMass If TRUE, mass weighting is used.
+ * \param[in] bMass If true, mass weighting is used.
* \param[out] xout \p block->nr COM/COG positions.
- * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is TRUE.
+ * \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
* value of \p bMass.
*/
int
gmx_calc_comg_block(t_topology *top, rvec x[], t_block *block, atom_id index[],
- gmx_bool bMass, rvec xout[])
+ bool bMass, rvec xout[])
{
if (bMass)
{
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==FALSE).
+ * (can be NULL if \p bMASS==false).
* \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[in] bMass If TRUE, force on COM is calculated.
+ * \param[in] bMass If true, force on COM is calculated.
* \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.
+ * \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
* value of \p bMass.
*/
int
gmx_calc_comg_f_block(t_topology *top, rvec f[], t_block *block, atom_id index[],
- gmx_bool bMass, rvec fout[])
+ bool bMass, rvec fout[])
{
if (bMass)
{
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==FALSE).
+ * (can be NULL if \p bMASS==false).
* \param[in] x Position vectors of all atoms.
* \param[in] block Blocks for calculation.
- * \param[in] bMass If TRUE, mass weighting is used.
+ * \param[in] bMass If true, mass weighting is used.
* \param[out] xout \p block->nr COM/COG positions.
- * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is TRUE.
+ * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is true.
*
* Calls gmx_calc_comg_block(), converting the \p t_blocka structure into
* a \p t_block and an index. Other parameters are passed unmodified.
*/
int
gmx_calc_comg_blocka(t_topology *top, rvec x[], t_blocka *block,
- gmx_bool bMass, rvec xout[])
+ bool bMass, rvec xout[])
{
/* TODO: It would probably be better to do this without the type cast */
return gmx_calc_comg_block(top, x, (t_block *)block, block->a, bMass, xout);
/*!
* \param[in] top Topology structure with masses
- * (can be NULL if \p bMASS==TRUE).
+ * (can be NULL if \p bMASS==true).
* \param[in] f Forces on all atoms.
* \param[in] block Blocks for calculation.
- * \param[in] bMass If TRUE, force on COM is calculated.
+ * \param[in] bMass If true, force on COM is calculated.
* \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 FALSE.
+ * \returns 0 on success, EINVAL if \p top is NULL and \p bMass is false.
*
* Calls gmx_calc_comg_f_block(), converting the \p t_blocka structure into
* a \p t_block and an index. Other parameters are passed unmodified.
*/
int
gmx_calc_comg_f_blocka(t_topology *top, rvec f[], t_blocka *block,
- gmx_bool bMass, rvec fout[])
+ bool bMass, rvec fout[])
{
/* TODO: It would probably be better to do this without the type cast */
return gmx_calc_comg_f_block(top, f, (t_block *)block, block->a, bMass, fout);
* - gmx_calc_com(): Calculates the center of mass (COM) of a given group
* of atoms.
* - gmx_calc_comg(): Calculates either the COM or COG, based on a
- * gmx_boolean flag.
+ * boolean flag.
*
* A second set of routines is provided for calculating the centers for groups
* that wrap over periodic boundaries (gmx_calc_cog_pbc(), gmx_calc_com_pbc(),
#include "../legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/** Calculate a single center of geometry. */
int
gmx_calc_cog(t_topology *top, rvec x[], int nrefat, atom_id index[], rvec xout);
/** Calculate a single center of mass/geometry. */
int
gmx_calc_comg(t_topology *top, rvec x[], int nrefat, atom_id index[],
- gmx_bool bMass, rvec xout);
+ bool bMass, rvec xout);
/** Calculate force on a single center of mass/geometry. */
int
gmx_calc_comg_f(t_topology *top, rvec f[], int nrefat, atom_id index[],
- gmx_bool bMass, rvec fout);
+ bool bMass, rvec fout);
/** Calculate a single center of geometry iteratively, taking PBC into account. */
int
/** Calculate a single center of mass/geometry iteratively with PBC. */
int
gmx_calc_comg_pbc(t_topology *top, rvec x[], t_pbc *pbc,
- int nrefat, atom_id index[], gmx_bool bMass, rvec xout);
+ int nrefat, atom_id index[], bool bMass, rvec xout);
/** Calculate centers of geometry for a blocked index. */
int
/** Calculate centers of mass/geometry for a blocked index. */
int
gmx_calc_comg_block(t_topology *top, rvec x[], t_block *block,
- atom_id index[], gmx_bool bMass, rvec xout[]);
+ atom_id index[], bool bMass, rvec xout[]);
/** Calculate forces on centers of mass/geometry for a blocked index. */
int
gmx_calc_comg_f_block(t_topology *top, rvec f[], t_block *block,
- atom_id index[], gmx_bool bMass, rvec fout[]);
+ atom_id index[], bool bMass, rvec fout[]);
/** Calculate centers of mass/geometry for a set of blocks; */
int
gmx_calc_comg_blocka(t_topology *top, rvec x[], t_blocka *block,
- gmx_bool bMass, rvec xout[]);
+ bool bMass, rvec xout[]);
/** Calculate forces on centers of mass/geometry for a set of blocks; */
int
gmx_calc_comg_f_blocka(t_topology *top, rvec x[], t_blocka *block,
- gmx_bool bMass, rvec xout[]);
-
-#ifdef __cplusplus
-}
-#endif
+ bool bMass, rvec xout[]);
#endif
* here.
* -# A second pass with simple reordering and initialization is done:
* -# Boolean expressions are combined such that one element can evaluate,
- * e.g., "A and B and C". The subexpressions in gmx_boolean expression are
+ * e.g., "A and B and C". The subexpressions in boolean expression are
* reordered such that static expressions come first without otherwise
* altering the relative order of the expressions.
* -# The \c t_selelem::evaluate field is set to the correct evaluation
* possible selections, and these are stored in the internal compiler
* data structure for each element.
* To be able to do this for all possible values of dynamical expressions,
- * special care needs to be taken with gmx_boolean expressions because they
+ * special care needs to be taken with boolean expressions because they
* are short-circuiting. This is done through the
* \c SEL_CDATA_EVALMAX flag, which makes dynamic child expressions
* of \c BOOL_OR expressions evaluate to empty groups, while subexpressions
* information, but do not unnecessarily copy the values.
*
*
- * \subsection selcompiler_tree_gmx_bool Boolean elements
+ * \subsection selcompiler_tree_bool Boolean elements
*
* \ref SEL_BOOLEAN elements have been merged such that one element
* may carry out evaluation of more than one operation of the same type.
/*! \brief
* Whether the whole subexpression should be treated as static.
*
- * This flag is always FALSE if \ref SEL_DYNAMIC is set for the element,
- * but it is also FALSE for static elements within common subexpressions.
+ * This flag is always false if \ref SEL_DYNAMIC is set for the element,
+ * but it is also false for static elements within common subexpressions.
*/
SEL_CDATA_STATIC = 2,
/** Whether the subexpression will always be evaluated in the same group. */
*
* \param sel Selection element to initialize
* \param[in] isize Maximum evaluation group size.
- * \param[in] bChildEval TRUE if children have already been processed.
- * \returns TRUE if the memory was allocated, FALSE if children need to
+ * \param[in] bChildEval true if children have already been processed.
+ * \returns true if the memory was allocated, false if children need to
* be processed first.
*
* If called more than once, memory is (re)allocated to ensure that the
* maximum of the \p isize values can be stored.
*/
-static gmx_bool
-alloc_selection_data(t_selelem *sel, int isize, gmx_bool bChildEval)
+static bool
+alloc_selection_data(t_selelem *sel, int isize, bool bChildEval)
{
int nalloc;
if (sel->mempool)
{
- return TRUE;
+ return true;
}
/* Find out the number of elements to allocate */
if (sel->flags & SEL_SINGLEVAL)
if (!bChildEval)
{
- return FALSE;
+ return false;
}
child = (sel->type == SEL_SUBEXPRREF ? sel->child : sel);
if (child->type == SEL_SUBEXPR)
gmx_ana_pos_reserve(sel->v.u.p, isize, 0);
}
}
- return TRUE;
+ return true;
}
/*! \brief
********************************************************************/
/*! \brief
- * Removes redundant gmx_boolean selection elements.
+ * Removes redundant boolean selection elements.
*
* \param sel Root of the selection subtree to optimize.
*
- * This function merges similar gmx_boolean operations (e.g., (A or B) or C becomes
+ * This function merges similar boolean operations (e.g., (A or B) or C becomes
* a single OR operation with three operands).
*/
static void
-optimize_gmx_boolean_expressions(t_selelem *sel)
+optimize_boolean_expressions(t_selelem *sel)
{
t_selelem *child, *prev;
child = sel->child;
while (child)
{
- optimize_gmx_boolean_expressions(child);
+ optimize_boolean_expressions(child);
/* Remove double negations */
if (child->type == SEL_BOOLEAN && child->u.boolt == BOOL_NOT
&& child->child->type == SEL_BOOLEAN && child->child->u.boolt == BOOL_NOT)
}
/*! \brief
- * Reorders children of gmx_boolean expressions such that static selections
+ * Reorders children of boolean expressions such that static selections
* come first.
*
* \param sel Root of the selection subtree to reorder.
* The same is true for the dynamic expressions.
*/
static void
-reorder_gmx_boolean_static_children(t_selelem *sel)
+reorder_boolean_static_children(t_selelem *sel)
{
t_selelem *child, *prev, *next;
child = sel->child;
while (child)
{
- reorder_gmx_boolean_static_children(child);
+ reorder_boolean_static_children(child);
child = child->next;
}
}
- /* Reorder gmx_boolean expressions such that static selections come first */
+ /* Reorder boolean expressions such that static selections come first */
if (sel->type == SEL_BOOLEAN && (sel->flags & SEL_DYNAMIC))
{
t_selelem start;
* for the children of this element. */
if (sel->type == SEL_BOOLEAN)
{
- gmx_bool bEvalMax;
+ bool bEvalMax;
bEvalMax = (sel->u.boolt == BOOL_AND);
child = sel->child;
* for any element for which the evaluation group may depend on the trajectory
* frame, the flag is cleared.
*
- * reorder_gmx_boolean_static_children() should have been called.
+ * reorder_boolean_static_children() should have been called.
*/
static void
init_item_staticeval(t_selelem *sel)
}
else /* bStaticEval is set */
{
- /* For gmx_boolean expressions, any expression after the first dynamic
+ /* For boolean expressions, any expression after the first dynamic
* expression should not have bStaticEval. */
if (sel->type == SEL_BOOLEAN)
{
* Marks a subtree completely dynamic or undoes such a change.
*
* \param sel Selection subtree to mark.
- * \param[in] bDynamic If TRUE, the \p bStatic flag of the whole
- * selection subtree is cleared. If FALSE, the flag is restored to
+ * \param[in] bDynamic If true, the \p bStatic flag of the whole
+ * selection subtree is cleared. If false, the flag is restored to
* using \ref SEL_DYNAMIC.
*
* Does not descend into parameters of methods unless the parameters
* are evaluated for each atom.
*/
static void
-mark_subexpr_dynamic(t_selelem *sel, gmx_bool bDynamic)
+mark_subexpr_dynamic(t_selelem *sel, bool bDynamic)
{
t_selelem *child;
init_method(t_selelem *sel, t_topology *top, int isize)
{
t_selelem *child;
- gmx_bool bAtomVal;
+ bool bAtomVal;
/* Find out whether there are any atom-valued parameters */
- bAtomVal = FALSE;
+ bAtomVal = false;
child = sel->child;
while (child)
{
if (child->flags & SEL_ATOMVAL)
{
- bAtomVal = TRUE;
+ bAtomVal = true;
}
child = child->next;
}
sel->u.expr.method->outinit(top, &sel->v, sel->u.expr.mdata);
if (sel->v.type != POS_VALUE && sel->v.type != GROUP_VALUE)
{
- alloc_selection_data(sel, isize, TRUE);
+ alloc_selection_data(sel, isize, true);
}
}
else
{
- alloc_selection_data(sel, isize, TRUE);
+ alloc_selection_data(sel, isize, true);
if ((sel->flags & SEL_DYNAMIC)
&& sel->v.type != GROUP_VALUE && sel->v.type != POS_VALUE)
{
}
/*! \brief
- * Evaluates the static part of a gmx_boolean expression.
+ * Evaluates the static part of a boolean expression.
*
* \param[in] data Evaluation data.
* \param[in,out] sel Boolean selection element whose children should be
* reorder_item_static_children() should have been called.
*/
static void
-evaluate_gmx_boolean_static_part(gmx_sel_evaluate_t *data, t_selelem *sel,
+evaluate_boolean_static_part(gmx_sel_evaluate_t *data, t_selelem *sel,
gmx_ana_index_t *g)
{
t_selelem *child, *next;
_gmx_selelem_set_vtype(child, GROUP_VALUE);
child->evaluate = NULL;
_gmx_selvalue_reserve(&child->v, 1);
- gmx_ana_index_copy(child->v.u.g, sel->v.u.g, TRUE);
+ gmx_ana_index_copy(child->v.u.g, sel->v.u.g, true);
init_item_compilerdata(child);
init_item_minmax_groups(child);
child->cdata->flags &= ~SEL_CDATA_STATICEVAL;
if (child->u.cgrp.nalloc_index > 0)
{
char *name = child->u.cgrp.name;
- gmx_ana_index_copy(&child->u.cgrp, child->v.u.g, FALSE);
+ gmx_ana_index_copy(&child->u.cgrp, child->v.u.g, false);
gmx_ana_index_squeeze(&child->u.cgrp);
child->u.cgrp.name = name;
}
else
{
- gmx_ana_index_copy(&child->u.cgrp, child->v.u.g, TRUE);
+ gmx_ana_index_copy(&child->u.cgrp, child->v.u.g, true);
}
}
}
/*! \brief
- * Evaluates the minimum and maximum groups for a gmx_boolean expression.
+ * Evaluates the minimum and maximum groups for a boolean expression.
*
* \param[in] sel \ref SEL_BOOLEAN element currently being evaluated.
* \param[in] g Group for which \p sel has been evaluated.
* problem.
*/
static void
-evaluate_gmx_boolean_minmax_grps(t_selelem *sel, gmx_ana_index_t *g,
+evaluate_boolean_minmax_grps(t_selelem *sel, gmx_ana_index_t *g,
gmx_ana_index_t *gmin, gmx_ana_index_t *gmax)
{
t_selelem *child;
break;
case BOOL_AND:
- gmx_ana_index_copy(gmin, sel->child->cdata->gmin, TRUE);
- gmx_ana_index_copy(gmax, sel->child->cdata->gmax, TRUE);
+ gmx_ana_index_copy(gmin, sel->child->cdata->gmin, true);
+ gmx_ana_index_copy(gmax, sel->child->cdata->gmax, true);
child = sel->child->next;
while (child && gmax->isize > 0)
{
if ((sel->child->cdata->flags & SEL_CDATA_STATIC)
&& sel->child->v.u.g->isize > gmax->isize)
{
- gmx_ana_index_copy(sel->child->v.u.g, gmax, FALSE);
+ gmx_ana_index_copy(sel->child->v.u.g, gmax, false);
gmx_ana_index_squeeze(sel->child->v.u.g);
if (sel->child->u.cgrp.isize > 0)
{
- gmx_ana_index_copy(&sel->child->u.cgrp, gmax, FALSE);
+ gmx_ana_index_copy(&sel->child->u.cgrp, gmax, false);
gmx_ana_index_squeeze(&sel->child->u.cgrp);
}
}
* because of the way _gmx_sel_evaluate_or() works. */
gmx_ana_index_reserve(gmin, g->isize);
gmx_ana_index_reserve(gmax, g->isize);
- gmx_ana_index_copy(gmin, sel->child->cdata->gmin, FALSE);
- gmx_ana_index_copy(gmax, sel->child->cdata->gmax, FALSE);
+ gmx_ana_index_copy(gmin, sel->child->cdata->gmin, false);
+ gmx_ana_index_copy(gmax, sel->child->cdata->gmax, false);
child = sel->child->next;
while (child && gmin->isize < g->isize)
{
&& sel->child->v.u.g->isize < gmin->isize)
{
gmx_ana_index_reserve(sel->child->v.u.g, gmin->isize);
- gmx_ana_index_copy(sel->child->v.u.g, gmin, FALSE);
+ gmx_ana_index_copy(sel->child->v.u.g, gmin, false);
if (sel->child->u.cgrp.isize > 0)
{
gmx_ana_index_reserve(&sel->child->u.cgrp, gmin->isize);
- gmx_ana_index_copy(&sel->child->u.cgrp, gmin, FALSE);
+ gmx_ana_index_copy(&sel->child->u.cgrp, gmin, false);
}
}
break;
analyze_static(gmx_sel_evaluate_t *data, t_selelem *sel, gmx_ana_index_t *g)
{
t_selelem *child, *next;
- gmx_bool bDoMinMax;
+ bool bDoMinMax;
if (sel->type != SEL_ROOT && g)
{
- alloc_selection_data(sel, g->isize, FALSE);
+ alloc_selection_data(sel, g->isize, false);
}
bDoMinMax = (sel->cdata->flags & SEL_CDATA_DOMINMAX);
}
if (bDoMinMax)
{
- gmx_ana_index_copy(sel->cdata->gmax, g, TRUE);
+ gmx_ana_index_copy(sel->cdata->gmax, g, true);
}
}
break;
else
{
/* Evalute the static part if there is more than one expression */
- evaluate_gmx_boolean_static_part(data, sel, g);
+ evaluate_boolean_static_part(data, sel, g);
/* Evaluate the selection.
- * If the type is gmx_boolean, we must explicitly handle the
- * static part evaluated in evaluate_gmx_boolean_static_part()
+ * If the type is boolean, we must explicitly handle the
+ * static part evaluated in evaluate_boolean_static_part()
* here because g may be larger. */
if (sel->u.boolt == BOOL_AND && sel->child->type == SEL_CONST)
{
}
/* Evaluate minimal and maximal selections */
- evaluate_gmx_boolean_minmax_grps(sel, g, sel->cdata->gmin,
+ evaluate_boolean_minmax_grps(sel, g, sel->cdata->gmin,
sel->cdata->gmax);
}
break;
}
else if (bDoMinMax)
{
- gmx_ana_index_copy(sel->cdata->gmax, g, TRUE);
+ gmx_ana_index_copy(sel->cdata->gmax, g, true);
}
break;
sel->cdata->evaluate(data, sel, g);
if (bDoMinMax)
{
- gmx_ana_index_copy(sel->cdata->gmin, sel->child->cdata->gmin, TRUE);
- gmx_ana_index_copy(sel->cdata->gmax, sel->child->cdata->gmax, TRUE);
+ gmx_ana_index_copy(sel->cdata->gmin, sel->child->cdata->gmin, true);
+ gmx_ana_index_copy(sel->cdata->gmax, sel->child->cdata->gmax, true);
}
}
else
{
isize += sel->u.cgrp.isize;
gmx_ana_index_reserve(&sel->u.cgrp, isize);
- alloc_selection_data(sel, isize, FALSE);
+ alloc_selection_data(sel, isize, false);
}
sel->cdata->evaluate(data, sel, g);
if (isize > 0 && bDoMinMax)
/* The subexpression should have been evaluated if g is NULL
* (i.e., this is a method parameter or a direct value of a
* selection). */
- alloc_selection_data(sel, sel->child->cdata->gmax->isize, TRUE);
+ alloc_selection_data(sel, sel->child->cdata->gmax->isize, true);
}
sel->cdata->evaluate(data, sel, g);
if ((sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR)
{
if ((sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR) || !g)
{
- gmx_ana_index_copy(sel->cdata->gmin, sel->child->cdata->gmin, TRUE);
- gmx_ana_index_copy(sel->cdata->gmax, sel->child->cdata->gmax, TRUE);
+ gmx_ana_index_copy(sel->cdata->gmin, sel->child->cdata->gmin, true);
+ gmx_ana_index_copy(sel->cdata->gmax, sel->child->cdata->gmax, true);
}
else
{
}
/* Replace the result of the evaluation */
- /* This is not necessary for subexpressions or for gmx_boolean negations
+ /* This is not necessary for subexpressions or for boolean negations
* because the evaluation function already has done it properly. */
if (sel->v.type == GROUP_VALUE && (sel->flags & SEL_DYNAMIC)
&& sel->type != SEL_SUBEXPR
{
if (sel->cdata->flags & SEL_CDATA_EVALMAX)
{
- gmx_ana_index_copy(sel->v.u.g, sel->cdata->gmax, FALSE);
+ gmx_ana_index_copy(sel->v.u.g, sel->cdata->gmax, false);
}
else
{
- gmx_ana_index_copy(sel->v.u.g, sel->cdata->gmin, FALSE);
+ gmx_ana_index_copy(sel->v.u.g, sel->cdata->gmin, false);
}
}
}
}
else
{
- gmx_ana_index_copy(&root->u.cgrp, expr->cdata->gmax, TRUE);
+ gmx_ana_index_copy(&root->u.cgrp, expr->cdata->gmax, true);
}
/* For selections, store the maximum group for
* gmx_ana_selcollection_evaluate_fin() as the value of the root
_gmx_selelem_set_vtype(root, GROUP_VALUE);
root->flags |= (SEL_ALLOCVAL | SEL_ALLOCDATA);
_gmx_selvalue_reserve(&root->v, 1);
- gmx_ana_index_copy(root->v.u.g, expr->v.u.p->g, TRUE);
+ gmx_ana_index_copy(root->v.u.g, expr->v.u.p->g, true);
}
}
}
item = sc->root;
while (item)
{
- /* Process gmx_boolean and arithmetic expressions. */
- optimize_gmx_boolean_expressions(item);
- reorder_gmx_boolean_static_children(item);
+ /* Process boolean and arithmetic expressions. */
+ optimize_boolean_expressions(item);
+ reorder_boolean_static_children(item);
optimize_arithmetic_expressions(item);
/* Initialize evaluation */
init_item_evalfunc(item);
{
if (item->child->cdata->flags & SEL_CDATA_COMMONSUBEXPR)
{
- mark_subexpr_dynamic(item->child, TRUE);
+ mark_subexpr_dynamic(item->child, true);
}
set_evaluation_function(item, &analyze_static);
item->evaluate(&evaldata, item, NULL);
{
bool bMinMax = item->child->cdata->flags & SEL_CDATA_DOMINMAX;
- mark_subexpr_dynamic(item->child, FALSE);
+ mark_subexpr_dynamic(item->child, false);
item->child->u.cgrp.isize = 0;
/* We won't clear item->child->v.u.g here, because it may
* be static, and hence actually point to item->child->cdata->gmax,
t_selelem *elem = sel->selelem;
if (sel->bDynamic)
{
- gmx_ana_index_copy(sel->g, elem->v.u.g, FALSE);
+ gmx_ana_index_copy(sel->g, elem->v.u.g, false);
sel->g->name = NULL;
gmx_ana_indexmap_update(&sel->p.m, sel->g, bMaskOnly);
sel->p.nr = sel->p.m.nr;
/* We need to keep the name for the cgrp across the copy to avoid
* problems if g has a name set. */
char *name = sel->u.cgrp.name;
- gmx_ana_index_copy(&sel->u.cgrp, g, FALSE);
+ gmx_ana_index_copy(&sel->u.cgrp, g, false);
sel->u.cgrp.name = name;
gmiss.isize = 0;
}
/* Currently, there is no need to do anything fancy here,
* but some future extensions may need a more flexible
* implementation. */
- gmx_ana_pos_copy(sel->v.u.p, expr->v.u.p, FALSE);
+ gmx_ana_pos_copy(sel->v.u.p, expr->v.u.p, false);
break;
case GROUP_VALUE:
if (!g)
{
- gmx_ana_index_copy(sel->v.u.g, expr->v.u.g, FALSE);
+ gmx_ana_index_copy(sel->v.u.g, expr->v.u.g, false);
}
else
{
{
MempoolSelelemReserver reserver(child, g->isize);
child->evaluate(data, child, g);
- gmx_ana_index_copy(sel->v.u.g, child->v.u.g, FALSE);
+ gmx_ana_index_copy(sel->v.u.g, child->v.u.g, false);
}
child = child->next;
while (child && sel->v.u.g->isize > 0)
* \param[in] isize Array of index group sizes.
* \param[in] index Array of pointers to indices of each group.
* \param[in] name Array of names of the groups.
- * \param[in] bFree If TRUE, the \p isize, \p index and \p name arrays
+ * \param[in] bFree If true, the \p isize, \p index and \p name arrays
* are freed after they have been copied.
*/
void
gmx_ana_indexgrps_set(gmx_ana_indexgrps_t **g, int ngrps, int *isize,
- atom_id **index, char **name, gmx_bool bFree)
+ atom_id **index, char **name, bool bFree)
{
int i;
{
get_index(&(top->atoms), fnm, ngrps, isize, index, name);
}
- gmx_ana_indexgrps_set(g, ngrps, isize, index, name, TRUE);
+ gmx_ana_indexgrps_set(g, ngrps, isize, index, name, true);
}
/*!
gmx_ana_indexgrps_alloc(dest, src->nr);
for (g = 0; g < src->nr; ++g)
{
- gmx_ana_index_copy(&(*dest)->g[g], &src->g[g], TRUE);
+ gmx_ana_index_copy(&(*dest)->g[g], &src->g[g], true);
}
}
/*!
* \param[out] g Index group structure.
- * \returns TRUE if \p g is empty, i.e., has 0 index groups.
+ * \returns true if \p g is empty, i.e., has 0 index groups.
*/
-gmx_bool
+bool
gmx_ana_indexgrps_is_empty(gmx_ana_indexgrps_t *g)
{
return g->nr == 0;
* \param[out] dest Output structure.
* \param[in] src Input index groups.
* \param[in] n Number of the group to extract.
- * \returns TRUE if \p n is a valid group in \p src, FALSE otherwise.
+ * \returns true if \p n is a valid group in \p src, false otherwise.
*/
-gmx_bool
+bool
gmx_ana_indexgrps_extract(gmx_ana_index_t *dest, gmx_ana_indexgrps_t *src, int n)
{
if (n < 0 || n >= src->nr)
{
dest->isize = 0;
- return FALSE;
+ return false;
}
- gmx_ana_index_copy(dest, &src->g[n], TRUE);
- return TRUE;
+ gmx_ana_index_copy(dest, &src->g[n], true);
+ return true;
}
/*!
* \param[out] dest Output structure.
* \param[in] src Input index groups.
* \param[in] name Name (or part of the name) of the group to extract.
- * \returns TRUE if \p name is a valid group in \p src, FALSE otherwise.
+ * \returns true if \p name is a valid group in \p src, false otherwise.
*
* Uses the Gromacs routine find_group() to find the actual group;
* the comparison is case-insensitive.
*/
-gmx_bool
+bool
gmx_ana_indexgrps_find(gmx_ana_index_t *dest, gmx_ana_indexgrps_t *src, char *name)
{
int i;
if (i == NOTSET)
{
dest->isize = 0;
- return FALSE;
+ return false;
}
return gmx_ana_indexgrps_extract(dest, src, i);
/*!
* \param[out] dest Destination index group.
* \param[in] src Source index group.
- * \param[in] bAlloc If TRUE, memory is allocated at \p dest; otherwise,
+ * \param[in] bAlloc If true, memory is allocated at \p dest; otherwise,
* it is assumed that enough memory has been allocated for index.
*
- * A deep copy of the name is only made if \p bAlloc is TRUE.
+ * A deep copy of the name is only made if \p bAlloc is true.
*/
void
-gmx_ana_index_copy(gmx_ana_index_t *dest, gmx_ana_index_t *src, gmx_bool bAlloc)
+gmx_ana_index_copy(gmx_ana_index_t *dest, gmx_ana_index_t *src, bool bAlloc)
{
dest->isize = src->isize;
if (dest->isize > 0)
/*!
* \param[in] g Index group to check.
- * \returns TRUE if the index group is sorted and has no duplicates,
- * FALSE otherwise.
+ * \returns true if the index group is sorted and has no duplicates,
+ * false otherwise.
*/
-gmx_bool
+bool
gmx_ana_index_check_sorted(gmx_ana_index_t *g)
{
int i;
{
if (g->index[i+1] <= g->index[i])
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
/********************************************************************
/*!
* \param[in] a Index group to check.
* \param[in] b Index group to check.
- * \returns TRUE if \p a and \p b are equal, FALSE otherwise.
+ * \returns true if \p a and \p b are equal, false otherwise.
*/
-gmx_bool
+bool
gmx_ana_index_equals(gmx_ana_index_t *a, gmx_ana_index_t *b)
{
int i;
if (a->isize != b->isize)
{
- return FALSE;
+ return false;
}
for (i = 0; i < a->isize; ++i)
{
if (a->index[i] != b->index[i])
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
/*!
* \param[in] a Index group to check against.
* \param[in] b Index group to check.
- * \returns TRUE if \p b is contained in \p a,
- * FALSE otherwise.
+ * \returns true if \p b is contained in \p a,
+ * false otherwise.
*
* If the elements are not in the same order in both groups, the function
* fails. However, the groups do not need to be sorted.
*/
-gmx_bool
+bool
gmx_ana_index_contains(gmx_ana_index_t *a, gmx_ana_index_t *b)
{
int i, j;
}
if (i == a->isize)
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
/*!
{
dest2->index[k--] = src->index[j--];
}
- gmx_ana_index_copy(dest1, g, FALSE);
+ gmx_ana_index_copy(dest1, g, false);
}
/*!
* (can be NULL if \p type is \ref INDEX_UNKNOWN).
* \param[in] type Type of partitioning to make.
* \param[in] bComplete
- * If TRUE, the index group is expanded to include any residue/molecule
+ * If true, the index group is expanded to include any residue/molecule
* (depending on \p type) that is partially contained in the group.
* If \p type is not INDEX_RES or INDEX_MOL, this has no effect.
*
*/
void
gmx_ana_index_make_block(t_blocka *t, t_topology *top, gmx_ana_index_t *g,
- e_index_t type, gmx_bool bComplete)
+ e_index_t type, bool bComplete)
{
int i, j, ai;
int id, cur;
* off otherwise. */
if (type != INDEX_RES && type != INDEX_MOL)
{
- bComplete = FALSE;
+ bComplete = false;
}
/* Allocate memory for the atom array and fill it unless we are using
* completion. */
/*!
* \param[in] g Index group to check.
* \param[in] b Block data to check against.
- * \returns TRUE if \p g consists of one or more complete blocks from \p b,
- * FALSE otherwise.
+ * \returns true if \p g consists of one or more complete blocks from \p b,
+ * false otherwise.
*
* The atoms in \p g are assumed to be sorted.
*/
-gmx_bool
+bool
gmx_ana_index_has_full_blocks(gmx_ana_index_t *g, t_block *b)
{
int i, j, bi;
/* If not found, or if too large, return */
if (bi == b->nr || i + b->index[bi+1] - b->index[bi] > g->isize)
{
- return FALSE;
+ return false;
}
/* Check that the block matches the index */
for (j = b->index[bi]; j < b->index[bi+1]; ++j, ++i)
{
if (g->index[i] != j)
{
- return FALSE;
+ return false;
}
}
/* Move the search to the next block */
++bi;
}
- return TRUE;
+ return true;
}
/*!
* \param[in] g Index group to check.
* \param[in] b Block data to check against.
- * \returns TRUE if \p g consists of one or more complete blocks from \p b,
- * FALSE otherwise.
+ * \returns true if \p g consists of one or more complete blocks from \p b,
+ * false otherwise.
*
* The atoms in \p g and \p b->a are assumed to be in the same order.
*/
-gmx_bool
+bool
gmx_ana_index_has_full_ablocks(gmx_ana_index_t *g, t_blocka *b)
{
int i, j, bi;
/* If not found, or if too large, return */
if (bi == b->nr || i + b->index[bi+1] - b->index[bi] > g->isize)
{
- return FALSE;
+ return false;
}
/* Check that the block matches the index */
for (j = b->index[bi]; j < b->index[bi+1]; ++j, ++i)
{
if (b->a[j] != g->index[i])
{
- return FALSE;
+ return false;
}
}
/* Move the search to the next block */
++bi;
}
- return TRUE;
+ return true;
}
/*!
* \param[in] g Index group to check.
* \param[in] type Block data to check against.
* \param[in] top Topology data.
- * \returns TRUE if \p g consists of one or more complete elements of type
- * \p type, FALSE otherwise.
+ * \returns true if \p g consists of one or more complete elements of type
+ * \p type, false otherwise.
*
- * If \p type is \ref INDEX_ATOM, the return value is always TRUE.
+ * If \p type is \ref INDEX_ATOM, the return value is always true.
* If \p type is \ref INDEX_UNKNOWN or \ref INDEX_ALL, the return value is
- * always FALSE.
+ * always false.
*/
-gmx_bool
+bool
gmx_ana_index_has_complete_elems(gmx_ana_index_t *g, e_index_t type,
t_topology *top)
{
{
case INDEX_UNKNOWN:
case INDEX_ALL:
- return FALSE;
+ return false;
case INDEX_ATOM:
- return TRUE;
+ return true;
case INDEX_RES:
{
{
if (ai > 0 && top->atoms.atom[ai-1].resind == id)
{
- return FALSE;
+ return false;
}
if (i > 0 && g->index[i-1] < top->atoms.nr - 1
&& top->atoms.atom[g->index[i-1]+1].resind == prev)
{
- return FALSE;
+ return false;
}
}
prev = id;
if (g->index[i-1] < top->atoms.nr - 1
&& top->atoms.atom[g->index[i-1]+1].resind == prev)
{
- return FALSE;
+ return false;
}
break;
}
case INDEX_MOL:
return gmx_ana_index_has_full_blocks(g, &top->mols);
}
- return TRUE;
+ return true;
}
/*!
m->b.a = NULL;
m->b.nalloc_index = 0;
m->b.nalloc_a = 0;
- m->bStatic = TRUE;
- m->bMapStatic = TRUE;
+ m->bStatic = true;
+ m->bMapStatic = true;
}
/*!
int i, ii, mi;
m->type = type;
- gmx_ana_index_make_block(&m->b, top, g, type, FALSE);
+ gmx_ana_index_make_block(&m->b, top, g, type, false);
gmx_ana_indexmap_reserve(m, m->b.nr, m->b.nra);
m->nr = m->b.nr;
for (i = mi = 0; i < m->nr; ++i)
}
m->mapb.nr = m->nr;
memcpy(m->mapb.index, m->b.index, (m->nr+1)*sizeof(*(m->mapb.index)));
- m->bStatic = TRUE;
- m->bMapStatic = TRUE;
+ m->bStatic = true;
+ m->bMapStatic = true;
}
/*!
/*!
* \param[in,out] dest Destination data structure.
* \param[in] src Source mapping.
- * \param[in] bFirst If TRUE, memory is allocated for \p dest and a full
+ * \param[in] bFirst If true, memory is allocated for \p dest and a full
* copy is made; otherwise, only variable parts are copied, and no memory
* is allocated.
*
* \p dest should have been initialized somehow (calloc() is enough).
*/
void
-gmx_ana_indexmap_copy(gmx_ana_indexmap_t *dest, gmx_ana_indexmap_t *src, gmx_bool bFirst)
+gmx_ana_indexmap_copy(gmx_ana_indexmap_t *dest, gmx_ana_indexmap_t *src, bool bFirst)
{
if (bFirst)
{
/*!
* \param[in,out] m Mapping structure.
* \param[in] g Current index group.
- * \param[in] bMaskOnly TRUE if the unused blocks should be masked with
+ * \param[in] bMaskOnly true if the unused blocks should be masked with
* -1 instead of removing them.
*
* Updates the index group mapping with the new index group \p g.
*/
void
gmx_ana_indexmap_update(gmx_ana_indexmap_t *m, gmx_ana_index_t *g,
- gmx_bool bMaskOnly)
+ bool bMaskOnly)
{
int i, j, bi, bj;
- gmx_bool bStatic;
+ bool bStatic;
/* Process the simple cases first */
if (m->type == INDEX_UNKNOWN && m->b.nra == 0)
{
m->mapb.index[bj] = m->b.index[bj];
}
- m->bMapStatic = TRUE;
+ m->bMapStatic = true;
}
}
/* Exit immediately if the group is static */
if (bStatic)
{
- m->bStatic = TRUE;
+ m->bStatic = true;
return;
}
/* Update the number of blocks */
m->mapb.index[bi] = g->isize;
m->nr = bi;
- m->bMapStatic = FALSE;
+ m->bMapStatic = false;
}
m->mapb.nr = m->nr;
- m->bStatic = FALSE;
+ m->bStatic = false;
}
/*!
#include "../legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/** Stores a set of index groups. */
typedef struct gmx_ana_indexgrps_t gmx_ana_indexgrps_t;
*/
t_blocka b;
/*! \brief
- * TRUE if the current reference IDs are for the whole group (internal use only).
+ * true if the current reference IDs are for the whole group (internal use only).
*
* This is used internally to optimize the evaluation such that
* gmx_ana_indexmap_update() does not take any time if the group is
* actually static.
*/
- gmx_bool bStatic;
+ bool bStatic;
/*! \brief
- * TRUE if the current mapping is for the whole group (internal use only).
+ * true if the current mapping is for the whole group (internal use only).
*
* This is used internally to optimize the evaluation such that
* gmx_ana_indexmap_update() does not take any time if the group is
* actually static.
*/
- gmx_bool bMapStatic;
+ bool bMapStatic;
} gmx_ana_indexmap_t;
/** Initializes index groups from arrays. */
void
gmx_ana_indexgrps_set(gmx_ana_indexgrps_t **g, int ngrps, int *isize,
- atom_id **index, char **name, gmx_bool bFree);
+ atom_id **index, char **name, bool bFree);
/** Reads index groups from a file or constructs them from topology. */
void
gmx_ana_indexgrps_init(gmx_ana_indexgrps_t **g, t_topology *top,
/** Create a deep copy of \c gmx_ana_indexgrps_t. */
void
gmx_ana_indexgrps_clone(gmx_ana_indexgrps_t **dest, gmx_ana_indexgrps_t *src);
-/** Returns TRUE if the index group structure is emtpy. */
-gmx_bool
+/** Returns true if the index group structure is emtpy. */
+bool
gmx_ana_indexgrps_is_empty(gmx_ana_indexgrps_t *g);
/** Returns a pointer to an index group. */
gmx_ana_index_t *
gmx_ana_indexgrps_get_grp(gmx_ana_indexgrps_t *g, int n);
/** Extracts a single index group. */
-gmx_bool
+bool
gmx_ana_indexgrps_extract(gmx_ana_index_t *dest, gmx_ana_indexgrps_t *src, int n);
/** Finds and extracts a single index group by name. */
-gmx_bool
+bool
gmx_ana_indexgrps_find(gmx_ana_index_t *dest, gmx_ana_indexgrps_t *src, char *name);
/** Writes out a list of index groups. */
gmx_ana_index_deinit(gmx_ana_index_t *g);
/** Copies a \c gmx_ana_index_t. */
void
-gmx_ana_index_copy(gmx_ana_index_t *dest, gmx_ana_index_t *src, gmx_bool bAlloc);
+gmx_ana_index_copy(gmx_ana_index_t *dest, gmx_ana_index_t *src, bool bAlloc);
/** Writes out the contents of a index group. */
void
void
gmx_ana_index_check(gmx_ana_index_t *g, int natoms);
/** Checks whether an index group is sorted. */
-gmx_bool
+bool
gmx_ana_index_check_sorted(gmx_ana_index_t *g);
/*@}*/
void
gmx_ana_index_sort(gmx_ana_index_t *g);
/** Checks whether two index groups are equal. */
-gmx_bool
+bool
gmx_ana_index_equals(gmx_ana_index_t *a, gmx_ana_index_t *b);
/** Checks whether a sorted index group contains another sorted index group. */
-gmx_bool
+bool
gmx_ana_index_contains(gmx_ana_index_t *a, gmx_ana_index_t *b);
/** Calculates the intersection between two sorted index groups. */
/** Partition a group based on topology information. */
void
gmx_ana_index_make_block(t_blocka *t, t_topology *top, gmx_ana_index_t *g,
- e_index_t type, gmx_bool bComplete);
+ e_index_t type, bool bComplete);
/** Checks whether a group consists of full blocks. */
-gmx_bool
+bool
gmx_ana_index_has_full_blocks(gmx_ana_index_t *g, t_block *b);
/** Checks whether a group consists of full blocks. */
-gmx_bool
+bool
gmx_ana_index_has_full_ablocks(gmx_ana_index_t *g, t_blocka *b);
/** Checks whether a group consists of full residues/molecules. */
-gmx_bool
+bool
gmx_ana_index_has_complete_elems(gmx_ana_index_t *g, e_index_t type, t_topology *top);
/** Initializes an empty index group mapping. */
gmx_ana_indexmap_deinit(gmx_ana_indexmap_t *m);
/** Makes a deep copy of an index group mapping. */
void
-gmx_ana_indexmap_copy(gmx_ana_indexmap_t *dest, gmx_ana_indexmap_t *src, gmx_bool bFirst);
+gmx_ana_indexmap_copy(gmx_ana_indexmap_t *dest, gmx_ana_indexmap_t *src, bool bFirst);
/** Updates an index group mapping. */
void
-gmx_ana_indexmap_update(gmx_ana_indexmap_t *m, gmx_ana_index_t *g, gmx_bool bMaskOnly);
+gmx_ana_indexmap_update(gmx_ana_indexmap_t *m, gmx_ana_index_t *g, bool bMaskOnly);
/*@}*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
int *excl;
/** Whether to try grid searching. */
- gmx_bool bTryGrid;
+ bool bTryGrid;
/** Whether grid searching is actually used for the current positions. */
- gmx_bool bGrid;
+ bool bGrid;
/** Array allocated for storing in-unit-cell reference positions. */
rvec *xref_alloc;
- /** FALSE if the box is rectangular. */
- gmx_bool bTric;
+ /** false if the box is rectangular. */
+ bool bTric;
/** Box vectors of a single grid cell. */
matrix cellbox;
/** The reciprocal cell vectors as columns; the inverse of \p cellbox. */
gmx_ana_nbsearch_t *d;
snew(d, 1);
- d->bTryGrid = TRUE;
+ d->bTryGrid = true;
if (cutoff <= 0)
{
cutoff = GMX_REAL_MAX;
- d->bTryGrid = FALSE;
+ d->bTryGrid = false;
}
d->cutoff = cutoff;
d->cutoff2 = sqr(cutoff);
*
* \param[in,out] d Grid information.
* \param[in] pbc Information about the box.
- * \returns FALSE if grid search is not suitable.
+ * \returns false if grid search is not suitable.
*/
-static gmx_bool
+static bool
grid_setup_cells(gmx_ana_nbsearch_t *d, t_pbc *pbc)
{
real targetsize;
d->ncells *= d->ncelldim[dd];
if (d->ncelldim[dd] < 3)
{
- return FALSE;
+ return false;
}
}
/* Reallocate if necessary */
}
d->cells_nalloc = d->ncells;
}
- return TRUE;
+ return true;
}
/*! \brief
*
* \param[in,out] d Grid information.
* \param[in] pbc Information about the box.
- * \returns FALSE if grid search is not suitable.
+ * \returns false if grid search is not suitable.
*/
-static gmx_bool
+static bool
grid_set_box(gmx_ana_nbsearch_t *d, t_pbc *pbc)
{
int dd;
/* TODO: This check could be improved. */
if (0.5*pbc->max_cutoff2 < d->cutoff2)
{
- return FALSE;
+ return false;
}
if (!grid_setup_cells(d, pbc))
{
- return FALSE;
+ return false;
}
d->bTric = TRICLINIC(pbc->box);
}
}
grid_init_cell_nblist(d, pbc);
- return TRUE;
+ return true;
}
/*! \brief
d->nref = n;
if (!pbc)
{
- d->bGrid = FALSE;
+ d->bGrid = false;
}
else if (d->bTryGrid)
{
/*! \brief
* Helper function to check whether a reference point should be excluded.
*/
-static gmx_bool
+static bool
is_excluded(gmx_ana_nbsearch_t *d, int j)
{
if (d->exclind < d->nexcl)
if (d->exclind < d->nexcl && d->refid[j] == d->excl[d->exclind])
{
++d->exclind;
- return TRUE;
+ return true;
}
}
else
if (d->excl[d->exclind] == j)
{
++d->exclind;
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
/*! \brief
/*! \brief
* Does a grid search.
*/
-static gmx_bool
+static bool
grid_search(gmx_ana_nbsearch_t *d,
- gmx_bool (*action)(gmx_ana_nbsearch_t *d, int i, real r2))
+ bool (*action)(gmx_ana_nbsearch_t *d, int i, real r2))
{
int i;
rvec dx;
d->prevnbi = nbi;
d->prevcai = cai;
d->previ = i;
- return TRUE;
+ return true;
}
}
}
if (action(d, i, r2))
{
d->previ = i;
- return TRUE;
+ return true;
}
}
}
}
- return FALSE;
+ return false;
}
/*! \brief
*
* Simply breaks the loop on the first found neighbor.
*/
-static gmx_bool
+static bool
within_action(gmx_ana_nbsearch_t *d, int i, real r2)
{
- return TRUE;
+ return true;
}
/*! \brief
* Helper function to use with grid_search() to find the minimum distance.
*/
-static gmx_bool
+static bool
mindist_action(gmx_ana_nbsearch_t *d, int i, real r2)
{
d->cutoff2 = r2;
- return FALSE;
+ return false;
}
/*!
* \param[in] d Neighborhood search data structure.
* \param[in] x Test position.
- * \returns TRUE if \p x is within the cutoff of any reference position,
- * FALSE otherwise.
+ * \returns true if \p x is within the cutoff of any reference position,
+ * false otherwise.
*/
-gmx_bool
+bool
gmx_ana_nbsearch_is_within(gmx_ana_nbsearch_t *d, const rvec x)
{
grid_search_start(d, x);
* \param[in] d Neighborhood search data structure.
* \param[in] p Test positions.
* \param[in] i Use the i'th position in \p p for testing.
- * \returns TRUE if the test position is within the cutoff of any reference
- * position, FALSE otherwise.
+ * \returns true if the test position is within the cutoff of any reference
+ * position, false otherwise.
*/
-gmx_bool
+bool
gmx_ana_nbsearch_pos_is_within(gmx_ana_nbsearch_t *d, const gmx_ana_pos_t *p, int i)
{
return gmx_ana_nbsearch_is_within(d, p->x[i]);
* \param[in] d Neighborhood search data structure.
* \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.
+ * \returns true if there are positions within the cutoff.
*/
-gmx_bool
+bool
gmx_ana_nbsearch_first_within(gmx_ana_nbsearch_t *d, const rvec x, int *jp)
{
grid_search_start(d, x);
* \param[in] p Test positions.
* \param[in] i Use the i'th position in \p p.
* \param[out] jp Index of the reference position in the first pair.
- * \returns TRUE if there are positions within the cutoff.
+ * \returns true if there are positions within the cutoff.
*/
-gmx_bool
+bool
gmx_ana_nbsearch_pos_first_within(gmx_ana_nbsearch_t *d, const gmx_ana_pos_t *p,
int i, int *jp)
{
/*!
* \param[in] d Neighborhood search data structure.
* \param[out] jp Index of the test position in the next pair.
- * \returns TRUE if there are positions within the cutoff.
+ * \returns true if there are positions within the cutoff.
*/
-gmx_bool
+bool
gmx_ana_nbsearch_next_within(gmx_ana_nbsearch_t *d, int *jp)
{
if (grid_search(d, &within_action))
{
*jp = d->previ;
- return TRUE;
+ return true;
}
*jp = -1;
- return FALSE;
+ return false;
}
void
gmx_ana_nbsearch_set_excl(gmx_ana_nbsearch_t *d, int nexcl, int excl[]);
/** Check whether a point is within a neighborhood. */
-gmx_bool
+bool
gmx_ana_nbsearch_is_within(gmx_ana_nbsearch_t *d, const rvec x);
/** Check whether a position is within a neighborhood. */
-gmx_bool
+bool
gmx_ana_nbsearch_pos_is_within(gmx_ana_nbsearch_t *d,
const struct gmx_ana_pos_t *p, int i);
/** Calculates the minimun distance from the reference points. */
gmx_ana_nbsearch_pos_mindist(gmx_ana_nbsearch_t *d,
const struct gmx_ana_pos_t *p, int i);
/** Finds the first reference position within the cutoff. */
-gmx_bool
+bool
gmx_ana_nbsearch_first_within(gmx_ana_nbsearch_t *d, const rvec x, int *jp);
/** Finds the first reference position within the cutoff. */
-gmx_bool
+bool
gmx_ana_nbsearch_pos_first_within(gmx_ana_nbsearch_t *d,
const struct gmx_ana_pos_t *p, int i, int *jp);
/** Finds the next reference position within the cutoff. */
-gmx_bool
+bool
gmx_ana_nbsearch_next_within(gmx_ana_nbsearch_t *d, int *jp);
#endif
{
return ¶m[i];
}
- /* Check for 'no' prefix on gmx_boolean parameters */
+ /* Check for 'no' prefix on boolean parameters */
if (param[i].val.type == NO_VALUE
&& strlen(name) > 2 && name[0] == 'n' && name[1] == 'o'
&& !strcmp(param[i].name, name+2))
* \param[in] values Pointer to the list of values.
* \param param Parameter to parse.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the values were parsed successfully, FALSE otherwise.
+ * \returns true if the values were parsed successfully, false otherwise.
*/
-static gmx_bool
+static bool
parse_values_range(int nval, t_selexpr_value *values, gmx_ana_selparam_t *param,
void *scanner)
{
if (param->val.type != INT_VALUE && param->val.type != REAL_VALUE)
{
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid range parameter type");
- return FALSE;
+ return false;
}
idata = NULL;
rdata = NULL;
if (value->bExpr)
{
_gmx_selparser_error(scanner, "expressions not supported within range parameters");
- return FALSE;
+ return false;
}
if (value->type != param->val.type)
{
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid range value type");
- return FALSE;
+ return false;
}
if (param->val.type == INT_VALUE)
{
_gmx_selparser_error(scanner, "the value should consist of exactly one range");
sfree(idata);
sfree(rdata);
- return FALSE;
+ return false;
}
if (param->val.type == INT_VALUE)
{
}
param->nvalptr = NULL;
- return TRUE;
+ return true;
}
/*! \brief
* \param param Parameter to parse.
* \param root Selection element to which child expressions are added.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the values were parsed successfully, FALSE otherwise.
+ * \returns true if the values were parsed successfully, false otherwise.
*
* For integer ranges, the sequence of numbers from the first to second value
* is stored, each as a separate value.
*/
-static gmx_bool
+static bool
parse_values_varnum(int nval, t_selexpr_value *values,
gmx_ana_selparam_t *param, t_selelem *root, void *scanner)
{
{
GMX_ERROR_NORET(gmx::eeInternalError,
"Variable-count value type not implemented");
- return FALSE;
+ return false;
}
/* Reserve appropriate amount of memory */
if (value->bExpr)
{
_gmx_selparser_error(scanner, "expressions not supported within value lists");
- return FALSE;
+ return false;
}
if (value->type != param->val.type)
{
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid value type");
- return FALSE;
+ return false;
}
switch (param->val.type)
{
if (value->u.r.r1 != value->u.r.r2)
{
_gmx_selparser_error(scanner, "real ranges not supported");
- return FALSE;
+ return false;
}
param->val.u.r[i++] = value->u.r.r1;
break;
case POS_VALUE: copy_rvec(value->u.x, param->val.u.p->x[i++]); break;
default: /* Should not be reached */
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid value type");
- return FALSE;
+ return false;
}
value = value->next;
}
place_child(root, child, param);
}
- return TRUE;
+ return true;
}
/*! \brief
* \param param Parameter to parse.
* \param root Selection element to which child expressions are added.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the values were parsed successfully, FALSE otherwise.
+ * \returns true if the values were parsed successfully, false otherwise.
*/
-static gmx_bool
+static bool
parse_values_varnum_expr(int nval, t_selexpr_value *values,
gmx_ana_selparam_t *param, t_selelem *root,
void *scanner)
if (nval != 1 || !values->bExpr)
{
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid expression value");
- return FALSE;
+ return false;
}
value = values;
value->u.expr = NULL;
if (!child)
{
- return FALSE;
+ return false;
}
/* Process single-valued expressions */
*param->nvalptr = param->val.nr;
}
param->nvalptr = NULL;
- return TRUE;
+ return true;
}
if (!(child->flags & SEL_VARNUMVAL))
{
_gmx_selparser_error(scanner, "invalid expression value");
- return FALSE;
+ return false;
}
child->flags |= SEL_ALLOCVAL;
/* Rest of the initialization is done during compilation in
* init_method(). */
- return TRUE;
+ return true;
}
/*! \brief
* as the value \p i of \p param.
* This function is used internally by parse_values_std().
*/
-static gmx_bool
+static bool
set_expr_value_store(t_selelem *sel, gmx_ana_selparam_t *param, int i,
void *scanner)
{
if (sel->v.type != GROUP_VALUE && !(sel->flags & SEL_SINGLEVAL))
{
_gmx_selparser_error(scanner, "invalid expression value");
- return FALSE;
+ return false;
}
switch (sel->v.type)
{
case GROUP_VALUE: sel->v.u.g = ¶m->val.u.g[i]; break;
default: /* Error */
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid value type");
- return FALSE;
+ return false;
}
sel->v.nr = 1;
sel->v.nalloc = -1;
- return TRUE;
+ return true;
}
/*! \brief
* \param param Parameter to parse.
* \param root Selection element to which child expressions are added.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the values were parsed successfully, FALSE otherwise.
+ * \returns true if the values were parsed successfully, false otherwise.
*
* For integer ranges, the sequence of numbers from the first to second value
* is stored, each as a separate value.
*/
-static gmx_bool
+static bool
parse_values_std(int nval, t_selexpr_value *values, gmx_ana_selparam_t *param,
t_selelem *root, void *scanner)
{
t_selexpr_value *value;
t_selelem *child;
int i, j;
- gmx_bool bDynamic;
+ bool bDynamic;
/* Handle atom-valued parameters */
if (param->flags & SPAR_ATOMVAL)
if (nval > 1)
{
_gmx_selparser_error(scanner, "more than one value not supported");
- return FALSE;
+ return false;
}
value = values;
if (value->bExpr)
value->u.expr = NULL;
if (!child)
{
- return FALSE;
+ return false;
}
child->flags |= SEL_ALLOCVAL;
if (child->v.type != GROUP_VALUE && (child->flags & SEL_ATOMVAL))
{
*param->nvalptr = -1;
}
- return TRUE;
+ return true;
}
param->flags &= ~SPAR_ATOMVAL;
param->val.nr = 1;
value = values;
i = 0;
- bDynamic = FALSE;
+ bDynamic = false;
while (value && i < param->val.nr)
{
if (value->type != param->val.type)
/* Check that the expression is valid */
if (!child)
{
- return FALSE;
+ return false;
}
if (!set_expr_value_store(child, param, i, scanner))
{
- return FALSE;
+ return false;
}
if (child->flags & SEL_DYNAMIC)
{
- bDynamic = TRUE;
+ bDynamic = true;
}
}
else
if (value->u.r.r1 != value->u.r.r2)
{
_gmx_selparser_error(scanner, "real ranges not supported");
- return FALSE;
+ return false;
}
param->val.u.r[i] = value->u.r.r1;
break;
case GROUP_VALUE:
GMX_ERROR_NORET(gmx::eeInternalError,
"Invalid non-expression value");
- return FALSE;
+ return false;
}
}
++i;
if (value != NULL)
{
_gmx_selparser_error(scanner, "extra values'");
- return FALSE;
+ return false;
}
if (i < param->val.nr)
{
_gmx_selparser_error(scanner, "not enough values");
- return FALSE;
+ return false;
}
if (!bDynamic)
{
}
param->nvalptr = NULL;
- return TRUE;
+ return true;
}
/*! \brief
* \param[in] values Pointer to the list of values.
* \param param Parameter to parse.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the values were parsed successfully, FALSE otherwise.
+ * \returns true if the values were parsed successfully, false otherwise.
*/
-static gmx_bool
+static bool
parse_values_bool(const char *name, int nval, t_selexpr_value *values,
gmx_ana_selparam_t *param, void *scanner)
{
- gmx_bool bSetNo;
+ bool bSetNo;
int len;
if (param->val.type != NO_VALUE)
{
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid boolean parameter");
- return FALSE;
+ return false;
}
if (nval > 1 || (values && values->type != INT_VALUE))
{
_gmx_selparser_error(scanner, "parameter takes only a yes/no/on/off/0/1 value");
- return FALSE;
+ return false;
}
- bSetNo = FALSE;
+ bSetNo = false;
/* Check if the parameter name is given with a 'no' prefix */
len = strlen(name);
if (len > 2 && name[0] == 'n' && name[1] == 'o'
&& strncmp(name+2, param->name, len-2) == 0)
{
- bSetNo = TRUE;
+ bSetNo = true;
}
if (bSetNo && nval > 0)
{
_gmx_selparser_error(scanner, "parameter 'no%s' should not have a value",
param->name);
- return FALSE;
+ return false;
}
if (values && values->u.i.i1 == 0)
{
- bSetNo = TRUE;
+ bSetNo = true;
}
- *param->val.u.b = bSetNo ? FALSE : TRUE;
- return TRUE;
+ *param->val.u.b = bSetNo ? false : true;
+ return true;
}
/*! \brief
* \param[in] values Pointer to the list of values.
* \param param Parameter to parse.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the values were parsed successfully, FALSE otherwise.
+ * \returns true if the values were parsed successfully, false otherwise.
*/
-static gmx_bool
+static bool
parse_values_enum(int nval, t_selexpr_value *values, gmx_ana_selparam_t *param,
void *scanner)
{
if (nval != 1)
{
_gmx_selparser_error(scanner, "a single value is required");
- return FALSE;
+ return false;
}
if (values->type != STR_VALUE || param->val.type != STR_VALUE)
{
GMX_ERROR_NORET(gmx::eeInternalError, "Invalid enum parameter");
- return FALSE;
+ return false;
}
if (values->bExpr)
{
_gmx_selparser_error(scanner, "expression value for enumerated parameter not supported");
- return FALSE;
+ return false;
}
len = strlen(values->u.s);
if (match > 0)
{
_gmx_selparser_error(scanner, "ambiguous value");
- return FALSE;
+ return false;
}
match = i;
}
if (match == 0)
{
_gmx_selparser_error(scanner, "invalid value");
- return FALSE;
+ return false;
}
param->val.u.s[0] = param->val.u.s[match];
- return TRUE;
+ return true;
}
/*! \brief
val->u.expr->type == SEL_CONST)
{
t_selelem *expr = val->u.expr;
- val->bExpr = FALSE;
+ val->bExpr = false;
switch (expr->v.type)
{
case INT_VALUE:
* \param params Array of parameters to parse.
* \param root Selection element to which child expressions are added.
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the parameters were parsed successfully, FALSE otherwise.
+ * \returns true if the parameters were parsed successfully, false otherwise.
*
* Initializes the \p params array based on the parameters in \p pparams.
* See the documentation of \c gmx_ana_selparam_t for different options
* The list \p pparams and any associated values are freed after the parameters
* have been processed, no matter is there was an error or not.
*/
-gmx_bool
+bool
_gmx_sel_parse_params(t_selexpr_param *pparams, int nparam, gmx_ana_selparam_t *params,
t_selelem *root, void *scanner)
{
gmx::MessageStringCollector *errors = _gmx_sel_lexer_error_reporter(scanner);
t_selexpr_param *pparam;
gmx_ana_selparam_t *oparam;
- gmx_bool bOk, rc;
+ bool bOk, rc;
int i;
/* Check that the value pointers of SPAR_VARNUM parameters are NULL and
* that they are not NULL for other parameters */
- bOk = TRUE;
+ bOk = true;
for (i = 0; i < nparam; ++i)
{
std::string contextStr = gmx::formatString("In parameter '%s'", params[i].name);
{
_gmx_selparser_error(scanner, "nvalptr is NULL but both "
"SPAR_VARNUM and SPAR_DYNAMIC are specified");
- bOk = FALSE;
+ bOk = false;
}
}
else
if (params[i].val.u.ptr == NULL)
{
_gmx_selparser_error(scanner, "value pointer is NULL");
- bOk = FALSE;
+ bOk = false;
}
}
}
if (!bOk)
{
_gmx_selexpr_free_params(pparams);
- return FALSE;
+ return false;
}
/* Parse the parameters */
pparam = pparams;
{
oparam = NULL;
_gmx_selparser_error(scanner, "too many NULL parameters provided");
- bOk = FALSE;
+ bOk = false;
pparam = pparam->next;
continue;
}
else
{
_gmx_selparser_error(scanner, "all NULL parameters should appear in the beginning of the list");
- bOk = FALSE;
+ bOk = false;
pparam = pparam->next;
continue;
}
if (!oparam)
{
_gmx_selparser_error(scanner, "unknown parameter skipped");
- bOk = FALSE;
+ bOk = false;
goto next_param;
}
if (oparam->flags & SPAR_SET)
{
_gmx_selparser_error(scanner, "parameter set multiple times, extra values skipped");
- bOk = FALSE;
+ bOk = false;
goto next_param;
}
oparam->flags |= SPAR_SET;
if (convert_values(pparam->value, oparam->val.type, scanner) != 0)
{
_gmx_selparser_error(scanner, "invalid value");
- bOk = FALSE;
+ bOk = false;
goto next_param;
}
if (oparam->val.type == NO_VALUE)
}
if (!rc)
{
- bOk = FALSE;
+ bOk = false;
}
/* Advance to the next parameter */
next_param:
if (!(params[i].flags & SPAR_OPTIONAL) && !(params[i].flags & SPAR_SET))
{
_gmx_selparser_error(scanner, "required parameter '%s' not specified", params[i].name);
- bOk = FALSE;
+ bOk = false;
}
}
* from a variable, otherwise the child type is not \ref SEL_SUBEXPR.
*
*
- * \subsection selparser_tree_gmx_bool Boolean elements
+ * \subsection selparser_tree_bool Boolean elements
*
- * One \ref SEL_BOOLEAN element is created for each gmx_boolean keyword in the
+ * One \ref SEL_BOOLEAN element is created for each boolean keyword in the
* input, and the tree structure represents the evaluation order.
* The \c t_selelem::boolt type gives the type of the operation.
* Each element has exactly two children (one for \ref BOOL_NOT elements),
t_selexpr_value *value;
snew(value, 1);
value->type = type;
- value->bExpr = FALSE;
+ value->bExpr = false;
value->next = NULL;
return value;
}
t_selexpr_value *value;
snew(value, 1);
value->type = expr->v.type;
- value->bExpr = TRUE;
+ value->bExpr = true;
value->u.expr = expr;
value->next = NULL;
return value;
{
t_selelem *child;
int rc;
- gmx_bool bUseChildType=FALSE;
- gmx_bool bOnlySingleChildren;
+ bool bUseChildType=false;
+ bool bOnlySingleChildren;
/* Return if the flags have already been set */
if (sel->flags & SEL_FLAGSSET)
case SEL_CONST:
case SEL_GROUPREF:
sel->flags |= SEL_SINGLEVAL;
- bUseChildType = FALSE;
+ bUseChildType = false;
break;
case SEL_EXPRESSION:
{
sel->flags |= SEL_ATOMVAL;
}
- bUseChildType = FALSE;
+ bUseChildType = false;
break;
case SEL_ARITHMETIC:
sel->flags |= SEL_ATOMVAL;
- bUseChildType = FALSE;
+ bUseChildType = false;
break;
case SEL_MODIFIER:
{
sel->flags |= SEL_VARNUMVAL;
}
- bUseChildType = FALSE;
+ bUseChildType = false;
break;
case SEL_ROOT:
- bUseChildType = FALSE;
+ bUseChildType = false;
break;
case SEL_BOOLEAN:
case SEL_SUBEXPR:
case SEL_SUBEXPRREF:
- bUseChildType = TRUE;
+ bUseChildType = true;
break;
}
/* Loop through children to propagate their flags upwards */
- bOnlySingleChildren = TRUE;
+ bOnlySingleChildren = true;
child = sel->child;
while (child)
{
}
if (!(child->flags & SEL_SINGLEVAL))
{
- bOnlySingleChildren = FALSE;
+ bOnlySingleChildren = false;
}
child = child->next;
/*!
* \param[in] scanner Scanner data structure.
- * \returns TRUE if the parser should finish, FALSE if parsing should
+ * \returns true if the parser should finish, false if parsing should
* continue.
*
* This function is called always after _gmx_sel_append_selection() to
* This is used to terminate interactive parsers when the correct number of
* selections has been provided.
*/
-gmx_bool
+bool
_gmx_sel_parser_should_finish(yyscan_t scanner)
{
gmx_ana_selcollection_t *sc = _gmx_sel_lexer_selcollection(scanner);
{
/** Type of the value. */
e_selvalue_t type;
- /** TRUE if the value is the result of an expression. */
- gmx_bool bExpr;
+ /** true if the value is the result of an expression. */
+ bool bExpr;
/** The actual value. */
union {
/** The integer value/range (\p type INT_VALUE); */
char *s;
/** The position value (\p type POS_VALUE); */
rvec x;
- /** The expression if \p bExpr is TRUE. */
+ /** The expression if \p bExpr is true. */
struct t_selelem *expr;
} u;
/** Pointer to the next value. */
_gmx_sel_append_selection(struct t_selelem *sel, struct t_selelem *last,
void *scanner);
/** Check whether the parser should finish. */
-gmx_bool
+bool
_gmx_sel_parser_should_finish(void *scanner);
/** Handle empty commands. */
/* In params.c */
/** Initializes an array of parameters based on input from the selection parser. */
-gmx_bool
+bool
_gmx_sel_parse_params(t_selexpr_param *pparams, int nparam,
struct gmx_ana_selparam_t *param, struct t_selelem *root,
void *scanner);
/** Pointer to the last data structure. */
gmx_ana_poscalc_t *last;
/** Whether the collection has been initialized for evaluation. */
- gmx_bool bInit;
+ bool bInit;
};
/*! \internal \brief
/** Position storage for calculations that are used as a base. */
gmx_ana_pos_t *p;
- /** TRUE if the positions have been evaluated for the current frame. */
- gmx_bool bEval;
+ /** true if the positions have been evaluated for the current frame. */
+ bool bEval;
/*! \brief
* Base position data for this calculation.
*
}
/*!
- * \param[in] bAtom If TRUE, the "atom" value is included.
+ * \param[in] bAtom If true, the "atom" value is included.
* \returns NULL-terminated array of strings that contains the string
* values acceptable for gmx_ana_poscalc_type_from_enum().
*
* be used with Gromacs command-line parsing.
*/
const char **
-gmx_ana_poscalc_create_type_enum(gmx_bool bAtom)
+gmx_ana_poscalc_create_type_enum(bool bAtom)
{
const char **pcenum;
size_t i;
pcc->top = NULL;
pcc->first = NULL;
pcc->last = NULL;
- pcc->bInit = FALSE;
+ pcc->bInit = false;
*pccp = pcc;
return 0;
}
* \p bBase affects on how the \p pc->gmax field is initialized.
*/
static void
-set_poscalc_maxindex(gmx_ana_poscalc_t *pc, gmx_ana_index_t *g, gmx_bool bBase)
+set_poscalc_maxindex(gmx_ana_poscalc_t *pc, gmx_ana_index_t *g, bool bBase)
{
gmx_ana_index_make_block(&pc->b, pc->coll->top, g, pc->itype, pc->flags & POS_COMPLWHOLE);
/* Set the type to POS_ATOM if the calculation in fact is such. */
/* Setup the gmax field */
if ((pc->flags & POS_COMPLWHOLE) && !bBase && pc->b.nra > g->isize)
{
- gmx_ana_index_copy(&pc->gmax, g, TRUE);
+ gmx_ana_index_copy(&pc->gmax, g, true);
sfree(pc->gmax.name);
pc->gmax.name = NULL;
}
* Checks whether a position calculation should use a base at all.
*
* \param[in] pc Position calculation data to check.
- * \returns TRUE if \p pc can use a base and gets some benefit out of it,
- * FALSE otherwise.
+ * \returns true if \p pc can use a base and gets some benefit out of it,
+ * false otherwise.
*/
-static gmx_bool
+static bool
can_use_base(gmx_ana_poscalc_t *pc)
{
/* For atoms, it should be faster to do a simple copy, so don't use a
* base. */
if (pc->type == POS_ATOM)
{
- return FALSE;
+ return false;
}
/* For dynamic selections that do not use completion, it is not possible
* to use a base. */
if ((pc->type == POS_RES || pc->type == POS_MOL)
&& (pc->flags & POS_DYNAMIC) && !(pc->flags & (POS_COMPLMAX | POS_COMPLWHOLE)))
{
- return FALSE;
+ return false;
}
/* Dynamic calculations for a single position cannot use a base. */
if ((pc->type == POS_ALL || pc->type == POS_ALL_PBC)
&& (pc->flags & POS_DYNAMIC))
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/*! \brief
* \p pc1.
* \param[in,out] g Working space, should have enough allocated memory to
* contain the intersection of the atoms in \p pc1 and \p pc2.
- * \returns TRUE if the two calculations should be merged to use a common
- * base, FALSE otherwise.
+ * \returns true if the two calculations should be merged to use a common
+ * base, false otherwise.
*/
-static gmx_bool
+static bool
should_merge(gmx_ana_poscalc_t *pc1, gmx_ana_poscalc_t *pc2,
gmx_ana_index_t *g1, gmx_ana_index_t *g)
{
/* Do not merge calculations with different mass weighting. */
if ((pc1->flags & POS_MASS) != (pc2->flags & POS_MASS))
{
- return FALSE;
+ return false;
}
/* Avoid messing up complete calculations. */
if ((pc1->flags & POS_COMPLWHOLE) != (pc2->flags & POS_COMPLWHOLE))
{
- return FALSE;
+ return false;
}
/* Find the overlap between the calculations. */
gmx_ana_index_set(&g2, pc2->b.nra, pc2->b.a, NULL, 0);
/* Do not merge if there is no overlap. */
if (g->isize == 0)
{
- return FALSE;
+ return false;
}
/* Full completion calculations always match if the type is correct. */
if ((pc1->flags & POS_COMPLWHOLE) && (pc2->flags & POS_COMPLWHOLE)
&& pc1->type == pc2->type)
{
- return TRUE;
+ return true;
}
/* The calculations also match if the intersection consists of full
* blocks. */
if (gmx_ana_index_has_full_ablocks(g, &pc1->b)
&& gmx_ana_index_has_full_ablocks(g, &pc2->b))
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*! \brief
flags = pc->flags & ~(POS_DYNAMIC | POS_MASKONLY);
gmx_ana_poscalc_create(&base, pc->coll, pc->type, flags);
- set_poscalc_maxindex(base, &pc->gmax, TRUE);
+ set_poscalc_maxindex(base, &pc->gmax, true);
snew(base->p, 1);
void
gmx_ana_poscalc_set_maxindex(gmx_ana_poscalc_t *pc, gmx_ana_index_t *g)
{
- set_poscalc_maxindex(pc, g, FALSE);
+ set_poscalc_maxindex(pc, g, false);
setup_base(pc);
}
/*!
* \param[in] pc Position calculation data to query.
- * \returns TRUE if \p pc requires topology for initialization and/or
- * evaluation, FALSE otherwise.
+ * \returns true if \p pc requires topology for initialization and/or
+ * evaluation, false otherwise.
*/
-gmx_bool
+bool
gmx_ana_poscalc_requires_top(gmx_ana_poscalc_t *pc)
{
if ((pc->flags & POS_MASS) || pc->type == POS_RES || pc->type == POS_MOL)
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*!
}
pc = pc->next;
}
- pcc->bInit = TRUE;
+ pcc->bInit = true;
}
/*!
pc = pcc->first;
while (pc)
{
- pc->bEval = FALSE;
+ pc->bEval = false;
pc = pc->next;
}
}
{
int i, j, bi, bj;
- if (pc->bEval == TRUE && !(pc->flags & POS_MASKONLY))
+ if (pc->bEval == true && !(pc->flags & POS_MASKONLY))
{
return;
}
/* Update the index map */
if (pc->flags & POS_DYNAMIC)
{
- gmx_ana_indexmap_update(&p->m, g, FALSE);
+ gmx_ana_indexmap_update(&p->m, g, false);
p->nr = p->m.nr;
}
else if (pc->flags & POS_MASKONLY)
{
- gmx_ana_indexmap_update(&p->m, g, TRUE);
+ gmx_ana_indexmap_update(&p->m, g, true);
if (pc->bEval)
return;
}
if (!(pc->flags & POS_DYNAMIC))
{
- pc->bEval = TRUE;
+ pc->bEval = true;
}
/* Evaluate the positions */
gmx_ana_poscalc_type_from_enum(const char *post, e_poscalc_t *type, int *flags);
/** Creates a list of strings for position enum parameter handling. */
const char **
-gmx_ana_poscalc_create_type_enum(gmx_bool bAtom);
+gmx_ana_poscalc_create_type_enum(bool bAtom);
/** Creates a new position calculation collection object. */
int
/** Frees the memory allocated for position calculation. */
void
gmx_ana_poscalc_free(gmx_ana_poscalc_t *pc);
-/** Returns TRUE if the position calculation requires topology information. */
-gmx_bool
+/** Returns true if the position calculation requires topology information. */
+bool
gmx_ana_poscalc_requires_top(gmx_ana_poscalc_t *pc);
/** Initializes evaluation for a position calculation collection. */
/*!
* \param[in,out] dest Destination positions.
* \param[in] src Source positions.
- * \param[in] bFirst If TRUE, memory is allocated for \p dest and a full
+ * \param[in] bFirst If true, memory is allocated for \p dest and a full
* copy is made; otherwise, only variable parts are copied, and no memory
* is allocated.
*
* \p dest should have been initialized somehow (calloc() is enough).
*/
void
-gmx_ana_pos_copy(gmx_ana_pos_t *dest, gmx_ana_pos_t *src, gmx_bool bFirst)
+gmx_ana_pos_copy(gmx_ana_pos_t *dest, gmx_ana_pos_t *src, bool bFirst)
{
if (bFirst)
{
pos->m.b.index[0] = 0;
/* This function should only be used to construct all the possible
* positions, so the result should always be static. */
- pos->m.bStatic = TRUE;
- pos->m.bMapStatic = TRUE;
+ pos->m.bStatic = true;
+ pos->m.bMapStatic = true;
}
/*!
pos->m.mapb.nr = 0;
/* This should not really be necessary, but do it for safety... */
pos->m.mapb.index[0] = 0;
- /* We set the flags to TRUE, although really in the empty state they
- * should be FALSE. This makes it possible to update the flags in
+ /* We set the flags to true, although really in the empty state they
+ * should be false. This makes it possible to update the flags in
* gmx_ana_pos_append(), and just make a simple check in
* gmx_ana_pos_append_finish(). */
- pos->m.bStatic = TRUE;
- pos->m.bMapStatic = TRUE;
+ pos->m.bStatic = true;
+ pos->m.bMapStatic = true;
}
/*!
if (refid < 0)
{
dest->m.refid[j] = -1;
- dest->m.bStatic = FALSE;
+ dest->m.bStatic = false;
/* If we are using masks, there is no need to alter the
* mapid field. */
}
{
if (refid != j)
{
- dest->m.bStatic = FALSE;
- dest->m.bMapStatic = FALSE;
+ dest->m.bStatic = false;
+ dest->m.bMapStatic = false;
}
dest->m.refid[j] = refid;
/* Use the original IDs from the output structure to correctly
{
if (pos->m.nr != pos->m.b.nr)
{
- pos->m.bStatic = FALSE;
- pos->m.bMapStatic = FALSE;
+ pos->m.bStatic = false;
+ pos->m.bMapStatic = false;
}
}
#include "indexutil.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*! \brief
* Stores a set of positions together with their origins.
*/
gmx_ana_pos_free(gmx_ana_pos_t *pos);
/** Copies the evaluated positions to a preallocated data structure. */
void
-gmx_ana_pos_copy(gmx_ana_pos_t *dest, gmx_ana_pos_t *src, gmx_bool bFirst);
+gmx_ana_pos_copy(gmx_ana_pos_t *dest, gmx_ana_pos_t *src, bool bFirst);
/** Sets the number of positions in a position structure. */
void
void
gmx_ana_pos_append_finish(gmx_ana_pos_t *pos);
-#ifdef __cplusplus
-}
-#endif
-
#endif
if (state->bMatchOf)
{
BEGIN(matchof);
- state->bMatchOf = FALSE;
+ state->bMatchOf = false;
}
else if (state->bMatchBool)
{
BEGIN(matchbool);
- state->bMatchBool = FALSE;
+ state->bMatchBool = false;
}
else if (state->bCmdStart)
{
void
_gmx_sel_free_lexer(yyscan_t scanner);
-/** Returns TRUE if the scanner is interactive. */
-gmx_bool
+/** Returns true if the scanner is interactive. */
+bool
_gmx_sel_is_lexer_interactive(yyscan_t scanner);
/** Returns the selection collection for the scanner. */
struct gmx_ana_selcollection_t *
if (state->bMatchOf)
{
BEGIN(matchof);
- state->bMatchOf = FALSE;
+ state->bMatchOf = false;
}
else if (state->bMatchBool)
{
BEGIN(matchbool);
- state->bMatchBool = FALSE;
+ state->bMatchBool = false;
}
else if (state->bCmdStart)
{
#undef yytext
#undef yyleng
-static gmx_bool
+static bool
read_stdin_line(gmx_sel_lexer_t *state)
{
char *ptr = state->inputstr;
if (feof(stdin))
{
- return FALSE;
+ return false;
}
if (state->bInteractive)
{
_gmx_sel_yyblex(YYSTYPE *yylval, yyscan_t yyscanner)
{
gmx_sel_lexer_t *state = _gmx_sel_yyget_extra(yyscanner);
- gmx_bool bCmdStart;
+ bool bCmdStart;
int token;
if (!state->bBuffer && !state->inputstr)
}
static int
-init_param_token(YYSTYPE *yylval, gmx_ana_selparam_t *param, gmx_bool bBoolNo)
+init_param_token(YYSTYPE *yylval, gmx_ana_selparam_t *param, bool bBoolNo)
{
if (bBoolNo)
{
}
static int
-init_method_token(YYSTYPE *yylval, gmx_ana_selmethod_t *method, gmx_bool bPosMod,
+init_method_token(YYSTYPE *yylval, gmx_ana_selmethod_t *method, bool bPosMod,
gmx_sel_lexer_t *state)
{
/* If the previous token was not KEYWORD_POS, return EMPTY_POSMOD
if (state->nextparam)
{
gmx_ana_selparam_t *param = state->nextparam;
- gmx_bool bBoolNo = state->bBoolNo;
+ bool bBoolNo = state->bBoolNo;
if (state->neom > 0)
{
return END_OF_METHOD;
}
state->nextparam = NULL;
- state->bBoolNo = FALSE;
+ state->bBoolNo = false;
_gmx_sel_lexer_add_token(param->name, -1, state);
return init_param_token(yylval, param, bBoolNo);
}
gmx_ana_selmethod_t *method = state->nextmethod;
state->nextmethod = NULL;
- return init_method_token(yylval, method, TRUE, state);
+ return init_method_token(yylval, method, true, state);
}
return 0;
}
if (state->msp >= 0)
{
gmx_ana_selparam_t *param = NULL;
- gmx_bool bBoolNo = FALSE;
+ bool bBoolNo = false;
int sp = state->msp;
while (!param && sp >= 0)
{
param = &state->mstack[sp]->param[i];
break;
}
- /* Check separately for a 'no' prefix on gmx_boolean parameters */
+ /* Check separately for a 'no' prefix on boolean parameters */
if (state->mstack[sp]->param[i].val.type == NO_VALUE
&& yyleng > 2 && yytext[0] == 'n' && yytext[1] == 'o'
&& !strncmp(state->mstack[sp]->param[i].name, yytext+2, yyleng-2))
{
param = &state->mstack[sp]->param[i];
- bBoolNo = TRUE;
+ bBoolNo = true;
break;
}
}
{
if (param->val.type == NO_VALUE && !bBoolNo)
{
- state->bMatchBool = TRUE;
+ state->bMatchBool = true;
}
if (sp < state->msp)
{
}
/* Check if the identifier matches with a symbol */
- symbol = _gmx_sel_find_symbol_len(state->sc->symtab, yytext, yyleng, FALSE);
+ symbol = _gmx_sel_find_symbol_len(state->sc->symtab, yytext, yyleng, false);
/* If there is no match, return the token as a string */
if (!symbol)
{
* some additional handling. */
if (symtype == SYMBOL_POS)
{
- state->bMatchOf = TRUE;
+ state->bMatchOf = true;
yylval->str = _gmx_sel_sym_name(symbol);
state->prev_pos_kw = 2;
return KEYWORD_POS;
state->nextparam = NULL;
state->nextmethod = NULL;
state->prev_pos_kw = 0;
- state->bBoolNo = FALSE;
- state->bMatchOf = FALSE;
- state->bMatchBool = FALSE;
- state->bCmdStart = TRUE;
- state->bBuffer = FALSE;
+ state->bBoolNo = false;
+ state->bMatchOf = false;
+ state->bMatchBool = false;
+ state->bCmdStart = true;
+ state->bBuffer = false;
_gmx_sel_yyset_extra(state, *scannerp);
}
_gmx_sel_yylex_destroy(scanner);
}
-gmx_bool
+bool
_gmx_sel_is_lexer_interactive(yyscan_t scanner)
{
gmx_sel_lexer_t *state = _gmx_sel_yyget_extra(scanner);
{
gmx_sel_lexer_t *state = _gmx_sel_yyget_extra(scanner);
- state->bBuffer = TRUE;
+ state->bBuffer = true;
state->buffer = _gmx_sel_yy_create_buffer(fp, YY_BUF_SIZE, scanner);
_gmx_sel_yy_switch_to_buffer(state->buffer, scanner);
}
{
_gmx_sel_yy_delete_buffer(state->buffer, scanner);
}
- state->bBuffer = TRUE;
+ state->bBuffer = true;
state->buffer = _gmx_sel_yy_scan_string(str, scanner);
}
int nexpsel;
//! Whether the parser is interactive.
- gmx_bool bInteractive;
+ bool bInteractive;
//! Current input string (line) for an interactive scanner.
char *inputstr;
//! Number of bytes allocated for \a inputstr.
//! 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;
+ bool bBoolNo;
/*! \brief
* Method symbol to return before resuming scanning
*
int prev_pos_kw;
//! Whether the 'of' keyword is acceptable as the next token.
- gmx_bool bMatchOf;
+ bool bMatchOf;
//! Whether boolean values (yes/no/on/off) are acceptable as the next token.
- gmx_bool bMatchBool;
+ bool bMatchBool;
//! Whether the next token starts a new selection.
- gmx_bool bCmdStart;
+ bool bCmdStart;
//! Whether an external buffer is set for the scanner.
- gmx_bool bBuffer;
+ bool bBuffer;
//! The current buffer for the scanner.
YY_BUFFER_STATE buffer;
} gmx_sel_lexer_t;
if (elem->child->type == SEL_CONST)
{
- gmx_ana_pos_copy(&_sel.p, elem->child->v.u.p, TRUE);
- _sel.bDynamic = FALSE;
+ gmx_ana_pos_copy(&_sel.p, elem->child->v.u.p, true);
+ _sel.bDynamic = false;
}
else
{
sel->cfractype = type;
if (type == CFRAC_NONE || !sel->selelem)
{
- sel->bCFracDyn = FALSE;
+ sel->bCFracDyn = false;
}
else if (!_gmx_selelem_can_estimate_cover(sel->selelem))
{
sel->cfractype = CFRAC_NONE;
- sel->bCFracDyn = FALSE;
+ sel->bCFracDyn = false;
}
else
{
- sel->bCFracDyn = TRUE;
+ sel->bCFracDyn = true;
}
sel->cfrac = sel->bCFracDyn ? 0.0 : 1.0;
sel->avecfrac = sel->cfrac;
real *q;
/** Pointer to the index group that holds the selected atoms. */
struct gmx_ana_index_t *g;
- /** TRUE if the value can change as a function of time. */
- gmx_bool bDynamic;
+ /** true if the value can change as a function of time. */
+ bool bDynamic;
/** Type of the covered fraction. */
e_coverfrac_t cfractype;
- /** TRUE if the covered fraction depends on the frame. */
- gmx_bool bCFracDyn;
+ /** true if the covered fraction depends on the frame. */
+ bool bCFracDyn;
/** Covered fraction of the selection for the current frame. */
real cfrac;
/** The average covered fraction (over the trajectory). */
*/
Options &options = _impl->_options;
- const char **postypes = gmx_ana_poscalc_create_type_enum(TRUE);
+ const char **postypes = gmx_ana_poscalc_create_type_enum(true);
if (postypes == NULL)
{
// TODO: Use an out-of-memory exception here
gmx_ana_poscalc_type_from_enum(_impl->_rpost.c_str(), &type, &flags);
if (type != POS_ATOM)
{
- return TRUE;
+ return true;
}
}
if (!_impl->_spost.empty())
gmx_ana_poscalc_type_from_enum(_impl->_spost.c_str(), &type, &flags);
if (type != POS_ATOM)
{
- return TRUE;
+ return true;
}
}
{
if (_gmx_selelem_requires_top(sel))
{
- return TRUE;
+ return true;
}
sel = sel->next;
}
- return FALSE;
+ return false;
}
/*! \copydoc _gmx_selelem_type_str() */
const char *
-_gmx_selelem_gmx_boolean_type_str(t_selelem *sel)
+_gmx_selelem_boolean_type_str(t_selelem *sel)
{
switch (sel->u.boolt)
{
* \returns Pointer to the newly allocated and initialized element.
*
* \c t_selelem::type is set to \p type,
- * \c t_selelem::v::type is set to \ref GROUP_VALUE for gmx_boolean and comparison
+ * \c t_selelem::v::type is set to \ref GROUP_VALUE for boolean and comparison
* expressions and \ref NO_VALUE for others,
* \ref SEL_ALLOCVAL is set for non-root elements (\ref SEL_ALLOCDATA is also
* set for \ref SEL_BOOLEAN elements),
/*!
* \param[in] fp File handle to receive the output.
* \param[in] sel Root of the selection subtree to print.
- * \param[in] bValues If TRUE, the evaluated values of selection elements
+ * \param[in] bValues If true, the evaluated values of selection elements
* are printed as well.
* \param[in] level Indentation level, starting from zero.
*/
void
-_gmx_selelem_print_tree(FILE *fp, t_selelem *sel, gmx_bool bValues, int level)
+_gmx_selelem_print_tree(FILE *fp, t_selelem *sel, bool bValues, int level)
{
t_selelem *child;
int i;
}
else if (sel->type == SEL_BOOLEAN)
{
- fprintf(fp, " %s", _gmx_selelem_gmx_boolean_type_str(sel));
+ fprintf(fp, " %s", _gmx_selelem_boolean_type_str(sel));
}
else if (sel->type == SEL_EXPRESSION
&& sel->u.expr.method->name == sm_compare.name)
/*!
* \param[in] root Root of the subtree to query.
- * \returns TRUE if \p root or any any of its elements require topology
- * information, FALSE otherwise.
+ * \returns true if \p root or any any of its elements require topology
+ * information, false otherwise.
*/
-gmx_bool
+bool
_gmx_selelem_requires_top(t_selelem *root)
{
t_selelem *child;
{
if (root->u.expr.method && (root->u.expr.method->flags & SMETH_REQTOP))
{
- return TRUE;
+ return true;
}
if (root->u.expr.pc && gmx_ana_poscalc_requires_top(root->u.expr.pc))
{
- return TRUE;
+ return true;
}
}
child = root->child;
{
if (_gmx_selelem_requires_top(child))
{
- return TRUE;
+ return true;
}
child = child->next;
}
- return FALSE;
+ return false;
}
SEL_MODIFIER
} e_selelem_t;
-/** Defines the gmx_boolean operation of \c t_selelem objects with type \ref SEL_BOOLEAN. */
+/** Defines the boolean operation of \c t_selelem objects with type \ref SEL_BOOLEAN. */
typedef enum
{
BOOL_NOT, /**< Not */
/** Returns a string representation of the type of a \c t_selelem. */
extern const char *
_gmx_selelem_type_str(struct t_selelem *sel);
-/** Returns a string representation of the gmx_boolean type of a \ref SEL_BOOLEAN \c t_selelem. */
+/** Returns a string representation of the boolean type of a \ref SEL_BOOLEAN \c t_selelem. */
extern const char *
-_gmx_selelem_gmx_boolean_type_str(struct t_selelem *sel);
+_gmx_selelem_boolean_type_str(struct t_selelem *sel);
/** Returns a string representation of the type of a \c gmx_ana_selvalue_t. */
extern const char *
_gmx_sel_value_type_str(gmx_ana_selvalue_t *val);
/** Prints a human-readable version of a selection element subtree. */
extern void
-_gmx_selelem_print_tree(FILE *fp, t_selelem *root, gmx_bool bValues, int level);
+_gmx_selelem_print_tree(FILE *fp, t_selelem *root, bool bValues, int level);
/* In compile.c */
/** Prints a human-readable version of the internal compiler data structure. */
extern void
_gmx_selelem_print_compiler_info(FILE *fp, t_selelem *sel, int level);
-/** Returns TRUE if the selection element subtree requires topology information for evaluation. */
-extern gmx_bool
+/** Returns true if the selection element subtree requires topology information for evaluation. */
+extern bool
_gmx_selelem_requires_top(t_selelem *root);
/* In sm_insolidangle.c */
-/** Returns TRUE if the covered fraction of the selection can be calculated. */
-extern gmx_bool
+/** Returns true if the covered fraction of the selection can be calculated. */
+extern bool
_gmx_selelem_can_estimate_cover(t_selelem *sel);
/** Returns the covered fraction of the selection for the current frame. */
extern real
"1. An expression like [TT]NUM_EXPR1 < NUM_EXPR2[tt] evaluates to an",
"[TT]ATOM_EXPR[tt] that selects all the atoms for which the comparison",
"is true.[BR]",
- "2. Atom expressions can be combined with gmx_boolean operations such as",
+ "2. Atom expressions can be combined with boolean operations such as",
"[TT]not ATOM_EXPR[tt], [TT]ATOM_EXPR and ATOM_EXPR[tt], or",
"[TT]ATOM_EXPR or ATOM_EXPR[tt]. Parentheses can be used to alter the",
"evaluation order.[BR]",
* \param[in] fp Where to write the list.
* \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
+ * \param[in] bMod If false, \ref SMETH_MODIFIER methods are excluded, otherwise
* only them are printed.
*/
static void
print_keyword_list(FILE *fp, gmx_sel_symtab_t *symtab, e_selvalue_t type,
- gmx_bool bMod)
+ bool bMod)
{
gmx_sel_symrec_t *symbol;
while (symbol)
{
gmx_ana_selmethod_t *method = _gmx_sel_sym_value_method(symbol);
- gmx_bool bShow;
+ bool bShow;
bShow = (method->type == type)
&& ((bMod && (method->flags & SMETH_MODIFIER))
|| (!bMod && !(method->flags & SMETH_MODIFIER)));
&& strncmp(method->name, topic, strlen(topic)) == 0)
{
print_tty_formatted(fp, method->help.nlhelp,
- method->help.help, 0, NULL, NULL, FALSE);
+ method->help.help, 0, NULL, NULL, false);
return;
}
symbol = _gmx_sel_next_symbol(symbol, SYMBOL_METHOD);
return;
}
/* Print the help */
- print_tty_formatted(fp, item->nl, item->text, 0, NULL, NULL, FALSE);
+ print_tty_formatted(fp, item->nl, item->text, 0, NULL, NULL, false);
/* Special handling of certain pages */
if (!topic)
{
/* Print the list of keywords */
fprintf(fp, "\nKeywords that select atoms by an integer property:\n");
fprintf(fp, "(use in expressions or like \"atomnr 1 to 5 7 9\")\n");
- print_keyword_list(fp, symtab, INT_VALUE, FALSE);
+ print_keyword_list(fp, symtab, INT_VALUE, false);
fprintf(fp, "\nKeywords that select atoms by a numeric property:\n");
fprintf(fp, "(use in expressions or like \"occupancy 0.5 to 1\")\n");
- print_keyword_list(fp, symtab, REAL_VALUE, FALSE);
+ print_keyword_list(fp, symtab, REAL_VALUE, false);
fprintf(fp, "\nKeywords that select atoms by a string property:\n");
fprintf(fp, "(use like \"name PATTERN [PATTERN] ...\")\n");
- print_keyword_list(fp, symtab, STR_VALUE, FALSE);
+ print_keyword_list(fp, symtab, STR_VALUE, false);
fprintf(fp, "\nAdditional keywords that directly select atoms:\n");
- print_keyword_list(fp, symtab, GROUP_VALUE, FALSE);
+ print_keyword_list(fp, symtab, GROUP_VALUE, false);
fprintf(fp, "\nKeywords that directly evaluate to positions:\n");
fprintf(fp, "(see also \"help positions\")\n");
- print_keyword_list(fp, symtab, POS_VALUE, FALSE);
+ print_keyword_list(fp, symtab, POS_VALUE, false);
fprintf(fp, "\nAdditional keywords:\n");
- print_keyword_list(fp, symtab, POS_VALUE, TRUE);
- print_keyword_list(fp, symtab, NO_VALUE, TRUE);
+ print_keyword_list(fp, symtab, POS_VALUE, true);
+ print_keyword_list(fp, symtab, NO_VALUE, true);
}
}
* \param[in] name Name of the method (used for error messages).
* \param[in] nparams Number of parameters in \p param.
* \param[in,out] param Parameter array
- * (only the \c flags field of gmx_boolean parameters may be modified).
+ * (only the \c flags field of boolean parameters may be modified).
* \param[in] symtab Symbol table (used for checking overlaps).
- * \returns TRUE if there are no problems with the parameters,
- * FALSE otherwise.
+ * \returns true if there are no problems with the parameters,
+ * false otherwise.
*
* This function performs some checks common to both check_method() and
* check_modifier().
* If you remove a check, make sure that the parameter parser can handle the
* resulting parameters.
*/
-static gmx_bool
+static bool
check_params(FILE *fp, const char *name, int nparams, gmx_ana_selparam_t param[],
gmx_sel_symtab_t *symtab)
{
- gmx_bool bOk = TRUE;
+ bool bOk = true;
gmx_sel_symrec_t *sym;
int i, j;
if (nparams > 0 && !param)
{
report_error(fp, name, "error: missing parameter data");
- bOk = FALSE;
- return FALSE;
+ bOk = false;
+ return false;
}
if (nparams == 0 && param)
{
if (param[i].name == NULL && i > 0)
{
report_error(fp, name, "error: NULL parameter should be the first one");
- bOk = FALSE;
+ bOk = false;
continue;
}
/* Check for duplicates */
if (!gmx_strcasecmp(param[i].name, param[j].name))
{
report_error(fp, name, "error: duplicate parameter name '%s'", param[i].name);
- bOk = FALSE;
+ bOk = false;
break;
}
}
if (param[i].val.type != INT_VALUE && param[i].val.type != REAL_VALUE)
{
report_param_error(fp, name, param[i].name, "error: SPAR_RANGES cannot be set for a non-numeric parameter");
- bOk = FALSE;
+ bOk = false;
}
if (param[i].flags & SPAR_DYNAMIC)
{
if (!(param[i].flags & SPAR_VARNUM) && param[i].val.nr != 1)
{
report_param_error(fp, name, param[i].name, "error: range should take either one or an arbitrary number of values");
- bOk = FALSE;
+ bOk = false;
}
if (param[i].flags & SPAR_ATOMVAL)
{
report_param_error(fp, name, param[i].name, "error: SPAR_RANGES and SPAR_ATOMVAL both set");
- bOk = FALSE;
+ bOk = false;
}
}
if ((param[i].flags & SPAR_VARNUM) && (param[i].flags & SPAR_ATOMVAL))
{
report_param_error(fp, name, param[i].name, "error: SPAR_VARNUM and SPAR_ATOMVAL both set");
- bOk = FALSE;
+ bOk = false;
}
if (param[i].flags & SPAR_ENUMVAL)
{
if (param[i].val.type != STR_VALUE)
{
report_param_error(fp, name, param[i].name, "error: SPAR_ENUMVAL can only be set for string parameters");
- bOk = FALSE;
+ bOk = false;
}
if (param[i].val.nr != 1)
{
report_param_error(fp, name, param[i].name, "error: SPAR_ENUMVAL parameters should take exactly one value");
- bOk = FALSE;
+ bOk = false;
}
if (param[i].flags & (SPAR_DYNAMIC | SPAR_VARNUM | SPAR_ATOMVAL))
{
report_param_error(fp, name, param[i].name, "error: only SPAR_OPTIONAL supported with SPAR_ENUMVAL");
- bOk = FALSE;
+ bOk = false;
}
}
- /* Check gmx_boolean parameters */
+ /* Check boolean parameters */
if (param[i].val.type == NO_VALUE)
{
if (param[i].val.nr != 0)
{
- report_param_error(fp, name, param[i].name, "error: number of values should be zero for gmx_boolean parameters");
- bOk = FALSE;
+ report_param_error(fp, name, param[i].name, "error: number of values should be zero for boolean parameters");
+ bOk = false;
}
- /* The gmx_boolean parameters should always be optional, so set the
+ /* The boolean parameters should always be optional, so set the
* flag for convenience. */
param[i].flags |= SPAR_OPTIONAL;
/* Any other flags should not be specified */
if (param[i].flags & ~SPAR_OPTIONAL)
{
- report_param_error(fp, name, param[i].name, "error: gmx_boolean parameter should not have any flags set");
- bOk = FALSE;
+ report_param_error(fp, name, param[i].name, "error: boolean parameter should not have any flags set");
+ bOk = false;
}
}
/* Check val.nr */
if (param[i].val.nr <= 0)
{
report_param_error(fp, name, param[i].name, "error: val.nr <= 0");
- bOk = FALSE;
+ bOk = false;
}
}
/* Check that the value pointer is NULL */
if (!isalpha(param[i].name[0]))
{
report_param_error(fp, name, param[i].name, "error: name does not begin with a letter");
- bOk = FALSE;
+ bOk = false;
continue;
}
for (j = 1; param[i].name[j] != 0; ++j)
if (param[i].name[j] != '_' && !isalnum(param[i].name[j]))
{
report_param_error(fp, name, param[i].name, "error: name contains non-alphanumeric characters");
- bOk = FALSE;
+ bOk = false;
break;
}
}
continue;
}
/* Check that the name does not conflict with a method */
- if (_gmx_sel_find_symbol(symtab, param[i].name, TRUE))
+ if (_gmx_sel_find_symbol(symtab, param[i].name, true))
{
report_param_error(fp, name, param[i].name, "error: name conflicts with another method or a keyword");
- bOk = FALSE;
+ bOk = false;
}
} /* End of parameter loop */
/* Check parameters of existing methods */
if (param)
{
report_param_error(fp, method->name, param->name, "error: name conflicts with another method or a keyword");
- bOk = FALSE;
+ bOk = false;
}
sym = _gmx_sel_next_symbol(sym, SYMBOL_METHOD);
}
* \param[in] fp File handle to use for diagnostic messages
* (can be NULL).
* \param[in] method The method to check.
- * \returns TRUE if there are no problems, FALSE otherwise.
+ * \returns true if there are no problems, false otherwise.
*
* This function performs some checks common to both check_method() and
* check_modifier().
* This function checks that all the required callbacks are defined, i.e.,
* not NULL, to find programming errors.
*/
-static gmx_bool
+static bool
check_callbacks(FILE *fp, gmx_ana_selmethod_t *method)
{
- gmx_bool bOk = TRUE;
- gmx_bool bNeedInit;
+ bool bOk = true;
+ bool bNeedInit;
int i;
/* Make some checks on init_data and free */
if (method->nparams > 0 && !method->init_data)
{
report_error(fp, method->name, "error: init_data should be provided because the method has parameters");
- bOk = FALSE;
+ bOk = false;
}
if (method->free && !method->init_data)
{
if (method->type == POS_VALUE && !method->outinit)
{
report_error(fp, method->name, "error: outinit should be provided because the method has POS_VALUE");
- bOk = FALSE;
+ bOk = false;
}
/* Warn of dynamic callbacks in static methods */
if (!(method->flags & SMETH_MODIFIER))
if (method->type != NO_VALUE && !method->update && !method->pupdate)
{
report_error(fp, method->name, "error: evaluation function missing");
- bOk = FALSE;
+ bOk = false;
}
/* Loop through the parameters to determine if initialization callbacks
* are needed. */
- bNeedInit = FALSE;
+ bNeedInit = false;
for (i = 0; i < method->nparams; ++i)
{
if (method->param[i].val.type != POS_VALUE
&& (method->param[i].flags & (SPAR_VARNUM | SPAR_ATOMVAL)))
{
- bNeedInit = TRUE;
+ bNeedInit = true;
}
}
/* Check that the callbacks required by the parameters are present */
if (bNeedInit && !method->init)
{
report_error(fp, method->name, "error: init should be provided");
- bOk = FALSE;
+ bOk = false;
}
return bOk;
}
* If you remove a check, please make sure that the selection parser,
* compiler, and evaluation functions can deal with the method.
*/
-static gmx_bool
+static bool
check_method(FILE *fp, gmx_ana_selmethod_t *method, gmx_sel_symtab_t *symtab)
{
- gmx_bool bOk = TRUE;
+ bool bOk = true;
/* Check the type */
if (method->type == NO_VALUE)
{
report_error(fp, method->name, "error: no value type specified");
- bOk = FALSE;
+ bOk = false;
}
if (method->type == STR_VALUE && method->nparams > 0)
{
report_error(fp, method->name, "error: evaluates to a string but is not a keyword");
- bOk = FALSE;
+ bOk = false;
}
/* Check flags */
if (method->type == GROUP_VALUE)
if (method->flags & SMETH_VARNUMVAL)
{
report_error(fp, method->name, "error: SMETH_VARNUMVAL cannot be set for group-valued methods");
- bOk = FALSE;
+ bOk = false;
}
}
else
&& (method->flags & SMETH_VARNUMVAL))
{
report_error(fp, method->name, "error: SMETH_SINGLEVAL and SMETH_VARNUMVAL both set");
- bOk = FALSE;
+ bOk = false;
}
}
if ((method->flags & SMETH_CHARVAL) && method->type != STR_VALUE)
{
report_error(fp, method->name, "error: SMETH_CHARVAL can only be specified for STR_VALUE methods");
- bOk = FALSE;
+ bOk = false;
}
/* Check the parameters */
if (!check_params(fp, method->name, method->nparams, method->param, symtab))
{
- bOk = FALSE;
+ bOk = false;
}
/* Check the callback pointers */
if (!check_callbacks(fp, method))
{
- bOk = FALSE;
+ bOk = false;
}
return bOk;
* If you remove a check, please make sure that the selection parser,
* compiler, and evaluation functions can deal with the method.
*/
-static gmx_bool
+static bool
check_modifier(FILE *fp, gmx_ana_selmethod_t *method, gmx_sel_symtab_t *symtab)
{
- gmx_bool bOk = TRUE;
+ bool bOk = true;
/* Check the type */
if (method->type != NO_VALUE && method->type != POS_VALUE)
{
report_error(fp, method->name, "error: modifier should have type POS_VALUE or NO_VALUE");
- bOk = FALSE;
+ bOk = false;
}
/* Check flags */
if (method->flags & (SMETH_SINGLEVAL | SMETH_VARNUMVAL))
{
report_error(fp, method->name, "error: modifier should not have SMETH_SINGLEVAL or SMETH_VARNUMVAL set");
- bOk = FALSE;
+ bOk = false;
}
/* Check the parameters */
/* The first parameter is skipped */
if (!check_params(fp, method->name, method->nparams-1, method->param+1, symtab))
{
- bOk = FALSE;
+ bOk = false;
}
/* Check the callback pointers */
if (!check_callbacks(fp, method))
{
- bOk = FALSE;
+ bOk = false;
}
if (method->update)
{
report_error(fp, method->name, "error: modifier should not have update");
- bOk = FALSE;
+ bOk = false;
}
if (method->type == POS_VALUE && !method->pupdate)
{
report_error(fp, method->name, "error: evaluation function missing");
- bOk = FALSE;
+ bOk = false;
}
return bOk;
gmx_ana_selmethod_register(gmx_sel_symtab_t *symtab,
const char *name, gmx_ana_selmethod_t *method)
{
- gmx_bool bOk;
+ bool bOk;
/* Check the method */
if (method->flags & SMETH_MODIFIER)
{
if (!_gmx_sel_add_method_symbol(symtab, name, method))
{
- bOk = FALSE;
+ bOk = false;
}
}
if (!bOk)
{
size_t i;
int rc;
- gmx_bool bOk;
+ bool bOk;
- bOk = TRUE;
+ bOk = true;
for (i = 0; i < asize(smtable_def); ++i)
{
gmx_ana_selmethod_t *method = smtable_def[i].method;
}
if (rc != 0)
{
- bOk = FALSE;
+ bOk = false;
}
}
return bOk ? 0 : -1;
#include "indexutil.h"
#include "selvalue.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/*! \name Parameter flags
* \anchor selparam_flags
*/
gmx_ana_selparam_t *
gmx_ana_selparam_find(const char *name, int nparam, gmx_ana_selparam_t *param);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "../legacyheaders/types/simple.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/** Defines the value type of a different selection objects. */
typedef enum
{
- NO_VALUE, /**< No value; either an error condition or an gmx_boolean
+ NO_VALUE, /**< No value; either an error condition or an boolean
parameter. */
INT_VALUE, /**< One or more integer values. */
REAL_VALUE, /**< One or more real values. */
/** Group value (type \ref GROUP_VALUE). */
struct gmx_ana_index_t *g;
/** Boolean value (only parameters of type \ref NO_VALUE); */
- gmx_bool *b;
+ bool *b;
} u;
/*! \brief
* Number of elements allocated for the value array.
int
_gmx_selvalue_setstore_alloc(gmx_ana_selvalue_t *val, void *ptr, int nalloc);
-#ifdef __cplusplus
-}
-#endif
-
#endif
* \param[in] n Number of values in the \p val->u array.
* \param[in,out] val Value to convert.
* \param[in] cmpt Comparison operator type.
- * \param[in] bRight TRUE if \p val appears on the right hand size of
+ * \param[in] bRight true if \p val appears on the right hand size of
* \p cmpt.
* \returns 0 on success, EINVAL on error.
*
* The values are rounded such that the same comparison operator can be used.
*/
static void
-convert_real_int(int n, t_compare_value *val, e_comparison_t cmpt, gmx_bool bRight)
+convert_real_int(int n, t_compare_value *val, e_comparison_t cmpt, bool bRight)
{
int i;
int *iv;
}
else /* d->left is static */
{
- convert_real_int(n1, &d->left, d->cmpt, FALSE);
+ convert_real_int(n1, &d->left, d->cmpt, false);
}
}
else if (!(d->left.flags & CMP_REALVAL) && (d->right.flags & CMP_REALVAL))
}
else /* d->right is static */
{
- convert_real_int(n2, &d->right, d->cmpt, TRUE);
+ convert_real_int(n2, &d->right, d->cmpt, true);
}
}
}
t_methoddata_compare *d = (t_methoddata_compare *)data;
int i, i1, i2, ig;
int a, b;
- gmx_bool bAccept;
+ bool bAccept;
for (i = i1 = i2 = ig = 0; i < g->isize; ++i)
{
a = d->left.i[i1];
b = d->right.i[i2];
- bAccept = FALSE;
+ bAccept = false;
switch (d->cmpt)
{
case CMP_INVALID: break;
t_methoddata_compare *d = (t_methoddata_compare *)data;
int i, i1, i2, ig;
real a, b;
- gmx_bool bAccept;
+ bool bAccept;
for (i = i1 = i2 = ig = 0; i < g->isize; ++i)
{
a = d->left.r[i1];
b = (d->right.flags & CMP_REALVAL) ? d->right.r[i2] : d->right.i[i2];
- bAccept = FALSE;
+ bAccept = false;
switch (d->cmpt)
{
case CMP_INVALID: break;
static void
init_frame_insolidangle(t_topology *top, t_trxframe *fr, t_pbc *pbc, void *data);
/** Internal helper function for evaluate_insolidangle(). */
-static gmx_bool
+static bool
accept_insolidangle(rvec x, t_pbc *pbc, void *data);
/** Evaluates the \p insolidangle selection method. */
static void
static real
estimate_covered_fraction(t_methoddata_insolidangle *surf);
/** Checks whether a point lies within a solid angle. */
-static gmx_bool
+static bool
is_surface_covered(t_methoddata_insolidangle *surf, rvec x);
/** Parameters for the \p insolidangle selection method. */
* \param[in] x Test point.
* \param[in] pbc PBC data (if NULL, no PBC are used).
* \param[in] data Pointer to a \c t_methoddata_insolidangle data structure.
- * \returns TRUE if \p x is within the solid angle, FALSE otherwise.
+ * \returns true if \p x is within the solid angle, false otherwise.
*/
-static gmx_bool
+static bool
accept_insolidangle(rvec x, t_pbc *pbc, void *data)
{
t_methoddata_insolidangle *d = (t_methoddata_insolidangle *)data;
/*!
* \param[in] sel Selection element to query.
- * \returns TRUE if the covered fraction can be estimated for \p sel with
- * _gmx_selelem_estimate_coverfrac(), FALSE otherwise.
+ * \returns true if the covered fraction can be estimated for \p sel with
+ * _gmx_selelem_estimate_coverfrac(), false otherwise.
*/
-gmx_bool
+bool
_gmx_selelem_can_estimate_cover(t_selelem *sel)
{
t_selelem *child;
- gmx_bool bFound;
- gmx_bool bDynFound;
+ bool bFound;
+ bool bDynFound;
if (sel->type == SEL_BOOLEAN && sel->u.boolt == BOOL_OR)
{
- return FALSE;
+ return false;
}
- bFound = FALSE;
- bDynFound = FALSE;
+ bFound = false;
+ bDynFound = false;
child = sel->child;
while (child)
{
{
if (bFound || bDynFound)
{
- return FALSE;
+ return false;
}
- bFound = TRUE;
+ bFound = true;
}
else if (child->u.expr.method
&& (child->u.expr.method->flags & SMETH_DYNAMIC))
{
if (bFound)
{
- return FALSE;
+ return false;
}
- bDynFound = TRUE;
+ bDynFound = true;
}
}
else if (!_gmx_selelem_can_estimate_cover(child))
{
- return FALSE;
+ return false;
}
child = child->next;
}
- return TRUE;
+ return true;
}
/*!
* \returns Fraction of angles covered by the selection (between zero and one).
*
* The return value is undefined if _gmx_selelem_can_estimate_cover() returns
- * FALSE.
+ * false.
* Should be called after gmx_ana_evaluate_selections() has been called for the
* frame.
*/
/*!
* \param[in] surf Surface data structure to search.
* \param[in] x Unit vector to check.
- * \returns TRUE if \p x is within the solid angle, FALSE otherwise.
+ * \returns true if \p x is within the solid angle, false otherwise.
*/
-static gmx_bool
+static bool
is_surface_covered(t_methoddata_insolidangle *surf, rvec x)
{
int bin, i;
/* Check for completely covered bin */
if (surf->bin[bin].n == -1)
{
- return TRUE;
+ return true;
}
/* Check each point that partially covers the bin */
for (i = 0; i < surf->bin[bin].n; ++i)
{
if (sph_distc(x, surf->bin[bin].x[i]) < surf->distccut)
{
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
* Array of strings/regular expressions to match against.
*/
struct t_methoddata_kwstr_match {
- /** TRUE if the expression is a regular expression, FALSE otherwise. */
- gmx_bool bRegExp;
+ /** true if the expression is a regular expression, false otherwise. */
+ bool bRegExp;
/** The value to match against. */
union {
#ifdef USE_REGEX
- /** Compiled regular expression if \p bRegExp is TRUE. */
+ /** Compiled regular expression if \p bRegExp is true. */
regex_t r;
#endif
- /** The string if \p bRegExp is FALSE; */
+ /** The string if \p bRegExp is false; */
char *s;
} u;
} *m;
char *s;
int i;
size_t j;
- gmx_bool bRegExp;
+ bool bRegExp;
d->v = param[0].val.u.s;
d->n = param[1].val.nr;
for (i = 0; i < d->n; ++i)
{
s = param[1].val.u.s[i];
- bRegExp = FALSE;
+ bRegExp = false;
for (j = 0; j < strlen(s); ++j)
{
if (ispunct(s[j]) && s[j] != '?' && s[j] != '*')
{
- bRegExp = TRUE;
+ bRegExp = true;
break;
}
}
sprintf(buf, "^%s$", s);
if (regcomp(&d->m[i].u.r, buf, REG_EXTENDED | REG_NOSUB))
{
- bRegExp = FALSE;
+ bRegExp = false;
fprintf(stderr, "WARNING: error in regular expression,\n"
" will match '%s' as a simple string\n", s);
}
sfree(buf);
#else
- bRegExp = FALSE;
+ bRegExp = false;
fprintf(stderr, "WARNING: no regular expressions support,\n"
" will match '%s' as a simple string\n", s);
#endif
{
t_methoddata_kwstr *d = (t_methoddata_kwstr *)data;
int i, j;
- gmx_bool bFound;
+ bool bFound;
out->u.g->isize = 0;
for (i = 0; i < g->isize; ++i)
{
- bFound = FALSE;
+ bFound = false;
for (j = 0; j < d->n && !bFound; ++j)
{
if (d->m[j].bRegExp)
* are available, but the ifdef is still needed. */
if (!regexec(&d->m[j].u.r, d->v[i], 0, NULL, 0))
{
- bFound = TRUE;
+ bFound = true;
}
#endif
}
{
if (gmx_wcmatch(d->m[j].u.s, d->v[i]) == 0)
{
- bFound = TRUE;
+ bFound = true;
}
}
}
t_methoddata_permute *d = (t_methoddata_permute *)data;
int i, j, b, k;
- gmx_ana_pos_copy(out->u.p, &d->p, TRUE);
+ gmx_ana_pos_copy(out->u.p, &d->p, true);
gmx_ana_pos_set_evalgrp(out->u.p, &d->g);
d->g.isize = 0;
gmx_ana_pos_empty_init(out->u.p);
gmx_ana_index_t g;
/** Position evaluation data structure. */
gmx_ana_poscalc_t *pc;
- /** TRUE if periodic boundary conditions should be used. */
- gmx_bool bPBC;
+ /** true if periodic boundary conditions should be used. */
+ bool bPBC;
/** Type of positions to calculate. */
char *type;
/** Flags for the position calculation. */
param[1].val.u.b = &data->bPBC;
}
data->pc = NULL;
- data->bPBC = FALSE;
+ data->bPBC = false;
data->type = NULL;
data->flags = -1;
return data;
*/
char **as_s_sorted;
/** Whether simple matching can be used. */
- gmx_bool bSorted;
+ bool bSorted;
} t_methoddata_same;
/** Allocates data for the \p same selection method. */
int i, j;
/* Collapse adjacent values, and check whether the array is sorted. */
- d->bSorted = TRUE;
+ d->bSorted = true;
for (i = 1, j = 0; i < d->nas; ++i)
{
if (d->as.i[i] != d->as.i[j])
{
if (d->as.i[i] < d->as.i[j])
{
- d->bSorted = FALSE;
+ d->bSorted = false;
}
++j;
d->as.i[j] = d->as.i[i];
}
if (j < g->isize && d->val.i[j] < d->val.i[j - 1])
{
- d->bSorted = FALSE;
+ d->bSorted = false;
}
}
}
/* Collapse adjacent values.
* For strings, it's unlikely that the values would be sorted originally,
- * so set bSorted always to FALSE. */
- d->bSorted = FALSE;
+ * so set bSorted always to false. */
+ d->bSorted = false;
d->as_s_sorted[0] = d->as.s[0];
for (i = 1, j = 0; i < d->nas; ++i)
{
evaluate_all(t_topology *top, t_trxframe *fr, t_pbc *pbc,
gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
{
- gmx_ana_index_copy(out->u.g, g, FALSE);
+ gmx_ana_index_copy(out->u.g, g, false);
}
/*!
static void
check_molecules(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
{
- gmx_bool bOk;
+ bool bOk;
bOk = (top != NULL && top->mols.nr > 0);
if (!bOk)
static void
check_atomtype(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
{
- gmx_bool bOk;
+ bool bOk;
bOk = (top != NULL && top->atoms.atomtype != NULL);
if (!bOk)
static void
check_pdbinfo(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
{
- gmx_bool bOk;
+ bool bOk;
bOk = (top != NULL && top->atoms.pdbinfo != NULL);
if (!bOk)
gmx_sel_symrec_t *last;
int i;
- postypes = gmx_ana_poscalc_create_type_enum(TRUE);
+ postypes = gmx_ana_poscalc_create_type_enum(true);
last = tab->first;
while (last && last->next)
{
/*!
* \param[in] tab Symbol table to search.
* \param[in] name Symbol name to find.
- * \param[in] bExact If FALSE, symbols that begin with \p name are also
+ * \param[in] bExact If false, symbols that begin with \p name are also
* considered.
* \returns Pointer to the symbol with name \p name, or NULL if not found.
*
- * If no exact match is found and \p bExact is FALSE, returns a symbol that
+ * If no exact match is found and \p bExact is false, returns a symbol that
* begins with \p name if a unique matching symbol is found.
*/
gmx_sel_symrec_t *
-_gmx_sel_find_symbol(gmx_sel_symtab_t *tab, const char *name, gmx_bool bExact)
+_gmx_sel_find_symbol(gmx_sel_symtab_t *tab, const char *name, bool bExact)
{
return _gmx_sel_find_symbol_len(tab, name, strlen(name), bExact);
}
* \param[in] tab Symbol table to search.
* \param[in] name Symbol name to find.
* \param[in] len Only consider the first \p len characters of \p name.
- * \param[in] bExact If FALSE, symbols that begin with \p name are also
+ * \param[in] bExact If false, symbols that begin with \p name are also
* considered.
* \returns Pointer to the symbol with name \p name, or NULL if not found.
*
- * If no exact match is found and \p bExact is FALSE, returns a symbol that
+ * If no exact match is found and \p bExact is false, returns a symbol that
* begins with \p name if a unique matching symbol is found.
*
* The parameter \p len is there to allow using this function from scanner.l
*/
gmx_sel_symrec_t *
_gmx_sel_find_symbol_len(gmx_sel_symtab_t *tab, const char *name, size_t len,
- gmx_bool bExact)
+ bool bExact)
{
gmx_sel_symrec_t *sym;
gmx_sel_symrec_t *match;
- gmx_bool bUnique;
- gmx_bool bMatch;
+ bool bUnique;
+ bool bMatch;
match = NULL;
- bUnique = TRUE;
- bMatch = FALSE;
+ bUnique = true;
+ bMatch = false;
sym = tab->first;
while (sym)
{
}
if (bMatch)
{
- bUnique = FALSE;
+ bUnique = false;
}
- bMatch = TRUE;
+ bMatch = true;
if (sym->type == SYMBOL_METHOD)
{
match = sym;
_gmx_sel_symtab_free(gmx_sel_symtab_t *tab);
/** Finds a symbol by name. */
gmx_sel_symrec_t *
-_gmx_sel_find_symbol(gmx_sel_symtab_t *tab, const char *name, gmx_bool bExact);
+_gmx_sel_find_symbol(gmx_sel_symtab_t *tab, const char *name, bool bExact);
/** Finds a symbol by name. */
gmx_sel_symrec_t *
_gmx_sel_find_symbol_len(gmx_sel_symtab_t *tab, const char *name, size_t len,
- gmx_bool bExact);
+ bool bExact);
/** Returns the first symbol of a given type. */
gmx_sel_symrec_t *
_gmx_sel_first_symbol(gmx_sel_symtab_t *tab, e_symbol_t type);
/*! \brief
* Sets whether PBC are used.
*
- * \param[in] bPBC TRUE if PBC should be used.
+ * \param[in] bPBC true if PBC should be used.
*
* If called in TrajectoryAnalysisModule::initOptions(), this function
* sets the default for whether PBC are used in the analysis.
/*! \brief
* Sets whether molecules are made whole.
*
- * \param[in] bRmPBC TRUE if molecules should be made whole.
+ * \param[in] bRmPBC true if molecules should be made whole.
*
* If called in TrajectoryAnalysisModule::initOptions(), this function
* sets the default for whether molecules are made whole.
if (mdh != NULL)
{
- gmx_ana_indexmap_update(d->_mmap, sel[0]->indexGroup(), TRUE);
+ gmx_ana_indexmap_update(d->_mmap, sel[0]->indexGroup(), true);
mdh->startFrame(frnr, fr.time);
for (int b = 0; b < d->_mmap->nr; ++b)
{
bool
TrajectoryAnalysisRunnerCommon::readNextFrame()
{
- bool bContinue = FALSE;
+ bool bContinue = false;
if (hasTrajectory())
{
bContinue = read_next_frame(_impl->_oenv, _impl->_status, _impl->fr);