Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
CompositeParamAdapter Class Reference

Concrete implementation of IDependency using DependentBlockManager. More...

#include <CompositeParamCreator.h>

Inheritance diagram for CompositeParamAdapter:
Collaboration diagram for CompositeParamAdapter:

Public Member Functions

void add_block_dependency (const BlockName &name, const std::unordered_map< ParameterType, std::vector< std::string > > &source_names, ParameterType dest, DepUpdateFunc recalculateFunc) override
 Adds a dependent block using DependentBlockManager.
 
void add_param_dependency (const ParamId &pid, const std::unordered_set< ParamId > &source_pids, DepParamUpdateFunc recalculateFunc) override
 Adds a dependent parameter using DependentBlockManager.
 
void remove_dependency (const BlockName &name, ParameterType src) override
 Removes a dependent block using DependentBlockManager.
 
void update_dependency (const BlockName &name, ParameterType src) override
 Manually triggers an update on a dependent block using DependentBlockManager.
 
- Public Member Functions inherited from IDependency
virtual ~IDependency ()=default
 Virtual destructor for proper polymorphic cleanup.
 

Detailed Description

Concrete implementation of IDependency using DependentBlockManager.

This adapter glues high-level dependency management code (e.g. configuration, model setup) to the underlying mechanisms based on:

All methods simply forward to the static helpers in DependentBlockManager:

This indirection allows you to:

  • mock or replace the dependency manager in tests,
  • centralize all dependency creation logic behind a single interface (IDependency).
See also
IDependency
DependentBlockManager
DependentBlock
DependentParameter
Examples
examples/dependency_management_example.cpp.

Definition at line 45 of file CompositeParamCreator.h.

Member Function Documentation

◆ add_block_dependency()

void CompositeParamAdapter::add_block_dependency ( const BlockName name,
const std::unordered_map< ParameterType, std::vector< std::string > > &  source_names,
ParameterType  dest,
DepUpdateFunc  recalculateFunc 
)
overridevirtual

Adds a dependent block using DependentBlockManager.

Creates a new DependentBlock whose content is computed from a set of source blocks, possibly coming from different Parameters instances.

Internally, this calls:

DependentBlockManager::addDependentBlock(name, source_names, dest, recalculateFunc);
static void addDependentBlock(std::string name, std::unordered_map< ParameterType, std::vector< std::string > > source_names, ParameterType dest, DepUpdateFunc recalculateFunc)
Adds a DependentBlock with multiple sources coming from various Parameters instances.
Parameters
nameName of the dependent block to create.
source_namesMap associating each source ParameterType to the list of block names that will serve as inputs.
destDestination ParameterType in which the new block will be registered.
recalculateFuncLambda used to recompute the block from its sources.

Implements IDependency.

Examples
examples/dependency_management_example.cpp.

Definition at line 3 of file CompositeParamCreator.cpp.

◆ add_param_dependency()

void CompositeParamAdapter::add_param_dependency ( const ParamId pid,
const std::unordered_set< ParamId > &  source_pids,
DepParamUpdateFunc  recalculateFunc 
)
overridevirtual

Adds a dependent parameter using DependentBlockManager.

Creates a DependentParameter whose value is computed from one or several source parameters, possibly across different ParameterType instances.

Internally, this calls:

DependentBlockManager::addDependentParameter(pid, source_pids, recalculateFunc);
static void addDependentParameter(ParamId pid, std::unordered_set< ParamId > source_pids, DepParamUpdateFunc recalculateFunc)
Adds a DependentParameter based on multiple source parameters.
Parameters
pidID of the dependent parameter to create.
source_pidsSet of IDs for the source parameters.
recalculateFuncLambda used to recompute the parameter value.

Implements IDependency.

Definition at line 12 of file CompositeParamCreator.cpp.

◆ remove_dependency()

void CompositeParamAdapter::remove_dependency ( const BlockName name,
ParameterType  src 
)
overridevirtual

Removes a dependent block using DependentBlockManager.

Internally, this calls:

static void removeDependentBlock(const std::string &name, ParameterType src)
Removes a DependentBlock from a specified Parameters instance.
Parameters
nameName of the dependent block to remove.
srcParameterType (model) where the block is registered.

Implements IDependency.

Definition at line 20 of file CompositeParamCreator.cpp.

◆ update_dependency()

void CompositeParamAdapter::update_dependency ( const BlockName name,
ParameterType  src 
)
overridevirtual

Manually triggers an update on a dependent block using DependentBlockManager.

Internally, this calls:

static void update(const std::string &name, ParameterType src)
Manually triggers an update on a DependentBlock.
Parameters
nameName of the dependent block to update.
srcParameterType (model) where the block is located.

Implements IDependency.

Examples
examples/dependency_management_example.cpp.

Definition at line 24 of file CompositeParamCreator.cpp.


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