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

Pure SoA: NextID as Long #3772

Merged
merged 1 commit into from
Feb 20, 2024
Merged
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
20 changes: 10 additions & 10 deletions Src/Particle/AMReX_ParticleTile.H
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ struct SoAParticle : SoAParticleBase
{
}

static int the_next_id;
static Long the_next_id;

//functions to get id and cpu in the SOA data

Expand Down Expand Up @@ -423,19 +423,19 @@ struct SoAParticle : SoAParticleBase
return this->m_particle_tile_data.m_rdata[position_index][m_index];
}

static int NextID ();
static Long NextID ();

/**
* \brief This version can only be used inside omp critical.
*/
static int UnprotectedNextID ();
static Long UnprotectedNextID ();

/**
* \brief Reset on restart.
*
* \param nextid
*/
static void NextID (int nextid);
static void NextID (Long nextid);

private :

Expand All @@ -446,10 +446,10 @@ private :
};

//template <int NArrayReal, int NArrayInt> Long ConstSoAParticle<NArrayReal, NArrayInt>::the_next_id = 1;
template <int NArrayReal, int NArrayInt> int SoAParticle<NArrayReal, NArrayInt>::the_next_id = 1;
template <int NArrayReal, int NArrayInt> Long SoAParticle<NArrayReal, NArrayInt>::the_next_id = 1;

template <int NArrayReal, int NArrayInt>
int
Long
SoAParticle<NArrayReal, NArrayInt>::NextID ()
{
Long next;
Expand All @@ -466,14 +466,14 @@ SoAParticle<NArrayReal, NArrayInt>::NextID ()
amrex::Abort("SoAParticle<NArrayReal, NArrayInt>::NextID() -- too many particles");
}

return int(next);
return next;
}

template <int NArrayReal, int NArrayInt>
int
Long
SoAParticle<NArrayReal, NArrayInt>::UnprotectedNextID ()
{
int next = the_next_id++;
Long next = the_next_id++;
if (next > LongParticleIds::LastParticleID) {
amrex::Abort("SoAParticle<NArrayReal, NArrayInt>::NextID() -- too many particles");
}
Expand All @@ -482,7 +482,7 @@ SoAParticle<NArrayReal, NArrayInt>::UnprotectedNextID ()

template <int NArrayReal, int NArrayInt>
void
SoAParticle<NArrayReal, NArrayInt>::NextID (int nextid)
SoAParticle<NArrayReal, NArrayInt>::NextID (Long nextid)
{
the_next_id = nextid;
}
Expand Down
Loading