/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010-2017, The GROMACS development team.
+ * Copyright (c) 2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
class AnalysisDataHandleImpl
{
- public:
- //! Creates a handle associated with the given data object.
- explicit AnalysisDataHandleImpl(AnalysisData *data)
- : data_(*data), currentFrame_(nullptr)
- {
- }
-
- //! The data object that this handle belongs to.
- AnalysisData &data_;
- //! Current storage frame object, or NULL if no current frame.
- AnalysisDataStorageFrame *currentFrame_;
+public:
+ //! Creates a handle associated with the given data object.
+ explicit AnalysisDataHandleImpl(AnalysisData* data) : data_(*data), currentFrame_(nullptr) {}
+
+ //! The data object that this handle belongs to.
+ AnalysisData& data_;
+ //! Current storage frame object, or NULL if no current frame.
+ AnalysisDataStorageFrame* currentFrame_;
};
-} // namespace internal
+} // namespace internal
/********************************************************************
* AnalysisData::Impl
*/
class AnalysisData::Impl
{
- public:
- //! Smart pointer type to manage a data handle implementation.
- typedef std::unique_ptr<internal::AnalysisDataHandleImpl>
- HandlePointer;
- //! Shorthand for a list of data handles.
- typedef std::vector<HandlePointer> HandleList;
-
- //! Storage implementation.
- AnalysisDataStorage storage_;
- /*! \brief
- * List of handles for this data object.
- *
- * Note that AnalysisDataHandle objects also contain (raw) pointers
- * to these objects.
- */
- HandleList handles_;
+public:
+ //! Smart pointer type to manage a data handle implementation.
+ typedef std::unique_ptr<internal::AnalysisDataHandleImpl> HandlePointer;
+ //! Shorthand for a list of data handles.
+ typedef std::vector<HandlePointer> HandleList;
+
+ //! Storage implementation.
+ AnalysisDataStorage storage_;
+ /*! \brief
+ * List of handles for this data object.
+ *
+ * Note that AnalysisDataHandle objects also contain (raw) pointers
+ * to these objects.
+ */
+ HandleList handles_;
};
/********************************************************************
* AnalysisData
*/
-AnalysisData::AnalysisData()
- : impl_(new Impl)
-{
-}
+AnalysisData::AnalysisData() : impl_(new Impl) {}
-AnalysisData::~AnalysisData()
-{
-}
+AnalysisData::~AnalysisData() {}
-void
-AnalysisData::setDataSetCount(int dataSetCount)
+void AnalysisData::setDataSetCount(int dataSetCount)
{
GMX_RELEASE_ASSERT(impl_->handles_.empty(),
"Cannot change data dimensionality after creating handles");
}
-void
-AnalysisData::setColumnCount(int dataSet, int columnCount)
+void AnalysisData::setColumnCount(int dataSet, int columnCount)
{
GMX_RELEASE_ASSERT(impl_->handles_.empty(),
"Cannot change data dimensionality after creating handles");
}
-void
-AnalysisData::setMultipoint(bool bMultipoint)
+void AnalysisData::setMultipoint(bool bMultipoint)
{
- GMX_RELEASE_ASSERT(impl_->handles_.empty(),
- "Cannot change data type after creating handles");
+ GMX_RELEASE_ASSERT(impl_->handles_.empty(), "Cannot change data type after creating handles");
AbstractAnalysisData::setMultipoint(bMultipoint);
}
-int
-AnalysisData::frameCount() const
+int AnalysisData::frameCount() const
{
return impl_->storage_.frameCount();
}
-AnalysisDataHandle
-AnalysisData::startData(const AnalysisDataParallelOptions &opt)
+AnalysisDataHandle AnalysisData::startData(const AnalysisDataParallelOptions& opt)
{
GMX_RELEASE_ASSERT(impl_->handles_.size() < static_cast<unsigned>(opt.parallelizationFactor()),
"Too many calls to startData() compared to provided options");
}
-void
-AnalysisData::finishFrameSerial(int frameIndex)
+void AnalysisData::finishFrameSerial(int frameIndex)
{
impl_->storage_.finishFrameSerial(frameIndex);
}
-void
-AnalysisData::finishData(AnalysisDataHandle handle)
+void AnalysisData::finishData(AnalysisDataHandle handle)
{
Impl::HandleList::iterator i;
break;
}
}
- GMX_RELEASE_ASSERT(i != impl_->handles_.end(),
- "finishData() called for an unknown handle");
+ GMX_RELEASE_ASSERT(i != impl_->handles_.end(), "finishData() called for an unknown handle");
impl_->handles_.erase(i);
}
-AnalysisDataFrameRef
-AnalysisData::tryGetDataFrameInternal(int index) const
+AnalysisDataFrameRef AnalysisData::tryGetDataFrameInternal(int index) const
{
return impl_->storage_.tryGetDataFrame(index);
}
-bool
-AnalysisData::requestStorageInternal(int nframes)
+bool AnalysisData::requestStorageInternal(int nframes)
{
return impl_->storage_.requestStorage(nframes);
}
* AnalysisDataHandle
*/
-AnalysisDataHandle::AnalysisDataHandle()
- : impl_(nullptr)
-{
-}
+AnalysisDataHandle::AnalysisDataHandle() : impl_(nullptr) {}
-AnalysisDataHandle::AnalysisDataHandle(internal::AnalysisDataHandleImpl *impl)
- : impl_(impl)
-{
-}
+AnalysisDataHandle::AnalysisDataHandle(internal::AnalysisDataHandleImpl* impl) : impl_(impl) {}
-void
-AnalysisDataHandle::startFrame(int index, real x, real dx)
+void AnalysisDataHandle::startFrame(int index, real x, real dx)
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->currentFrame_ == nullptr,
"startFrame() called twice without calling finishFrame()");
- impl_->currentFrame_ =
- &impl_->data_.impl_->storage_.startFrame(index, x, dx);
+ impl_->currentFrame_ = &impl_->data_.impl_->storage_.startFrame(index, x, dx);
}
-void
-AnalysisDataHandle::selectDataSet(int index)
+void AnalysisDataHandle::selectDataSet(int index)
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
}
-void
-AnalysisDataHandle::setPoint(int column, real value, bool bPresent)
+void AnalysisDataHandle::setPoint(int column, real value, bool bPresent)
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
}
-void
-AnalysisDataHandle::setPoint(int column, real value, real error, bool bPresent)
+void AnalysisDataHandle::setPoint(int column, real value, real error, bool bPresent)
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
}
-void
-AnalysisDataHandle::setPoints(int firstColumn, int count, const real *values,
- bool bPresent)
+void AnalysisDataHandle::setPoints(int firstColumn, int count, const real* values, bool bPresent)
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
}
-void
-AnalysisDataHandle::finishPointSet()
+void AnalysisDataHandle::finishPointSet()
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->data_.isMultipoint(),
}
-void
-AnalysisDataHandle::finishFrame()
+void AnalysisDataHandle::finishFrame()
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"finishFrame() called without calling startFrame()");
- AnalysisDataStorageFrame *frame = impl_->currentFrame_;
- impl_->currentFrame_ = nullptr;
+ AnalysisDataStorageFrame* frame = impl_->currentFrame_;
+ impl_->currentFrame_ = nullptr;
frame->finishFrame();
}
-void
-AnalysisDataHandle::finishData()
+void AnalysisDataHandle::finishData()
{
GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
// Deletes the implementation pointer.