Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/Hipace.H
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public:
* \param[in] bins slice indexing
* \param[in] only_ghost whether to send only ghost particles
*/
void Notify (const int step, const int it, amrex::Vector<BeamBins>& bins, bool only_ghost=false);
void Notify (const int step, const int it, const amrex::Vector<BeamBins>& bins, bool only_ghost=false);

/** \brief When slices sent to rank downstream, free buffer memory and make buffer nullptr
*
Expand Down Expand Up @@ -150,7 +150,7 @@ public:
* \param[in] bins an amrex::DenseBins object that orders particles by slice
*/
void SolveOneSlice (int islice_coarse, const int ibox,
amrex::Vector<amrex::Vector<BeamBins>>& bins);
const amrex::Vector<amrex::Vector<BeamBins>>& bins);

/** \brief Reset plasma and field slice quantities to initial value.
*
Expand Down Expand Up @@ -363,7 +363,7 @@ private:
* \param[in] ibox index of the current box
*/
void PredictorCorrectorLoopToSolveBxBy (const int islice_local, const int lev,
amrex::Vector<BeamBins> bins, const int ibox);
const amrex::Vector<BeamBins>& bins, const int ibox);

/** \brief define Geometry, DistributionMapping and BoxArray for the slice.
* The slice MultiFAB and the plasma particles are defined on this GDB.
Expand Down
13 changes: 5 additions & 8 deletions src/Hipace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ Hipace::Evolve ()

void
Hipace::SolveOneSlice (int islice_coarse, const int ibox,
amrex::Vector<amrex::Vector<BeamBins>>& bins)
const amrex::Vector<amrex::Vector<BeamBins>>& bins)
{
HIPACE_PROFILE("Hipace::SolveOneSlice()");

Expand Down Expand Up @@ -847,7 +847,7 @@ Hipace::ExplicitSolveBxBy (const int lev)

void
Hipace::PredictorCorrectorLoopToSolveBxBy (const int islice_local, const int lev,
amrex::Vector<BeamBins> bins, const int ibox)
const amrex::Vector<BeamBins>& bins, const int ibox)
{
HIPACE_PROFILE("Hipace::PredictorCorrectorLoopToSolveBxBy()");

Expand Down Expand Up @@ -1118,7 +1118,7 @@ Hipace::Wait (const int step, int it, bool only_ghost)

void
Hipace::Notify (const int step, const int it,
amrex::Vector<BeamBins>& bins, bool only_ghost)
const amrex::Vector<BeamBins>& bins, bool only_ghost)
{
HIPACE_PROFILE("Hipace::Notify()");

Expand Down Expand Up @@ -1200,13 +1200,10 @@ Hipace::Notify (const int step, const int it,
const auto p_comm_int = comm_int.data();
const auto p_psend_buffer = psend_buffer + offset_beam*psize;

BeamBins::index_type* indices = nullptr;
BeamBins::index_type const * offsets = 0;
BeamBins::index_type const * const indices = bins[ibeam].permutationPtr();
BeamBins::index_type const * const offsets = bins[ibeam].offsetsPtr();
BeamBins::index_type cell_start = 0;

indices = bins[ibeam].permutationPtr();
offsets = bins[ibeam].offsetsPtr();

// The particles that are in the last slice (sent as ghost particles) are
// given by the indices[cell_start:cell_stop-1]
cell_start = offsets[bx.bigEnd(Direction::z)-bx.smallEnd(Direction::z)];
Expand Down
6 changes: 3 additions & 3 deletions src/particles/MultiBeam.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public:
*/
void DepositCurrentSlice (
Fields& fields, amrex::Vector<amrex::Geometry> const& geom, const int lev, int islice,
amrex::Vector<BeamBins> bins,
const amrex::Vector<BeamBins>& bins,
const amrex::Vector<BoxSorter>& a_box_sorter_vec, const int ibox,
const bool do_beam_jx_jy_deposition, const int which_slice);

Expand Down Expand Up @@ -71,7 +71,7 @@ public:
*/
void AdvanceBeamParticlesSlice (
Fields& fields, amrex::Geometry const& gm, int const lev, const int islice, const amrex::Box bx,
amrex::Vector<BeamBins>& bins,
const amrex::Vector<BeamBins>& bins,
const amrex::Vector<BoxSorter>& a_box_sorter_vec, const int ibox);

/** Loop over species and init them
Expand Down Expand Up @@ -117,7 +117,7 @@ public:
* \param[in] bins bins object to access particles per slice
* \param[in] bx box in which we want to acce particles
*/
int NGhostParticles (int ibeam, amrex::Vector<BeamBins>& bins, amrex::Box bx);
int NGhostParticles (int ibeam, const amrex::Vector<BeamBins>& bins, amrex::Box bx);

/** \brief remove ghost particles, in practice those after the last slice. */
void RemoveGhosts ();
Expand Down
6 changes: 3 additions & 3 deletions src/particles/MultiBeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ MultiBeam::InitData (const amrex::Geometry& geom)
void
MultiBeam::DepositCurrentSlice (
Fields& fields, amrex::Vector<amrex::Geometry> const& geom, const int lev, int islice,
amrex::Vector<BeamBins> bins,
const amrex::Vector<BeamBins>& bins,
const amrex::Vector<BoxSorter>& a_box_sorter_vec, const int ibox,
const bool do_beam_jx_jy_deposition, const int which_slice)

Expand Down Expand Up @@ -75,7 +75,7 @@ MultiBeam::sortParticlesByBox (
void
MultiBeam::AdvanceBeamParticlesSlice (
Fields& fields, amrex::Geometry const& gm, int const lev, const int islice, const amrex::Box bx,
amrex::Vector<BeamBins>& bins,
const amrex::Vector<BeamBins>& bins,
const amrex::Vector<BoxSorter>& a_box_sorter_vec, const int ibox)
{
for (int i=0; i<m_nbeams; i++) {
Expand Down Expand Up @@ -119,7 +119,7 @@ MultiBeam::StoreNRealParticles ()
}

int
MultiBeam::NGhostParticles (int ibeam, amrex::Vector<BeamBins>& bins, amrex::Box bx)
MultiBeam::NGhostParticles (int ibeam, const amrex::Vector<BeamBins>& bins, amrex::Box bx)
{
BeamBins::index_type const * offsets = 0;
offsets = bins[ibeam].offsetsPtr();
Expand Down
2 changes: 1 addition & 1 deletion src/particles/deposition/BeamDepositCurrent.H
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
void
DepositCurrentSlice (BeamParticleContainer& beam, Fields& fields,
amrex::Vector<amrex::Geometry> const& gm, int const lev, const int islice,
int const offset, BeamBins& bins,
int const offset, const BeamBins& bins,
const bool do_beam_jx_jy_deposition, const int which_slice,
int nghost=0);

Expand Down
2 changes: 1 addition & 1 deletion src/particles/deposition/BeamDepositCurrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
void
DepositCurrentSlice (BeamParticleContainer& beam, Fields& fields,
amrex::Vector<amrex::Geometry> const& gm, int const lev ,const int islice,
int const offset, BeamBins& bins,
int const offset, const BeamBins& bins,
const bool do_beam_jx_jy_deposition, const int which_slice, int nghost)
{
HIPACE_PROFILE("DepositCurrentSlice_BeamParticleContainer()");
Expand Down
10 changes: 3 additions & 7 deletions src/particles/deposition/BeamDepositCurrentInner.H
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void doDepositionShapeN (const BeamParticleContainer& ptile,
amrex::Real z_pos_offset,
amrex::Real const q,
int islice,
BeamBins& bins,
const BeamBins& bins,
int box_offset,
const bool do_beam_jx_jy_deposition,
const int which_slice,
Expand Down Expand Up @@ -107,14 +107,10 @@ void doDepositionShapeN (const BeamParticleContainer& ptile,
"jx, jy, and jz must be exactly one cell thick in the z direction."
);

BeamBins::index_type*
indices = nullptr;
BeamBins::index_type const * offsets = 0;
BeamBins::index_type const * const indices = bins.permutationPtr();
BeamBins::index_type const * const offsets = bins.offsetsPtr();
BeamBins::index_type cell_start = 0, cell_stop = 0;

indices = bins.permutationPtr();
offsets = bins.offsetsPtr();

// The particles that are in slice islice are
// given by the indices[cell_start:cell_stop]
if (which_slice == WhichSlice::This) {
Expand Down
2 changes: 1 addition & 1 deletion src/particles/pusher/BeamParticleAdvance.H
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
void
AdvanceBeamParticlesSlice (BeamParticleContainer& beam, Fields& fields, amrex::Geometry const& gm,
int const lev, const int islice_local, const amrex::Box box,
const int offset, BeamBins& bins);
const int offset, const BeamBins& bins);

#endif // BEAMPARTICLEADVANCE_H_
10 changes: 3 additions & 7 deletions src/particles/pusher/BeamParticleAdvance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
void
AdvanceBeamParticlesSlice (BeamParticleContainer& beam, Fields& fields, amrex::Geometry const& gm,
int const lev, const int islice_local, const amrex::Box box,
const int offset, BeamBins& bins)
const int offset, const BeamBins& bins)
{
HIPACE_PROFILE("AdvanceBeamParticlesSlice()");
using namespace amrex::literals;
Expand Down Expand Up @@ -65,12 +65,8 @@ AdvanceBeamParticlesSlice (BeamParticleContainer& beam, Fields& fields, amrex::G
gm.isPeriodicArray(), offset);

// Declare a DenseBins to pass it to doDepositionShapeN, although it will not be used.
BeamBins::index_type*
indices = nullptr;
BeamBins::index_type const *
offsets = nullptr;
indices = bins.permutationPtr();
offsets = bins.offsetsPtr();
BeamBins::index_type const * const indices = bins.permutationPtr();
BeamBins::index_type const * const offsets = bins.offsetsPtr();
BeamBins::index_type const
cell_start = offsets[islice_local], cell_stop = offsets[islice_local+1];
// The particles that are in slice islice_local are
Expand Down