Skip to content

Commit

Permalink
#32 make dense accumulates run in parallel for const expressions, and…
Browse files Browse the repository at this point in the history
… fix bug if a sparse sum is within a dense sum
  • Loading branch information
martinjrobins committed Jul 6, 2018
1 parent 8298930 commit 8080b04
Show file tree
Hide file tree
Showing 8 changed files with 1,229 additions and 1,284 deletions.
4 changes: 2 additions & 2 deletions src/Particles.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ class Particles {
/// copy-constructor. performs deep copying of all particles from \p other
/// to \a *this
Particles(const particles_type &other)
: data(other.data), search(other.search), next_id(other.next_id),
searchable(other.searchable), seed(other.seed) {}
: data(other.data), next_id(other.next_id), searchable(other.searchable),
seed(other.seed), search(other.search) {}

/// range-based copy-constructor. performs deep copying of all
/// particles from \p first to \p last
Expand Down
907 changes: 447 additions & 460 deletions src/Symbolic.h

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/detail/Contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,15 @@ template <typename labels_type, typename dx_type> struct EvalCtx {
// figure out how to do this via enable_if....

result_type sum = accum.init;
for (const auto &i : label.get_particles()) {
auto new_labels = fusion::make_map<label_type>(i);

auto particles = label.get_particles();

#ifdef HAVE_OPENMP
#pragma omp parallel for
#endif
for (int i = 0; i < particles.size(); ++i) {
const auto &p = particles[i];
auto new_labels = fusion::make_map<label_type>(p);
EvalCtx<decltype(new_labels), decltype(ctx.m_dx)> const new_ctx(
new_labels, ctx.m_dx);
sum = accum.functor(sum, proto::eval(expr, new_ctx));
Expand Down
454 changes: 226 additions & 228 deletions src/detail/Expressions.h

Large diffs are not rendered by default.

0 comments on commit 8080b04

Please sign in to comment.