The DependencyResolver identifies and resolves the dependencies among a set of objects derived from DependencyDefinition.
More...
template<typename Node, typename ItemType>
class neml2::DependencyResolver< Node, ItemType >
The DependencyResolver identifies and resolves the dependencies among a set of objects derived from DependencyDefinition.
- Template Parameters
-
Node | The type of the node in the dependency graph, i.e. if this resolver is used to figure out dependencies among Models, this template parameter should be Model. |
ItemType | The type of the consumed/provided items of each node |
#include <DependencyResolver.h>
|
| DependencyResolver ()=default |
|
void | add_node (DependencyDefinition< ItemType > *) |
| Add a node (defining consumed/provided items) in the dependency graph.
|
|
void | add_additional_outbound_item (const ItemType &item) |
| Add an additional outbound item that the dependency graph provides
|
|
void | set_priority (DependencyDefinition< ItemType > *, size_t) |
| Set a node's priority, useful for resolving cyclic dependency.
|
|
void | resolve () |
| Resolve nodal dependency and find an evaluation order.
|
|
const std::vector< Node * > & | resolution () const |
| The resolved (nodal) evaluation order following which all consumed items of the current node.
|
|
const std::map< Item, std::set< Item > > & | item_providers () const |
|
const std::map< Item, std::set< Item > > & | item_consumers () const |
|
const std::map< Node *, std::set< Node * > > & | node_providers () const |
|
const std::map< Node *, std::set< Node * > > & | node_consumers () const |
|
const std::set< Node * > & | end_nodes () const |
| End nodes which are not consumed by anyone else.
|
|
const std::set< Item > & | outbound_items () const |
| The items provided by the overall dependency graph, i.e., the items that are not consumed by any node.
|
|
const std::set< Node * > & | start_nodes () const |
| Start nodes which do not consume anyone else.
|
|
const std::set< Item > & | inbound_items () const |
| The items consumed by the overall dependency graph, i.e., the items that are not provided by any node.
|
|
bool & | unique_item_provider () |
|
bool & | unique_item_consumer () |
|
◆ DependencyResolver()
template<typename Node, typename ItemType>
◆ add_additional_outbound_item()
template<typename Node, typename ItemType>
void add_additional_outbound_item |
( |
const ItemType & | item | ) |
|
Add an additional outbound item that the dependency graph provides
◆ add_node()
template<typename Node, typename ItemType>
Add a node (defining consumed/provided items) in the dependency graph.
◆ end_nodes()
template<typename Node, typename ItemType>
const std::set< Node * > & end_nodes |
( |
| ) |
const |
|
inline |
End nodes which are not consumed by anyone else.
◆ inbound_items()
template<typename Node, typename ItemType>
const std::set< Item > & inbound_items |
( |
| ) |
const |
|
inline |
The items consumed by the overall dependency graph, i.e., the items that are not provided by any node.
◆ item_consumers()
template<typename Node, typename ItemType>
const std::map< Item, std::set< Item > > & item_consumers |
( |
| ) |
const |
|
inline |
The item-item consumer dictionary: key of the dictionary is the item of interest, and the value of the dictionary is the set of items that consume the item of interest.
◆ item_providers()
template<typename Node, typename ItemType>
const std::map< Item, std::set< Item > > & item_providers |
( |
| ) |
const |
|
inline |
The item-item provider dictionary: key of the dictionary is the item of interest, and the value of the dictionary is the set of items that provide the item of interest.
◆ node_consumers()
template<typename Node, typename ItemType>
const std::map< Node *, std::set< Node * > > & node_consumers |
( |
| ) |
const |
|
inline |
The node-node consumer dictionary: key of the dictionary is the node of interest, and the value of the dictionary is the set of nodes that consume the item of interest.
◆ node_providers()
template<typename Node, typename ItemType>
const std::map< Node *, std::set< Node * > > & node_providers |
( |
| ) |
const |
|
inline |
The node-node provider dictionary: key of the dictionary is the node of interest, and the value of the dictionary is the set of nodes that provide the item of interest.
◆ outbound_items()
template<typename Node, typename ItemType>
const std::set< Item > & outbound_items |
( |
| ) |
const |
|
inline |
The items provided by the overall dependency graph, i.e., the items that are not consumed by any node.
◆ resolution()
template<typename Node, typename ItemType>
const std::vector< Node * > & resolution |
( |
| ) |
const |
|
inline |
The resolved (nodal) evaluation order following which all consumed items of the current node.
◆ resolve()
template<typename Node, typename ItemType>
Resolve nodal dependency and find an evaluation order.
◆ set_priority()
template<typename Node, typename ItemType>
Set a node's priority, useful for resolving cyclic dependency.
◆ start_nodes()
template<typename Node, typename ItemType>
const std::set< Node * > & start_nodes |
( |
| ) |
const |
|
inline |
Start nodes which do not consume anyone else.
◆ unique_item_consumer()
template<typename Node, typename ItemType>
bool & unique_item_consumer |
( |
| ) |
|
|
inline |
- Returns
- a boolean flag controlling whether item consumer should be unique
◆ unique_item_provider()
template<typename Node, typename ItemType>
bool & unique_item_provider |
( |
| ) |
|
|
inline |
- Returns
- a boolean flag controlling whether item provider should be unique