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. }
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; }
void AbstractPlotModule::frameStarted(const AnalysisDataFrameHeader &frame) { if (!isFileOpen()) { return; } if (!impl_->bOmitX_) { std::fprintf(impl_->fp_, impl_->xformat_, frame.x() * impl_->xscale_); } }