void
AbstractAnalysisDataStored::startNextFrame(real x, real dx)
{
    // Start storing the frame if needed.
    if (_impl->_nalloc > 0)
    {
        if (_impl->_nextind >= _impl->_nalloc)
        {
            if (_impl->_bStoreAll)
            {
                int ncol = columnCount();

                _impl->_nalloc = _impl->_nextind + 1;
                _impl->_store.resize(_impl->_nalloc);
                for (int i = _impl->_nextind; i < _impl->_nalloc; ++i)
                {
                    _impl->_store[i] = new AnalysisDataFrame();
                    _impl->_store[i]->allocate(ncol);
                }
            }
            else
            {
                _impl->_nextind = 0;
            }
        }

        _impl->_store[_impl->_nextind]->_x  = x;
        _impl->_store[_impl->_nextind]->_dx = dx;
    }

    // Notify any modules.
    notifyFrameStart(x, dx);
}
Exemple #2
0
void
AnalysisDataDisplacementModule::frameFinished(const AnalysisDataFrameHeader & /*header*/)
{
    if (_impl->nstored <= 1)
    {
        return;
    }

    int step, i;

    if (_impl->nstored == 2)
    {
        if (_impl->histm)
        {
            _impl->histm->init(histogramFromBins(0, _impl->max_store / _impl->nmax,
                                                 _impl->dt).integerBins());
        }
        notifyDataStart();
    }
    AnalysisDataFrameHeader header(_impl->nstored - 2, _impl->t, 0);
    notifyFrameStart(header);

    for (i = _impl->ci - _impl->nmax, step = 1;
         step < _impl->nstored && i != _impl->ci;
         i -= _impl->nmax, ++step)
    {
        if (i < 0)
        {
            i += _impl->max_store;
        }
        _impl->currValues_.clear();
        _impl->currValues_.push_back(AnalysisDataValue(step * _impl->dt));
        int k = 1;
        for (int j = 0; j < _impl->nmax; j += _impl->ndim, ++k)
        {
            real dist2 = 0.0;

            for (int d = 0; d < _impl->ndim; ++d)
            {
                real displ = _impl->oldval[_impl->ci + j + d]
                    - _impl->oldval[i + j + d];
                dist2 += displ * displ;
            }
            _impl->currValues_.push_back(AnalysisDataValue(dist2));
        }
        notifyPointsAdd(AnalysisDataPointSetRef(header, _impl->currValues_));
    }

    notifyFrameFinish(header);
}
void
AnalysisDataDisplacementModule::frameFinished()
{
    if (_impl->nstored <= 1)
    {
        return;
    }

    int step, i;
    int rc;

    if (_impl->nstored == 2)
    {
        if (_impl->histm)
        {
            _impl->histm->initNBins(0, _impl->dt,
                                    _impl->max_store / _impl->nmax, true);
        }
        notifyDataStart();
    }
    notifyFrameStart(_impl->t, 0);

    for (i = _impl->ci - _impl->nmax, step = 1;
         step < _impl->nstored && i != _impl->ci;
         i -= _impl->nmax, ++step)
    {
        if (i < 0)
        {
            i += _impl->max_store;
        }
        _impl->currd[0] = step * _impl->dt;
        int k = 1;
        for (int j = 0; j < _impl->nmax; j += _impl->ndim, ++k)
        {
            real dist2 = 0.0;

            for (int d = 0; d < _impl->ndim; ++d)
            {
                dist2 += sqr(_impl->oldval[_impl->ci + j + d]
                             - _impl->oldval[i + j + d]);
            }
            _impl->currd[k] = dist2;
        }
        notifyPointsAdd(0, k, _impl->currd, NULL, NULL);
    }

    notifyFrameFinish();
}