Gromacs
2026.0-dev-20241121-c76fa1e
|
#include <gromacs/analysisdata/datamodulemanager.h>
Encapsulates handling of data modules attached to AbstractAnalysisData.
See IAnalysisDataModule and Parallelizable Handling of Output Data (analysisdata) for more details on the notifications and the order in which they should be raised.
Classes | |
class | Impl |
Private implementation class for AnalysisDataModuleManager. More... | |
Public Types | |
enum | DataProperty { eMultipleDataSets, eMultipleColumns, eMultipoint, eDataPropertyNR } |
Identifies data properties to check with data modules. More... | |
Public Member Functions | |
void | dataPropertyAboutToChange (DataProperty property, bool bSet) |
Allows the manager to check modules for compatibility with the data. More... | |
bool | hasSerialModules () const |
Whether there are modules that do not support parallel processing. More... | |
void | addModule (AbstractAnalysisData *data, const AnalysisDataModulePointer &module) |
Adds a module to process the data. More... | |
void | applyModule (AbstractAnalysisData *data, IAnalysisDataModule *module) |
Applies a module to process data that is ready. More... | |
void | notifyDataStart (AbstractAnalysisData *data) |
Notifies attached modules of the start of serial data. More... | |
void | notifyParallelDataStart (AbstractAnalysisData *data, const AnalysisDataParallelOptions &options) |
Notifies attached modules of the start of parallel data. More... | |
void | notifyFrameStart (const AnalysisDataFrameHeader &header) const |
Notifies attached serial modules of the start of a frame. More... | |
void | notifyParallelFrameStart (const AnalysisDataFrameHeader &header) const |
Notifies attached parallel modules of the start of a frame. More... | |
void | notifyPointsAdd (const AnalysisDataPointSetRef &points) const |
Notifies attached serial modules of the addition of points to the current frame. More... | |
void | notifyParallelPointsAdd (const AnalysisDataPointSetRef &points) const |
Notifies attached parallel modules of the addition of points to a frame. More... | |
void | notifyFrameFinish (const AnalysisDataFrameHeader &header) const |
Notifies attached serial modules of the end of a frame. More... | |
void | notifyParallelFrameFinish (const AnalysisDataFrameHeader &header) const |
Notifies attached parallel modules of the end of a frame. More... | |
void | notifyDataFinish () const |
Notifies attached modules of the end of data. More... | |
Identifies data properties to check with data modules.
Enumerator | |
---|---|
eMultipleDataSets |
Data has multiple data sets. |
eMultipleColumns |
Data has multiple columns. |
eMultipoint |
Data is multipoint. |
eDataPropertyNR |
Number of properties; for internal use only. |
void gmx::AnalysisDataModuleManager::addModule | ( | AbstractAnalysisData * | data, |
const AnalysisDataModulePointer & | module | ||
) |
Adds a module to process the data.
data | Data object to add the module to. |
module | Module to add. |
void gmx::AnalysisDataModuleManager::applyModule | ( | AbstractAnalysisData * | data, |
IAnalysisDataModule * | module | ||
) |
Applies a module to process data that is ready.
data | Data object to apply the module to. |
module | Module to apply. |
APIError | in same situations as addModule(). |
unspecified | Any exception thrown by module in its notification methods. |
void gmx::AnalysisDataModuleManager::dataPropertyAboutToChange | ( | DataProperty | property, |
bool | bSet | ||
) |
Allows the manager to check modules for compatibility with the data.
APIError | if any data module already added is not compatible with the new setting. |
Does two things: checks any modules already attached to the data and throws if any of them is not compatible, and stores the property to check modules attached in the future.
Strong exception safety.
bool gmx::AnalysisDataModuleManager::hasSerialModules | ( | ) | const |
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.
void gmx::AnalysisDataModuleManager::notifyDataFinish | ( | ) | const |
Notifies attached modules of the end of data.
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::dataFinished(). |
Should be called once, after all the other notification calls.
void gmx::AnalysisDataModuleManager::notifyDataStart | ( | AbstractAnalysisData * | data | ) |
Notifies attached modules of the start of serial data.
data | Data object that is starting. |
APIError | if any attached data module is not compatible. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::dataStarted(). |
Should be called once, after data properties have been set with the methods in AbstractAnalysisData, and before any other notification methods. The caller should be prepared for requestStorage() calls to data
from the attached modules.
data
should typically be this
when calling from a class derived from AbstractAnalysisData.
This method initializes all modules for serial processing by calling IAnalysisDataModule::dataStarted().
void gmx::AnalysisDataModuleManager::notifyFrameFinish | ( | const AnalysisDataFrameHeader & | header | ) | const |
Notifies attached serial modules of the end of a frame.
[in] | header | Header information for the frame that is ending. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::frameFinished(). |
Should be called once for each call of notifyFrameStart(), after any notifyPointsAdd() calls for the frame. header
should be identical to that used in the corresponding notifyFrameStart() call.
This method also notifies parallel modules about serial end of frame.
void gmx::AnalysisDataModuleManager::notifyFrameStart | ( | const AnalysisDataFrameHeader & | header | ) | const |
Notifies attached serial modules of the start of a frame.
[in] | header | Header information for the frame that is starting. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::frameStarted(). |
Should be called once for each frame, before notifyPointsAdd() calls for that frame.
void gmx::AnalysisDataModuleManager::notifyParallelDataStart | ( | AbstractAnalysisData * | data, |
const AnalysisDataParallelOptions & | options | ||
) |
Notifies attached modules of the start of parallel data.
data | Data object that is starting. | |
[in] | options | Parallelization properties of the input data. |
APIError | if any attached data module is not compatible. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::parallelDataStarted(). |
Can be called instead of notifyDataStart() if data
supports non-sequential creation of frames. Works as notifyDataStart(), but instead calls IAnalysisDataModule::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 gmx::AnalysisDataModuleManager::notifyParallelFrameFinish | ( | const AnalysisDataFrameHeader & | header | ) | const |
Notifies attached parallel modules of the end of a frame.
[in] | header | Header information for the frame that is ending. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::frameFinished(). |
Should be called once for each call of notifyParallelFrameStart(), after any notifyParallelPointsAdd() calls for the frame. header
should be identical to that used in the corresponding notifyParallelFrameStart() call.
void gmx::AnalysisDataModuleManager::notifyParallelFrameStart | ( | const AnalysisDataFrameHeader & | header | ) | const |
Notifies attached parallel modules of the start of a frame.
[in] | header | Header information for the frame that is starting. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::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 gmx::AnalysisDataModuleManager::notifyParallelPointsAdd | ( | const AnalysisDataPointSetRef & | points | ) | const |
Notifies attached parallel modules of the addition of points to a frame.
[in] | points | Set of points added (also provides access to frame-level data). |
APIError | if any attached data module is not compatible. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::pointsAdded(). |
See notifyPointsAdd() for information on the structure of the point sets.
void gmx::AnalysisDataModuleManager::notifyPointsAdd | ( | const AnalysisDataPointSetRef & | points | ) | const |
Notifies attached serial modules of the addition of points to the current frame.
[in] | points | Set of points added (also provides access to frame-level data). |
APIError | if any attached data module is not compatible. |
unspecified | Any exception thrown by attached data modules in IAnalysisDataModule::pointsAdded(). |
Can be called zero or more times for each frame. The caller should ensure that any column occurs at most once in the calls, unless the data is multipoint. For efficiency reasons, calls to this method should be aggregated whenever possible, i.e., it's better to handle multiple columns or even the whole frame in a single call rather than calling the method for each column separately.