Пример #1
0
void
AnalysisDataLifetimeModule::frameStarted(const AnalysisDataFrameHeader &header)
{
    if (header.index() == 0)
    {
        impl_->firstx_ = header.x();
    }
    impl_->lastx_ = header.x();
    ++impl_->frameCount_;
    // TODO: Check the input for even spacing.
}
Пример #2
0
void
AnalysisDataFrameAverageModule::frameFinished(const AnalysisDataFrameHeader &header)
{
    AnalysisDataStorageFrame &frame =
        impl_->storage_.currentFrame(header.index());
    const int                 samples = impl_->sampleCount_;
    if (samples > 0)
    {
        frame.value(0) /= samples;
    }
    impl_->storage_.finishFrame(header.index());
}
Пример #3
0
void
AnalysisDataDisplacementModule::frameStarted(const AnalysisDataFrameHeader &header)
{
    // Initialize times.
    if (_impl->bFirst)
    {
        _impl->t0 = header.x();
    }
    else if (_impl->dt <= 0)
    {
        _impl->dt = header.x() - _impl->t0;
        if (_impl->dt < 0 || gmx_within_tol(_impl->dt, 0.0, GMX_REAL_EPS))
        {
            GMX_THROW(APIError("Identical or decreasing frame times"));
        }
    }
    else
    {
        if (!gmx_within_tol(header.x() - _impl->t, _impl->dt, GMX_REAL_EPS))
        {
            GMX_THROW(APIError("Frames not evenly spaced"));
        }
    }
    _impl->t = header.x();

    // Allocate memory for all the positions once it is possible.
    if (_impl->max_store == -1 && !_impl->bFirst)
    {
        _impl->max_store = _impl->nmax * (int)(_impl->tmax/_impl->dt + 1);
        srenew(_impl->oldval, _impl->max_store);
    }

    // Increment the index where current positions are stored.
    _impl->ci += _impl->nmax;
    if (_impl->ci >= _impl->max_store)
    {
        _impl->ci = 0;
    }

/*
    for (int i = 0; i < _impl->nmax; ++i)
    {
        _impl->p[_impl->ci + i].bPres = false;
    }
 */
    _impl->nstored++;
    _impl->bFirst = false;
}
Пример #4
0
void
AbstractAnalysisData::notifyFrameStart(const AnalysisDataFrameHeader &header) const
{
    GMX_ASSERT(impl_->bInData_, "notifyDataStart() not called");
    GMX_ASSERT(!impl_->bInFrame_,
               "notifyFrameStart() called while inside a frame");
    GMX_ASSERT(header.index() == impl_->nframes_,
               "Out of order frames");
    impl_->bInFrame_ = true;
    impl_->currIndex_ = header.index();

    Impl::ModuleList::const_iterator i;
    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
    {
        (*i)->frameStarted(header);
    }
}
Пример #5
0
void
MockAnalysisDataModule::Impl::finishReferenceFrame(
        const AnalysisDataFrameHeader &header)
{
    EXPECT_TRUE(frameChecker_.get() != NULL);
    EXPECT_EQ(frameIndex_, header.index());
    ++frameIndex_;
    frameChecker_.reset();
}
Пример #6
0
void
AbstractPlotModule::frameStarted(const AnalysisDataFrameHeader &frame)
{
    if (!isFileOpen())
    {
        return;
    }
    if (!impl_->bOmitX_)
    {
        std::fprintf(impl_->fp_, impl_->xformat_, frame.x() * impl_->xscale_);
    }
}
void
AnalysisDataModuleManager::notifyFrameStart(const AnalysisDataFrameHeader &header) const
{
    GMX_ASSERT(impl_->state_ == Impl::eInData, "Invalid call sequence");
    GMX_ASSERT(header.index() == impl_->currIndex_, "Out of order frames");
    impl_->state_     = Impl::eInFrame;

    if (impl_->bSerialModules_)
    {
        Impl::ModuleList::const_iterator i;
        for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
        {
            if (!i->bParallel)
            {
                i->module->frameStarted(header);
            }
        }
    }
}
Пример #8
0
void
AbstractAnalysisData::notifyFrameFinish(const AnalysisDataFrameHeader &header)
{
    GMX_ASSERT(impl_->bInData_, "notifyDataStart() not called");
    GMX_ASSERT(impl_->bInFrame_, "notifyFrameStart() not called");
    GMX_ASSERT(header.index() == impl_->currIndex_,
               "Header does not correspond to current frame");
    impl_->bInFrame_ = false;
    impl_->currIndex_ = -1;

    // Increment the counter before notifications to allow frame access from
    // modules.
    ++impl_->nframes_;

    Impl::ModuleList::const_iterator i;
    for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
    {
        (*i)->frameFinished(header);
    }
}
void
AnalysisDataModuleManager::notifyFrameFinish(const AnalysisDataFrameHeader &header) const
{
    GMX_ASSERT(impl_->state_ == Impl::eInFrame, "notifyFrameStart() not called");
    GMX_ASSERT(header.index() == impl_->currIndex_,
               "Header does not correspond to current frame");
    // TODO: Add a check for the frame count in the source data including this
    // frame.
    impl_->state_ = Impl::eInData;
    ++impl_->currIndex_;

    if (impl_->bSerialModules_)
    {
        Impl::ModuleList::const_iterator i;
        for (i = impl_->modules_.begin(); i != impl_->modules_.end(); ++i)
        {
            if (!i->bParallel)
            {
                i->module->frameFinished(header);
            }
        }
    }
}
Пример #10
0
void
AnalysisDataFrameAverageModule::frameFinished(const AnalysisDataFrameHeader &header)
{
    impl_->storage_.finishFrame(header.index());
}