Skip to content

Commit

Permalink
allow run_all without notifying children
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylannl committed Sep 10, 2020
1 parent 1950495 commit d501d05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/geoflow/core_nodes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions src/geoflow/geoflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,20 +415,22 @@ std::string Node::debug_info() {
void NodeManager::queue(std::shared_ptr<Node> 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<NodeHandle> to_run;
for (auto& [name, node] : nodes) {
if(node->is_root() && node->autorun) {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/geoflow/geoflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d501d05

Please sign in to comment.