Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / analysisdata / datamodulemanager.h
index 67f5a93779b2daaaff2089aeb3acacc870403d2c..4688ce01b3476461ba7472500fee627c68bf75b7 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,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) 2010,2011,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
 #ifndef GMX_ANALYSISDATA_DATAMODULEMANAGER_H
 #define GMX_ANALYSISDATA_DATAMODULEMANAGER_H
 
-#include "abstractdata.h"
-
-#include "../utility/common.h"
+#include "gromacs/analysisdata/abstractdata.h"
+#include "gromacs/utility/common.h"
 
 namespace gmx
 {
 
+class AnalysisDataParallelOptions;
+
 /*! \libinternal \brief
  * Encapsulates handling of data modules attached to AbstractAnalysisData.
  *
@@ -89,6 +90,17 @@ class AnalysisDataModuleManager
          */
         void dataPropertyAboutToChange(DataProperty property, bool bSet);
 
+        /*! \brief
+         * Whether there are modules that do not support parallel processing.
+         *
+         * Must not be called before notifyDataStart()/notifyParallelDataStart().
+         * If notifyDataStart() has been called, returns true if there are any
+         * modules (all modules are treated as serial).
+         *
+         * Does not throw.
+         */
+        bool hasSerialModules() const;
+
         /*! \brief
          * Adds a module to process the data.
          *
@@ -121,7 +133,7 @@ class AnalysisDataModuleManager
                          AnalysisDataModuleInterface *module);
 
         /*! \brief
-         * Notifies attached modules of the start of data.
+         * Notifies attached modules of the start of serial data.
          *
          * \param   data  Data object that is starting.
          * \throws  APIError if any attached data module is not compatible.
@@ -136,10 +148,34 @@ class AnalysisDataModuleManager
          *
          * \p data should typically be \c this when calling from a class
          * derived from AbstractAnalysisData.
+         *
+         * This method initializes all modules for serial processing by calling
+         * AnalysisDataModuleInterface::dataStarted().
+         */
+        void notifyDataStart(AbstractAnalysisData *data);
+        /*! \brief
+         * Notifies attached modules of the start of parallel data.
+         *
+         * \param     data    Data object that is starting.
+         * \param[in] options Parallelization properties of the input data.
+         * \throws  APIError if any attached data module is not compatible.
+         * \throws  unspecified Any exception thrown by attached data modules
+         *      in AnalysisDataModuleInterface::parallelDataStarted().
+         *
+         * Can be called instead of notifyDataStart() if \p data supports
+         * non-sequential creation of frames.  Works as notifyDataStart(),
+         * but instead calls AnalysisDataModuleInterface::parallelDataStarted()
+         * and records whether the module supports the parallel mode.
+         * Subsequent notification calls then notify the modules according to
+         * the mode they accept.
+         *
+         * See notifyDataStart() for general constraints.
          */
-        void notifyDataStart(AbstractAnalysisData *data) const;
+        void notifyParallelDataStart(
+            AbstractAnalysisData              *data,
+            const AnalysisDataParallelOptions &options);
         /*! \brief
-         * Notifies attached modules of the start of a frame.
+         * Notifies attached serial modules of the start of a frame.
          *
          * \param[in] header  Header information for the frame that is starting.
          * \throws    unspecified Any exception thrown by attached data modules
@@ -150,7 +186,21 @@ class AnalysisDataModuleManager
          */
         void notifyFrameStart(const AnalysisDataFrameHeader &header) const;
         /*! \brief
-         * Notifies attached modules of the addition of points to the
+         * Notifies attached parallel modules of the start of a frame.
+         *
+         * \param[in] header  Header information for the frame that is starting.
+         * \throws    unspecified Any exception thrown by attached data modules
+         *      in AnalysisDataModuleInterface::frameStarted().
+         *
+         * If notifyParallelDataStart() has been called, should be called once
+         * for each frame, before notifyParallelPointsAdd() calls for that
+         * frame.
+         * It is allowed to call this method in any order for the frames, but
+         * should be called exactly once for each frame.
+         */
+        void notifyParallelFrameStart(const AnalysisDataFrameHeader &header) const;
+        /*! \brief
+         * Notifies attached serial modules of the addition of points to the
          * current frame.
          *
          * \param[in] points  Set of points added (also provides access to
@@ -169,7 +219,20 @@ class AnalysisDataModuleManager
          */
         void notifyPointsAdd(const AnalysisDataPointSetRef &points) const;
         /*! \brief
-         * Notifies attached modules of the end of a frame.
+         * Notifies attached parallel modules of the addition of points to a frame.
+         *
+         * \param[in] points  Set of points added (also provides access to
+         *      frame-level data).
+         * \throws    APIError if any attached data module is not compatible.
+         * \throws    unspecified Any exception thrown by attached data modules
+         *      in AnalysisDataModuleInterface::pointsAdded().
+         *
+         * See notifyPointsAdd() for information on the structure of the point
+         * sets.
+         */
+        void notifyParallelPointsAdd(const AnalysisDataPointSetRef &points) const;
+        /*! \brief
+         * Notifies attached serial modules of the end of a frame.
          *
          * \param[in] header  Header information for the frame that is ending.
          * \throws    unspecified Any exception thrown by attached data modules
@@ -181,6 +244,19 @@ class AnalysisDataModuleManager
          * notifyFrameStart() call.
          */
         void notifyFrameFinish(const AnalysisDataFrameHeader &header) const;
+        /*! \brief
+         * Notifies attached parallel modules of the end of a frame.
+         *
+         * \param[in] header  Header information for the frame that is ending.
+         * \throws    unspecified Any exception thrown by attached data modules
+         *      in AnalysisDataModuleInterface::frameFinished().
+         *
+         * Should be called once for each call of notifyParallelFrameStart(),
+         * after any notifyParallelPointsAdd() calls for the frame.
+         * \p header should be identical to that used in the corresponding
+         * notifyParallelFrameStart() call.
+         */
+        void notifyParallelFrameFinish(const AnalysisDataFrameHeader &header) const;
         /*! \brief
          * Notifies attached modules of the end of data.
          *