Exemplo n.º 1
0
/*!
 * \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.
 */
bool
_gmx_selelem_requires_top(const gmx::SelectionTreeElement &root)
{
    if (root.type == SEL_EXPRESSION || root.type == SEL_MODIFIER)
    {
        if (root.u.expr.method && (root.u.expr.method->flags & SMETH_REQTOP))
        {
            return true;
        }
        if (root.u.expr.pc && gmx_ana_poscalc_requires_top(root.u.expr.pc))
        {
            return true;
        }
    }
    gmx::SelectionTreeElementPointer child = root.child;
    while (child)
    {
        if (_gmx_selelem_requires_top(*child))
        {
            return true;
        }
        child = child->next;
    }
    return false;
}
Exemplo n.º 2
0
/*!
 * \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.
 */
bool
_gmx_selelem_requires_top(t_selelem *root)
{
    t_selelem *child;

    if (root->type == SEL_EXPRESSION || root->type == SEL_MODIFIER)
    {
        if (root->u.expr.method && (root->u.expr.method->flags & SMETH_REQTOP))
        {
            return true;
        }
        if (root->u.expr.pc && gmx_ana_poscalc_requires_top(root->u.expr.pc))
        {
            return true;
        }
    }
    child = root->child;
    while (child)
    {
        if (_gmx_selelem_requires_top(child))
        {
            return true;
        }
        child = child->next;
    }
    return false;
}
Exemplo n.º 3
0
bool
SelectionCollection::requiresTopology() const
{
    e_poscalc_t  type;
    int          flags;

    if (!impl_->rpost_.empty())
    {
        flags = 0;
        // Should not throw, because has been checked earlier.
        PositionCalculationCollection::typeFromEnum(impl_->rpost_.c_str(),
                                                    &type, &flags);
        if (type != POS_ATOM)
        {
            return true;
        }
    }
    if (!impl_->spost_.empty())
    {
        flags = 0;
        // Should not throw, because has been checked earlier.
        PositionCalculationCollection::typeFromEnum(impl_->spost_.c_str(),
                                                    &type, &flags);
        if (type != POS_ATOM)
        {
            return true;
        }
    }

    SelectionTreeElementPointer sel = impl_->sc_.root;
    while (sel)
    {
        if (_gmx_selelem_requires_top(*sel))
        {
            return true;
        }
        sel = sel->next;
    }
    return false;
}
Exemplo n.º 4
0
bool
SelectionCollection::requiresTopology() const
{
    t_selelem   *sel;
    e_poscalc_t  type;
    int          flags;

    if (!_impl->_rpost.empty())
    {
        flags = 0;
        // Should not throw, because has been checked earlier.
        gmx_ana_poscalc_type_from_enum(_impl->_rpost.c_str(), &type, &flags);
        if (type != POS_ATOM)
        {
            return true;
        }
    }
    if (!_impl->_spost.empty())
    {
        flags = 0;
        // Should not throw, because has been checked earlier.
        gmx_ana_poscalc_type_from_enum(_impl->_spost.c_str(), &type, &flags);
        if (type != POS_ATOM)
        {
            return true;
        }
    }

    sel = _impl->_sc.root;
    while (sel)
    {
        if (_gmx_selelem_requires_top(sel))
        {
            return true;
        }
        sel = sel->next;
    }
    return false;
}
Exemplo n.º 5
0
/*!
 * \param[in]  sc  Selection collection to query.
 * \returns    TRUE if any selection in \p sc requires topology information,
 *   FALSE otherwise.
 *
 * Before gmx_ana_selcollection_parse_*(), the return value is based just on
 * the position types set.
 * After gmx_ana_selcollection_parse_*(), the return value also takes into account the
 * selection keywords used.
 */
bool
gmx_ana_selcollection_requires_top(gmx_ana_selcollection_t *sc)
{
    t_selelem   *sel;
    e_poscalc_t  type;
    int          flags;
    int          rc;

    if (sc->rpost)
    {
        flags = 0;
        rc = gmx_ana_poscalc_type_from_enum(sc->rpost, &type, &flags);
        if (rc == 0 && type != POS_ATOM)
        {
            return TRUE;
        }
    }
    if (sc->spost)
    {
        flags = 0;
        rc = gmx_ana_poscalc_type_from_enum(sc->spost, &type, &flags);
        if (rc == 0 && type != POS_ATOM)
        {
            return TRUE;
        }
    }

    sel = sc->root;
    while (sel)
    {
        if (_gmx_selelem_requires_top(sel))
        {
            return TRUE;
        }
        sel = sel->next;
    }
    return FALSE;
}