Skip to content

Commit

Permalink
MRA: Fix key child computation
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Schuchart <[email protected]>
  • Loading branch information
devreal committed Sep 17, 2024
1 parent 50d0bcf commit a19fefc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/madness/mra-device/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace mra {
assert(n<MAX_LEVEL);
std::array<Translation,NDIM> l = this->l;
for (auto& x : l) x = 2*x + 1;
return Key<NDIM>(2*n, l);
return Key<NDIM>(n+1, l);
}

/// Used by iterator to increment child translation
Expand All @@ -126,7 +126,7 @@ namespace mra {
assert(idx<num_children);
std::array<Translation,NDIM> l = this->l;
for (Dimension d = 0; d < NDIM; ++d) l[d] = 2*l[d] + (idx & (1<<d)) ? 1 : 0;
return Key<NDIM>(2*n, l);
return Key<NDIM>(n+1, l);
}
};
template <> inline SCOPE Key<1> Key<1>::parent(Level generation) const {
Expand Down
2 changes: 1 addition & 1 deletion examples/madness/mra-device/mrattg-device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ void test(std::size_t K) {
D.set_cube(-6.0,6.0);

srand48(5551212); // for reproducible results
//for (auto i : range(10000)) drand48(); // warmup generator
for (int i = 0; i < range(10000); ++i) drand48(); // warmup generator

ttg::Edge<mra::Key<NDIM>, void> project_control;
ttg::Edge<mra::Key<NDIM>, mra::FunctionReconstructedNode<T, NDIM>> project_result, reconstruct_result;
Expand Down
4 changes: 2 additions & 2 deletions examples/mrakey.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace mra {
assert(n<MAX_LEVEL);
std::array<Translation,NDIM> l = this->l;
for (auto& x : l) x = 2*x + 1;
return Key<NDIM>(2*n, l);
return Key<NDIM>(n+1, l);
}

/// Used by iterator to increment child translation
Expand All @@ -127,7 +127,7 @@ namespace mra {
assert(idx<NDIM);
std::array<Translation,NDIM> l = this->l;
for (auto d : range(NDIM)) l[d] = 2*l[d] + (idx & (1<<d)) ? 1 : 0;
return Key<NDIM>(2*n, l);
return Key<NDIM>(n+1, l);
}
};
template <> inline Key<1> Key<1>::parent(Level generation) const {
Expand Down

0 comments on commit a19fefc

Please sign in to comment.