|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
#include <Block.h>


Public Member Functions | |
| Block ()=default | |
| Default constructor. | |
| Block (std::shared_ptr< Block > other) | |
| Copy-like constructor from another block. | |
| BlockName | get_name () const |
| Returns the name of the block. | |
| void | store (const LhaID &id, std::shared_ptr< Parameter > param) override |
| Stores a new parameter under the given LHA id. | |
| void | assign (const LhaID &key, std::shared_ptr< Parameter > param) override |
| Replaces the payload of an existing parameter from another parameter object. | |
| void | assign (const LhaID &key, scalar_t value) |
| Sets the expected value of an existing parameter. | |
| void | store_or_assign (const LhaID &key, std::shared_ptr< Parameter > param) override |
| Stores a parameter if absent, otherwise assigns into the existing one. | |
| bool | contains (const LhaID &key) const override |
| Checks whether the block contains a parameter with the given id. | |
| std::shared_ptr< Parameter > | retrieve (const LhaID &id) override |
| Retrieves a stored parameter by id. | |
| void | remove (const LhaID &key) override |
| Removes a parameter and clears its downstream dependency subtree. | |
| std::unordered_set< LhaID > | getAllIDs () |
| Returns the set of all parameter ids stored in the block. | |
| const std::map< LhaID, std::shared_ptr< Parameter > > & | getItems () |
| Returns the internal parameter map. | |
| void | set_owner (ParameterType type) |
| Sets the owner ParameterType on all contained parameters. | |
| void | addObserver (std::shared_ptr< Block > observer) |
| Adds a block observer if not already present. | |
| void | removeObserver (std::shared_ptr< Block > observer) |
| Removes a previously registered observer block. | |
| void | notifyObservers () |
| Notifies all observer blocks that this block has changed. | |
| std::vector< std::shared_ptr< Block > > | getObservers () const |
| Returns the current list of observer blocks. | |
| virtual void | init () |
| Initialization hook. | |
| virtual void | update () |
| Updates the block. | |
| virtual void | destroy () |
| Destroys the block and its downstream block dependencies. | |
| virtual void | freeze () |
| Freezes all parameters contained in the block. | |
| virtual void | unfreeze () |
| Unfreezes all parameters contained in the block. | |
| void | copy (std::shared_ptr< Block > other) |
| Copies the content and metadata from another block. | |
| std::shared_ptr< Block > | deep_clone_plain () const |
| Deep-copies this block as a plain independent block. | |
| virtual void | clear_above () |
| Clears parameter dependencies above this block. | |
| virtual void | clear_below () |
| Clears parameter dependencies below this block. | |
| bool | has_scale () |
| Returns whether the block has an associated scale. | |
| void | set_scale (double scale) |
| Sets the block-wide scale. | |
| double | get_scale () |
| Returns the block-wide scale. | |
| void | erase_local (const LhaID &id) |
| Erases an entry from the local storage map only. | |
| virtual std::unordered_map< std::string, std::shared_ptr< Block > > | get_source_blocks () const |
| Returns the source blocks of this block. | |
| virtual void | ensure_up_to_date () |
| Ensures that the block content is up to date. | |
| void | bind_self (std::shared_ptr< Block > self) |
| Binds an explicit self shared_ptr to the block. | |
| ~Block () | |
| Destructor. | |
Public Member Functions inherited from IStorage< LhaID, Parameter > | |
| virtual | ~IStorage ()=default |
Public Attributes | |
| BlockName | blockname {""} |
| Name of the block (e.g. "SMINPUTS", "MASS", "FWCOEF"...) | |
Protected Member Functions | |
| std::weak_ptr< Block > | self_weak () |
| Optional explicit self-reference used to rebind owner_block on contained parameters. | |
Protected Attributes | |
| std::vector< std::shared_ptr< Block > > | observers |
| std::map< LhaID, std::shared_ptr< Parameter > > | items |
| List of observing blocks notified through notifyObservers(). | |
| std::optional< double > | scale |
| Internal storage of parameters indexed by LHA id. | |
| std::weak_ptr< Block > | self_ |
| Optional block-wide scale. | |
Friends | |
| std::ostream & | operator<< (std::ostream &, std::shared_ptr< Block >) |
| Stream output operator for a block. | |
|
default |
Default constructor.
Constructs an empty block with no parameters, no observers, and no scale.
| Block::Block | ( | std::shared_ptr< Block > | other | ) |
Copy-like constructor from another block.
This constructor copies the content and metadata of other by delegating to copy(). Stored parameter pointers are copied as shared pointers.
After the copy, parameter owner-block links are rebound to this new block whenever a valid self reference is available.
| other | Block to copy from. |
|
inline |
| void Block::addObserver | ( | std::shared_ptr< Block > | observer | ) |
Sets the expected value of an existing parameter.
This calls Parameter::set_expected(value) on the stored parameter.
Current notification behavior:
Block::notifyObservers() is triggered here.| key | Identifier of the parameter to update. |
| value | New value. |
Replaces the payload of an existing parameter from another parameter object.
This does not replace the shared pointer stored in the block. Instead, it copies the numerical/configuration payload into the already stored destination parameter using Parameter::overwrite_payload_from(...).
Current notification behavior:
Block::notifyObservers() call is performed here.| key | Identifier of the parameter to overwrite. |
| param | Source parameter whose payload is copied. |
Implements IStorage< LhaID, Parameter >.
Reimplemented in DependentBlock.
|
inline |
Binds an explicit self shared_ptr to the block.
This is used to make owner-block links available even in situations where shared_from_this() is not yet safe or convenient.
After binding, all currently stored parameters are rebound to this block as their owner block.
| self | Shared pointer referring to this block instance. |
|
virtual |
Clears parameter dependencies above this block.
Delegates clear_above() to all contained parameters.
Reimplemented in DependentBlock.
|
virtual |
Clears parameter dependencies below this block.
A snapshot of current parameter pointers is built first to avoid iterator invalidation during recursive dependency clearing.
Reimplemented in DependentBlock.
|
overridevirtual |
Checks whether the block contains a parameter with the given id.
Before the lookup, the block is forced up-to-date through ensure_up_to_date(). For a plain Block this is a no-op, but for DependentBlock this may trigger lazy recomputation.
| key | LHA identifier. |
Implements IStorage< LhaID, Parameter >.
| void Block::copy | ( | std::shared_ptr< Block > | other | ) |
Copies the content and metadata from another block.
Copied elements:
Stored parameter pointers are copied as shared pointers. If this block is already self-bound, copied parameters have their owner-block link rebound to this block.
| other | Source block. |
| std::shared_ptr< Block > Block::deep_clone_plain | ( | ) | const |
Deep-copies this block as a plain independent block.
All contained Parameter payloads are duplicated, observer links and owner-block links are not shared with the source block. Dependency graph objects are intentionally not cloned here; dependent blocks are rebuilt by the owning Parameters strategy inside each runtime context.
|
virtual |
Destroys the block and its downstream block dependencies.
Current behavior:
Reimplemented in DependentBlock.
|
inlinevirtual |
Ensures that the block content is up to date.
For a plain Block this is a no-op. DependentBlock overrides it to implement lazy recomputation.
Reimplemented in DependentBlock.
| void Block::erase_local | ( | const LhaID & | id | ) |
|
virtual |
Freezes all parameters contained in the block.
This delegates to Parameter::freeze() on each stored parameter.
Reimplemented in DependentBlock.
|
inline |
| double Block::get_scale | ( | ) |
|
virtual |
Returns the source blocks of this block.
Plain blocks have no source blocks, so the default implementation returns an empty map.
Reimplemented in DependentBlock.
| std::unordered_set< LhaID > Block::getAllIDs | ( | ) |
| std::vector< std::shared_ptr< Block > > Block::getObservers | ( | ) | const |
| bool Block::has_scale | ( | ) |
|
inlinevirtual |
Initialization hook.
Plain blocks do nothing by default. Derived classes may override this to register dependencies or pre-fill content.
Reimplemented in DependentBlock.
| void Block::notifyObservers | ( | ) |
|
overridevirtual |
Removes a parameter and clears its downstream dependency subtree.
The parameter is first asked to clear its own downstream dependencies via Parameter::clear_below(), then removed from the block.
After that, all observer blocks currently attached to this block are destroyed recursively.
| key | Identifier of the parameter to remove. |
Implements IStorage< LhaID, Parameter >.
| void Block::removeObserver | ( | std::shared_ptr< Block > | observer | ) |
Retrieves a stored parameter by id.
The block is first ensured up-to-date. If the id is missing, an error is logged.
| id | LHA identifier to retrieve. |
Implements IStorage< LhaID, Parameter >.
|
inlineprotected |
Optional explicit self-reference used to rebind owner_block on contained parameters.
Returns the best available weak self-reference.
Priority:
shared_from_this() when available,| void Block::set_owner | ( | ParameterType | type | ) |
| void Block::set_scale | ( | double | scale | ) |
Stores a new parameter under the given LHA id.
If the key already exists, the parameter is not overwritten and a debug message is emitted.
If the block has been bound to itself through bind_self(), the stored parameter receives this block as owner block.
| id | LHA identifier of the parameter. |
| param | Parameter object to store. |
Implements IStorage< LhaID, Parameter >.
|
overridevirtual |
Stores a parameter if absent, otherwise assigns into the existing one.
This is a convenience method:
| key | Identifier of the parameter. |
| param | Parameter to store or assign. |
Implements IStorage< LhaID, Parameter >.
|
virtual |
Unfreezes all parameters contained in the block.
This delegates to Parameter::unfreeze() on each stored parameter.
Reimplemented in DependentBlock.
|
virtual |
Updates the block.
Default behavior: calls update() on every contained parameter.
For plain blocks this is an eager propagation method. Dependent blocks override this with lazy dirty-marking semantics.
Reimplemented in DependentBlock.
|
friend |
Stream output operator for a block.
Prints block content in a human-readable form:
| os | Output stream. |
| ba | Block to print. |
| BlockName Block::blockname {""} |
List of observing blocks notified through notifyObservers().
|
protected |
|
protected |
|
protected |