ppap4lmp
0.7.2
|
Processor analyzes data contained in one or more Generator objects. More...
#include <processor.h>
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 |
Processor analyzes data contained in one or more Generator objects.
Definition at line 18 of file processor.h.
|
inlinevirtual |
Finish analysis.
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.
|
protectedvirtual |
Call Generator::finish_using_generated_data of i* th Generator object in generators.
i | Index in generators. |
Definition at line 68 of file processor.cpp.
|
inlinevirtual |
Prepare analysis.
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.
|
protected |
Store an object of Element, GenDict or GenList class in generators.
gen | Shared 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. |
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.
|
protected |
Store objects of Element, GenDict or GenList class in generators.
gens | List 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. |
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.
|
virtual |
Run analysis using i th Generator object in generators, where i = i_generator.
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.
|
protectedpure virtual |
Implementation of analysis using an element of generators.
index | An index in generators for a Generator object to be analyzed. |
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.
void Processor::startup | ( | ) |
Startup this Processor object.
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.
|
protectedvirtual |
Call Generator::generate_data of i th Generator object in generators.
i | Index in generators. |
Definition at line 58 of file processor.cpp.
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.
|
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.
|
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.