| 54 | } |
| 55 | |
| 56 | std::vector<std::vector<unsigned int>> |
| 57 | brute_force_search() |
| 58 | { |
| 59 | std::vector<std::vector<unsigned int>> brute_force_neighbors(positions.size()); |
| 60 | for (int i = 0; i < positions.size(); ++i) |
| 61 | { |
| 62 | std::vector<unsigned int>& neighbors = brute_force_neighbors[i]; |
| 63 | for (int j = 0; j < positions.size(); ++j) |
| 64 | { |
| 65 | if (i == j) |
| 66 | continue; |
| 67 | std::array<Real, 3> const& xa = positions[i]; |
| 68 | std::array<Real, 3> const& xb = positions[j]; |
| 69 | Real l2 = |
| 70 | (xa[0] - xb[0])*(xa[0] - xb[0]) + |
| 71 | (xa[1] - xb[1])*(xa[1] - xb[1]) + |
| 72 | (xa[2] - xb[2])*(xa[2] - xb[2]); |
| 73 | if (l2 <= radius * radius) |
| 74 | { |
| 75 | neighbors.push_back(j); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | return std::move(brute_force_neighbors); |
| 80 | } |
| 81 | |
| 82 | void |
| 83 | compare_with_bruteforce_search(NeighborhoodSearch const& nsearch) |
no outgoing calls
no test coverage detected