/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2012,2013,2014, 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.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
#include <vector>
-#include "../legacyheaders/types/simple.h"
-
-#include "../utility/common.h"
-#include "../utility/gmxassert.h"
-
-#include "dataframe.h"
+#include "gromacs/analysisdata/dataframe.h"
+#include "gromacs/utility/common.h"
+#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/real.h"
namespace gmx
{
*
* After this method has been called, all values appear as not set.
*
- * May call AnalysisDataModuleManager::notifyPointsAdd(), and may throw
- * any exception this method throws.
+ * May call AnalysisDataModuleManager::notifyPointsAdd() and
+ * AnalysisDataModuleManager::notifyParallelPointsAdd(), and may throw
+ * any exception these methods throw.
*/
void finishPointSet();
/*! \brief
* To use this class in a class derived from AbstractAnalysisData, a member
* variable of this type should be declared and the pure virtual methods
* forwarded to frameCount(), tryGetDataFrame() and requestStorage().
- * Storage properties should be set up, and then startDataStorage() called.
+ * Storage properties should be set up, and then startDataStorage() or
+ * startParallelDataStorage() called.
* New frames can then be added using startFrame(), currentFrame() and
* finishFrame() methods. When all frames are ready, finishDataStorage() must
* be called. These methods (and AnalysisDataStorageFrame::finishPointSet())
AnalysisDataStorage();
~AnalysisDataStorage();
- /*! \brief
- * Set parallelization options for the storage.
- *
- * \param[in] opt Parallization options to use.
- *
- * If this method is not called, the storage is set up for serial
- * storage only.
- *
- * Does not throw.
- */
- void setParallelOptions(const AnalysisDataParallelOptions &opt);
-
/*! \brief
* Returns the number of ready frames.
*
*/
void startDataStorage(AbstractAnalysisData *data,
AnalysisDataModuleManager *modules);
+ /*! \brief
+ * Start storing data in parallel.
+ *
+ * \param[in] data AbstractAnalysisData object containing this
+ * storage.
+ * \param[in] options Parallelization options to use.
+ * \param modules Module manager for \p data.
+ * \exception std::bad_alloc if storage allocation fails.
+ *
+ * Should be called instead of startDataStorage() if the data will be
+ * produced in parallel. Works as startDataStorage(), but additionally
+ * initializes the storage and the attached modules to prepare for
+ * out-of-order data frames.
+ *
+ * Calls AnalysisDataModuleManager::notifyParallelDataStart(), and
+ * throws any exceptions this method throws.
+ */
+ void startParallelDataStorage(
+ AbstractAnalysisData *data,
+ AnalysisDataModuleManager *modules,
+ const AnalysisDataParallelOptions &options);
/*! \brief
* Starts storing a new frame.
*
* far in the future:
* If \c i is the index of the last frame such that all frames from
* 0, ..., \c i have been finished, then \p header().index() should be
- * at most \c 2*parallelizationFactor-1 larger than \c i, where
+ * at most \c parallelizationFactor larger than \c i, where
* parallelizationFactor is the parallelization factor passed to
* setParallelOptions().
* Throws APIError if this constraint is violated.
*
- * Calls AnalysisDataModuleManager::notifyFrameStart() in certain
- * cases, and throws any exceptions this method throws.
+ * Calls AnalysisDataModuleManager::notifyFrameStart() (in certain
+ * cases) and AnalysisDataModuleManager::notifyParallelFrameStart(),
+ * and throws any exceptions these methods throw.
*/
AnalysisDataStorageFrame &startFrame(const AnalysisDataFrameHeader &header);
/*! \brief