diff --git a/src/mykdtree.tcc b/src/mykdtree.tcc index cd72fe4..e276cad 100644 --- a/src/mykdtree.tcc +++ b/src/mykdtree.tcc @@ -97,15 +97,15 @@ namespace CosmoTool { recursiveIntersectionCells(info, root, 0); if (periodic) { - ReplicateGenerator replicate(x); + ReplicateGenerator r(x, replicate); do { coords x_new; - replicate.getPosition(info.x); + r.getPosition(info.x); recursiveIntersectionCells(info, root, 0); } - while (replicate.next()); + while (r.next()); } return info.currentRank; @@ -131,15 +131,15 @@ namespace CosmoTool { recursiveIntersectionCells(info, root, 0); if (periodic) { - ReplicateGenerator replicate(x); + ReplicateGenerator r(x, replicate); do { coords x_new; - replicate.getPosition(info.x); + r.getPosition(info.x); recursiveIntersectionCells(info, root, 0); } - while (replicate.next()); + while (r.next()); } return info.currentRank; } @@ -160,15 +160,15 @@ namespace CosmoTool { recursiveIntersectionCells(info, root, 0); if (periodic) { - ReplicateGenerator replicate(x); + ReplicateGenerator r(x, replicate); do { coords x_new; - replicate.getPosition(info.x); + r.getPosition(info.x); recursiveIntersectionCells(info, root, 0); } - while (replicate.next()); + while (r.next()); } return info.currentRank; @@ -408,15 +408,15 @@ namespace CosmoTool { recursiveNearest(root, 0, x, R2, best); if (periodic) { - ReplicateGenerator replicate(x); + ReplicateGenerator r(x, replicate); do { coords x_new; - replicate.getPosition(x_new); + r.getPosition(x_new); recursiveNearest(root, 0, x_new, R2, best); } - while (replicate.next()); + while (r.next()); } return best; @@ -491,15 +491,15 @@ namespace CosmoTool { recursiveMultipleNearest(info, root, 0); if (periodic) { - ReplicateGenerator replicate(x); + ReplicateGenerator r(x, replicate); do { coords x_new; - replicate.getPosition(info.x); + r.getPosition(info.x); recursiveMultipleNearest(info, root, 0); } - while (replicate.next()); + while (r.next()); } // std::cout << "Traversed = " << info.traversed << std::endl; @@ -518,15 +518,15 @@ namespace CosmoTool { recursiveMultipleNearest(info, root, 0); if (periodic) { - ReplicateGenerator replicate(x); + ReplicateGenerator r(x, replicate); do { coords x_new; - replicate.getPosition(info.x); + r.getPosition(info.x); recursiveMultipleNearest(info, root, 0); } - while (replicate.next()); + while (r.next()); } memcpy(distances, info.queue.getPriorities(), sizeof(CoordType)*N2); } diff --git a/src/replicateGenerator.hpp b/src/replicateGenerator.hpp index 75088c2..8f52ace 100644 --- a/src/replicateGenerator.hpp +++ b/src/replicateGenerator.hpp @@ -12,10 +12,12 @@ namespace CosmoTool { public: typedef Coord Coords[N]; + Coord replicate; - ReplicateGenerator(const Coords& x) + ReplicateGenerator(const Coords& x, Coord shift) { face = 0; + replicate = shift; numFaces = spower(3); std::copy(x, x+N, x_base); } @@ -34,7 +36,7 @@ namespace CosmoTool int c_face; c_face = q_face % 3; q_face /= 3; - x_shifted[i] = x_base[i] + (c_face-1); + x_shifted[i] = x_base[i] + (c_face-1)*replicate; no_move = no_move && (c_face == 1); } if (no_move)