Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/include/const_accessor_simple.hxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#pragma once

// ======================================================================
Expand Down Expand Up @@ -181,20 +180,20 @@ struct ConstAccessorPatchSimple
uint n_;
};

ConstAccessorPatchSimple(const ConstAccessorSimple& accessor, int p)
: accessor_{accessor}, p_{p}
ConstAccessorPatchSimple(const Mparticles& mprts, int p)
: mprts_{mprts}, p_{p}
{}

const_iterator begin() const { return {*this, 0}; }
const_iterator end() const { return {*this, size()}; }
ConstParticleProxy operator[](int n) const
{
return {accessor_.data(p_)[n], accessor_.mprts(), p_};
return {mprts_[p_].begin()[n], mprts_, p_};
}
uint size() const { return accessor_.size(p_); }
uint size() const { return mprts_[p_].size(); }

private:
const ConstAccessorSimple& accessor_;
const Mparticles& mprts_;
const int p_;
};

Expand All @@ -210,7 +209,7 @@ struct ConstAccessorSimple

ConstAccessorSimple(Mparticles& mprts) : mprts_{mprts} {}

Patch operator[](int p) const { return {*this, p}; }
Patch operator[](int p) const { return {mprts_, p}; }
const Mparticles& mprts() const { return mprts_; }
uint size(int p) const { return mprts_[p].size(); }
typename Mparticles::Patch::iterator data(int p) const
Expand Down
2 changes: 1 addition & 1 deletion src/libpsc/cuda/mparticles_patch_cuda.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct ConstAccessorCuda
off_{mprts.get_offsets()}
{}

Patch operator[](int p) const { return {*this, p}; }
Patch operator[](int p) const { return {mprts_, p}; }
Mparticles& mprts() const { return mprts_; }
const _Particle* data(int p) const { return &data_[off_[p]]; }
uint size(int p) const { return off_[p + 1] - off_[p]; }
Expand Down