ppap4lmp  0.7.2
PyElement Class Reference

Trampoline class to bind Element class to Python. More...

#include <py_element.h>

Inheritance diagram for PyElement:
Collaboration diagram for PyElement:

Public Member Functions

ElPtr get_element (const Json &name) override
 Get this object as a shared pointer of Element class. More...
 
ShPtr< Generatorget_generator (const Json &name) override
 Get this object as a shared pointer of Generator class. More...
 
void accessed_by_instance_of (const Str &classname) override
 Set class name of an instance calling Element::check_required_keys. More...
 
 Element ()
 Constructor of Element class. More...
 
- Public Member Functions inherited from Element
 Element ()
 Constructor of Element class. More...
 
ShPtr< Elementappend_updater (const ShPtr< Updater > &upd)
 Append an Updater object to this Element object: the only way to extend an updating process associated with this object. More...
 
const Jsonget_data ()
 Get a reference to data of this object. More...
 
Set< Strget_keys ()
 Get keys of the data of this object. More...
 
Json make_reduced_data (const Json &key_)
 Get reduced data of this object. More...
 
template<typename T >
void make_1darray_from_data (T &array, const Str &key)
 Extract values of a property in data as a one-dimensional Eigen-Array. More...
 
template<typename T >
void make_2darray_from_data (T &array, const Vec< Str > &keys)
 Extract values of properties in data as a two-dimensional Eigen-Array. More...
 
void update_keys ()
 Update datakeys. This method must be called after setting new properties to data. More...
 
void check_required_keys (const Json &key_)
 Check if this object has required key(s). More...
 
bool check_optional_keys (const Json &key_)
 Check if this object has optional key(s). More...
 
const Jsonget_data_py ()
 Get a reference to data of this object. More...
 
Set< Strget_keys_py ()
 Get keys of the data of this object. More...
 
ArrayXi get_1d_int_py (const Str &key)
 Get integer values stored in Element::data of this object as a one-dimensional Numpy-Array. More...
 
ArrayXd get_1d_float_py (const Str &key)
 Get float values stored in Element::data of this object as a one-dimensional Numpy-Array. More...
 
ArrayXXi get_2d_int_py (const py::args &args)
 Get integer values stored in Element::data of this object as a two-dimensional Numpy-Array. More...
 
ArrayXXd get_2d_float_py (const py::args &args)
 Get float values stored in Element::data of this object as a two-dimensional Numpy-Array. More...
 
- Public Member Functions inherited from Generator
void book_to_generate_data ()
 Appoint to this Generator object. More...
 
void generate_data ()
 Hello to this Generator object. More...
 
void finish_using_generated_data ()
 Goodbye to this object. More...
 
const Vec< UpdatePair > & get_update_chain ()
 Get update_chain of this object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Generator
void merge_update_chain (const Vec< UpdatePair > &new_chain)
 
- Protected Attributes inherited from Generator
Vec< UpdatePairupdate_chain
 

Detailed Description

Trampoline class to bind Element class to Python.

For more details, please see pybind11 documentation: https://pybind11.readthedocs.io/en/stable/advanced/classes.html.

Definition at line 20 of file py_element.h.

Member Function Documentation

◆ accessed_by_instance_of()

void PyElement::accessed_by_instance_of ( const Str classname)
inlineoverridevirtual

Set class name of an instance calling Element::check_required_keys.

Parameters
classnameA string to be assigned to Element::accessing_classname.
Returns
None.

Reimplemented from Element.

Definition at line 35 of file py_element.h.

◆ Element()

Element::Element

Constructor of Element class.

This constructor is thread-unsafe because it accesses its members thread-globally. Ensure this constructor is not called in a multithreading context.

Definition at line 22 of file element.cpp.

◆ get_element()

ElPtr PyElement::get_element ( const Json name)
inlineoverridevirtual

Get this object as a shared pointer of Element class.

Parameters
nameLeave it as it is (default is nullptr).
Returns
Shared pointer to this Element object.

One needs to get as Element when using this data.

Reimplemented from Element.

Definition at line 23 of file py_element.h.

◆ get_generator()

ShPtr<Generator> PyElement::get_generator ( const Json name)
inlineoverridevirtual

Get this object as a shared pointer of Generator class.

Parameters
nameLeave it as it is (default is nullptr).
Returns
Shared pointer to this object up-casted to Generator.

One needs to get as Generator when storing this object.

Reimplemented from Element.

Definition at line 29 of file py_element.h.


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