mirror of https://github.com/CGAL/cgal
Rename traverse_indices to traverse (now that it's the only traversal function)
This commit is contained in:
parent
5bc0962b81
commit
8fe57f5adf
|
|
@ -16,7 +16,7 @@ void dump_as_polylines(const Octree& ot)
|
||||||
{
|
{
|
||||||
// SL: I cheated for this part and looked at the implementation
|
// SL: I cheated for this part and looked at the implementation
|
||||||
std::ofstream out("octree.polylines.txt");
|
std::ofstream out("octree.polylines.txt");
|
||||||
for (Octree::Node_index node : ot.traverse_indices(CGAL::Orthtrees::Leaves_traversal<Octree>(ot)))
|
for (Octree::Node_index node : ot.traverse(CGAL::Orthtrees::Leaves_traversal<Octree>(ot)))
|
||||||
{
|
{
|
||||||
if (!ot.is_leaf(node))
|
if (!ot.is_leaf(node))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ int main(int argc, char** argv) {
|
||||||
octree.refine();
|
octree.refine();
|
||||||
|
|
||||||
// Print out the first branch using custom traversal
|
// Print out the first branch using custom traversal
|
||||||
for (auto node: octree.traverse_indices<First_branch_traversal<Octree>>()) {
|
for (auto node: octree.traverse<First_branch_traversal<Octree>>()) {
|
||||||
std::cout << octree.to_string(node) << std::endl;
|
std::cout << octree.to_string(node) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ int main(int argc, char **argv) {
|
||||||
octree.refine();
|
octree.refine();
|
||||||
|
|
||||||
// Print out the octree using preorder traversal
|
// Print out the octree using preorder traversal
|
||||||
for (auto node : octree.traverse_indices<Preorder_traversal>()) {
|
for (auto node : octree.traverse<Preorder_traversal>()) {
|
||||||
std::cout << octree.to_string(node) << std::endl;
|
std::cout << octree.to_string(node) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ public:
|
||||||
|
|
||||||
// Collect all the leaf nodes
|
// Collect all the leaf nodes
|
||||||
std::queue<Node_index> leaf_nodes;
|
std::queue<Node_index> leaf_nodes;
|
||||||
for (Node_index leaf: traverse_indices(Orthtrees::Leaves_traversal<Self>(*this))) {
|
for (Node_index leaf: traverse(Orthtrees::Leaves_traversal<Self>(*this))) {
|
||||||
leaf_nodes.push(leaf);
|
leaf_nodes.push(leaf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,7 +451,7 @@ public:
|
||||||
\return a forward input iterator over the node indices of the tree
|
\return a forward input iterator over the node indices of the tree
|
||||||
*/
|
*/
|
||||||
template <typename Traversal>
|
template <typename Traversal>
|
||||||
Node_index_range traverse_indices(Traversal traversal) const {
|
Node_index_range traverse(Traversal traversal) const {
|
||||||
|
|
||||||
Node_index first = traversal.first_index();
|
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
|
\tparam Traversal model of `OrthtreeTraversal` that provides functions
|
||||||
compatible with the type of the orthtree
|
compatible with the type of the orthtree
|
||||||
|
|
@ -475,8 +475,8 @@ public:
|
||||||
\return a forward input iterator over the node indices of the tree
|
\return a forward input iterator over the node indices of the tree
|
||||||
*/
|
*/
|
||||||
template <typename Traversal, typename ...Args>
|
template <typename Traversal, typename ...Args>
|
||||||
Node_index_range traverse_indices(Args&& ...args) const {
|
Node_index_range traverse(Args&& ...args) const {
|
||||||
return traverse_indices(Traversal{*this, std::forward<Args>(args)...});
|
return traverse(Traversal{*this, std::forward<Args>(args)...});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -1157,7 +1157,7 @@ public:
|
||||||
|
|
||||||
/// \cond SKIP_IN_MANUAL
|
/// \cond SKIP_IN_MANUAL
|
||||||
void dump_to_polylines(std::ostream& os) const {
|
void dump_to_polylines(std::ostream& os) const {
|
||||||
for (const auto n: traverse_indices<Orthtrees::Preorder_traversal>())
|
for (const auto n: traverse<Orthtrees::Preorder_traversal>())
|
||||||
if (is_leaf(n)) {
|
if (is_leaf(n)) {
|
||||||
Bbox box = bbox(n);
|
Bbox box = bbox(n);
|
||||||
dump_box_to_polylines(box, os);
|
dump_box_to_polylines(box, os);
|
||||||
|
|
@ -1214,7 +1214,7 @@ public:
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& os, const Self& orthtree) {
|
friend std::ostream& operator<<(std::ostream& os, const Self& orthtree) {
|
||||||
// Iterate over all nodes
|
// Iterate over all nodes
|
||||||
for (auto n: orthtree.traverse_indices(Orthtrees::Preorder_traversal<Self>(orthtree))) {
|
for (auto n: orthtree.traverse(Orthtrees::Preorder_traversal<Self>(orthtree))) {
|
||||||
// Show the depth
|
// Show the depth
|
||||||
for (int i = 0; i < orthtree.depth(n); ++i)
|
for (int i = 0; i < orthtree.depth(n); ++i)
|
||||||
os << ". ";
|
os << ". ";
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ int main(void) {
|
||||||
|
|
||||||
// Expanding the tree; new nodes should be assigned the default value
|
// Expanding the tree; new nodes should be assigned the default value
|
||||||
tree.refine(10, 1);
|
tree.refine(10, 1);
|
||||||
for (auto n : tree.traverse_indices<CGAL::Orthtrees::Preorder_traversal<Octree>>()) {
|
for (auto n : tree.traverse<CGAL::Orthtrees::Preorder_traversal<Octree>>()) {
|
||||||
// Everything but the root will have the default value
|
// Everything but the root will have the default value
|
||||||
if (!tree.is_root(n)) assert(node_int_property[n] == 5);
|
if (!tree.is_root(n)) assert(node_int_property[n] == 5);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ std::size_t count_jumps(Octree& octree) {
|
||||||
|
|
||||||
std::size_t jumps = 0;
|
std::size_t jumps = 0;
|
||||||
|
|
||||||
for (auto node: octree.traverse_indices<Leaves_traversal>()) {
|
for (auto node: octree.traverse<Leaves_traversal>()) {
|
||||||
|
|
||||||
for (int direction = 0; direction < 6; ++direction) {
|
for (int direction = 0; direction < 6; ++direction) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ bool test_preorder_1_node() {
|
||||||
octree.refine(10, 1);
|
octree.refine(10, 1);
|
||||||
|
|
||||||
// Create the range
|
// Create the range
|
||||||
auto nodes = octree.traverse_indices<Preorder_traversal>();
|
auto nodes = octree.traverse<Preorder_traversal>();
|
||||||
|
|
||||||
// Check each item in the range
|
// Check each item in the range
|
||||||
auto iter = nodes.begin();
|
auto iter = nodes.begin();
|
||||||
|
|
@ -47,7 +47,7 @@ bool test_preorder_9_nodes() {
|
||||||
octree.refine(10, 1);
|
octree.refine(10, 1);
|
||||||
|
|
||||||
// Create the range
|
// Create the range
|
||||||
auto nodes = octree.traverse_indices<Preorder_traversal>();
|
auto nodes = octree.traverse<Preorder_traversal>();
|
||||||
|
|
||||||
// Check each item in the range
|
// Check each item in the range
|
||||||
auto iter = nodes.begin();
|
auto iter = nodes.begin();
|
||||||
|
|
@ -72,7 +72,7 @@ bool test_level_9_nodes() {
|
||||||
octree.refine(10, 1);
|
octree.refine(10, 1);
|
||||||
|
|
||||||
// Create the range
|
// Create the range
|
||||||
auto nodes = octree.traverse_indices<Level_traversal>(static_cast<std::size_t>(1));
|
auto nodes = octree.traverse<Level_traversal>(static_cast<std::size_t>(1));
|
||||||
|
|
||||||
// Check each item in the range
|
// Check each item in the range
|
||||||
auto iter = nodes.begin();
|
auto iter = nodes.begin();
|
||||||
|
|
@ -98,7 +98,7 @@ bool test_preorder_25_nodes() {
|
||||||
octree.refine(10, 1);
|
octree.refine(10, 1);
|
||||||
|
|
||||||
// Create the range
|
// Create the range
|
||||||
auto nodes = octree.traverse_indices<Preorder_traversal>();
|
auto nodes = octree.traverse<Preorder_traversal>();
|
||||||
|
|
||||||
// Check each item in the range
|
// Check each item in the range
|
||||||
auto iter = nodes.begin();
|
auto iter = nodes.begin();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue