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

Implement StructOfArray::empty() and ParticleTile::empty() for pure SoA #3296

Merged
merged 1 commit into from
May 4, 2023
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
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_ParticleTile.H
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,12 @@ struct ParticleTile
SoA& GetStructOfArrays () { return m_soa_tile; }
const SoA& GetStructOfArrays () const { return m_soa_tile; }

template <typename T = ParticleType, typename std::enable_if<!T::is_soa_particle, int>::type = 0>
bool empty () const { return m_aos_tile.empty(); }

template <typename T = ParticleType, typename std::enable_if<T::is_soa_particle, int>::type = 0>
bool empty () const { return m_soa_tile.empty(); }

/**
* \brief Returns the total number of particles (real and neighbor)
*
Expand Down
6 changes: 6 additions & 0 deletions Src/Particle/AMReX_StructOfArrays.H
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ struct StructOfArrays {
return 0;
}

/**
* \brief Returns whether the SoA is empty (i.e. has size() == 0)
*
*/
[[nodiscard]] bool empty () const { return this->size() == 0; }

/**
* \brief Returns the number of real particles (excluding neighbors)
*
Expand Down