Skip to content

Commit

Permalink
ParticleTile: push_back_real/int w/ Vector (#2634)
Browse files Browse the repository at this point in the history
Add more overloads to `push_back_real`/`int` to support
`amrex::Vector` and its const iterators.

This makes initialization routines more natural (similar to
`std::vector` constructors).
  • Loading branch information
ax3l authored Feb 28, 2022
1 parent 067830e commit 3199edf
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Src/Particle/AMReX_ParticleTile.H
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,22 @@ struct ParticleTile
m_soa_tile.GetRealData(comp).insert(it, beg, end);
}

///
/// Add a range of Real values to the struct-of-arrays for the given comp.
/// This sets the data for several particles at once.
///
void push_back_real (int comp, amrex::Vector<amrex::ParticleReal>::const_iterator beg, amrex::Vector<amrex::ParticleReal>::const_iterator end) {
push_back_real(comp, &(*beg), &(*end));
}

///
/// Add a range of Real values to the struct-of-arrays for the given comp.
/// This sets the data for several particles at once.
///
void push_back_real (int comp, amrex::Vector<amrex::ParticleReal> const & vec) {
push_back_real(comp, vec.cbegin(), vec.cend());
}

///
/// Add npar copies of the Real value v to the struct-of-arrays for the given comp.
/// This sets the data for several particles at once.
Expand Down Expand Up @@ -436,6 +452,22 @@ struct ParticleTile
m_soa_tile.GetIntData(comp).insert(it, beg, end);
}

///
/// Add a range of int values to the struct-of-arrays for the given comp.
/// This sets the data for several particles at once.
///
void push_back_int (int comp, amrex::Vector<int>::const_iterator beg, amrex::Vector<int>::const_iterator end) {
push_back_int(comp, &(*beg), &(*end));
}

///
/// Add a range of int values to the struct-of-arrays for the given comp.
/// This sets the data for several particles at once.
///
void push_back_int (int comp, amrex::Vector<int> const & vec) {
push_back_int(comp, vec.cbegin(), vec.cend());
}

///
/// Add npar copies of the int value v to the struct-of-arrays for the given comp.
/// This sets the data for several particles at once.
Expand Down

0 comments on commit 3199edf

Please sign in to comment.