ppap4lmp  0.7.2
Processor Class Referenceabstract

Processor analyzes data contained in one or more Generator objects. More...

#include <processor.h>

Inheritance diagram for Processor:
Collaboration diagram for Processor:

Public Member Functions

 Processor ()=default
 Constructor of Processor class (default).
 
virtual void prepare ()
 Prepare analysis. More...
 
virtual void finish ()
 Finish analysis. More...
 
virtual bool run ()
 Run analysis using i th Generator object in generators, where i = i_generator. More...
 
void startup ()
 Startup this Processor object. More...
 

Protected Member Functions

virtual void run_impl (const int index)=0
 Implementation of analysis using an element of generators. More...
 
template<class GEN >
void register_generator (const ShPtr< GEN > &gen)
 
template<class GEN >
void register_generators (const Vec< ShPtr< GEN >> &gens)
 
virtual void use_generator_at (const int i)
 Call Generator::generate_data of i th Generator object in generators. More...
 
virtual void finish_using_generator_at (const int i)
 Call Generator::finish_using_generated_data of i* th Generator object in generators. More...
 

Protected Attributes

int n_generators
 
Vec< ShPtr< Generator > > generators
 

Private Attributes

int i_generator
 

Detailed Description

Processor analyzes data contained in one or more Generator objects.

Definition at line 18 of file processor.h.

Member Function Documentation

◆ finish()

virtual void Processor::finish ( )
inlinevirtual

Finish analysis.

Returns
None.

This method is called in Invoker::execute. Please see the subclasses for more details (some subclasses do nothing by this method).

Reimplemented in ProRadialDistributionFunction, ProRadialDistributionFunctionWithDeformation, ProTimeCorrelationInMolecule, ProDistanceInMolecule, ProMeanSquareDisplacement, and ProValueArray.

Definition at line 137 of file processor.h.

◆ finish_using_generator_at()

void Processor::finish_using_generator_at ( const int  i)
protectedvirtual

Call Generator::finish_using_generated_data of i* th Generator object in generators.

Parameters
iIndex in generators.
Returns
None.

Definition at line 68 of file processor.cpp.

Here is the caller graph for this function:

◆ prepare()

virtual void Processor::prepare ( )
inlinevirtual

Prepare analysis.

Returns
None.

This method is called in Invoker::execute. Please see the subclasses for more details (some subclasses do nothing by this method).

Reimplemented in ProRadialDistributionFunction, ProThicknessProfile, ProRadialDistributionFunctionWithDeformation, ProTimeCorrelationInMolecule, ProDistanceInMolecule, ProMeanSquareDisplacement, ProValueArray, and ProData.

Definition at line 127 of file processor.h.

◆ register_generator()

template<class GEN >
template void Processor::register_generator ( const ShPtr< GEN > &  gen)
protected

Store an object of Element, GenDict or GenList class in generators.

Parameters
genShared pointer to an object of Element, GenDict or GenList class. This pointer is up-casted to a shared pointer of Generator class when being stored in generators.
Returns
None.

Note that this method is thread-unsafe because it accesses its members thread-globally. It is recommended to call this method only from constructors of subclasses of this class. Please ensure that these constructors are used outside a multithreading context.

Definition at line 16 of file processor.cpp.

Here is the caller graph for this function:

◆ register_generators()

template<class GEN >
template void Processor::register_generators ( const Vec< ShPtr< GEN >> &  gens)
protected

Store objects of Element, GenDict or GenList class in generators.

Parameters
gensList of shared pointers to objects of Element, GenDict or GenList class. These pointers are up-casted to shared pointers of Generator class when being stored in generators.
Returns
None.

Note that this method is thread-unsafe because it accesses its members thread-globally. It is recommended to call this method only from constructors of subclasses of this class. Please ensure that these constructors are used outside a multithreading context.

Definition at line 36 of file processor.cpp.

Here is the caller graph for this function:

◆ run()

bool Processor::run ( )
virtual

Run analysis using i th Generator object in generators, where i = i_generator.

Returns
A boolean whether all Generator objects in generators have finished being used in run_impl.

First, this method copies i_generator as an index in generators for a Generator object to be analyzed. This method then calls Generator::generate_data to execute updating processes associated with the Generator object, and calls run_impl taking the copied index, and finally calls Generator::finish_using_generated_data to clears Element::data if it is no longer to be used.

Definition at line 76 of file processor.cpp.

Here is the call graph for this function:

◆ run_impl()

virtual void Processor::run_impl ( const int  index)
protectedpure virtual

Implementation of analysis using an element of generators.

Parameters
indexAn index in generators for a Generator object to be analyzed.
Returns
None.

To be compatible with multithreading computation, class members should not be modified in this method. If modification of some members is necessary, please consider defining them as Vec, and modifying only their i th element, where i = index.

Implemented in ProRadialDistributionFunctionWithDeformation, ProTimeCorrelationInMolecule, ProRadialDistributionFunction, ProMeanSquareDisplacement, ProThicknessProfile, ProDistanceInMolecule, ProValueArray, and ProData.

Here is the caller graph for this function:

◆ startup()

void Processor::startup ( )

Startup this Processor object.

Returns
None.

This method (re)sets i_generator to 0, and then calls Generator::book of Generator objects in generators.

Definition at line 101 of file processor.cpp.

◆ use_generator_at()

void Processor::use_generator_at ( const int  i)
protectedvirtual

Call Generator::generate_data of i th Generator object in generators.

Parameters
iIndex in generators.
Returns
None.

Definition at line 58 of file processor.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ generators

Vec<ShPtr<Generator> > Processor::generators
protected

A sequence of Generators objects to be used for analysis. This member can be set only by register_generator or register_generators.

Definition at line 37 of file processor.h.

◆ i_generator

int Processor::i_generator
private

Index in generators for a Generator object currently used for analysis. This member is set to 0 in startup, and updated in run. Both the modifications are thread-safe.

Definition at line 24 of file processor.h.

◆ n_generators

int Processor::n_generators
protected

Length of generators. Considering a dynamics simulation, for example, a length of generators is equal to a length of the simulation trajectory.

Definition at line 31 of file processor.h.


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