Loading...
Searching...
No Matches
PyNetworkPolicy Class Referencefinal

`#include <py_policy.h>`

Inheritance diagram for PyNetworkPolicy:
[legend]
Collaboration diagram for PyNetworkPolicy:
[legend]

## Public Member Functions

std::string | name () const override
| Human-readable name for the policy.
const std::set< fourdst::atomic::Species > & | get_seed_species () const override
| Returns the seed species the policy requires to initialize the network.
const gridfire::reaction::ReactionSet & | get_seed_reactions () const override
| Returns the set of seed reactions the policy requires.
gridfire::policy::ConstructionResults | construct () override
| Construct and return a DynamicEngine instance (or engine view stack) satisfying the policy.
gridfire::policy::NetworkPolicyStatus | get_status () const override
| Returns the current verification/construction status of the policy.
const std::vector< std::unique_ptr< gridfire::engine::DynamicEngine > > & | get_engine_stack () const override
std::vector< gridfire::engine::EngineTypes > | get_engine_types_stack () const override
const std::unique_ptr< gridfire::partition::PartitionFunction > & | get_partition_function () const override
std::unique_ptr< gridfire::engine::scratch::StateBlob > | get_stack_scratch_blob () const override
Public Member Functions inherited from gridfire::policy::NetworkPolicy
virtual | ~NetworkPolicy ()=default

## Member Function Documentation

## construct()

gridfire::policy::ConstructionResults PyNetworkPolicy::construct | ( |  | ) |

nodiscardoverridevirtual

Construct and return a DynamicEngine instance (or engine view stack) satisfying the policy.

Implementations typically build one or more engine layers (GraphEngine, MultiscalePartitioningEngineView, AdaptiveEngineView, etc.) and return a reference to the top-most DynamicEngine. The storage lifetime of the returned reference is implementation-defined (usually owned by the policy instance).

Returns
  DynamicEngine& reference to a running/constructed engine ready for solver consumption.

Exceptions

  gridfire::exceptions::MissingKeyReactionError | if required reactions are not present in the constructed network (see `gridfire/exceptions/error_policy.h`).
  gridfire::exceptions::MissingSeedSpeciesError | if required seed species are missing from the initializing composition.
  gridfire::exceptions::PolicyError | for other construction/verification failures.

Example
  DynamicEngine &engine = policy.construct();
  solver::CVODESolverStrategy solver(engine);
  NetOut out = solver.evaluate(netIn, true);

Implements gridfire::policy::NetworkPolicy.

## get_engine_stack()

const std::vector< std::unique_ptr< gridfire::engine::DynamicEngine > > & PyNetworkPolicy::get_engine_stack | ( |  | ) | const

nodiscardoverridevirtual

Implements gridfire::policy::NetworkPolicy.

## get_engine_types_stack()

std::vector< gridfire::engine::EngineTypes > PyNetworkPolicy::get_engine_types_stack | ( |  | ) | const

nodiscardoverridevirtual

Implements gridfire::policy::NetworkPolicy.

## get_partition_function()

const std::unique_ptr< gridfire::partition::PartitionFunction > & PyNetworkPolicy::get_partition_function | ( |  | ) | const

nodiscardoverridevirtual

Implements gridfire::policy::NetworkPolicy.

## get_seed_reactions()

const gridfire::reaction::ReactionSet & PyNetworkPolicy::get_seed_reactions | ( |  | ) | const

nodiscardoverridevirtual

Returns the set of seed reactions the policy requires.

The ReactionSet describes reactions that must be present in the constructed network for the policy to be considered satisfied. Concrete policies often implement their reaction requirements by composing one or more ReactionChainPolicy instances (see `chains.h`).

Example
  const reaction::ReactionSet &reactions = policy.get_seed_reactions();
  // inspect reaction IDs or count
  std::cout << "Policy requires " << reactions.size() << " reactions" << std::endl;

Implements gridfire::policy::NetworkPolicy.

## get_seed_species()

const std::set< fourdst::atomic::Species > & PyNetworkPolicy::get_seed_species | ( |  | ) | const

nodiscardoverridevirtual

Returns the seed species the policy requires to initialize the network.

The returned set contains atomic species identifiers (fourdst::atomic::Species) which the policy expects to be present in the initial composition used to build the network.

Implementations should return a copy or an immutable reference to their internal set of required seed species.

Example
  const auto seeds = policy.get_seed_species();
  for (const auto &s : seeds) { std::cout << s.name() << std::endl; }

Implements gridfire::policy::NetworkPolicy.

## get_stack_scratch_blob()

std::unique_ptr< gridfire::engine::scratch::StateBlob > PyNetworkPolicy::get_stack_scratch_blob | ( |  | ) | const

nodiscardoverridevirtual

Implements gridfire::policy::NetworkPolicy.

## get_status()

gridfire::policy::NetworkPolicyStatus PyNetworkPolicy::get_status | ( |  | ) | const

nodiscardoverridevirtual

Returns the current verification/construction status of the policy.

The status reports whether the policy has been initialized and whether the constructed network satisfies the policy's key requirements.

Example
  NetworkPolicyStatus s = policy.getStatus();
  if (s != NetworkPolicyStatus::INITIALIZED_VERIFIED) { // handle error }

Implements gridfire::policy::NetworkPolicy.

## name()

std::string PyNetworkPolicy::name | ( |  | ) | const

nodiscardoverridevirtual

Human-readable name for the policy.

Returns
  a std::string identifying the policy implementation (e.g. "MainSequencePolicy").

Example
  std::string n = policy.name();
  std::cout << "Using policy: " << n << std::endl;

Implements gridfire::policy::NetworkPolicy.

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

- src/python/policy/trampoline/py_policy.h
- src/python/policy/trampoline/py_policy.cpp