Hipace
BoxSort.H
Go to the documentation of this file.
1 /* Copyright 2021
2  *
3  * This file is part of HiPACE++.
4  *
5  * Authors: MaxThevenet
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef HIPACE_BoxSort_H_
9 #define HIPACE_BoxSort_H_
10 
11 #include <AMReX_MultiFab.H>
12 #include <AMReX_AmrParticles.H>
13 #include <AMReX_Particles.H>
14 #include <AMReX_AmrCore.H>
15 
17 
18 class BoxSorter
19 {
20 public:
21  using index_type = unsigned long long;
22 
23  void sortParticlesByBox (const amrex::Real * z_array,
24  const index_type num_particles,
25  const bool init_on_cpu,
26  const amrex::Geometry& a_geom);
27 
29  index_type* boxCountsPtr () noexcept { return m_box_counts_cpu.dataPtr(); }
30 
33 
35  const index_type* boxCountsPtr () const noexcept { return m_box_counts_cpu.dataPtr(); }
36 
38  const index_type* boxOffsetsPtr () const noexcept { return m_box_offsets_cpu.dataPtr(); }
39 
40 
48 };
49 
50 #endif // HIPACE_BoxSort_H_
Container for particles of 1 beam species.
Definition: BeamParticleContainer.H:68
Definition: BoxSort.H:19
const index_type * boxOffsetsPtr() const noexcept
returns the pointer to the offsets array
Definition: BoxSort.H:38
amrex::Vector< index_type > m_box_counts_cpu
Definition: BoxSort.H:42
index_type * boxCountsPtr() noexcept
returns the pointer to the permutation array
Definition: BoxSort.H:29
const index_type * boxCountsPtr() const noexcept
returns the pointer to the permutation array
Definition: BoxSort.H:35
void sortParticlesByBox(const amrex::Real *z_array, const index_type num_particles, const bool init_on_cpu, const amrex::Geometry &a_geom)
Definition: BoxSort.cpp:14
unsigned long long index_type
Definition: BoxSort.H:21
amrex::Vector< index_type > m_box_offsets_cpu
Definition: BoxSort.H:44
index_type * boxOffsetsPtr() noexcept
returns the pointer to the offsets array
Definition: BoxSort.H:32
amrex::PODVector< index_type, amrex::PolymorphicArenaAllocator< index_type > > m_box_permutations
Definition: BoxSort.H:47
T * dataPtr() noexcept