File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,23 @@ namespace UnitTest
2727Node *TestGraph::fetchHead () const { return head_; }
2828// Returns the name of the current head node in the graph
2929std::string TestGraph::fetchHeadName () const { return head_ ? std::string (head_->name ()) : " NO_NODE" ; }
30+ // Run the graph in a piecewise manner - initially from a specific node, then from the last node - in order to emplace a set
31+ // of dynamic edges that we expect to exist at run time
32+ NodeConstants::ProcessResult TestGraph::runDynamic (Node *startNode, std::vector<EdgeDefinition> edges) const
33+ {
34+ currentGraph_->setUpdateRequired ();
35+
36+ auto result = NodeConstants::ProcessResult::Unchanged;
37+ result = startNode->run ();
38+ if (result == NodeConstants::ProcessResult::Failed)
39+ return result;
40+
41+ for (const auto &edge : edges)
42+ if (!currentGraph_->addEdge (edge) ||
43+ currentGraph_->findNode (edge.targetNode )->run () == NodeConstants::ProcessResult::Failed)
44+ return NodeConstants::ProcessResult::Failed;
45+ return result;
46+ }
3047// Append new node to the graph
3148Node *TestGraph::appendNode (const std::string &nodeType, const std::optional<std::string> &name)
3249{
Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ class TestGraph : public DissolveGraph
4646 std::string fetchHeadName () const ;
4747 // Returns reference to current top node in graph, cast to the known node type
4848 template <class NodeType > NodeType *head () const { return static_cast <NodeType *>(head_); }
49+ // Run the graph in a piecewise manner - initially from a specific node, then from the last node - in order to emplace a set
50+ // of dynamic edges that we expect to exist at run time
51+ NodeConstants::ProcessResult runDynamic (Node *startNode, std::vector<EdgeDefinition> edges) const ;
4952 // Append new node to the graph
5053 Node *appendNode (const std::string &nodeType, const std::optional<std::string> &name = {});
5154 // Create species insertion node chain
You can’t perform that action at this time.
0 commit comments