From d501d05311ba74706f75b549e8cef21759466025 Mon Sep 17 00:00:00 2001 From: Ravi Peters Date: Thu, 10 Sep 2020 20:01:07 +0200 Subject: [PATCH] allow run_all without notifying children --- src/geoflow/core_nodes.hpp | 2 +- src/geoflow/geoflow.cpp | 10 ++++++---- src/geoflow/geoflow.hpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/geoflow/core_nodes.hpp b/src/geoflow/core_nodes.hpp index 7f87e99..59b8919 100644 --- a/src/geoflow/core_nodes.hpp +++ b/src/geoflow/core_nodes.hpp @@ -195,7 +195,7 @@ namespace geoflow::nodes::core { std::cout << "Processing item " << i+1 << "/" << input_size_ << "\n"; std::clock_t c_start = std::clock(); // CPU time // auto t_start = std::chrono::high_resolution_clock::now(); // Wall time - flowchart->run(proxy_node, false); + flowchart->run_all(false); std::clock_t c_end = std::clock(); // CPU time // auto t_end = std::chrono::high_resolution_clock::now(); // Wall time runtime = 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC; diff --git a/src/geoflow/geoflow.cpp b/src/geoflow/geoflow.cpp index 38f74c8..5f72e53 100644 --- a/src/geoflow/geoflow.cpp +++ b/src/geoflow/geoflow.cpp @@ -415,7 +415,7 @@ std::string Node::debug_info() { void NodeManager::queue(std::shared_ptr n) { node_queue.push(n); } -size_t NodeManager::run_all() { +size_t NodeManager::run_all(bool notify_children) { // find all root nodes with autorun enabled std::vector to_run; for (auto& [name, node] : nodes) { @@ -423,12 +423,14 @@ size_t NodeManager::run_all() { to_run.push_back(node); } } - for (auto& node : to_run){ - node->notify_children(); + if(notify_children) { + for (auto& node : to_run){ + node->notify_children(); + } } size_t run_count = 0; for (auto& node : to_run){ - run_count += run(node); + run_count += run(node, notify_children); } return run_count; } diff --git a/src/geoflow/geoflow.hpp b/src/geoflow/geoflow.hpp index 449ff82..ce5ece6 100644 --- a/src/geoflow/geoflow.hpp +++ b/src/geoflow/geoflow.hpp @@ -716,7 +716,7 @@ namespace geoflow { std::string substitute_globals(const std::string& text) const; - size_t run_all(); + size_t run_all(bool notify_children=true); size_t run(Node &node, bool notify_children=true); size_t run(NodeHandle node, bool notify_children=true) { return run(*node, notify_children);