ppap4lmp
0.7.2
|
Updater is an abstract class to update data held by an Element object. More...
#include <updater.h>
Public Member Functions | |
Updater ()=default | |
Constructor of Updater class. More... | |
void | compute (const ElPtr &elem, const int elementid, Json &data) |
Managing computation to update Element::data. More... | |
void | remove_from_skippable_elementids (const int elementid) |
Remove Element::elementid from skippable_elementids. More... | |
const ShPtr< Generator > & | get_ext_generator () |
Get ext_generator of this object. More... | |
Protected Member Functions | |
virtual void | compute_body (const ElPtr &elem, Json &data)=0 |
Managing computation to update Element::data. More... | |
virtual void | compute_common (const ElPtr &elem, Json &data) |
Common part of compute_body. More... | |
virtual void | compute_impl (Json &data, JsonToVoidFunc check_required_keys, JsonToBoolFunc check_optional_keys)=0 |
Implementation of computation updating Element::data. More... | |
Protected Attributes | |
ShPtr< Generator > | ext_generator |
Private Member Functions | |
bool | check_compute_request_for (const int elementid) |
Private Attributes | |
Set< int > | skippable_elementids |
Updater is an abstract class to update data held by an Element object.
This class is a superclass of the Starter, Adder and Filter class.
An object of this class is append to an Element object by Element::append_updater and stored as UpdatePair (where the first item is the Element object and the second item is the object of this class).
|
default |
Constructor of Updater class.
This constructor is thread-unsafe because it accesses its members thread-globally. Ensure this constructor is not called in a multithreading context. Please be careful that constructors of subclasses of this class are also thread-unsafe.
|
private |
Look for Element::elementid in skippable_elementids.
elementid | An Element::elementid to be checked. |
elementid
is found in skippable_elementids, this method returns false, that is, rejects the Element object of the elementid
. Definition at line 13 of file updater.cpp.
Managing computation to update Element::data.
elem | Shared pointer to an Element object where computed properties are added to. |
elementid | A constant integer copied from Element::elementid. |
data | Mutable reference to Element::data where computed properties are added to. |
Definition at line 34 of file updater.cpp.
Managing computation to update Element::data.
elem | Shared pointer to an Element object where computed properties are added to. |
data | Mutable reference to Element::data where computed properties are added to. |
More specific than compute; implementation of this method is different in each subclass.
Implemented in Starter, Adder, and Filter.
Common part of compute_body.
elem | Shared pointer to an Element object where computed properties are added to. |
data | Mutable reference to Element::data where computed properties are added to. |
Definition at line 47 of file updater.cpp.
|
protectedpure virtual |
Implementation of computation updating Element::data.
data | Mutable reference to Element::data where computed properties are added to. |
check_required_keys | Wrapper function for Element::check_required_keys of an Element object where this instance is appended to. |
check_optional_keys | Wrapper function for Element::check_optional_keys of an Element object where this instance is appended to. |
Implemented in FilComparison, AddMap, StaBeads, AddChildPositions, AddGyrationRadius, AddInertiaMoment, AddChildIDs, AddCoMPosition, AddMolecularOrientation, AddSpecialBonds, AddDihedralAngle, AddBondAngle, AddBondLength, FilSet, AddWrappedPosition, StaDumpBox, AddRename, StaMolecules, StaDumpAtoms, StaCustom, and StaCopy.
Get ext_generator of this object.
This method is mainly used in Element::update_chain.
Definition at line 86 of file updater.cpp.
void Updater::remove_from_skippable_elementids | ( | const int | elementid | ) |
Remove Element::elementid from skippable_elementids.
elementid | An Element::elementid to be removed. |
Removing elementid
from skippable_elementids is necessary so that this object can update the Element object of the elementid
again after its Element::data being cleared.
Definition at line 75 of file updater.cpp.
Shared pointer to a Generator object used in updating process. To compute some properties for an Element object where this object is appended to, an external Generator object (can be Element/GenDict/GenList) might be required. For example, to compute the center of mass of molecules for a molecular Element object, an atomic Element object containing positions of the atoms is required.
|
private |
If this Updater object is called from an Element object for the first time, this object stores Element::elementid in skippable_elementids and updates Element::data. From the second time on, this object skips the updating computation.