void
Selection::printInfo(FILE *fp) const
{
    fprintf(fp, "\"%s\" (%d position%s, %d atom%s%s)", name(),
            posCount(),  posCount()  == 1 ? "" : "s",
            atomCount(), atomCount() == 1 ? "" : "s",
            isDynamic() ? ", dynamic" : "");
    fprintf(fp, "\n");
}
void
SelectionData::initializeMassesAndCharges(const t_topology *top)
{
    GMX_ASSERT(posMass_.empty() && posCharge_.empty(),
               "Should not be called more than once");
    posMass_.reserve(posCount());
    posCharge_.reserve(posCount());
    if (top == NULL)
    {
        posMass_.resize(posCount(), 1.0);
        posCharge_.resize(posCount(), 0.0);
    }
    else
    {
        computeMassesAndCharges(top, rawPositions_, &posMass_, &posCharge_);
    }
}
/*!

*/
void
PlayerObject::updateByHear( const SideID heard_side,
                            const int heard_unum,
                            const bool goalie,
                            const Vector2D & heard_pos )
{
    M_heard_pos = heard_pos;
    M_heard_pos_count = 0;

    M_ghost_count = 0;

    if ( heard_side != NEUTRAL )
    {
        M_side = heard_side;
    }

    if ( heard_unum != Unum_Unknown
         && unumCount() > 0 )
    {
        M_unum = heard_unum;
        //M_unum_count = 1;
    }

    if ( goalie )
    {
        M_goalie = true;
    }

    if ( posCount() >= 2
         || distFromSelf() > 20.0 )
    {
        M_pos = heard_pos;

        if ( posCount() > 1 )
        {
            M_pos_count = 1;
        }
    }
}
void
Selection::printDebugInfo(FILE *fp, int nmaxind) const
{
    const gmx_ana_pos_t &p = data().rawPositions_;

    fprintf(fp, "  ");
    printInfo(fp);
    fprintf(fp, "    Group ");
    gmx_ana_index_t g;
    gmx_ana_index_set(&g, p.m.mapb.nra, p.m.mapb.a, 0);
    gmx_ana_index_dump(fp, &g, nmaxind);

    fprintf(fp, "    Block (size=%d):", p.m.mapb.nr);
    if (!p.m.mapb.index)
    {
        fprintf(fp, " (null)");
    }
    else
    {
        int n = p.m.mapb.nr;
        if (nmaxind >= 0 && n > nmaxind)
        {
            n = nmaxind;
        }
        for (int i = 0; i <= n; ++i)
        {
            fprintf(fp, " %d", p.m.mapb.index[i]);
        }
        if (n < p.m.mapb.nr)
        {
            fprintf(fp, " ...");
        }
    }
    fprintf(fp, "\n");

    int n = posCount();
    if (nmaxind >= 0 && n > nmaxind)
    {
        n = nmaxind;
    }
    fprintf(fp, "    RefId:");
    if (!p.m.refid)
    {
        fprintf(fp, " (null)");
    }
    else
    {
        for (int i = 0; i < n; ++i)
        {
            fprintf(fp, " %d", p.m.refid[i]);
        }
        if (n < posCount())
        {
            fprintf(fp, " ...");
        }
    }
    fprintf(fp, "\n");

    fprintf(fp, "    MapId:");
    if (!p.m.mapid)
    {
        fprintf(fp, " (null)");
    }
    else
    {
        for (int i = 0; i < n; ++i)
        {
            fprintf(fp, " %d", p.m.mapid[i]);
        }
        if (n < posCount())
        {
            fprintf(fp, " ...");
        }
    }
    fprintf(fp, "\n");
}