aboria / Aboria

Enables computations over a set of particles in N-dimensional space
https://aboria.github.io/Aboria
Other
105 stars 30 forks source link

NeighbourQueryBase needs the concept of a root child_iterator #26

Open martinjrobins opened 6 years ago

martinjrobins commented 6 years ago

Aboria::NeighbourQueryBase needs the concept of a root child_iterator to simplify writing, for example, a depth-first iteration. At the moment it is:

     auto depth_first = [&](const auto &parent) {
      std::cout << query.get_bounds(parent) << std::endl;

      for (auto i = query.get_children(parent); i != false; ++i) {
        depth_first(i);
      }
    };

    for (auto i = query.get_children(); i != false; ++i) {
      depth_first(i);
    }

It should be

     auto depth_first = [&](const auto &parent) {
      std::cout << query.get_bounds(parent) << std::endl;

      for (auto i = query.get_children(parent); i != false; ++i) {
        depth_first(i);
      }
    };
    depth_first(query.get_root());