From 8fe57f5adf29cbda5f7a7953df6a05efc9379c85 Mon Sep 17 00:00:00 2001 From: JacksonCampolattaro Date: Thu, 27 Jul 2023 09:49:20 +0200 Subject: [PATCH] Rename traverse_indices to traverse (now that it's the only traversal function) --- Orthtree/examples/Orthtree/octree_surface_mesh.cpp | 2 +- .../examples/Orthtree/octree_traversal_custom.cpp | 2 +- .../Orthtree/octree_traversal_preorder.cpp | 2 +- Orthtree/include/CGAL/Orthtree.h | 14 +++++++------- .../Orthtree/test_octree_custom_properties.cpp | 2 +- Orthtree/test/Orthtree/test_octree_grade.cpp | 2 +- Orthtree/test/Orthtree/test_octree_traverse.cpp | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Orthtree/examples/Orthtree/octree_surface_mesh.cpp b/Orthtree/examples/Orthtree/octree_surface_mesh.cpp index aba87d2c6df..c2acd05791e 100644 --- a/Orthtree/examples/Orthtree/octree_surface_mesh.cpp +++ b/Orthtree/examples/Orthtree/octree_surface_mesh.cpp @@ -16,7 +16,7 @@ void dump_as_polylines(const Octree& ot) { // SL: I cheated for this part and looked at the implementation std::ofstream out("octree.polylines.txt"); - for (Octree::Node_index node : ot.traverse_indices(CGAL::Orthtrees::Leaves_traversal(ot))) + for (Octree::Node_index node : ot.traverse(CGAL::Orthtrees::Leaves_traversal(ot))) { if (!ot.is_leaf(node)) continue; diff --git a/Orthtree/examples/Orthtree/octree_traversal_custom.cpp b/Orthtree/examples/Orthtree/octree_traversal_custom.cpp index 4211b5bbb8a..dd6de668c8b 100644 --- a/Orthtree/examples/Orthtree/octree_traversal_custom.cpp +++ b/Orthtree/examples/Orthtree/octree_traversal_custom.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) { octree.refine(); // Print out the first branch using custom traversal - for (auto node: octree.traverse_indices>()) { + for (auto node: octree.traverse>()) { std::cout << octree.to_string(node) << std::endl; } diff --git a/Orthtree/examples/Orthtree/octree_traversal_preorder.cpp b/Orthtree/examples/Orthtree/octree_traversal_preorder.cpp index 0ebc4ba03fc..fbda2f8db8f 100644 --- a/Orthtree/examples/Orthtree/octree_traversal_preorder.cpp +++ b/Orthtree/examples/Orthtree/octree_traversal_preorder.cpp @@ -37,7 +37,7 @@ int main(int argc, char **argv) { octree.refine(); // Print out the octree using preorder traversal - for (auto node : octree.traverse_indices()) { + for (auto node : octree.traverse()) { std::cout << octree.to_string(node) << std::endl; } diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index d70545a209c..acc045bc0e7 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -369,7 +369,7 @@ public: // Collect all the leaf nodes std::queue leaf_nodes; - for (Node_index leaf: traverse_indices(Orthtrees::Leaves_traversal(*this))) { + for (Node_index leaf: traverse(Orthtrees::Leaves_traversal(*this))) { leaf_nodes.push(leaf); } @@ -451,7 +451,7 @@ public: \return a forward input iterator over the node indices of the tree */ template - Node_index_range traverse_indices(Traversal traversal) const { + Node_index_range traverse(Traversal traversal) const { Node_index first = traversal.first_index(); @@ -465,7 +465,7 @@ public: /*! - \brief Convenience function for using a traversal without constructing it yourself + \brief Convenience method for using a traversal without constructing it yourself \tparam Traversal model of `OrthtreeTraversal` that provides functions compatible with the type of the orthtree @@ -475,8 +475,8 @@ public: \return a forward input iterator over the node indices of the tree */ template - Node_index_range traverse_indices(Args&& ...args) const { - return traverse_indices(Traversal{*this, std::forward(args)...}); + Node_index_range traverse(Args&& ...args) const { + return traverse(Traversal{*this, std::forward(args)...}); } /*! @@ -1157,7 +1157,7 @@ public: /// \cond SKIP_IN_MANUAL void dump_to_polylines(std::ostream& os) const { - for (const auto n: traverse_indices()) + for (const auto n: traverse()) if (is_leaf(n)) { Bbox box = bbox(n); dump_box_to_polylines(box, os); @@ -1214,7 +1214,7 @@ public: friend std::ostream& operator<<(std::ostream& os, const Self& orthtree) { // Iterate over all nodes - for (auto n: orthtree.traverse_indices(Orthtrees::Preorder_traversal(orthtree))) { + for (auto n: orthtree.traverse(Orthtrees::Preorder_traversal(orthtree))) { // Show the depth for (int i = 0; i < orthtree.depth(n); ++i) os << ". "; diff --git a/Orthtree/test/Orthtree/test_octree_custom_properties.cpp b/Orthtree/test/Orthtree/test_octree_custom_properties.cpp index cb1139a7c04..8398175dbfd 100644 --- a/Orthtree/test/Orthtree/test_octree_custom_properties.cpp +++ b/Orthtree/test/Orthtree/test_octree_custom_properties.cpp @@ -35,7 +35,7 @@ int main(void) { // Expanding the tree; new nodes should be assigned the default value tree.refine(10, 1); - for (auto n : tree.traverse_indices>()) { + for (auto n : tree.traverse>()) { // Everything but the root will have the default value if (!tree.is_root(n)) assert(node_int_property[n] == 5); } diff --git a/Orthtree/test/Orthtree/test_octree_grade.cpp b/Orthtree/test/Orthtree/test_octree_grade.cpp index 7bec427e037..ef39e2f89b9 100644 --- a/Orthtree/test/Orthtree/test_octree_grade.cpp +++ b/Orthtree/test/Orthtree/test_octree_grade.cpp @@ -21,7 +21,7 @@ std::size_t count_jumps(Octree& octree) { std::size_t jumps = 0; - for (auto node: octree.traverse_indices()) { + for (auto node: octree.traverse()) { for (int direction = 0; direction < 6; ++direction) { diff --git a/Orthtree/test/Orthtree/test_octree_traverse.cpp b/Orthtree/test/Orthtree/test_octree_traverse.cpp index 0d442051faf..b0e2823ee78 100644 --- a/Orthtree/test/Orthtree/test_octree_traverse.cpp +++ b/Orthtree/test/Orthtree/test_octree_traverse.cpp @@ -26,7 +26,7 @@ bool test_preorder_1_node() { octree.refine(10, 1); // Create the range - auto nodes = octree.traverse_indices(); + auto nodes = octree.traverse(); // Check each item in the range auto iter = nodes.begin(); @@ -47,7 +47,7 @@ bool test_preorder_9_nodes() { octree.refine(10, 1); // Create the range - auto nodes = octree.traverse_indices(); + auto nodes = octree.traverse(); // Check each item in the range auto iter = nodes.begin(); @@ -72,7 +72,7 @@ bool test_level_9_nodes() { octree.refine(10, 1); // Create the range - auto nodes = octree.traverse_indices(static_cast(1)); + auto nodes = octree.traverse(static_cast(1)); // Check each item in the range auto iter = nodes.begin(); @@ -98,7 +98,7 @@ bool test_preorder_25_nodes() { octree.refine(10, 1); // Create the range - auto nodes = octree.traverse_indices(); + auto nodes = octree.traverse(); // Check each item in the range auto iter = nodes.begin();