ppap4lmp  0.7.2
ProValueArray Class Reference

ProValueArray makes one or more arrays consisting of values for property in a sequence of Element objects. More...

#include <pro_value_array.h>

Inheritance diagram for ProValueArray:
Collaboration diagram for ProValueArray:

Public Member Functions

 ProValueArray (const ElPtr &elem)
 Constructor of ProValueArray class for one Element object. More...
 
 ProValueArray (const Vec< ElPtr > &elems)
 Constructor of ProValueArray class for a sequence of Element objects. More...
 
virtual void prepare () override
 Resize value_trajectories. More...
 
virtual void finish () override
 Make results from value_trajectories. More...
 
void select (const py::args &args)
 Specify string keys for properties. To use this object, at least one key must be specified. Note that new keys overwrite old keys. More...
 
const Map< Str, ArrayXXd > & get_results ()
 Get dictionary from keys for property to two-dimensional arrays of values for the property. Each row of the array corresponds to each snapshot of a simulation, and each column of the array corresponds to each element in array Element objects (for example, each atom in Element objects for atoms). More...
 
- Public Member Functions inherited from Processor
 Processor ()=default
 Constructor of Processor class (default).
 
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) override
 Implementation of analysis using an element of generators. More...
 
- Protected Member Functions inherited from Processor
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...
 

Private Attributes

Vec< Strselected_keys
 
Map< Str, ArrayXXdresults
 
Vec< Map< Str, RowArrayXd > > value_trajectories
 

Additional Inherited Members

- Protected Attributes inherited from Processor
int n_generators
 
Vec< ShPtr< Generator > > generators
 

Detailed Description

ProValueArray makes one or more arrays consisting of values for property in a sequence of Element objects.

An object of this class makes one or more two-dimensional arrays consisting of values for property of Element objects stored in generators. These arrays are useful for calculating statistics of property added by Adder's subclass.

About usage in Python, please see pybind::py_pro_value_array.

Definition at line 26 of file pro_value_array.h.

Constructor & Destructor Documentation

◆ ProValueArray() [1/2]

ProValueArray::ProValueArray ( const ElPtr elem)

Constructor of ProValueArray class for one Element object.

Parameters
elemAn Element object. The parameter is put into generators by register_generator.

Definition at line 20 of file pro_value_array.cpp.

Here is the call graph for this function:

◆ ProValueArray() [2/2]

ProValueArray::ProValueArray ( const Vec< ElPtr > &  elems)

Constructor of ProValueArray class for a sequence of Element objects.

Parameters
elemsList of Element objects. If each Element object has an array data, all the array should have the same length. Elements of this parameter is put into generators by register_generators.

Definition at line 28 of file pro_value_array.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ finish()

void ProValueArray::finish ( )
overridevirtual

Make results from value_trajectories.

Returns
None.

Each row of a value of results corresponds to a value for the corresponding key in each element of value_trajectories.

Reimplemented from Processor.

Definition at line 84 of file pro_value_array.cpp.

Here is the call graph for this function:

◆ get_results()

const Map< Str, ArrayXXd > & ProValueArray::get_results ( )

Get dictionary from keys for property to two-dimensional arrays of values for the property. Each row of the array corresponds to each snapshot of a simulation, and each column of the array corresponds to each element in array Element objects (for example, each atom in Element objects for atoms).

Returns
results.

Definition at line 125 of file pro_value_array.cpp.

Here is the caller graph for this function:

◆ prepare()

void ProValueArray::prepare ( )
overridevirtual

Resize value_trajectories.

Returns
None.

Reimplemented from Processor.

Definition at line 77 of file pro_value_array.cpp.

◆ run_impl()

void ProValueArray::run_impl ( const int  index)
overrideprotectedvirtual

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.

I am sorry to say that the best documentation for this method is its source code...

Implements Processor.

Definition at line 36 of file pro_value_array.cpp.

Here is the call graph for this function:

◆ select()

void ProValueArray::select ( const py::args &  args)

Specify string keys for properties. To use this object, at least one key must be specified. Note that new keys overwrite old keys.

Parameters
*argsAn ordered list of string keys for properties (Python's variable number arguments). Be sure that all Element objects stored in this object has the keys. This parameter is converted to be stored as selected_keys.
Returns
None.

Definition at line 117 of file pro_value_array.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ results

Map<Str,ArrayXXd> ProValueArray::results
private

Dictionary from keys for property to two-dimensional arrays of values for the property. The keys are same as elements of selected_keys. Each column of the array corresponds to a sequence of the value for each element in array Element objects stored in generators (for example, each atom in Element objects for atoms), and each row of the array corresponds to each Element object of generators.

Definition at line 41 of file pro_value_array.h.

◆ selected_keys

Vec<Str> ProValueArray::selected_keys
private

List of string keys for properties to be targeted.

Definition at line 30 of file pro_value_array.h.

◆ value_trajectories

Vec<Map<Str,RowArrayXd> > ProValueArray::value_trajectories
private

List in which dictionaries from key for property to RowArrayXd of values for the property are stored. Indices in this list corresponds those in generators.

Definition at line 47 of file pro_value_array.h.


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