Added missing replication multiplicative factor

This commit is contained in:
Guilhem Lavaux 2013-03-05 11:11:20 -05:00
parent a0bf3dc2c2
commit 54d23331f3
2 changed files with 22 additions and 20 deletions

View File

@ -97,15 +97,15 @@ namespace CosmoTool {
recursiveIntersectionCells<false>(info, root, 0); recursiveIntersectionCells<false>(info, root, 0);
if (periodic) if (periodic)
{ {
ReplicateGenerator<float, N> replicate(x); ReplicateGenerator<float, N> r(x, replicate);
do do
{ {
coords x_new; coords x_new;
replicate.getPosition(info.x); r.getPosition(info.x);
recursiveIntersectionCells<false>(info, root, 0); recursiveIntersectionCells<false>(info, root, 0);
} }
while (replicate.next()); while (r.next());
} }
return info.currentRank; return info.currentRank;
@ -131,15 +131,15 @@ namespace CosmoTool {
recursiveIntersectionCells<false>(info, root, 0); recursiveIntersectionCells<false>(info, root, 0);
if (periodic) if (periodic)
{ {
ReplicateGenerator<float, N> replicate(x); ReplicateGenerator<float, N> r(x, replicate);
do do
{ {
coords x_new; coords x_new;
replicate.getPosition(info.x); r.getPosition(info.x);
recursiveIntersectionCells<false>(info, root, 0); recursiveIntersectionCells<false>(info, root, 0);
} }
while (replicate.next()); while (r.next());
} }
return info.currentRank; return info.currentRank;
} }
@ -160,15 +160,15 @@ namespace CosmoTool {
recursiveIntersectionCells<true>(info, root, 0); recursiveIntersectionCells<true>(info, root, 0);
if (periodic) if (periodic)
{ {
ReplicateGenerator<float, N> replicate(x); ReplicateGenerator<float, N> r(x, replicate);
do do
{ {
coords x_new; coords x_new;
replicate.getPosition(info.x); r.getPosition(info.x);
recursiveIntersectionCells<true>(info, root, 0); recursiveIntersectionCells<true>(info, root, 0);
} }
while (replicate.next()); while (r.next());
} }
return info.currentRank; return info.currentRank;
@ -408,15 +408,15 @@ namespace CosmoTool {
recursiveNearest(root, 0, x, R2, best); recursiveNearest(root, 0, x, R2, best);
if (periodic) if (periodic)
{ {
ReplicateGenerator<float, N> replicate(x); ReplicateGenerator<float, N> r(x, replicate);
do do
{ {
coords x_new; coords x_new;
replicate.getPosition(x_new); r.getPosition(x_new);
recursiveNearest(root, 0, x_new, R2, best); recursiveNearest(root, 0, x_new, R2, best);
} }
while (replicate.next()); while (r.next());
} }
return best; return best;
@ -491,15 +491,15 @@ namespace CosmoTool {
recursiveMultipleNearest(info, root, 0); recursiveMultipleNearest(info, root, 0);
if (periodic) if (periodic)
{ {
ReplicateGenerator<float, N> replicate(x); ReplicateGenerator<float, N> r(x, replicate);
do do
{ {
coords x_new; coords x_new;
replicate.getPosition(info.x); r.getPosition(info.x);
recursiveMultipleNearest(info, root, 0); recursiveMultipleNearest(info, root, 0);
} }
while (replicate.next()); while (r.next());
} }
// std::cout << "Traversed = " << info.traversed << std::endl; // std::cout << "Traversed = " << info.traversed << std::endl;
@ -518,15 +518,15 @@ namespace CosmoTool {
recursiveMultipleNearest(info, root, 0); recursiveMultipleNearest(info, root, 0);
if (periodic) if (periodic)
{ {
ReplicateGenerator<float, N> replicate(x); ReplicateGenerator<float, N> r(x, replicate);
do do
{ {
coords x_new; coords x_new;
replicate.getPosition(info.x); r.getPosition(info.x);
recursiveMultipleNearest(info, root, 0); recursiveMultipleNearest(info, root, 0);
} }
while (replicate.next()); while (r.next());
} }
memcpy(distances, info.queue.getPriorities(), sizeof(CoordType)*N2); memcpy(distances, info.queue.getPriorities(), sizeof(CoordType)*N2);
} }

View File

@ -12,10 +12,12 @@ namespace CosmoTool
{ {
public: public:
typedef Coord Coords[N]; typedef Coord Coords[N];
Coord replicate;
ReplicateGenerator(const Coords& x) ReplicateGenerator(const Coords& x, Coord shift)
{ {
face = 0; face = 0;
replicate = shift;
numFaces = spower<N,long>(3); numFaces = spower<N,long>(3);
std::copy(x, x+N, x_base); std::copy(x, x+N, x_base);
} }
@ -34,7 +36,7 @@ namespace CosmoTool
int c_face; int c_face;
c_face = q_face % 3; c_face = q_face % 3;
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); no_move = no_move && (c_face == 1);
} }
if (no_move) if (no_move)