Exemplo n.º 1
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);
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
void
AbstractAnalysisDataStored::storeThisFrame(const real *y, const real *dy,
                                           const bool *present)
{
    int ncol = columnCount();

    // Store the values if required.
    if (_impl->_nextind >= 0)
    {
        AnalysisDataFrame *fr = _impl->_store[_impl->_nextind];

        for (int i = 0; i < ncol; ++i)
        {
            fr->_y[i] = y[i];
            if (dy)
            {
                fr->_dy[i] = dy[i];
            }
            if (present)
            {
                fr->_present[i] = present[i];
            }
        }
    }
    ++_impl->_nframes;

    // Notify modules of new data.
    notifyPointsAdd(0, ncol, y, dy, present);
    // The index needs to be incremented after the notifications to allow
    // the modules to use getData() properly.
    if (_impl->_nextind >= 0)
    {
        ++_impl->_nextind;
    }
    notifyFrameFinish();
}