Gromacs  2025.0-dev-20241011-013a99c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions
gmx::TrajectoryAnalysisModuleData Class Referenceabstract

#include <gromacs/trajectoryanalysis/analysismodule.h>

+ Inheritance diagram for gmx::TrajectoryAnalysisModuleData:

Description

Base class for thread-local data storage during trajectory analysis.

Thread-local storage of data handles and selections is implemented in this class; TrajectoryAnalysisModule instances can access the thread-local values in their TrajectoryAnalysisModule::analyzeFrame() method using dataHandle() and parallelSelection().

See Also
TrajectoryAnalysisModule::startFrames()
TrajectoryAnalysisModule::analyzeFrame()
TrajectoryAnalysisModule::finishFrames()
Examples:
template.cpp.

Classes

class  Impl
 Private implementation class for TrajectoryAnalysisModuleData. More...
 

Public Member Functions

virtual void finish ()=0
 Performs any finishing actions after all frames have been processed. More...
 
AnalysisDataHandle dataHandle (const AnalysisData &data)
 Returns a data handle for a given dataset. More...
 

Static Public Member Functions

static Selection parallelSelection (const Selection &selection)
 Returns a selection that corresponds to the given selection. More...
 
static SelectionList parallelSelections (const SelectionList &selections)
 Returns a set of selection that corresponds to the given selections. More...
 

Protected Member Functions

 TrajectoryAnalysisModuleData (TrajectoryAnalysisModule *module, const AnalysisDataParallelOptions &opt, const SelectionCollection &selections)
 Initializes thread-local storage for data handles and selections. More...
 
void finishDataHandles ()
 Calls finishData() on all data handles. More...
 

Constructor & Destructor Documentation

gmx::TrajectoryAnalysisModuleData::TrajectoryAnalysisModuleData ( TrajectoryAnalysisModule module,
const AnalysisDataParallelOptions opt,
const SelectionCollection selections 
)
protected

Initializes thread-local storage for data handles and selections.

Parameters
[in]moduleAnalysis module to use for data objects.
[in]optData parallelization options.
[in]selectionsThread-local selection collection.
Exceptions
std::bad_allocif out of memory.
unspecifiedCan throw any exception thrown by AnalysisData::startData().

Calls AnalysisData::startData() on all data objects registered with TrajectoryAnalysisModule::registerAnalysisDataset() in module. The handles are accessible through dataHandle().

Member Function Documentation

AnalysisDataHandle gmx::TrajectoryAnalysisModuleData::dataHandle ( const AnalysisData data)

Returns a data handle for a given dataset.

Parameters
[in]dataAnalysis data object.
Returns
Data handle for data stored in this thread-local data.

data should have previously been registered with TrajectoryAnalysisModule::registerAnalysisDataset(). If data has zero columns in all data sets, the returned data handle is invalid.

Does not throw.

Examples:
template.cpp.
virtual void gmx::TrajectoryAnalysisModuleData::finish ( )
pure virtual

Performs any finishing actions after all frames have been processed.

Exceptions
unspecifiedImplementation may throw exceptions to indicate errors.

This function is called immediately before the destructor, after TrajectoryAnalysisModule::finishFrames(). Derived classes should implement any final operations that need to be done after successful analysis. All implementations should call finishDataHandles().

Implemented in gmx::analysismodules::anonymous_namespace{sasa.cpp}::SasaModuleData, gmx::analysismodules::anonymous_namespace{rdf.cpp}::RdfModuleData, gmx::analysismodules::anonymous_namespace{pairdist.cpp}::PairDistanceModuleData, and gmx::anonymous_namespace{analysismodule.cpp}::TrajectoryAnalysisModuleDataBasic.

void gmx::TrajectoryAnalysisModuleData::finishDataHandles ( )
protected

Calls finishData() on all data handles.

Exceptions
unspecifiedCan throw any exception thrown by AnalysisDataHandle::finishData().

This function should be called from the implementation of finish() in all subclasses.

Selection gmx::TrajectoryAnalysisModuleData::parallelSelection ( const Selection selection)
static

Returns a selection that corresponds to the given selection.

Parameters
[in]selectionGlobal selection object.
Returns
Selection object corresponding to this thread-local data.

selection is the selection object that was obtained from SelectionOption. The return value is the corresponding selection in the selection collection with which this data object was constructed with.

Does not throw.

Examples:
template.cpp.
SelectionList gmx::TrajectoryAnalysisModuleData::parallelSelections ( const SelectionList selections)
static

Returns a set of selection that corresponds to the given selections.

Exceptions
std::bad_allocif out of memory.

Works as parallelSelection(), but for a list of selections at once.

See Also
parallelSelection()

The documentation for this class was generated from the following files: