Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bins: Index Type int #3684

Merged
merged 2 commits into from
Aug 6, 2024
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
2 changes: 1 addition & 1 deletion Src/Particle/AMReX_BinIterator.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ constexpr bool IsParticleTileData (Args...) {
template <typename T>
struct BinIterator
{
using index_type = unsigned int;
using index_type = int;

using const_pointer_type = std::conditional_t<IsParticleTileData<T>(),
T,
Expand Down
4 changes: 2 additions & 2 deletions Src/Particle/AMReX_DenseBins.H
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace BinPolicy
template <typename T>
struct DenseBinIteratorFactory
{
using index_type = unsigned int;
using index_type = int;

using const_pointer_type = std::conditional_t<IsParticleTileData<T>(),
T,
Expand Down Expand Up @@ -78,7 +78,7 @@ class DenseBins
public:

using BinIteratorFactory = DenseBinIteratorFactory<T>;
using index_type = unsigned int;
using index_type = int;

using const_pointer_type = std::conditional_t<IsParticleTileData<T>(),
T,
Expand Down
6 changes: 3 additions & 3 deletions Src/Particle/AMReX_NeighborList.H
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ public:
m_pstruct = aos().dataPtr();
auto* const pstruct_ptr = aos().dataPtr();

const size_t np_total = aos.size();
const size_t np_real = src_tile.numRealParticles();
const int np_total = aos.size();
const int np_real = src_tile.numRealParticles();

auto const* off_bins_p = off_bins_v.data();
auto const* dxi_p = dxi_v.data();
Expand All @@ -333,7 +333,7 @@ public:

// First pass: count the number of neighbors for each particle
//---------------------------------------------------------------------------------------------------------
const size_t np_size = (num_bin_types > 1) ? np_total : np_real;
const int np_size = (num_bin_types > 1) ? np_total : np_real;
m_nbor_counts.resize( np_size+1, 0);
m_nbor_offsets.resize(np_size+1);

Expand Down
2 changes: 1 addition & 1 deletion Src/Particle/AMReX_NeighborParticlesI.H
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ selectActualNeighbors (CheckPair const& check_pair, int num_cells)
if (isActualNeighbor) { break; }
int nbr_cell_id = (ii * ny + jj) * nz + kk;
for (auto p = poffset[nbr_cell_id]; p < poffset[nbr_cell_id+1]; ++p) {
if (pperm[p] == i) { continue; }
if (pperm[p] == int(i)) { continue; }
if (detail::call_check_pair(check_pair, ptile_data, ptile_data, i, pperm[p])) {
IntVect cell_ijk = getParticleCell(pstruct[pperm[p]], plo, dxi, domain);
if (!box.contains(cell_ijk)) {
Expand Down
6 changes: 3 additions & 3 deletions Src/Particle/AMReX_SparseBins.H
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ template <typename T>
struct SparseBinIteratorFactory
{

using index_type = unsigned int;
using index_type = int;

using const_pointer_type = std::conditional_t<IsParticleTileData<T>(),
T,
Expand All @@ -33,7 +33,7 @@ struct SparseBinIteratorFactory
: m_bins_ptr(bins.dataPtr()),
m_offsets_ptr(offsets.dataPtr()),
m_permutation_ptr(permutation.dataPtr()),
m_items(items), m_num_bins(bins.size())
m_items(items), m_num_bins(int(bins.size()))
{}

[[nodiscard]] AMREX_GPU_HOST_DEVICE
Expand Down Expand Up @@ -97,7 +97,7 @@ public:

using BinIteratorFactory = SparseBinIteratorFactory<T>;
using bin_type = IntVect;
using index_type = unsigned int;
using index_type = int;

using const_pointer_type = std::conditional_t<IsParticleTileData<T>(),
T,
Expand Down
Loading